Finds contiguous regions in an image. The image is represented by the two-dimensional integer array of intensities stored in Data. A contiguous region is defined by pixels which are adjacent (i.e. having an edge in common); pixels which have just a single corner in common are not regarded to be contiguous. The parameters Thresh1 and Thresh2 define the limits of the interesting intensities. All pixels having an intensity greater than or equal to Thresh1 and less than or equal to Thresh2 are used for finding contiguous regions.
The parameters MinSize and MaxSize control the minimum and maximum size limits (in pixels) of a contiguous region. Regions which have an area less than MinSize or greater than MaxSize are not detected and are considered to belong to the background. Setting MaxSize to a zero value switches off the size limit control.
The function FindContigRegions returns the found contiguous regions in the variable array Regions. The rows of this array contain all found regions (each row describes a particular region). The columns of Regions contain the following information:
||the x and y coordinates of one of the pixels of the region
||left edge of the circumscribing rectangle (parallel to the axes)
||size of the region (number of pixels)
After performing FindContigRegions the Data array contains the indication of contiguous regions; all regions are numbered from 1 to NRegs, cells having the same region number belong to the same region, cells with zeroes are not part of a particle. Please note that the region number starts with 1 while the indices of the Region array are zero-based. The function returns the number of contiguous regions.