{ } Raw JSON

bundles / skimage latest / skimage / morphology / footprints / square

function

skimage.morphology.footprints:square

source: /dev/scikit-image/src/skimage/morphology/footprints.py :182

Signature

def   square ( width dtype = <class 'numpy.uint8'> * decomposition = None )

Summary

Generates a flat, square-shaped footprint.

Extended Summary

Every pixel along the perimeter has a chessboard distance no greater than radius (radius=floor(width/2)) pixels.

Parameters

width : int

The width and height of the square.

Returns

footprint : ndarray or tuple

The footprint where elements of the neighborhood are 1 and 0 otherwise. When decomposition is None, this is just a numpy.ndarray. Otherwise, this will be a tuple whose length is equal to the number of unique structuring elements to apply (see Notes for more detail)

Other Parameters

dtype : dtype-like, optional

The data type of the footprint.

decomposition : {None, 'separable', '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 give an identical result to a single, larger footprint, but often with better computational performance. See Notes for more details. With 'separable', this function uses separable 1D footprints for each axis. Whether 'sequence' or 'separable' is computationally faster may be architecture-dependent.

Notes

When decomposition is not None, each element of the footprint tuple is a 2-tuple of the form (ndarray, num_iter) that specifies a footprint array and the number of iterations it is to be applied.

For binary morphology, using decomposition='sequence' or decomposition='separable' were observed to give better performance than decomposition=None, with the magnitude of the performance increase rapidly increasing with footprint size. For grayscale morphology with square footprints, it is recommended to use decomposition=None since the internal SciPy functions that are called already have a fast implementation based on separable 1D sliding windows.

The 'sequence' decomposition mode only supports odd valued width. If width is even, the sequence used will be identical to the 'separable' mode.

Aliases

  • skimage.morphology.square