{ } Raw JSON

bundles / skimage latest / skimage / morphology / footprints / footprint_rectangle

function

skimage.morphology.footprints:footprint_rectangle

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

Signature

def   footprint_rectangle ( shape * dtype = <class 'numpy.uint8'> decomposition = None )

Summary

Generate a rectangular or hyper-rectangular footprint.

Extended Summary

Generates, depending on the length and dimensions requested with shape, a square, rectangle, cube, cuboid, or even higher-dimensional versions of these shapes.

Parameters

shape : tuple[int, ...]

The length of the footprint in each dimension. The length of the sequence determines the number of dimensions of the footprint.

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.

Returns

footprint : array or tuple[tuple[ndarray, int], ...]

A footprint consisting only of ones, i.e. every pixel belongs to the neighborhood. When decomposition is None, this is just an array. Otherwise, this will be a tuple whose length is equal to the number of unique structuring elements to apply (see Examples for more detail).

Examples

import skimage as ski
ski.morphology.footprint_rectangle((3, 5))
Decomposition will return multiple footprints that combine into a simple footprint of the requested shape.
ski.morphology.footprint_rectangle((9, 9), decomposition="sequence")
`"sequence"` makes sure that the decomposition only returns 1D footprints.
ski.morphology.footprint_rectangle((3, 5), decomposition="separable")
Generate a 5-dimensional hypercube with 3 samples in each dimension
ski.morphology.footprint_rectangle((3,) * 5).shape

Aliases

  • skimage.morphology.footprint_rectangle

Referenced by