dmriprep.workflows.dwi.fit module

DWI fit workflows.

The fit stage estimates all transforms without applying them, following the fit/transform architecture from fMRIPrep. This enables:

  1. Single-interpolation resampling by composing all transforms

  2. Reuse of precomputed derivatives via –derivatives flag

  3. Separation of compute-intensive estimation from I/O-intensive resampling

dmriprep.workflows.dwi.fit.init_dwi_fit_wf(*, dwi_file, precomputed=None, fieldmap_id=None, omp_nthreads=1)View on GitHub

Build a workflow to estimate all transforms for DWI preprocessing.

This workflow orchestrates the “fit” stage of DWI preprocessing, estimating head motion, eddy current distortions, susceptibility distortion corrections, and anatomical coregistration without applying any transforms to the data.

Workflow Graph
../_images/dmriprep-workflows-dwi-fit-1.png

(Source code, png, svg, pdf)

Parameters:
  • dwi_file – Path to the DWI NIfTI file.

  • precomputed – Dictionary containing precomputed derivatives to reuse.

  • fieldmap_id – ID of the fieldmap to use for SDC. If None, no SDC is performed.

  • omp_nthreads – Number of threads for parallel processing.

Inputs:
  • dwi_file – DWI NIfTI file.

  • in_bvec – File path of the b-vectors.

  • in_bval – File path of the b-values.

  • t1w_preproc – Preprocessed T1w image.

  • t1w_mask – Brain mask in T1w space.

  • t1w_dseg – Tissue segmentation in T1w space.

  • subjects_dir – FreeSurfer subjects directory.

  • subject_id – FreeSurfer subject ID.

  • fsnative2t1w_xfm – Transform from FreeSurfer native to T1w space.

  • fmap – Fieldmap image (if available).

  • fmap_ref – Fieldmap reference image.

  • fmap_coeff – Fieldmap B-spline coefficients.

  • fmap_mask – Fieldmap brain mask.

  • fmap_id – Fieldmap estimator ID.

  • sdc_method – SDC method identifier.

Outputs:
  • hmc_dwiref – 3D b=0 reference used for motion correction.

  • coreg_dwiref – SDC-corrected reference used for coregistration.

  • dwi_mask – Brain mask in DWI space.

  • motion_xfm – Per-volume affine transforms for head motion correction.

  • dwiref2anat_xfm – Transform from DWI reference to anatomical space.

  • dwiref2fmap_xfm – Transform from DWI reference to fieldmap space.

  • fmap_coeff – B-spline coefficients for susceptibility distortion correction.

  • out_bvec – Motion-corrected (rotated) gradient directions.

dmriprep.workflows.dwi.fit.init_dwi_reference_wf(*, omp_nthreads=1, name='dwi_reference_wf')View on GitHub

Build a workflow to generate a DWI reference from b=0 volumes.

This workflow extracts b=0 volumes, aligns them, and averages to create a robust reference image for motion correction.

Workflow Graph
../_images/dmriprep-workflows-dwi-fit-2.png

(Source code, png, svg, pdf)

Parameters:
  • omp_nthreads – Number of threads for parallel processing.

  • name – Workflow name.

Inputs:
  • dwi_file – DWI NIfTI file.

  • b0_ixs – Indices of b=0 volumes in the DWI series.

Outputs:
  • dwi_reference – 3D b=0 reference image.

  • validation_report – HTML reportlet for validation.