mango.image.registration.affine_transform

mango.image.registration.affine_transform(input, matrix, shift=None, offset=None, interptype=mango.image._mango_open_filters.InterpolationType.CATMULL_ROM_CUBIC_SPLINE, fill=None)

Applies an affine transformation to an image. This is the forward transform so that (conceptually):

idx  = scipy.array((i,j,k), dtype="int32")
tidx = matrix.dot((idx-offset).T) + offset + shift
out[tuple(tidx)] = input[tuple(idx)]

This differs from the scipy.ndimage.interpolation.affine_transform() function which does (conceptually, ignoring shift):

idx  = scipy.array((i,j,k), dtype="int32")
tidx = matrix.dot((idx-offset).T) + offset
out[tuple(idx)] = input[tuple(tidx)]
Parameters:
  • input (mango.Dds) – Image to be transformed.
  • matrix (numpy.ndarray) – A (3,3) shaped affine transformation matrix.
  • shift (3-sequence) – The translation (number of voxels), can be float elements.
  • offset (3-sequence) – The centre-point of the affine transformation (relative to input.origin). If None, the centre of the image is used as the centre of affine transformation. Elements can be float.
  • interptype (mango.image.InterpolationType) – Interpolation type.
  • fill (numeric) – The value used for elements outside the image-domain. If None uses the input.mtype.maskValue() or 0 if there is no input.mtype attribute.
Return type:

mango.Dds

Returns:

Affine-transformed mango.Dds image.

Previous topic

mango.image.registration.affine_transform

Next topic

Message Passing Interface Utilities (mango.mpi)

This Page