dask_image.ndfilters package¶

dask_image.ndfilters.
convolve
(image, weights, mode='reflect', cval=0.0, origin=0)¶ Wrapped copy of “scipy.ndimage.filters.convolve”
Excludes the output parameter as it would not work with Dask arrays.
Original docstring:
Multidimensional convolution.
The array is convolved with the given kernel.
 Parameters
image (array_like) – The image array.
weights (array_like) – Array of weights, same number of dimensions as image
mode ({'reflect', 'constant', 'nearest', 'mirror', 'wrap'}, optional) –
The mode parameter determines how the image array is extended beyond its boundaries. Default is ‘reflect’. Behavior for each valid value is as follows:
 ’reflect’ (d c b a  a b c d  d c b a)
The image is extended by reflecting about the edge of the last pixel.
 ’constant’ (k k k k  a b c d  k k k k)
The image is extended by filling all values beyond the edge with the same constant value, defined by the cval parameter.
 ’nearest’ (a a a a  a b c d  d d d d)
The image is extended by replicating the last pixel.
 ’mirror’ (d c b  a b c d  c b a)
The image is extended by reflecting about the center of the last pixel.
 ’wrap’ (a b c d  a b c d  a b c d)
The image is extended by wrapping around to the opposite edge.
cval (scalar, optional) – Value to fill past edges of image if mode is ‘constant’. Default is 0.0
origin (int or sequence, optional) – Controls the placement of the filter on the image array’s pixels. A value of 0 (the default) centers the filter over the pixel, with positive values shifting the filter to the left, and negative ones to the right. By passing a sequence of origins with length equal to the number of dimensions of the image array, different shifts can be specified along each axis.
 Returns
result – The result of convolution of image with weights.
 Return type
ndarray
See also
correlate()
Correlate an image with a kernel.
Notes
Each value in result is \(C_i = \sum_j{I_{i+kj} W_j}\), where W is the weights kernel, j is the ND spatial index over \(W\), I is the image and k is the coordinate of the center of W, specified by origin in the image parameters.

dask_image.ndfilters.
correlate
(image, weights, mode='reflect', cval=0.0, origin=0)¶ Wrapped copy of “scipy.ndimage.filters.correlate”
Excludes the output parameter as it would not work with Dask arrays.
Original docstring:
Multidimensional correlation.
The array is correlated with the given kernel.
 Parameters
image (array_like) – The image array.
weights (ndarray) – array of weights, same number of dimensions as image
mode ({'reflect', 'constant', 'nearest', 'mirror', 'wrap'}, optional) –
The mode parameter determines how the image array is extended beyond its boundaries. Default is ‘reflect’. Behavior for each valid value is as follows:
 ’reflect’ (d c b a  a b c d  d c b a)
The image is extended by reflecting about the edge of the last pixel.
 ’constant’ (k k k k  a b c d  k k k k)
The image is extended by filling all values beyond the edge with the same constant value, defined by the cval parameter.
 ’nearest’ (a a a a  a b c d  d d d d)
The image is extended by replicating the last pixel.
 ’mirror’ (d c b  a b c d  c b a)
The image is extended by reflecting about the center of the last pixel.
 ’wrap’ (a b c d  a b c d  a b c d)
The image is extended by wrapping around to the opposite edge.
cval (scalar, optional) – Value to fill past edges of image if mode is ‘constant’. Default is 0.0.
origin (int or sequence, optional) – Controls the placement of the filter on the image array’s pixels. A value of 0 (the default) centers the filter over the pixel, with positive values shifting the filter to the left, and negative ones to the right. By passing a sequence of origins with length equal to the number of dimensions of the image array, different shifts can be specified along each axis.
 Returns
result – The result of correlation of image with weights.
 Return type
ndarray
See also
convolve()
Convolve an image with a kernel.

dask_image.ndfilters.
gaussian_filter
(image, sigma, order=0, mode='reflect', cval=0.0, truncate=4.0)¶ Wrapped copy of “scipy.ndimage.filters.gaussian_filter”
Excludes the output parameter as it would not work with Dask arrays.
Original docstring:
Multidimensional Gaussian filter.
 Parameters
