mdreg.fit#

mdreg.fit(moving: ndarray, fit_image=None, fit_coreg=None, fit_pixel=None, precision=1.0, maxit=3, verbose=0, plot_params=None, force_2d=False)[source]#

Remove motion from a series of images or volumes.

Parameters:
  • moving (numpy.ndarray) – The series of images to be corrected, with dimensions (x,y,t) or (x,y,z,t).

  • fit_image (dict or list, optional) – A dictionary defining the signal model. For a slice-by-slice computation (4D array with force_2d=True), this can be a list of dictionaries, one for each slice. If fit_image is not provided, a constant model is used.

  • fit_coreg (dict, optional) – The parameters for coregistering the images. The default is None, which uses bspline coregistration in elastix with default parameters.

  • fit_pixel (dict, optional) – A dictionary defining a single-pixel signal model. For a slice-by-slice computation (4D array with force_2d=True), this can be a list of dictionaries, one for each slice. The default is None.

  • precision (float, optional) – The precision of the coregistration. The default is 1.0.

  • maxit (int, optional) – The maximum number of iterations. The default is 3.

  • verbose (int, optional) – The level of feedback to provide to the user. 0: no feedback; 1: text output only; 2: text output and progress bars; 3: text output, progress bars and image exports. The default is 0.

  • plot_params (dict, optional) – The parameters for plotting the images when verbose = 3. Any keyword arguments accepted by mdreg.plot_series can be included. This keyword is ignored when verbose < 3.

  • force_2d (bool, optional) – By default, a 3-dimensional moving array will be coregistered with a 3-dimensional deformation field. To perform slice-by-slice 2-dimensional registration instead, set force_2d to True. This keyword is ignored when the arrays are 2-dimensional. The default is False.

Returns:

  • coreg (numpy.ndarray) – The coregistered images with the same dimensions as moving.

  • defo (numpy.ndarray) – The deformation field with the same dimensions as moving, and one additional dimension for the components of the vector field. If moving has dimensions (x,y,t) and (x,y,z,t), then the deformation field will have dimensions (x,y,2,t) and (x,y,z,3,t), respectively.

  • fit (numpy.ndarray) – The fitted signal model with the same dimensions as moving.

  • pars (dict) – The parameters of the fitted signal model with dimensions (x,y,n) or (x,y,z,n), where n is the number of free parameters of the signal model.

Examples using mdreg.fit#

Customizing the coregistration

Customizing the coregistration

3D Variable Flip Angle (Linear)

3D Variable Flip Angle (Linear)