Statistical Methods
Audit What a Morphological Opening Removes from a Mask
Define the task
A morphological opening is erosion followed by dilation using a specified footprint. It can remove isolated foreground and narrow features, but those features may be scientifically real. Record the entire footprint, its origin, iteration count and outside-array value. A footprint's dimensions alone are insufficient: a five-cell cross and a filled 3×3 square act differently on the same mask.
Carry out the check
For the teaching tool, use one centered cross erosion followed by one cross dilation, treating outside cells as zero. Erosion retains a cell only when it and its four direct neighbors are foreground. Dilation then expands the surviving cells by that same cross. Inspect the changed locations and save both masks. Do not describe the result as improved segmentation without independent evidence. This operation is distinct from filling enclosed background holes.
Worked hypothetical example
Hypothetical example: rows [0,1,0], [1,1,1], [0,1,0] form a five-cell cross. Erosion leaves its center; dilation reconstructs all five cells, so the opening preserves it. A single central foreground cell erodes away and cannot return during dilation. The result demonstrates footprint dependence, not a recommended minimum object size. If pixel spacing differs by axis, the cross also has unequal physical reach; report that explicitly.
Method checked 23 November 2026 against Primary method documentation: binary_opening.