image (array_like) – The image array.
sigma (scalar or sequence of scalars) – Standard deviation for Gaussian kernel. The standard deviations of the Gaussian filter are given for each axis as a sequence, or as a single number, in which case it is equal for all axes.
order (int or sequence of ints, optional) – The order of the filter along each axis is given as a sequence of integers, or as a single number. An order of 0 corresponds to convolution with a Gaussian kernel. A positive order corresponds to convolution with that derivative of a Gaussian.
mode (str or sequence, optional) –
The mode parameter determines how the image array is extended when the filter overlaps a border. By passing a sequence of modes with length equal to the number of dimensions of the image array, different modes can be specified along each axis. Default value is ‘reflect’. The valid values and their behavior is as follows:
 ’reflect’ (d c b a  a b c d  d c b a)
The image is extended by reflecting about the edge of the last pixel.
 ’constant’ (k k k k  a b c d  k k k k)
The image is extended by filling all values beyond the edge with the same constant value, defined by the cval parameter.
 ’nearest’ (a a a a  a b c d  d d d d)
The image is extended by replicating the last pixel.
 ’mirror’ (d c b  a b c d  c b a)
The image is extended by reflecting about the center of the last pixel.
 ’wrap’ (a b c d  a b c d  a b c d)
The image is extended by wrapping around to the opposite edge.
cval (scalar, optional) – Value to fill past edges of image if mode is ‘constant’. Default is 0.0.
truncate (float) – Truncate the filter at this many standard deviations. Default is 4.0.
 Returns
gaussian_filter – Returned array of same shape as image.
 Return type
ndarray
Notes
The multidimensional filter is implemented as a sequence of 1D convolution filters. The intermediate arrays are stored in the same data type as the output. Therefore, for output types with a limited precision, the results may be imprecise because intermediate results may be stored with insufficient precision.

dask_image.ndfilters.
gaussian_gradient_magnitude
(image, sigma, mode='reflect', cval=0.0, truncate=4.0, **kwargs)¶ Wrapped copy of “scipy.ndimage.filters.gaussian_gradient_magnitude”
Excludes the output parameter as it would not work with Dask arrays.
Original docstring:
Multidimensional gradient magnitude using Gaussian derivatives.
 Parameters
image (array_like) – The image array.
sigma (scalar or sequence of scalars) – The standard deviations of the Gaussian filter are given for each axis as a sequence, or as a single number, in which case it is equal for all axes.
mode (str or sequence, optional) –
The mode parameter determines how the image array is extended when the filter overlaps a border. By passing a sequence of modes with length equal to the number of dimensions of the image array, different modes can be specified along each axis. Default value is ‘reflect’. The valid values and their behavior is as follows:
 ’reflect’ (d c b a  a b c d  d c b a)
The image is extended by reflecting about the edge of the last pixel.
 ’constant’ (k k k k  a b c d  k k k k)
The image is extended by filling all values beyond the edge with the same constant value, defined by the cval parameter.
 ’nearest’ (a a a a  a b c d  d d d d)
The image is extended by replicating the last pixel.
 ’mirror’ (d c b  a b c d  c b a)
The image is extended by reflecting about the center of the last pixel.
 ’wrap’ (a b c d  a b c d  a b c d)
The image is extended by wrapping around to the opposite edge.
cval (scalar, optional) – Value to fill past edges of image if mode is ‘constant’. Default is 0.0.
keyword arguments will be passed to gaussian_filter() (Extra) –
 Returns
gaussian_gradient_magnitude – Filtered array. Has the same shape as image.
 Return type
ndarray

dask_image.ndfilters.
gaussian_laplace
(image, sigma, mode='reflect', cval=0.0, truncate=4.0, **kwargs)¶ Wrapped copy of “scipy.ndimage.filters.gaussian_laplace”
Excludes the output parameter as it would not work with Dask arrays.
Original docstring:
Multidimensional Laplace filter using Gaussian second derivatives.
 Parameters
