mymesh.register.transform_image#
- mymesh.register.transform_image(image, T, options={})[source]#
Apply transformation matrix to an image. This is essentially an interface to scipy.ndimage.affine_transform but takes into account the need to invert the transformation matrix for consistency between the “pull” resampling performed by affine_transform and the “push” transformations used to transform points. The options input allows for inputting any of the keyword arguments used by affine_transform.
- Parameters:
image (array_like) – Image array
T (array_like) – Transformation matrix (either 3x3 or 4x4).
options (dict, optional) –
Options to be used by scipy.ndimage.affine_transform. If none are provide, all defaults will be used, by default dict(). Common options that may be used are mode to allow wrapping (‘grid-wrap’) or mirroring (‘mirror’) to change what happens when the contents of the image are moved beyond the bounds of the image, and order which changes the interpolation order of the transformation (the default is 3, transformations can be performed more efficiently by reducing to 1).
- Returns:
new_image – Transformed image array.
- Return type:
np.ndarray