Description

Removes small features and/or those that touch selected borders of the Image or the borders of a specified McRegions instance.

Return Type

None  

Syntax

object.CleanUpBordersAndNoise [McRegionsBorder], [BorderFlags], [MinSize]

The CleanUpBordersAndNoise Method syntax has these parts:

PartDescription
objectAn expression evaluating to an object of type McPoints.
McRegionsBorderOptional. A Variant value.

If given, this is an McRegions instance that holds the region features borders that are to be tested against. This argument is normally supplied and will usually be the AOI of the parent image (see Example). If not given, then the border is tested against the borders of the parent image (failure to have a parent image is an error in this case). Should the McRegions holding the borders have no features, then the borders of its parent image are used as the borders to test against.

BorderFlagsOptional. A mcRegionBorders enumeration, as described in settings.

Flags, which can be OR'ed together to denote which borders to test. The default value of mcrbAllBorders tests against all borders, and mcrbNoBorder skips the border test (testing only for MinSize). For irregular or multiple McRegionsBorder features's (ones with a Type(-1) property other than mcftBox), then an McRegionsBorder border is a boundary pixel of any AOI sub-region. Some border pixels may be on two (or more directions). For example, the left, top corner point of a rectangular (mcftBox) McRegionsBorder will be used for both the mcrbWest and mcrbNorth tests. Features that fall partially or completely outside of any McRegionsBorder may be aggressively removed to ensure that all features outside of the selected borders are gone. For McPoints, only points outside of or exactly on an McRegionsBorder boundary will be removed, even if the blob from which the point was detected did touch a boundary (see Sub DetectNonTouchingCentroids in the samples for a way to avoid marking points on blobs that touch AOI boundaries).

MinSizeOptional. A Long value.

If given, a minimum size for the features to be kept. In the case of McRegions, this is the mininum area of the region in units of square pixels. In the case of McLines, this is the minimum length of the line or polyline, in units of pixels. In the case of McPoints, this is the minimum area of the blob from which the point feature was created from bit mask data via the SetFromMask method or via the Threshold property. Point features placed directly by calling SetFeaturePoints are assumed to be one pixel in size.

Settings

The settings for BorderFlags are:

ConstantValueDescription
 mcrbNoBorder0

skips the border test

 mcrbNorth1

the top border is tested

 mcrbEast2

the right border is tested

 mcrbSouth4

the bottom border is tested

 mcrbWest8

the left border is tested

 mcrbAllBorders15

all borders are tested

Remarks

Any feature that touches or is outside of selected parent image borders (or selected borders of a specified McRegions instance: usually the AOI) will be removed. This is useful for getting rid of features that were possibly clipped by the image border or by an AOI when they are created by the Threshold property (an instance of McThreshold, which can segment image data into foreground and background pixels based on image luminance or color).

In addition, if the MinSize argument is non-zero, then it describes a minimum size for features to be preserved.

The test is performed on the bit mask representation of features, so the resolution of the test is at the pixel level.