image (array_like) – The image array.
sigma (scalar or sequence of scalars) – The standard deviations of the Gaussian filter are given for each axis as a sequence, or as a single number, in which case it is equal for all axes.
mode (str or sequence, optional) –
The mode parameter determines how the image array is extended when the filter overlaps a border. By passing a sequence of modes with length equal to the number of dimensions of the image array, different modes can be specified along each axis. Default value is ‘reflect’. The valid values and their behavior is as follows:
 ’reflect’ (d c b a  a b c d  d c b a)
The image is extended by reflecting about the edge of the last pixel.
 ’constant’ (k k k k  a b c d  k k k k)
The image is extended by filling all values beyond the edge with the same constant value, defined by the cval parameter.
 ’nearest’ (a a a a  a b c d  d d d d)
The image is extended by replicating the last pixel.
 ’mirror’ (d c b  a b c d  c b a)
The image is extended by reflecting about the center of the last pixel.
 ’wrap’ (a b c d  a b c d  a b c d)
The image is extended by wrapping around to the opposite edge.
cval (scalar, optional) – Value to fill past edges of image if mode is ‘constant’. Default is 0.0.
keyword arguments will be passed to gaussian_filter() (Extra) –

dask_image.ndfilters.
generic_filter
(image, function, size=None, footprint=None, mode='reflect', cval=0.0, origin=0, extra_arguments=(), extra_keywords={})¶ Wrapped copy of “scipy.ndimage.filters.generic_filter”
Excludes the output parameter as it would not work with Dask arrays.
Original docstring:
Calculate a multidimensional filter using the given function.
At each element the provided function is called. The image values within the filter footprint at that element are passed to the function as a 1D array of double values.
 Parameters
image (array_like) – The image array.
function ({callable, scipy.LowLevelCallable}) – Function to apply at each element.
size (scalar or tuple, optional) – See footprint, below. Ignored if footprint is given.
footprint (array, optional) – Either size or footprint must be defined. size gives the shape that is taken from the image array, at every element position, to define the image to the filter function. footprint is a boolean array that specifies (implicitly) a shape, but also which of the elements within this shape will get passed to the filter function. Thus
size=(n,m)
is equivalent tofootprint=np.ones((n,m))
. We adjust size to the number of dimensions of the image array, so that, if the image array is shape (10,10,10), and size is 2, then the actual size used is (2,2,2). When footprint is given, size is ignored.mode ({'reflect', 'constant', 'nearest', 'mirror', 'wrap'}, optional) –
The mode parameter determines how the image array is extended beyond its boundaries. Default is ‘reflect’. Behavior for each valid value is as follows:
 ’reflect’ (d c b a  a b c d  d c b a)
The image is extended by reflecting about the edge of the last pixel.
 ’constant’ (k k k k  a b c d  k k k k)
The image is extended by filling all values beyond the edge with the same constant value, defined by the cval parameter.
 ’nearest’ (a a a a  a b c d  d d d d)
The image is extended by replicating the last pixel.
 ’mirror’ (d c b  a b c d  c b a)
The image is extended by reflecting about the center of the last pixel.
 ’wrap’ (a b c d  a b c d  a b c d)
The image is extended by wrapping around to the opposite edge.
cval (scalar, optional) – Value to fill past edges of image if mode is ‘constant’. Default is 0.0.
origin (int or sequence, optional) – Controls the placement of the filter on the image array’s pixels. A value of 0 (the default) centers the filter over the pixel, with positive values shifting the filter to the left, and negative ones to the right. By passing a sequence of origins with length equal to the number of dimensions of the image array, different shifts can be specified along each axis.
extra_arguments (sequence, optional) – Sequence of extra positional arguments to pass to passed function.
extra_keywords (dict, optional) – dict of extra keyword arguments to pass to passed function.
Notes
This function also accepts lowlevel callback functions with one of the following signatures and wrapped in scipy.LowLevelCallable:
int callback(double *buffer, npy_intp filter_size, double *return_value, void *user_data) int callback(double *buffer, intptr_t filter_size, double *return_value, void *user_data)
The calling function iterates over the elements of the image and output arrays, calling the callback function at each element. The elements within the footprint of the filter at the current element are passed through the
buffer
parameter, and the number of elements within the footprint throughfilter_size
. The calculated value is returned inreturn_value
.user_data
is the data pointer provided to scipy.LowLevelCallable asis.The callback function must return an integer error status that is zero if something went wrong and one otherwise. If an error occurs, you should normally set the python error status with an informative message before returning, otherwise a default error message is set by the calling function.
In addition, some other lowlevel function pointer specifications are accepted, but these are for backward compatibility only and should not be used in new code.

