User's Guide

FLAG

Flag regions whose areas fall below specified thresholds.

Function:

Processes an image of homogeneous regions, changing region labels to class values, flagging regions that have areas below specified thresholds, and masking regions that belong to a specified class.

Parameters:

IN
Input image. Single-band image containing BYTE, INTEGER*2, or INTEGER*4 pixel data. Window options may be specified.

OUT
Output image. The output image is the same size as the input image specification. Output data type is determined based on the data type necessary to accommodate the class values in the output image.

DFLTHRSH
Default area threshold. Flaggs regions for all classes that are not found in INLT.

INLT(--)
Input labeled table. Contains class values and corresponding thresholds to be used in determination of whether to flag regions.

MASKCLSS(0)
Class value of mask regions. All regions that have a class value that matches this mask class will be changed to 0 (background).

Examples:

  1. LAS> flag in=landreg out=landflag dflthrsh=20 inlt=landthr maskclss=1

    The image LANDREG and its associated region description labeled table along with the threshold values contained in the labeled table LANDTHR flag regions whose areas fall below specified thresholds. The default threshold of 20 pixels is used for those regions whose class values are not contained in the LANDTHR labeled table. All regions whose class value was 1 are mapped to 0.

  2. LAS> flag in=landreg out=landflag dflthrsh=20 maskclss=0

    FLAG uses the image LANDREG and its associated region description labeled table along with the default threshold value of 20 to flag regions whose areas fall below this value. The mask value of 0 has no effect on the output image.

Description/Algorithm:

Flag processes an image of homogeneous regions created by REGLABEL, changing region labels to class values, flagging regions that have areas below specified thresholds, and masking regions that belong to a specified class.

Flag uses labeled images and region description files (labeled tables) that are generated by REGLABEL. The threshold values for given classes may be read from a labeled table (see user note 3). A default threshold value must be specified. It will be used for all regions whose classes are not explicitly contained in the threshold labeled table. If no threshold labeled table is entered, the default threshold will be used for all regions. Regions that have areas less than the specified threshold values (for given classes) are flagged by assigning negative class values to their pixels.

A mask class value may also be entered. All pixels of this class will be changed to a value of 0 (background).

Example:

  Input image:  		Associated labeled table:	
					Regnum	Class	Count	
  	1 1 1 2 2 2 3 3 4 4 3 3		  1	  4	  5
  	1 1 2 2 2 3 3 3 3 4 3 5		  2	  3	 12
 	6 6 7 7 2 2 2 3 3 3 3 5		  3       5      15 
  	6 7 7 7 7 2 2 2 3 3 8 9		  4	  6	  3 
				  	  5 	  7	  2
		  			  6	  3	  3
  Threshold labeled table:	  	  7	  4	  6
	Class  	Thresh	 	   	  8  	  7	  1
	  3	  10   			  9 	  5	  1
	  4	   6

  Default threshold value:  2 	

  Mask class:  6

  Output image:
	
	-4 -4 -4  3  3  3  5  5  0  0  5  5
	-4 -4  3  3  3  5  5  5  5  0  5  7
   	-3 -3  4  4  3  3  3  5  5  5  5  7
 	-3  4  4  4  4  3  3  3  5  5 -7 -5

   Note: The image input to FLAG must have been output by 
	 REGLABEL, and the absolute value of the image 
	 output by FLAG should be equivalent to the image 
  	 input to REGLABEL. 

Nonfatal Error Messages:

  1. [flag-thresh] Class <XXXX> occurs more than once in threshold table.

    The threshold table contained duplicate class entries. The sorting and searching of the table cannot guarantee which of the threshold values is used in processing. Therefore, you should eliminate all duplicates in the table and reprocess.

Fatal Error Messages:

  1. [flag-alloc] Error allocating dynamic memory

    A system error occurred when trying to allocate dynamic memory. This may be due to the work load on the system. Please try again when the system is not as busy.

  2. [flag-dtype] Image <XXXX> not of type byte, integer*2, or integer*4

    The image input to FLAG is assumed to be a single band image created by REGLABEL that has one of the data types listed above. Please enter an appropriate image.

  3. [flag-fatal] Fatal error encountered

    A fatal error was encountered during processing. Processing was terminated. The error message that is displayed immediately preceding this message is the specific error that was encountered.

  4. [flag-getfield] Error getting field pointer from <XXXX> labeled table

    The specified labeled table has been corrupted. Please regenerate the labeled table.

  5. [flag-nbands] Only single band input allowed

    The image input to FLAG is assumed to be a single band image created by REGLABEL. Please enter an appropriate image.

  6. [flag-region] Region labeled table out of sequence or missing data

    The region description labeled table has been corrupted. Rerun REGLABEL to regenerate the table.

  7. [flag-regnum] Region number in image not found in labeled table.

    There is a mismatch between the region labeled image and its associated region description labeled table. One of the two must have been corrupted. Rerun REGLABEL to regenerate them.

User Notes:

  1. The input image must have an associated region description file (labeled table) that was created by REGLABEL in order for FLAG to function. Thus, FLAG can only be run after REGLABEL.

  2. Other functions used in conjunction with FLAG to perform area filtering on classified images are NOMFIL, REGLABEL, and SMOOTH.

  3. The labeled table containing area threshold values (INLT parameter) should be modeled after the following example:

    	;
    	"THRSHTBL","Area threshold table";
    	"CLASS","I4","Class value in classified image",1,1
    	"THRESH","I4","Area threshold value",1,1;
    	3,10;
    	4,6;
    

    Simply enter as many classes and associated threshold values as you need--one pair on each line as shown in the example. The field names "CLASS" and "THRESH" and their defined types are critical to the successful use of the table.