dask_image.ndmorph package

dask_image.ndmorph package

dask_image.ndmorph.binary_closing(image, structure=None, iterations=1, origin=0, mask=None, border_value=0, brute_force=False)[source]

Wrapped copy of “scipy.ndimage._morphology.binary_closing”

Excludes the output parameter as it would not work with Dask arrays.

Original docstring:

Multidimensional binary closing with the given structuring element.

The closing of an image image by a structuring element is the erosion of the dilation of the image by the structuring element.

Parameters
  • image (array_like) – Binary array_like to be closed. Non-zero (True) elements form the subset to be closed.

  • structure (array_like, optional) – Structuring element used for the closing. Non-zero elements are considered True. If no structuring element is provided an element is generated with a square connectivity equal to one (i.e., only nearest neighbors are connected to the center, diagonally-connected elements are not considered neighbors).

  • iterations (int, optional) – The dilation step of the closing, then the erosion step are each repeated iterations times (one, by default). If iterations is less than 1, each operations is repeated until the result does not change anymore. Only an integer of iterations is accepted.

  • origin (int or tuple of ints, optional) – Placement of the filter, by default 0.

  • mask (array_like, optional) –

    If a mask is given, only those elements with a True value at the corresponding mask element are modified at each iteration.

    New in version 1.1.0.

  • border_value (int (cast to 0 or 1), optional) –

    Value at the border in the output array.

    New in version 1.1.0.

  • brute_force (boolean, optional) –

    Memory condition: if False, only the pixels whose value was changed in the last iteration are tracked as candidates to be updated in the current iteration; if true al pixels are considered as candidates for update, regardless of what happened in the previous iteration. False by default.

    New in version 1.1.0.

Returns

binary_closing – Closing of the image by the structuring element.

Return type

ndarray of bools

See also

grey_closing, binary_opening, binary_dilation, binary_erosion, generate_binary_structure

Notes

Closing [1]_ is a mathematical morphology operation [2]_ that consists in the succession of a dilation and an erosion of the image with the same structuring element. Closing therefore fills holes smaller than the structuring element.

Together with opening (binary_opening), closing can be used for noise removal.

References

1

https://en.wikipedia.org/wiki/Closing_%28morphology%29

2

https://en.wikipedia.org/wiki/Mathematical_morphology

dask_image.ndmorph.binary_dilation(image, structure=None, iterations=1, mask=None, border_value=0, origin=0, brute_force=False)[source]

Wrapped copy of “scipy.ndimage._morphology.binary_dilation”

Excludes the output parameter as it would not work with Dask arrays.

Original docstring:

Multidimensional binary dilation with the given structuring element.

Parameters
  • image (array_like) – Binary array_like to be dilated. Non-zero (True) elements form the subset to be dilated.

  • structure (array_like, optional) – Structuring element used for the dilation. Non-zero elements are considered True. If no structuring element is provided an element is generated with a square connectivity equal to one.

  • iterations (int, optional) – The dilation is repeated iterations times (one, by default). If iterations is less than 1, the dilation is repeated until the result does not change anymore. Only an integer of iterations is accepted.

  • mask (array_like, optional) – If a mask is given, only those elements with a True value at the corresponding mask element are modified at each iteration.

  • origin (int or tuple of ints, optional) – Placement of the filter, by default 0.

  • brute_force (boolean, optional) – Memory condition: if False, only the pixels whose value was changed in the last iteration are tracked as candidates to be updated (dilated) in the current iteration; if True all pixels are considered as candidates for dilation, regardless of what happened in the previous iteration. False by default.

Returns

binary_dilation – Dilation of the image by the structuring element.

Return type

ndarray of bools

See also

grey_dilation, binary_erosion, binary_closing, binary_opening, generate_binary_structure

Notes

Dilation [1]_ is a mathematical morphology operation [2]_ that uses a structuring element for expanding the shapes in an image. The binary dilation of an image by a structuring element is the locus of the points covered by the structuring element, when its center lies within the non-zero points of the image.

References

1

https://en.wikipedia.org/wiki/Dilation_%28morphology%29

2

https://en.wikipedia.org/wiki/Mathematical_morphology

