Mention which parameters to label are optional. Simplify label deprecation.

This commit is contained in:
Stefan van der Walt
2014-05-09 03:00:28 +02:00
committed by Johannes Schönberger
parent 0d1cc0f77d
commit a9ba1fea8f
2 changed files with 4 additions and 69 deletions
+3 -3
View File
@@ -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
+1 -66
View File
@@ -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)