dask_image.ndmeasure package¶
-
dask_image.ndmeasure.
center_of_mass
(input, labels=None, index=None)[source]¶ Find the center of mass over an image at specified subregions.
Parameters: - input (ndarray) – N-D image data
- labels (ndarray, optional) – Image features noted by integers. If None (default), all values.
- index (int or sequence of ints, optional) –
Labels to include in output. If None (default), all values where non-zero
labels
are used.The
index
argument only works whenlabels
is specified.
Returns: center_of_mass – Coordinates of centers-of-mass of
input
over theindex
selected regions fromlabels
.Return type: ndarray
-
dask_image.ndmeasure.
extrema
(input, labels=None, index=None)[source]¶ Find the min and max with positions over an image at specified subregions.
Parameters: - input (ndarray) – N-D image data
- labels (ndarray, optional) – Image features noted by integers. If None (default), all values.
- index (int or sequence of ints, optional) –
Labels to include in output. If None (default), all values where non-zero
labels
are used.The
index
argument only works whenlabels
is specified.
Returns: minimums, maximums, min_positions, max_positions – Values and coordinates of minimums and maximums in each feature.
Return type: tuple of ndarrays
-
dask_image.ndmeasure.
histogram
(input, min, max, bins, labels=None, index=None)[source]¶ Find the histogram over an image at specified subregions.
Histogram calculates the frequency of values in an array within bins determined by
min
,max
, andbins
. Thelabels
andindex
keywords can limit the scope of the histogram to specified sub-regions within the array.Parameters: - input (ndarray) – N-D image data
- min (int) – Minimum value of range of histogram bins.
- max (int) – Maximum value of range of histogram bins.
- bins (int) – Number of bins.
- labels (ndarray, optional) – Image features noted by integers. If None (default), all values.
- index (int or sequence of ints, optional) –
Labels to include in output. If None (default), all values where non-zero
labels
are used.The
index
argument only works whenlabels
is specified.
Returns: histogram – Histogram of
input
over theindex
selected regions fromlabels
.Return type: ndarray
-
dask_image.ndmeasure.
label
(input, structure=None)[source]¶ Label features in an array.
Parameters: - input (ndarray) – An array-like object to be labeled. Any non-zero values in
input
are counted as features and zero values are considered the background. - structure (ndarray, optional) –
A structuring element that defines feature connections.
structure
must be symmetric. If no structuring element is provided, one is automatically generated with a squared connectivity equal to one. That is, for a 2-Dinput
array, the default structuring element is:[[0,1,0], [1,1,1], [0,1,0]]
Returns: - label (ndarray or int) – An integer ndarray where each unique feature in
input
has a unique label in the returned array. - num_features (int) – How many objects were found.
- input (ndarray) – An array-like object to be labeled. Any non-zero values in
-
dask_image.ndmeasure.
labeled_comprehension
(input, labels, index, func, out_dtype, default, pass_positions=False)[source]¶ Compute a function over an image at specified subregions.
Roughly equivalent to [func(input[labels == i]) for i in index].
Sequentially applies an arbitrary function (that works on array_like input) to subsets of an n-D image array specified by
labels
andindex
. The option exists to provide the function with positional parameters as the second argument.Parameters: - input (ndarray) – N-D image data
- labels (ndarray, optional) – Image features noted by integers. If None (default), all values.
- index (int or sequence of ints, optional) –
Labels to include in output. If None (default), all values where non-zero
labels
are used.The
index
argument only works whenlabels
is specified. - func (callable) – Python function to apply to
labels
frominput
. - out_dtype (dtype) – Dtype to use for
result
. - default (int, float or None) – Default return value when a element of
index
does not exist inlabels
. - pass_positions (bool, optional) – If True, pass linear indices to
func
as a second argument. Default is False.
Returns: result – Result of applying
func
oninput
over theindex
selected regions fromlabels
.Return type: ndarray
-
dask_image.ndmeasure.
maximum
(input, labels=None, index=None)[source]¶ Find the maxima over an image at specified subregions.
Parameters: - input (ndarray) – N-D image data
- labels (ndarray, optional) – Image features noted by integers. If None (default), all values.
- index (int or sequence of ints, optional) –
Labels to include in output. If None (default), all values where non-zero
labels
are used.The
index
argument only works whenlabels
is specified.
Returns: maxima – Maxima of
input
over theindex
selected regions fromlabels
.Return type: ndarray
-
dask_image.ndmeasure.
maximum_position
(input, labels=None, index=None)[source]¶ Find the positions of maxima over an image at specified subregions.
For each region specified by
labels
, the position of the maximum value ofinput
within the region is returned.Parameters: - input (ndarray) – N-D image data
- labels (ndarray, optional) – Image features noted by integers. If None (default), all values.
- index (int or sequence of ints, optional) –
Labels to include in output. If None (default), all values where non-zero
labels
are used.The
index
argument only works whenlabels
is specified.
Returns: maxima_positions – Maxima positions of
input
over theindex
selected regions fromlabels
.Return type: ndarray
-
dask_image.ndmeasure.
mean
(input, labels=None, index=None)[source]¶ Find the mean over an image at specified subregions.
Parameters: - input (ndarray) – N-D image data
- labels (ndarray, optional) – Image features noted by integers. If None (default), all values.
- index (int or sequence of ints, optional) –
Labels to include in output. If None (default), all values where non-zero
labels
are used.The
index
argument only works whenlabels
is specified.
Returns: means – Mean of
input
over theindex
selected regions fromlabels
.Return type: ndarray
-
dask_image.ndmeasure.
median
(input, labels=None, index=None)[source]¶ Find the median over an image at specified subregions.
Parameters: - input (ndarray) – N-D image data
- labels (ndarray, optional) – Image features noted by integers. If None (default), all values.
- index (int or sequence of ints, optional) –
Labels to include in output. If None (default), all values where non-zero
labels
are used.The
index
argument only works whenlabels
is specified.
Returns: medians – Median of
input
over theindex
selected regions fromlabels
.Return type: ndarray
-
dask_image.ndmeasure.
minimum
(input, labels=None, index=None)[source]¶ Find the minima over an image at specified subregions.
Parameters: - input (ndarray) – N-D image data
- labels (ndarray, optional) – Image features noted by integers. If None (default), all values.
- index (int or sequence of ints, optional) –
Labels to include in output. If None (default), all values where non-zero
labels
are used.The
index
argument only works whenlabels
is specified.
Returns: minima – Minima of
input
over theindex
selected regions fromlabels
.Return type: ndarray
-
dask_image.ndmeasure.
minimum_position
(input, labels=None, index=None)[source]¶ Find the positions of minima over an image at specified subregions.
Parameters: - input (ndarray) – N-D image data
- labels (ndarray, optional) – Image features noted by integers. If None (default), all values.
- index (int or sequence of ints, optional) –
Labels to include in output. If None (default), all values where non-zero
labels
are used.The
index
argument only works whenlabels
is specified.
Returns: minima_positions – Maxima positions of
input
over theindex
selected regions fromlabels
.Return type: ndarray
-
dask_image.ndmeasure.
standard_deviation
(input, labels=None, index=None)[source]¶ Find the standard deviation over an image at specified subregions.
Parameters: - input (ndarray) – N-D image data
- labels (ndarray, optional) – Image features noted by integers. If None (default), all values.
- index (int or sequence of ints, optional) –
Labels to include in output. If None (default), all values where non-zero
labels
are used.The
index
argument only works whenlabels
is specified.
Returns: standard_deviation – Standard deviation of
input
over theindex
selected regions fromlabels
.Return type: ndarray
-
dask_image.ndmeasure.
sum
(input, labels=None, index=None)[source]¶ Find the sum over an image at specified subregions.
Parameters: - input (ndarray) – N-D image data
- labels (ndarray, optional) – Image features noted by integers. If None (default), all values.
- index (int or sequence of ints, optional) –
Labels to include in output. If None (default), all values where non-zero
labels
are used.The
index
argument only works whenlabels
is specified.
Returns: sum – Sum of
input
over theindex
selected regions fromlabels
.Return type: ndarray
-
dask_image.ndmeasure.
variance
(input, labels=None, index=None)[source]¶ Find the variance over an image at specified subregions.
Parameters: - input (ndarray) – N-D image data
- labels (ndarray, optional) – Image features noted by integers. If None (default), all values.
- index (int or sequence of ints, optional) –
Labels to include in output. If None (default), all values where non-zero
labels
are used.The
index
argument only works whenlabels
is specified.
Returns: variance – Variance of
input
over theindex
selected regions fromlabels
.Return type: ndarray