dask_image.ndmorph.binary_erosion(image, structure=None, iterations=1, mask=None, border_value=0, origin=0, brute_force=False)[source]

Wrapped copy of “scipy.ndimage._morphology.binary_erosion”

Excludes the output parameter as it would not work with Dask arrays.

Original docstring:

Multidimensional binary erosion with a given structuring element.

Binary erosion is a mathematical morphology operation used for image processing.

Parameters
  • image (array_like) – Binary image to be eroded. Non-zero (True) elements form the subset to be eroded.

  • structure (array_like, optional) – Structuring element used for the erosion. Non-zero elements are considered True. If no structuring element is provided, an element is generated with a square connectivity equal to one.

  • iterations (int, optional) – The erosion is repeated iterations times (one, by default). If iterations is less than 1, the erosion is repeated until the result does not change anymore.

  • mask (array_like, optional) – If a mask is given, only those elements with a True value at the corresponding mask element are modified at each iteration.

  • origin (int or tuple of ints, optional) – Placement of the filter, by default 0.

  • brute_force (boolean, optional) – Memory condition: if False, only the pixels whose value was changed in the last iteration are tracked as candidates to be updated (eroded) in the current iteration; if True all pixels are considered as candidates for erosion, regardless of what happened in the previous iteration. False by default.

Returns

binary_erosion – Erosion of the image by the structuring element.

Return type

ndarray of bools

See also

grey_erosion, binary_dilation, binary_closing, binary_opening, generate_binary_structure

Notes

Erosion [1]_ is a mathematical morphology operation [2]_ that uses a structuring element for shrinking the shapes in an image. The binary erosion of an image by a structuring element is the locus of the points where a superimposition of the structuring element centered on the point is entirely contained in the set of non-zero elements of the image.

References

1

https://en.wikipedia.org/wiki/Erosion_%28morphology%29

2

https://en.wikipedia.org/wiki/Mathematical_morphology

dask_image.ndmorph.binary_opening(image, structure=None, iterations=1, origin=0, mask=None, border_value=0, brute_force=False)[source]

Wrapped copy of “scipy.ndimage._morphology.binary_opening”

Excludes the output parameter as it would not work with Dask arrays.

Original docstring:

Multidimensional binary opening with the given structuring element.

The opening of an image image by a structuring element is the dilation of the erosion of the image by the structuring element.

Parameters
  • image (array_like) – Binary array_like to be opened. Non-zero (True) elements form the subset to be opened.

  • structure (array_like, optional) – Structuring element used for the opening. Non-zero elements are considered True. If no structuring element is provided an element is generated with a square connectivity equal to one (i.e., only nearest neighbors are connected to the center, diagonally-connected elements are not considered neighbors).

  • iterations (int, optional) – The erosion step of the opening, then the dilation step are each repeated iterations times (one, by default). If iterations is less than 1, each operation is repeated until the result does not change anymore. Only an integer of iterations is accepted.

  • origin (int or tuple of ints, optional) – Placement of the filter, by default 0.

  • mask (array_like, optional) –

    If a mask is given, only those elements with a True value at the corresponding mask element are modified at each iteration.

    New in version 1.1.0.

  • border_value (int (cast to 0 or 1), optional) –

    Value at the border in the output array.

    New in version 1.1.0.

  • brute_force (boolean, optional) –

    Memory condition: if False, only the pixels whose value was changed in the last iteration are tracked as candidates to be updated in the current iteration; if true all pixels are considered as candidates for update, regardless of what happened in the previous iteration. False by default.

    New in version 1.1.0.

Returns

binary_opening – Opening of the image by the structuring element.

Return type

ndarray of bools

See also

grey_opening, binary_closing, binary_erosion, binary_dilation, generate_binary_structure

Notes

Opening [1]_ is a mathematical morphology operation [2]_ that consists in the succession of an erosion and a dilation of the image with the same structuring element. Opening, therefore, removes objects smaller than the structuring element.

Together with closing (binary_closing), opening can be used for noise removal.

References

1

https://en.wikipedia.org/wiki/Opening_%28morphology%29

2

https://en.wikipedia.org/wiki/Mathematical_morphology