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 with scipy.ndimage.zoom.

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

Resample a deformed image back to the original image space and save it as NIfTI.

Classes

SpatialTransformer(*args, **kwargs)

N-D spatial transformer that warps an image with a voxel displacement field.

VecInt(*args, **kwargs)

Integrates a stationary velocity field via scaling and squaring.