The concept of a hole is one inherently related to a bit mask representation of regions (see McRegions for more discussion of bit mask versus polygon region representations). A hole is a set of connected background pixels completely surrounded by a set of connected foreground pixels (a blob).
A hole in a bit mask is not the same as a nested region feature. A nested feature is any whose boundary is enclosed within some other feature's boundary. A hole boundary is nested within the boundary of its enclosing blob, but usually there is no feature corresponding to this hole boundary (exception: when the mcofDefaultXorOnMerge bit of McFeatures.OptionsFlag is on then a hole bound will normally also correspond to a nested feature boundary). The relationships between nested region features are identified by the NestedWithin property and a set of related measurements.
The Holes property is an McRegions that holds the holes that appear in the "union bit map" of all features. The union bit map is always available via the via the McFeatures.AccessMaskedImageData, McFeatures.GetLineSegments or McFeatures.CreateFeatureMask methods, but its connected regions (blobs) are guaranteed to exactly correspond to the region features only if the the mcofKeepRegionsAsUnion bit of the McFeatures.OptionsFlag property is on (and it is off by default). Thus when the mcofKeepRegionsAsUnion bit of the McFeatures.OptionsFlag property is off (as it is by default), the Holes property (and measurements such as mRgnNumHoles) will have a non-zero count of Holes only under certain circumstances.
Even if mcofKeepRegionsAsUnion is off, holes may be initially present when a McRegions is filled from a bit mask via the McFeatures.SetFromMask method or via the Threshold property (an instance of McThreshold, which can segment image data into foreground and background pixels based on image luminance or color). These holes will persist as long as no operation is performed that requires recomputing the union bit mask; that is, so long as no features are added or changed. Holes may also appear in the union bit mask if the mcofDefaultXorOnMerge bit of McFeatures.OptionsFlag is on or if one or more features have the mcfsfXorOnMerge bit of their McFeatures.FeatureStatusFlags on. In this case, when the union bit mask is created by merging the pixels under and interior to the region features, the merge is done using an XOR rather than an OR bitwise operation. The effect is to create a hole in the union bitmap where one feature overlies another.
Furthermore, you may directly introduce holes into the union bit mask by assigning to the Holes property. Again, if mcofKeepRegionsAsUnion is off these holes will persist only so long as no changes are made to the features.
When the Holes property McRegions object is accessed, it is updated (if necessary) to reflect the current state of holes in the union bit mask. The Holes McRegions object is not updated at any other time, even if holes change.
The Holes property McRegions object is a child of the McRegions object exposing the property. The Holes' McFeatures.SourceFlags property is filled with the index of the parent feature for each hole region feature. The Holes object always has its mcofKeepRegionsAsUnion bit on, and its mcofConnect8 OptionsFlag is the same as the parent McRegions'.
The Holes property is also exposed as a measurement, mrRgnHolesAsRegions. And several other measurements are also based on the Holes property: mRgnNumHoles, mRgnHoleArea, mRgnHoleAreaRatio, miRgnHoleParent, mvRgnHoleIndices.