skimage2.util.label_points#
- skimage2.util.label_points(coords, output_shape)[source]#
Assign unique integer labels to coordinates on an image mask
- Parameters:
- coordsndarray
An array of N coordinates with dimension D
- output_shapetuple
The shape of the mask on which
coordsare labelled
- Returns:
- labelsndarray of dtype int
A mask of zeroes containing unique integer labels at the
coords.
Notes
The labels are assigned to coordinates that are converted to integer and considered to start from 0.
Coordinates that are out of range of the mask raise an IndexError.
Negative coordinates raise a ValueError
Examples
>>> import numpy as np >>> from _skimage2.util._label import label_points >>> coords = np.array([[0, 1], [2, 2]]) >>> output_shape = (5, 5) >>> mask = label_points(coords, output_shape) >>> mask array([[0, 1, 0, 0, 0], [0, 0, 0, 0, 0], [0, 0, 2, 0, 0], [0, 0, 0, 0, 0], [0, 0, 0, 0, 0]], dtype=uint64)