dask_image.ndfilters.
laplace
(image, mode='reflect', cval=0.0)¶ Wrapped copy of “scipy.ndimage.filters.laplace”
Excludes the output parameter as it would not work with Dask arrays.
Original docstring:
ND Laplace filter based on approximate second derivatives.
 Parameters
image (array_like) – The image array.
mode (str or sequence, optional) –
The mode parameter determines how the image array is extended when the filter overlaps a border. By passing a sequence of modes with length equal to the number of dimensions of the image array, different modes can be specified along each axis. Default value is ‘reflect’. The valid values and their behavior is as follows:
 ’reflect’ (d c b a  a b c d  d c b a)
The image is extended by reflecting about the edge of the last pixel.
 ’constant’ (k k k k  a b c d  k k k k)
The image is extended by filling all values beyond the edge with the same constant value, defined by the cval parameter.
 ’nearest’ (a a a a  a b c d  d d d d)
The image is extended by replicating the last pixel.
 ’mirror’ (d c b  a b c d  c b a)
The image is extended by reflecting about the center of the last pixel.
 ’wrap’ (a b c d  a b c d  a b c d)
The image is extended by wrapping around to the opposite edge.
cval (scalar, optional) – Value to fill past edges of image if mode is ‘constant’. Default is 0.0.

dask_image.ndfilters.
maximum_filter
(image, size=None, footprint=None, mode='reflect', cval=0.0, origin=0)¶ Wrapped copy of “scipy.ndimage.filters.maximum_filter”
Excludes the output parameter as it would not work with Dask arrays.
Original docstring:
Calculate a multidimensional maximum filter.
 Parameters
image (array_like) – The image array.
size (scalar or tuple, optional) – See footprint, below. Ignored if footprint is given.
footprint (array, optional) – Either size or footprint must be defined. size gives the shape that is taken from the image array, at every element position, to define the image to the filter function. footprint is a boolean array that specifies (implicitly) a shape, but also which of the elements within this shape will get passed to the filter function. Thus
size=(n,m)
is equivalent tofootprint=np.ones((n,m))
. We adjust size to the number of dimensions of the image array, so that, if the image array is shape (10,10,10), and size is 2, then the actual size used is (2,2,2). When footprint is given, size is ignored.mode (str or sequence, optional) –
The mode parameter determines how the image array is extended when the filter overlaps a border. By passing a sequence of modes with length equal to the number of dimensions of the image array, different modes can be specified along each axis. Default value is ‘reflect’. The valid values and their behavior is as follows:
 ’reflect’ (d c b a  a b c d  d c b a)
The image is extended by reflecting about the edge of the last pixel.
 ’constant’ (k k k k  a b c d  k k k k)
The image is extended by filling all values beyond the edge with the same constant value, defined by the cval parameter.
 ’nearest’ (a a a a  a b c d  d d d d)
The image is extended by replicating the last pixel.
 ’mirror’ (d c b  a b c d  c b a)
The image is extended by reflecting about the center of the last pixel.
 ’wrap’ (a b c d  a b c d  a b c d)
The image is extended by wrapping around to the opposite edge.
cval (scalar, optional) – Value to fill past edges of image if mode is ‘constant’. Default is 0.0.
origin (int or sequence, optional) – Controls the placement of the filter on the image array’s pixels. A value of 0 (the default) centers the filter over the pixel, with positive values shifting the filter to the left, and negative ones to the right. By passing a sequence of origins with length equal to the number of dimensions of the image array, different shifts can be specified along each axis.
 Returns
maximum_filter – Filtered array. Has the same shape as image.
 Return type
ndarray
Notes
A sequence of modes (one per axis) is only supported when the footprint is separable. Otherwise, a single mode string must be provided.

