mdreg.elastix.coreg#

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

Coregister two 2D images or 3D volumes.

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.

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

  • return_deformation (bool) – If set to True, return the deformation field as a third return value

  • params (dict) – Use keyword arguments to overrule any of the default parameters in the elastix template for the chosen method. The default parameters can be found by printing mdreg.elastix.defaults().

Returns:

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

  • transfo (itk.elastixParameterObject) – itk parameter object encoding the transformation from moving to fixed image. The transform can be examined with print(transfo).

  • defo (numpy.ndarray) – If requested, the deformation field is returned as a numpy array. The returned displacement vectors are measured in voxel units.