bundles / skimage 0.26.1rc0.dev0+git20260530.b607368ff / skimage / morphology / footprints / ball
function
skimage.morphology.footprints:ball
source: /dev/scikit-image/src/skimage/morphology/footprints.py :820
Signature
def ball ( radius , dtype = <class 'numpy.uint8'> , * , strict_radius = True , decomposition = None ) Summary
Generates a ball-shaped footprint.
Extended Summary
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
radius: floatThe radius of the ball-shaped footprint.
Returns
footprint: ndarray or tupleThe footprint where elements of the neighborhood are 1 and 0 otherwise.
Other Parameters
dtype: dtype-like, optionalThe data type of the footprint.
strict_radius: bool, optionalIf 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'}, optionalIf 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 kwargs strict_radius=False, decomposition=None.
Empirically, the equivalent composite footprint to the sequence decomposition approaches a rhombicuboctahedron (26-faces [2]).
Aliases
-
skimage.morphology.ball