dask_image.ndfilters.
median_filter
(image, size=None, footprint=None, mode='reflect', cval=0.0, origin=0)¶ Wrapped copy of “scipy.ndimage.filters.median_filter”
Excludes the output parameter as it would not work with Dask arrays.
Original docstring:
Calculate a multidimensional median filter.
 Parameters
image (array_like) – The image array.
size (scalar or tuple, optional) – See footprint, below. Ignored if footprint is given.
footprint (array, optional) – Either size or footprint must be defined. size gives the shape that is taken from the image array, at every element position, to define the image to the filter function. footprint is a boolean array that specifies (implicitly) a shape, but also which of the elements within this shape will get passed to the filter function. Thus
size=(n,m)
is equivalent tofootprint=np.ones((n,m))
. We adjust size to the number of dimensions of the image array, so that, if the image array is shape (10,10,10), and size is 2, then the actual size used is (2,2,2). When footprint is given, size is ignored.mode ({'reflect', 'constant', 'nearest', 'mirror', 'wrap'}, optional) –
The mode parameter determines how the image array is extended beyond its boundaries. Default is ‘reflect’. Behavior for each valid value is as follows:
 ’reflect’ (d c b a  a b c d  d c b a)
The image is extended by reflecting about the edge of the last pixel.
 ’constant’ (k k k k  a b c d  k k k k)
The image is extended by filling all values beyond the edge with the same constant value, defined by the cval parameter.
 ’nearest’ (a a a a  a b c d  d d d d)
The image is extended by replicating the last pixel.
 ’mirror’ (d c b  a b c d  c b a)
The image is extended by reflecting about the center of the last pixel.
 ’wrap’ (a b c d  a b c d  a b c d)
The image is extended by wrapping around to the opposite edge.
cval (scalar, optional) – Value to fill past edges of image if mode is ‘constant’. Default is 0.0.
origin (int or sequence, optional) – Controls the placement of the filter on the image array’s pixels. A value of 0 (the default) centers the filter over the pixel, with positive values shifting the filter to the left, and negative ones to the right. By passing a sequence of origins with length equal to the number of dimensions of the image array, different shifts can be specified along each axis.
 Returns
median_filter – Filtered array. Has the same shape as image.
 Return type
ndarray

dask_image.ndfilters.
minimum_filter
(image, size=None, footprint=None, mode='reflect', cval=0.0, origin=0)¶ Wrapped copy of “scipy.ndimage.filters.minimum_filter”
Excludes the output parameter as it would not work with Dask arrays.
Original docstring:
Calculate a multidimensional minimum filter.
 Parameters
image (array_like) – The image array.
size (scalar or tuple, optional) – See footprint, below. Ignored if footprint is given.
footprint (array, optional) – Either size or footprint must be defined. size gives the shape that is taken from the image array, at every element position, to define the image to the filter function. footprint is a boolean array that specifies (implicitly) a shape, but also which of the elements within this shape will get passed to the filter function. Thus
size=(n,m)
is equivalent tofootprint=np.ones((n,m))
. We adjust size to the number of dimensions of the image array, so that, if the image array is shape (10,10,10), and size is 2, then the actual size used is (2,2,2). When footprint is given, size is ignored.mode (str or sequence, optional) –
The mode parameter determines how the image array is extended when the filter overlaps a border. By passing a sequence of modes with length equal to the number of dimensions of the image array, different modes can be specified along each axis. Default value is ‘reflect’. The valid values and their behavior is as follows:
 ’reflect’ (d c b a  a b c d  d c b a)
The image is extended by reflecting about the edge of the last pixel.
 ’constant’ (k k k k  a b c d  k k k k)
The image is extended by filling all values beyond the edge with the same constant value, defined by the cval parameter.
 ’nearest’ (a a a a  a b c d  d d d d)
The image is extended by replicating the last pixel.
 ’mirror’ (d c b  a b c d  c b a)
The image is extended by reflecting about the center of the last pixel.
 ’wrap’ (a b c d  a b c d  a b c d)
