mdreg.elastix.coreg#

mdreg.elastix.coreg(moving: ndarray, fixed: ndarray, spacing=1.0, downsample=1, log=False, method='bspline', **params)[source]#

Coregister two arrays

Parameters:
  • moving (numpy.ndarray) – The moving image with dimensions (x,y) or (x,y,z).

  • fixed (numpy.ndarray) – The fixed target image with the same shape as the moving image.

  • spacing (array-like) – Pixel spacing in mm. This can be a single scalar if all dimensions are equal, or an array of 2 elements (for 2D data) or 3 elements ( for 3D data). Defaults to 1.

  • downsample (float) – Speed up the registration by downsampling the images with this factor. downsample=1 means no downsampling. This is the default.

  • log (bool) – Print a log during computations. Defaults to False.

  • method (str) – Deformation method to use. Options are ‘bspline’, ‘affine’, ‘rigid’ or ‘translation’. Default is ‘bspline’.

  • params (dict) – Use keyword arguments to overrule any of the default parameters in the elastix template for the chosen method.

Returns:

  • coreg (numpy.ndarray) – Coregistered image in the same shape as the moving image.

  • deformation (numpy.ndarray) – Deformation field in the same shape as the moving image - but with an additional dimension at the end for the components of the deformation vector.