MIR.utils.registration_utils

Registration utility functions and spatial transformer helpers.

Functions

crop_or_pad(volume, target_shape[, pad_value])

Center-crop or center-pad a NumPy array to exactly match target_shape.

get_pixdim(nib_img)

Extract voxel spacing from a nibabel image.

make_affine_from_pixdim(pixdim)

Create a 4x4 affine matrix from pixel spacing.

resample_by_pixdim(arr, from_pixdim, ...)

Resample a numpy array by voxel spacing.

resample_to_orginal_space_and_save(...[, ...])

Resample a deformed image back to the original image space.

Classes

SpatialTransformer(*args, **kwargs)

N-D Spatial Transformer Obtained from https://github.com/voxelmorph/voxelmorph

VecInt(*args, **kwargs)

Integrates a vector field via scaling and squaring.