The image is extended by wrapping around to the opposite edge.
cval (scalar, optional) – Value to fill past edges of image if mode is ‘constant’. Default is 0.0.
origin (int or sequence, optional) – Controls the placement of the filter on the image array’s pixels. A value of 0 (the default) centers the filter over the pixel, with positive values shifting the filter to the left, and negative ones to the right. By passing a sequence of origins with length equal to the number of dimensions of the image array, different shifts can be specified along each axis.
 Returns
minimum_filter – Filtered array. Has the same shape as image.
 Return type
ndarray
Notes
A sequence of modes (one per axis) is only supported when the footprint is separable. Otherwise, a single mode string must be provided.

dask_image.ndfilters.
percentile_filter
(image, percentile, size=None, footprint=None, mode='reflect', cval=0.0, origin=0)¶ Wrapped copy of “scipy.ndimage.filters.percentile_filter”
Excludes the output parameter as it would not work with Dask arrays.
Original docstring:
Calculate a multidimensional percentile filter.
 Parameters
image (array_like) – The image array.
percentile (scalar) – The percentile parameter may be less then zero, i.e., percentile = 20 equals percentile = 80
size (scalar or tuple, optional) – See footprint, below. Ignored if footprint is given.
footprint (array, optional) – Either size or footprint must be defined. size gives the shape that is taken from the image array, at every element position, to define the image to the filter function. footprint is a boolean array that specifies (implicitly) a shape, but also which of the elements within this shape will get passed to the filter function. Thus
size=(n,m)
is equivalent tofootprint=np.ones((n,m))
. We adjust size to the number of dimensions of the image array, so that, if the image array is shape (10,10,10), and size is 2, then the actual size used is (2,2,2). When footprint is given, size is ignored.mode ({'reflect', 'constant', 'nearest', 'mirror', 'wrap'}, optional) –
The mode parameter determines how the image array is extended beyond its boundaries. Default is ‘reflect’. Behavior for each valid value is as follows:
 ’reflect’ (d c b a  a b c d  d c b a)
The image is extended by reflecting about the edge of the last pixel.
 ’constant’ (k k k k  a b c d  k k k k)
The image is extended by filling all values beyond the edge with the same constant value, defined by the cval parameter.
 ’nearest’ (a a a a  a b c d  d d d d)
The image is extended by replicating the last pixel.
 ’mirror’ (d c b  a b c d  c b a)
The image is extended by reflecting about the center of the last pixel.
 ’wrap’ (a b c d  a b c d  a b c d)
The image is extended by wrapping around to the opposite edge.
cval (scalar, optional) – Value to fill past edges of image if mode is ‘constant’. Default is 0.0.
origin (int or sequence, optional) – Controls the placement of the filter on the image array’s pixels. A value of 0 (the default) centers the filter over the pixel, with positive values shifting the filter to the left, and negative ones to the right. By passing a sequence of origins with length equal to the number of dimensions of the image array, different shifts can be specified along each axis.
 Returns
percentile_filter – Filtered array. Has the same shape as image.
 Return type
ndarray

dask_image.ndfilters.
prewitt
(image, axis= 1, mode='reflect', cval=0.0)¶ Wrapped copy of “scipy.ndimage.filters.prewitt”
Excludes the output parameter as it would not work with Dask arrays.
Original docstring:
Calculate a Prewitt filter.
 Parameters
image (array_like) – The image array.
axis (int, optional) – The axis of image along which to calculate. Default is 1.
mode (str or sequence, optional) –
The mode parameter determines how the image array is extended when the filter overlaps a border. By passing a sequence of modes with length equal to the number of dimensions of the image array, different modes can be specified along each axis. Default value is ‘reflect’. The valid values and their behavior is as follows:
 ’reflect’ (d c b a  a b c d  d c b a)
The image is extended by reflecting about the edge of the last pixel.
 ’constant’ (k k k k  a b c d  k k k k)
The image is extended by filling all values beyond the edge with the same constant value, defined by the cval parameter.
 ’nearest’ (a a a a  a b c d  d d d d)
The image is extended by replicating the last pixel.
 ’mirror’ (d c b  a b c d  c b a)
