Top  Previous  Next

label ( integer Input, integer Output, integer X, integer Y, integer Index [, integer Connect =1] )

Use this function to label an object in a multiphase image or selection by indicating coordinates of a pixel belonging to the object. The function works by assigning a selected index value to pixels belonging to the same connected group of pixels. Two types of neighborhood can be selected for the operation.

An integer between 1 and 116 specifying the input image frame number. Values in the range of 100-116 correspond to hidden frames.  
An integer between 1 and 116 specifying the output image frame number. Values in the range of 100-116 correspond to hidden frames.  
X, Y  
Integer values specifying the coordinates of the pixel belonging to an object to be labeled. The coordinates are given in non-calibrated units relative to the upper left corner of the image.  
An integer between 0 and 255 specifying the index that will be assigned to pixels that belong to the same blob (connected group of pixels) as the selected pixel.  
An optional enumerated integer that describes the neighborhood used for connectivity analysis.  
M_4CONN=0 – uses the "city block" neighborhood. The pixels connected diagonally will be considered belonging to different objects.  
M_8CONN=1 – use the "chess board' neighborhood. Any interconnected pixels will be considered belonging to the same object.  
Default value: M_8CONN  
Error flags

The flag set if successful.  
The flag set if failed.  

Typically, the input image is a binary one with the background pixels set to zero, and objects of interests set to 1. To label objects on such an image, you should use values greater than 1 for the Index parameter. You can also erase an object from a binary or multiphase image by setting the Index value to zero.  


This set of statements measures the rectangularity of objects in a sample image and labels the objects that have this parameter greater than 0.8:  
setCurDir ("samples")  
for i=1 TO iCount Step 1  
 if Grid.GetParamValue(i,"Rectangularity")>0.8 then  
   x=Grid.GetParamValue(i, "StartX")  
   y=Grid.GetParamValue(i, "StartY")