eddymotion.registration.utils module

Utilities to aid in performing and evaluating image registration.

This module provides functions to compute displacements of image coordinates under a transformation, useful for assessing the accuracy of image registration processes.

eddymotion.registration.utils.displacement_framewise(img: nibabel.spatialimages.SpatialImage, test_xfm: nitransforms.base.BaseTransform, radius: float = 50.0)[source]

Compute the framewise displacement (FD) for a given transformation.

Parameters:
  • img (SpatialImage) – The reference image. Used to extract the center coordinates.

  • test_xfm (BaseTransform) – The transformation to test. Applied to coordinates around the image center.

  • radius (float, optional) – The radius (in mm) of the spherical neighborhood around the center of the image. Default is 50.0 mm.

Returns:

The average framewise displacement (FD) for the test transformation.

Return type:

float

eddymotion.registration.utils.displacements_within_mask(mask_img: nb.spatialimages.SpatialImage, test_xfm: nt.base.BaseTransform, reference_xfm: nt.base.BaseTransform | None = None) np.ndarray[source]

Compute the distance between voxel coordinates mapped through two transforms.

Parameters:
  • mask_img (SpatialImage) – A mask image that defines the region of interest. Voxel coordinates within the mask are transformed.

  • test_xfm (BaseTransform) – The transformation to test. This transformation is applied to the voxel coordinates.

  • reference_xfm (BaseTransform, optional) – A reference transformation to compare with. If None, the identity transformation is assumed (no transformation).

Returns:

An array of displacements (in mm) for each voxel within the mask.

Return type:

ndarray