The image is extended by reflecting about the center of the last pixel.
 ’wrap’ (a b c d  a b c d  a b c d)
The image is extended by wrapping around to the opposite edge.
cval (scalar, optional) – Value to fill past edges of image if mode is ‘constant’. Default is 0.0.

dask_image.ndfilters.
rank_filter
(image, rank, size=None, footprint=None, mode='reflect', cval=0.0, origin=0)¶ Wrapped copy of “scipy.ndimage.filters.rank_filter”
Excludes the output parameter as it would not work with Dask arrays.
Original docstring:
Calculate a multidimensional rank filter.
 Parameters
image (array_like) – The image array.
rank (int) – The rank parameter may be less then zero, i.e., rank = 1 indicates the largest element.
size (scalar or tuple, optional) – See footprint, below. Ignored if footprint is given.
footprint (array, optional) – Either size or footprint must be defined. size gives the shape that is taken from the image array, at every element position, to define the image to the filter function. footprint is a boolean array that specifies (implicitly) a shape, but also which of the elements within this shape will get passed to the filter function. Thus
size=(n,m)
is equivalent tofootprint=np.ones((n,m))
. We adjust size to the number of dimensions of the image array, so that, if the image array is shape (10,10,10), and size is 2, then the actual size used is (2,2,2). When footprint is given, size is ignored.mode ({'reflect', 'constant', 'nearest', 'mirror', 'wrap'}, optional) –
The mode parameter determines how the image array is extended beyond its boundaries. Default is ‘reflect’. Behavior for each valid value is as follows:
 ’reflect’ (d c b a  a b c d  d c b a)
The image is extended by reflecting about the edge of the last pixel.
 ’constant’ (k k k k  a b c d  k k k k)
The image is extended by filling all values beyond the edge with the same constant value, defined by the cval parameter.
 ’nearest’ (a a a a  a b c d  d d d d)
The image is extended by replicating the last pixel.
 ’mirror’ (d c b  a b c d  c b a)
The image is extended by reflecting about the center of the last pixel.
 ’wrap’ (a b c d  a b c d  a b c d)
The image is extended by wrapping around to the opposite edge.
cval (scalar, optional) – Value to fill past edges of image if mode is ‘constant’. Default is 0.0.
origin (int or sequence, optional) – Controls the placement of the filter on the image array’s pixels. A value of 0 (the default) centers the filter over the pixel, with positive values shifting the filter to the left, and negative ones to the right. By passing a sequence of origins with length equal to the number of dimensions of the image array, different shifts can be specified along each axis.
 Returns
rank_filter – Filtered array. Has the same shape as image.
 Return type
ndarray

dask_image.ndfilters.
sobel
(image, axis= 1, mode='reflect', cval=0.0)¶ Wrapped copy of “scipy.ndimage.filters.sobel”
Excludes the output parameter as it would not work with Dask arrays.
Original docstring:
Calculate a Sobel filter.
 Parameters
image (array_like) – The image array.
axis (int, optional) – The axis of image along which to calculate. Default is 1.
mode (str or sequence, optional) –
The mode parameter determines how the image array is extended when the filter overlaps a border. By passing a sequence of modes with length equal to the number of dimensions of the image array, different modes can be specified along each axis. Default value is ‘reflect’. The valid values and their behavior is as follows:
 ’reflect’ (d c b a  a b c d  d c b a)
The image is extended by reflecting about the edge of the last pixel.
 ’constant’ (k k k k  a b c d  k k k k)
The image is extended by filling all values beyond the edge with the same constant value, defined by the cval parameter.
 ’nearest’ (a a a a  a b c d  d d d d)
The image is extended by replicating the last pixel.
 ’mirror’ (d c b  a b c d  c b a)
The image is extended by reflecting about the center of the last pixel.
 ’wrap’ (a b c d  a b c d  a b c d)
The image is extended by wrapping around to the opposite edge.
cval (scalar, optional) – Value to fill past edges of image if mode is ‘constant’. Default is 0.0.

