dmriprep.interfaces.nifreeze module

Nipype interfaces for NiFreeze (motion and eddy-current estimation).

class dmriprep.interfaces.nifreeze.ExtractTransforms(from_file=None, resource_monitor=None, **inputs)View on GitHub

Bases: SimpleInterface

Extract and convert transforms from NiFreeze HDF5 output.

Converts NiFreeze’s internal transform representation to standard neuroimaging formats (ITK, FSL, AFNI) for BIDS derivative output and downstream processing.

Mandatory Inputs:

in_file (a pathlike object or string representing an existing file) – HDF5 file from NiFreeze estimation.

Optional Inputs:
  • output_format (‘itk’ or ‘fsl’ or ‘afni’) – Output transform format. (Nipype default value: itk)

  • reference (a pathlike object or string representing an existing file) – Reference image for transform header.

Outputs:
  • eddy_xfm (a list of items which are a pathlike object or string representing an existing file) – Per-volume eddy current transforms.

  • motion_params (a pathlike object or string representing an existing file) – Motion parameters TSV file.

  • motion_xfm (a list of items which are a pathlike object or string representing an existing file) – Per-volume motion transforms.

class dmriprep.interfaces.nifreeze.NiFreezeEstimate(from_file=None, resource_monitor=None, **inputs)View on GitHub

Bases: SimpleInterface

Estimate head motion and eddy-current distortions using NiFreeze.

This interface wraps NiFreeze’s estimation pipeline, which uses leave-one-out cross-validation with diffusion models (DTI, DKI, GP) to predict each volume and estimate motion/distortion by registering predicted to actual volumes.

The transforms are stored but not applied, following the fit/transform architecture pattern.

Mandatory Inputs:
  • bval_file (a pathlike object or string representing an existing file) – B-values file.

  • bvec_file (a pathlike object or string representing an existing file) – B-vectors file.

  • dwi_file (a pathlike object or string representing an existing file) – DWI NIfTI file.

Optional Inputs:
  • b0_file (a pathlike object or string representing an existing file) – Pre-computed b=0 reference image.

  • b0_threshold (a float) – Threshold for b=0 volumes. (Nipype default value: 50.0)

  • brainmask (a pathlike object or string representing an existing file) – Brain mask in DWI space.

  • model (‘DTI’ or ‘DKI’ or ‘GP’ or ‘average’) – Diffusion model for leave-one-out prediction. (Nipype default value: DTI)

  • n_threads (an integer) – Number of parallel threads. (Nipype default value: 1)

Outputs:
  • bzero (a pathlike object or string representing an existing file) – Estimated b=0 reference.

  • motion_affines (a list of items which are a pathlike object or string representing an existing file) – Per-volume motion transforms.

  • out_file (a pathlike object or string representing an existing file) – HDF5 file with estimated transforms.

class dmriprep.interfaces.nifreeze.RotateBVecs(from_file=None, resource_monitor=None, **inputs)View on GitHub

Bases: SimpleInterface

Rotate b-vectors based on motion correction transforms.

Extracts the rotation component from each affine transform and applies it to the corresponding b-vector. This is necessary to maintain consistency between gradient directions and the reoriented image data after motion correction.

Mandatory Inputs:
  • in_bval (a pathlike object or string representing an existing file) – Original b-values file.

  • in_bvec (a pathlike object or string representing an existing file) – Original b-vectors file.

  • transforms (a list of items which are a pathlike object or string representing an existing file) – Per-volume affine transforms.

Optional Inputs:

b0_threshold (a float) – Threshold for b=0 volumes. (Nipype default value: 50.0)

Outputs:

out_bvec (a pathlike object or string representing an existing file) – Rotated b-vectors file.