skimage2.morphology.ball#
- skimage2.morphology.ball(radius, dtype=<class 'numpy.uint8'>, *, strict_radius=True, decomposition=None)[source]#
Generates a ball-shaped footprint.
This is the 3D equivalent of a disk. A pixel is within the neighborhood if the Euclidean distance between it and the origin is no greater than radius.
- Parameters:
- radiusfloat
The radius of the ball-shaped footprint.
- Returns:
- footprintndarray or tuple
The footprint where elements of the neighborhood are 1 and 0 otherwise.
- Other Parameters:
- dtypedtype-like, optional
The data type of the footprint.
- strict_radiusbool, optional
If False, extend the radius by 0.5. This allows the circle to expand further within a cube that remains of size
2 * radius + 1along each axis. This parameter is ignored if decomposition is not None.- decomposition{None, ‘sequence’}, optional
If None, a single array is returned. For ‘sequence’, a tuple of smaller footprints is returned. Applying this series of smaller footprints will given a result equivalent to a single, larger footprint, but with better computational performance. For ball footprints, the sequence decomposition is not exactly equivalent to decomposition=None. See Notes for more details.
Notes
The disk produced by the decomposition=’sequence’ mode is not identical to that with decomposition=None. Here we extend the approach taken in [1] for disks to the 3D case, using 3-dimensional extensions of the “square”, “diamond” and “t-shaped” elements from that publication. All of these elementary elements have size
(3,) * ndim. We numerically computed the number of repetitions of each element that gives the closest match to the ball computed with kwargsstrict_radius=False, decomposition=None.Empirically, the equivalent composite footprint to the sequence decomposition approaches a rhombicuboctahedron (26-faces [2]).
References
[1]Park, H and Chin R.T. Decomposition of structuring elements for optimal implementation of morphological operations. In Proceedings: 1997 IEEE Workshop on Nonlinear Signal and Image Processing, London, UK. https://www.iwaenc.org/proceedings/1997/nsip97/pdf/scan/ns970226.pdf