dask_ndmeasure package¶
-
dask_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
labelsare used.The
indexargument only works whenlabelsis specified.
Returns: center_of_mass – Coordinates of centers-of-mass of
inputover theindexselected regions fromlabels.Return type: ndarray
-
dask_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
labelsare used.The
indexargument only works whenlabelsis specified.
Returns: minimums, maximums, min_positions, max_positions – Values and coordinates of minimums and maximums in each feature.
Return type: tuple of ndarrays
-
dask_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. Thelabelsandindexkeywords 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
labelsare used.The
indexargument only works whenlabelsis specified.
Returns: histogram – Histogram of
inputover theindexselected regions fromlabels.Return type: ndarray
-
dask_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
inputare counted as features and zero values are considered the background. - structure (ndarray, optional) –
A structuring element that defines feature connections.
structuremust be symmetric. If no structuring element is provided, one is automatically generated with a squared connectivity equal to one. That is, for a 2-Dinputarray, 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
inputhas 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_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
labelsandindex. 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
labelsare used.The
indexargument only works whenlabelsis specified. - func (callable) – Python function to apply to
labelsfrominput. - out_dtype (dtype) – Dtype to use for
result. - default (int, float or None) – Default return value when a element of
indexdoes not exist inlabels. - pass_positions (bool, optional) – If True, pass linear indices to
funcas a second argument. Default is False.
Returns: result – Result of applying
funconinputover theindexselected regions fromlabels.Return type: ndarray
-
dask_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
labelsare used.The
indexargument only works whenlabelsis specified.
Returns: maxima – Maxima of
inputover theindexselected regions fromlabels.Return type: ndarray
-
dask_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 ofinputwithin 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
labelsare used.The
indexargument only works whenlabelsis specified.
Returns: maxima_positions – Maxima positions of
inputover theindexselected regions fromlabels.Return type: ndarray
-
dask_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
labelsare used.The
indexargument only works whenlabelsis specified.
Returns: means – Mean of
inputover theindexselected regions fromlabels.Return type: ndarray
-
dask_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
labelsare used.The
indexargument only works whenlabelsis specified.
Returns: medians – Median of
inputover theindexselected regions fromlabels.Return type: ndarray
-
dask_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
labelsare used.The
indexargument only works whenlabelsis specified.
Returns: minima – Minima of
inputover theindexselected regions fromlabels.Return type: ndarray
-
dask_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
labelsare used.The
indexargument only works whenlabelsis specified.
Returns: minima_positions – Maxima positions of
inputover theindexselected regions fromlabels.Return type: ndarray
-
dask_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
labelsare used.The
indexargument only works whenlabelsis specified.
Returns: standard_deviation – Standard deviation of
inputover theindexselected regions fromlabels.Return type: ndarray
-
dask_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
labelsare used.The
indexargument only works whenlabelsis specified.
Returns: sum – Sum of
inputover theindexselected regions fromlabels.Return type: ndarray
-
dask_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
labelsare used.The
indexargument only works whenlabelsis specified.
Returns: variance – Variance of
inputover theindexselected regions fromlabels.Return type: ndarray