cupyx.scipy.ndimage.binary_dilation#

cupyx.scipy.ndimage.binary_dilation(input, structure=None, iterations=1, mask=None, output=None, border_value=0, origin=0, brute_force=False, *, axes=None)[source]#

Multidimensional binary dilation with the given structuring element.

Parameters:
  • input (cupy.ndarray) – The input binary array_like to be dilated. Non-zero (True) elements form the subset to be dilated.

  • structure (cupy.ndarray or tuple or int, optional) – The 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. If a tuple of integers is provided, a structuring element of the specified shape is used (all elements true). If an integer is provided, the structuring element will have the same size along all axes. (Default value = None).

  • 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 (cupy.ndarray or None, optional) – If a mask is given, only those elements with a True value at the corresponding mask element are modified at each iteration. (Default value = None)

  • output (cupy.ndarray, optional) – Array of the same shape as input, into which the output is placed. By default, a new array is created.

  • border_value (int (cast to 0 or 1), optional) – Value at the border in the output array. (Default value = 0)

  • 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.

  • axes (tuple of int or None) – The axes over which to apply the filter. If None, input is filtered along all axes. If an origin tuple is provided, its length must match the number of axes.

Returns:

The result of binary dilation.

Return type:

cupy.ndarray

Warning

This function may synchronize the device.