dask_image.ndfilters.
threshold_local
(image, block_size, method='gaussian', offset=0, mode='reflect', param=None, cval=0)¶ Compute a threshold mask image based on local pixel neighborhood.
Also known as adaptive or dynamic thresholding[1]_. The threshold value is the weighted mean for the local neighborhood of a pixel subtracted by a constant. Alternatively the threshold can be determined dynamically by a given function, using the ‘generic’ method.
 Parameters
image ((N, M) dask ndarray) – Input image.
block_size (int or list/tuple/array) – Size of pixel neighborhood which is used to calculate the threshold value. (1) A single value for use in all dimensions or (2) A tuple, list, or array with length equal to image.ndim
method ({'generic', 'gaussian', 'mean', 'median'}, optional) –
Method used to determine adaptive threshold for local neighbourhood in weighted mean image.
’generic’: use custom function (see param parameter)
’gaussian’: apply gaussian filter (see param parameter for custom sigma value)
’mean’: apply arithmetic mean filter
’median’: apply median rank filter
By default the ‘gaussian’ method is used.
offset (float, optional) – Constant subtracted from weighted mean of neighborhood to calculate the local threshold value. Default offset is 0.
mode ({'reflect', 'constant', 'nearest', 'mirror', 'wrap'}, optional) – The mode parameter determines how the array borders are handled, where cval is the value when mode is equal to ‘constant’. Default is ‘reflect’.
param ({int, function}, optional) – Either specify sigma for ‘gaussian’ method or function object for ‘generic’ method. This functions takes the flat array of local neighbourhood as a single argument and returns the calculated threshold for the centre pixel.
cval (float, optional) – Value to fill past edges of input if mode is ‘constant’.
 Returns
threshold – Threshold image. All pixels in the input image higher than the corresponding pixel in the threshold image are considered foreground.
 Return type
(N, M) dask ndarray
References
 1
https://docs.opencv.org/modules/imgproc/doc/miscellaneous_transformations.html?highlight=threshold
Examples
>>> import dask.array as da >>> image = da.random.random((1000, 1000), chunks=(100, 100)) >>> result = threshold_local(image, 15, 'gaussian')

dask_image.ndfilters.
uniform_filter
(image, size=3, mode='reflect', cval=0.0, origin=0)¶ Wrapped copy of “scipy.ndimage.filters.uniform_filter”
Excludes the output parameter as it would not work with Dask arrays.
Original docstring:
Multidimensional uniform filter.
 Parameters
image (array_like) – The image array.
size (int or sequence of ints, optional) – The sizes of the uniform filter are given for each axis as a sequence, or as a single number, in which case the size is equal for all axes.
mode (str or sequence, optional) –
The mode parameter determines how the image array is extended when the filter overlaps a border. By passing a sequence of modes with length equal to the number of dimensions of the image array, different modes can be specified along each axis. Default value is ‘reflect’. The valid values and their behavior is as follows:
 ’reflect’ (d c b a  a b c d  d c b a)
The image is extended by reflecting about the edge of the last pixel.
 ’constant’ (k k k k  a b c d  k k k k)
The image is extended by filling all values beyond the edge with the same constant value, defined by the cval parameter.
 ’nearest’ (a a a a  a b c d  d d d d)
The image is extended by replicating the last pixel.
 ’mirror’ (d c b  a b c d  c b a)
The image is extended by reflecting about the center of the last pixel.
 ’wrap’ (a b c d  a b c d  a b c d)
The image is extended by wrapping around to the opposite edge.
cval (scalar, optional) – Value to fill past edges of image if mode is ‘constant’. Default is 0.0.
origin (int or sequence, optional) – Controls the placement of the filter on the image array’s pixels. A value of 0 (the default) centers the filter over the pixel, with positive values shifting the filter to the left, and negative ones to the right. By passing a sequence of origins with length equal to the number of dimensions of the image array, different shifts can be specified along each axis.
 Returns
uniform_filter – Filtered array. Has the same shape as image.
 Return type
ndarray
Notes
The multidimensional filter is implemented as a sequence of 1D uniform filters. The intermediate arrays are stored in the same data type as the output. Therefore, for output types with a limited precision, the results may be imprecise because intermediate results may be stored with insufficient precision.