{ } Raw JSON

bundles / skimage latest / skimage / util / _label / label_points

function

skimage.util._label:label_points

source: /dev/scikit-image/src/skimage/util/_label.py :6

Signature

def   label_points ( coords output_shape )

Summary

Assign unique integer labels to coordinates on an image mask

Parameters

coords : ndarray

An array of N coordinates with dimension D

output_shape : tuple

The shape of the mask on which coords are labelled

Returns

labels : ndarray 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 skimage.util._label import label_points
coords = np.array([[0, 1], [2, 2]])
output_shape = (5, 5)
mask = label_points(coords, output_shape)
mask

Aliases

  • skimage.util.label_points