User's Guide

REGLABEL

Label each contiguous region in an image.

Function:

Performs region labeling. It converts an image of class values into an image of connected components. A connected component is a region of contiguous pixels having the same class value. Regions can be considered to be contiguous using either four-way or eight-way contiguity criteria. REGLABEL assigns each connected component, i.e., polygon, a unique label. Label numbers begin at one and progress up to the number of regions.

The original class values and counts of pixels in each region are output to a labeled table that is associated with the output image.

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 accomodate the number of regions labeled.

CONNECT(FOUR)
Contiguity checking criteria

  = FOUR:   Four-way checking.  Checks only
	    horizontally and vertically adjacent
	    pixels for contiguity 
  = EIGHT:  Eight-way checking.  Checks horizontally,
	    vertically, and diagonally adjacent pixels
	    for contiguity.

Examples:

  1. LAS> reglabel in=landuse out=landreg connect=four

    Regions are labeled on the LANDUSE input image using four-way contiguity criteria. Output from REGLABEL consists of the LANDREG image and an associated labeled table describing each of the labeled regions.

  2. LAS> reglabel in=landuse out=landreg connect=eight

    Regions are labeled on the LANDUSE input image using eight-way contiguity criteria. Output from REGLABEL consists of the LANDREG image and an associated labeled table describing each of the labeled regions.

Description/Algorithm:

The algorithm used for region labeling is based on the one described by Rosenfeld. The original implementation was by Nichols. REGLABEL makes a first pass through the input image and assigns pixels in contiguous regions a label. If unlike labels with the same class value coalesce from above, as in the case of a Y-shaped region, one of the labels is replaced with a pointer to the other label. Pointers and classes are contained in a table addressed by region number. A second pass through the initially labeled image follows the pointers and assigns a common label to all pixels of each region. Labels are reassigned so as to be numerically contiguous.

Either four-way or eight-way contiguity criteria can be used on forming regions of contiguous pixels. Four-way contiguity involves checking only horizontally and vertically adjacent pixels when forming regions. Eight-way contiguity involves additional checking for diagonally adjacent pixels. The final step is to create the region description labeled table file. The file format is region number, class number, and number of pixels.

Examples:

  Input image:			4 4 4 3 3 3 5 5 6 6 5 5
				4 4 3 3 3 5 5 5 5 6 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

  Four-way output 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
				  	  7	  4	  6
			 		  8  	  7	  1
		  			  9 	  5	  1

  Eight-way output image:  	Associated labeled table:	
					Regnum	Class	Count	
  	1 1 1 2 2 2 3 3 4 4 3 3		  1	  4	 11
  	1 1 2 2 2 3 3 3 3 4 3 5		  2	  3	 15
 	2 2 1 1 2 2 2 3 3 3 3 5		  3       5      16 
  	2 1 1 1 1 2 2 2 3 3 5 3		  4	  6	  3 
				  	  5 	  7	  3

References:

Dave Nichols, "Conversion of Raster Coded Images to Polygonal Data Structures," Proceedings of the Pecora VII Symposium, American Society of Photogrammetry, 1981.

Azriel Rosenfeld, "Extraction of Topological Information from Digital Images," Geoffrey Dutton, Ed., First International Advanced Study Symposium on Topological Data Structures for Geographic Information Systems, Harvard University Press, 1978

None.

    Nonfatal Error Message:

Fatal Error Messages:

  1. [reglabel-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. [reglabel-dtype] Image <XXXX> not of type byte, integer*2, or integer*4

    Input image must be one of the three types listed above. Please convert to one of the allowed data types before running REGLABEL.

  3. [reglabel-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. [reglabel-nbands] Only single band input allowed

    The image input to REGLABEL is assumed to be a single band classified image. Please enter a single band image.

User Notes:

  1. REGLABEL creates a region description labeled table that is associated with the output image file (root_name.lt). It contains columns: REGNUM (region number), CLASS (pixel value from classfied image) and COUNT (count of pixels in region).

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