skimage2.morphology.isotropic_opening#

skimage2.morphology.isotropic_opening(image, radius, out=None, spacing=None)[source]#

Return binary morphological opening of an image.

Compared to the more general skimage.morphology.opening(), this function only supports binary inputs and circular footprints. However, it performs typically faster for large (circular) footprints. This works by thresholding the exact Euclidean distance map [1], [2]. The implementation is based on: func:scipy.ndimage.distance_transform_edt.

Parameters:
imagendarray

Binary input image.

radiusfloat

The radius of the footprint used for the operation.

outndarray of bool, optional

The array to store the result of the morphology. If None is passed, a new array will be allocated.

spacingfloat, or sequence of float, optional

Spacing of elements along each dimension. If a sequence, must be of length equal to the input’s dimension (number of axes). If a single number, this value is used for all axes. If not specified, a grid spacing of unity is implied.

Returns:
openedndarray of bool

The result of the morphological opening.

References

[1]

Cuisenaire, O. and Macq, B., “Fast Euclidean morphological operators using local distance transformation by propagation, and applications,” Image Processing And Its Applications, 1999. Seventh International Conference on (Conf. Publ. No. 465), 1999, pp. 856-860 vol.2. DOI:10.1049/cp:19990446

[2]

Ingemar Ragnemalm, Fast erosion and dilation by contour processing and thresholding of distance maps, Pattern Recognition Letters, Volume 13, Issue 3, 1992, Pages 161-166. DOI:10.1016/0167-8655(92)90055-5

Examples

Remove connection between two bright regions

>>> import numpy as np
>>> import _skimage2 as ski2
>>> image = np.array([[1, 0, 0, 0, 1],
...                   [1, 1, 0, 1, 1],
...                   [1, 1, 1, 1, 1],
...                   [1, 1, 0, 1, 1],
...                   [1, 0, 0, 0, 1]], dtype=bool)
>>> result = ski2.morphology.isotropic_opening(image, radius=1)
>>> result.view(np.uint8)
array([[1, 0, 0, 0, 1],
       [1, 1, 0, 1, 1],
       [1, 1, 1, 1, 1],
       [1, 1, 0, 1, 1],
       [1, 0, 0, 0, 1]], dtype=uint8)