{ } Raw JSON

bundles / skimage 0.26.1rc0.dev0+git20260530.b607368ff / skimage / morphology / gray / _patch_footprint_mirroring

function

skimage.morphology.gray:_patch_footprint_mirroring

source: /dev/scikit-image/src/skimage/morphology/gray.py :100

Signature

def   _patch_footprint_mirroring ( footprint )

Summary

Mirror asymmetric footprints before dispatching to skimage2.

Extended Summary

This function ensures backwards compatibility when asymmetric footprints are passed to skimage.morphology.dilation, skimage.morphology.closing and skimage.morphology.black_tophat. See _Notes_ for details.

Parameters

footprint : ndarray or tuple, optional

Returns

patched_footprint : ndarray or tuple

Notes

Inside scipy.ndimage.grey_dilation the footprint is inverted/mirrored. This inversion is intentional so that closing and opening (the compositions of erosion and dilation) are extensive and anti-extensive.

skimage.morphology.dilation accidentally undoes this by mirroring

the footprint, before passing it to scipy.ndimage.grey_dilation.

skimage.morphology.closing and skimage.morphology.black_tophat then mirror/invert again to correct for this.

In skimage2 we drop all mirroring and align with SciPy. This function documents this procedure and ensures the wrappers around skimage2 keep the old behavior for skimage.morphology.dilation, skimage.morphology.closing and skimage.morphology.black_tophat.

skimage.morphology.erosion, skimage.morphology.opening and skimage.morphology.white_tophat _aren't_ affected.

Aliases

  • skimage.morphology.gray._patch_footprint_mirroring