dask_image.ndinterp package

dask_image.ndinterp package

dask_image.ndinterp.affine_transform(image, matrix, offset=0.0, output_shape=None, order=1, output_chunks=None, **kwargs)[source]

Apply an affine transform using Dask. For every output chunk, only the slice containing the relevant part of the image is processed. Chunkwise processing is performed either using ndimage.affine_transform or cupyx.scipy.ndimage.affine_transform, depending on the input type.


Differences to ndimage.affine_transformation: - currently, prefiltering is not supported

(affecting the output in case of interpolation order > 1)

  • default order is 1

  • modes ‘reflect’, ‘mirror’ and ‘wrap’ are not supported

Arguments equal to ndimage.affine_transformation, except for output_chunks.

  • image (array_like (Numpy Array, Cupy Array, Dask Array...)) – The image array.

  • matrix (array (ndim,), (ndim, ndim), (ndim, ndim+1) or (ndim+1, ndim+1)) – Transformation matrix.

  • offset (float or sequence, optional) – The offset into the array where the transform is applied. If a float, offset is the same for each axis. If a sequence, offset should contain one value for each axis.

  • output_shape (tuple of ints, optional) – The shape of the array to be returned.

  • order (int, optional) – The order of the spline interpolation. Note that for order>1 scipy’s affine_transform applies prefiltering, which is not yet supported and skipped in this implementation.

  • output_chunks (tuple of ints, optional) – The shape of the chunks of the output Dask Array.


affine_transform – A dask array representing the transformed output

Return type

Dask Array