diff --git a/skimage/measure/_ccomp.pyx b/skimage/measure/_ccomp.pyx index 2d2f5b13..26b9645a 100644 --- a/skimage/measure/_ccomp.pyx +++ b/skimage/measure/_ccomp.pyx @@ -101,13 +101,13 @@ def label(input, DTYPE_t neighbors=8, background=None, return_num=False): ---------- input : ndarray of dtype int Image to label. - neighbors : {4, 8}, int + neighbors : {4, 8}, int, optional Whether to use 4- or 8-connectivity. - background : int + background : int, optional Consider all pixels with this value as background pixels, and label them as -1. (Note: background pixels will be labeled as 0 starting with version 0.12). - return_num : bool + return_num : bool, optional Whether to return the number of assigned labels. Returns diff --git a/skimage/morphology/_label.py b/skimage/morphology/_label.py index 0f027adf..88312427 100644 --- a/skimage/morphology/_label.py +++ b/skimage/morphology/_label.py @@ -3,69 +3,4 @@ __all__ = ['label'] from ..measure._ccomp import label as _label from skimage._shared.utils import deprecated -@deprecated('skimage.measure.label') -def label(input, neighbors=8, background=None, return_num=False): - """Label connected regions of an integer array. - - Two pixels are connected when they are neighbors and have the same value. - They can be neighbors either in a 4- or 8-connected sense:: - - 4-connectivity 8-connectivity - - [ ] [ ] [ ] [ ] - | \ | / - [ ]--[ ]--[ ] [ ]--[ ]--[ ] - | / | \\ - [ ] [ ] [ ] [ ] - - Parameters - ---------- - input : ndarray of dtype int - Image to label. - neighbors : {4, 8}, int - Whether to use 4- or 8-connectivity. - background : int - Consider all pixels with this value as background pixels, and label - them as -1. (Note: background pixels will be labeled as 0 starting with - version 0.12). - return_num : bool - Whether to return the number of assigned labels. - - Returns - ------- - labels : ndarray of dtype int - Labeled array, where all connected regions are assigned the - same integer value. - num : int, optional - Number of labels, which equals the maximum label index and is only - returned if return_num is `True`. - - Examples - -------- - >>> x = np.eye(3).astype(int) - >>> print(x) - [[1 0 0] - [0 1 0] - [0 0 1]] - - >>> print(m.label(x, neighbors=4)) - [[0 1 1] - [2 3 1] - [2 2 4]] - - >>> print(m.label(x, neighbors=8)) - [[0 1 1] - [1 0 1] - [1 1 0]] - - >>> x = np.array([[1, 0, 0], - ... [1, 1, 5], - ... [0, 0, 0]]) - - >>> print(m.label(x, background=0)) - [[ 0 -1 -1] - [ 0 0 1] - [-1 -1 -1]] - - """ - return _label(input, neighbors, background, return_num) +label = deprecated('skimage.measure.label')(_label)