bundles / skimage latest / skimage / morphology / _util / _raveled_offsets_and_distances
function
skimage.morphology._util:_raveled_offsets_and_distances
source: /dev/scikit-image/src/skimage/morphology/_util.py :56
Signature
def _raveled_offsets_and_distances ( image_shape , * , footprint = None , connectivity = 1 , center = None , spacing = None , order = C ) Summary
Compute offsets to neighboring pixels in raveled coordinate space.
Extended Summary
This function also returns the corresponding distances from the center pixel given a spacing (assumed to be 1 along each axis by default).
Parameters
image_shape: tuple of intThe shape of the image for which the offsets are being computed.
footprint: array of boolThe footprint of the neighborhood, expressed as an n-dimensional array of 1s and 0s. If provided, the connectivity argument is ignored.
connectivity: {1, ..., ndim}The square connectivity of the neighborhood: the number of orthogonal steps allowed to consider a pixel a neighbor. See scipy.ndimage.generate_binary_structure. Ignored if footprint is provided.
center: tuple of intTuple of indices to the center of the footprint. If not provided, it is assumed to be the center of the footprint, either provided or generated by the connectivity argument.
spacing: tuple of floatThe spacing between pixels/voxels along each axis.
order: 'C' or 'F'The ordering of the array, either C or Fortran ordering.
Returns
raveled_offsets: ndarrayLinear offsets to a samples neighbors in the raveled image, sorted by their distance from the center.
distances: ndarrayThe pixel distances corresponding to each offset.
Notes
This function will return values even if image_shape contains a dimension length that is smaller than footprint.
Examples
off, d = _raveled_offsets_and_distances( (4, 5), footprint=np.ones((4, 3)), center=(1, 1) ) off✓
d[0] d[-1] # distance from (1, 1) to (3, 2)✗
Aliases
-
skimage.morphology._util._raveled_offsets_and_distances