Skip to main content

Pipeline Overview

Diffusion preprocessing follows a common sequence across large studies: brain extraction, denoising, Gibbs ringing removal, susceptibility distortion correction, head motion and eddy current correction, and model fitting. The Human Connectome Project, UK Biobank, and ABCD pipelines all implement that sequence. The configuration documented here is one version of it.

Maximov, Alnaes, and Westlye (2019) quantify which of these corrections change diffusion metrics and by how much: Human Brain Mapping 40(14), 4146-4162, doi:10.1016/j.neuroimage.2021.118756.

Pipeline Stages​

Twelve steps in two parts. Part A applies the corrections required of any diffusion dataset. Part B fits the diffusion models and writes the files a tractography workflow reads. Several further steps are useful but sit outside the required path and are listed separately below.

The number of steps a given study needs depends on its acquisition and its analysis. This is one tested configuration rather than the only valid one.

Part A — Core Preprocessing​

Part A has two routes. Both take raw data to corrected, brain-masked, T1-aligned diffusion data, and both feed Part B.

Route 1: QSIPrep​

StepNamePurposeTool(s)
—QSIPrepSkull stripping, TOPUP, denoising, Gibbs removal, eddy, bias correction, and T1 alignment in one containerized run, with a QC report per participantQSIPrep (Docker / Singularity)

QSIPrep reads BIDS, so DICOM conversion and BIDS layout happen first; the route page covers that. Because it writes the DWI into the T1 grid, Step 10 is not needed afterwards.

Route 2: Manual Steps​

StepNamePurposeTool(s)
1DICOM to NIfTIStandardize raw scanner datadcm2niix
2Skull StrippingRemove non-brain tissueANTs
3B0 ConcatenationMerge AP/PA fieldmapsFSL
4TOPUPCorrect susceptibility distortionsFSL
5Mean B0Create high-SNR reference imageFSL
6Brain MaskingDefine analysis regionFSL
7Denoising & GibbsRemove noise and ringing artifactsMRtrix3
8Eddy CorrectionCorrect motion and eddy currentsFSL

Choosing a Route​

Route 1: QSIPrepRoute 2: Manual
SuitsNew studies, multi-site studies, anyone who wants a pinned and reproducible containerLearning what each correction does; acquisitions QSIPrep does not support; full control of every parameter
InputBIDS tree (conversion done first)Raw DICOM
Runs asdcm2niix into BIDS, then one command per participantEight scripts per participant
Tools insideFSL topup and eddy, MRtrix3 dwidenoise and mrdegibbs; SynthStrip for skull stripping; N4 bias correction on the DWI by defaultANTs for skull stripping; no DWI bias correction
T1 ↔ DWIDWI resampled into the T1 grid; Step 10 skippedSeparate grids; Step 10 computes the transform
QCOne HTML report per participantA check section on each step's page
OutputBIDS derivatives, linked into the required layout by the route page's scriptThe required layout directly

The two routes are not verified to be numerically identical. Most steps use the same tool, but skull stripping differs, QSIPrep's Gibbs removal is off unless requested, and its bias correction is on unless disabled; the route page lists these step by step. Do not mix routes within one study.

Part B — Tractography Readiness​

Steps 11 and 12 take two forms. Multi-shell data uses three-tissue MSMT-CSD. Single-shell data uses single-tissue CSD, given in Step 12. Both produce the same output file.

StepNamePurposeTool(s)
9Tensor FittingCompute FA, MD, RD, ADFSL
10RegistrationAlign T1 to diffusion spaceFSL
11Response FunctionsEstimate per-tissue reference signalsMRtrix3
12FOD EstimationDeconvolve to fiber orientation distributionsMRtrix3
—Outputs for TractographyVerify outputs before tracking—

Optional Steps​

These are covered in this tutorial but are not required to reach tractography.

NamePurposeWhen it applies
BedpostXPer-voxel fiber orientations for FSL probtrackx2 — the FSL counterpart to Steps 11–12, which do the same job for MRtrix3 tckgenOnly if your tractography tool is probtrackx2; pick one, not both
Shell ExtractionIsolate b-value shellsTensor fitting — not for MSMT-CSD, which needs all shells
ICV CalculationEstimate intracranial volumeAs a statistical covariate
BIDS & pyAFQOrganize for pyAFQpyAFQ's automated whole-brain bundle recognition

Pipeline Flowchart​

Steps 9 and 11 both branch from Step 8, or from QSIPrep output, which replaces Steps 1–8 entirely. Tensor fitting and FOD estimation are independent of each other and can run in parallel. Registration (Step 10) needs the skull-stripped T1 from Step 2 and is skipped on the QSIPrep route. Everything converges at the required outputs.


Rationale​

Core Operations (Required)​

The following stages are accepted across the field as minimum required operations for diffusion MRI preprocessing:

  • Brain extraction (Step 2) -- non-brain tissue introduces artifacts and errors in all downstream steps
  • Susceptibility distortion correction (Step 4) -- corrects geometric distortions caused by magnetic field inhomogeneities
  • Denoising (Step 7) -- thermal noise degrades tensor estimation, especially at higher b-values
  • Motion and eddy current correction (Step 8) -- subject motion and eddy currents cause volume misalignment and signal distortions
  • Tensor fitting (Step 9) -- the fundamental computation that produces FA, MD, and other diffusion metrics

Software-Specific Steps​

Some stages exist because of specific software requirements rather than conceptual necessity:

  • B0 concatenation (Step 3) -- FSL's topup requires AP and PA B0 volumes in a single file
  • Mean B0 creation (Step 5) -- averaging multiple B0 volumes produces a higher-SNR reference for brain masking
  • Brain masking (Step 6) -- eddy requires an explicit brain mask; this refines the initial skull strip

Processing Standards​

This sequence reflects the processing standards established by:

  • Human Connectome Project (HCP) -- the gold standard for diffusion MRI processing
  • UK Biobank -- large-scale population imaging with automated preprocessing
  • ABCD Study -- multi-site developmental neuroimaging with rigorous QC

Directory Structure Convention​

Organizing outputs into a consistent directory structure makes the pipeline manageable across subjects. The recommended layout:

project/
raw/ # Raw DICOMs
NIFTI/ # Converted NIfTI files
derivatives/
ANTs/ # Skull stripping outputs
TOPUP/ # Distortion correction
EDDY/ # Motion/eddy correction
DTIFIT/ # Tensor fitting outputs
FLIRT/ # Registration matrices
ICV/ # Intracranial volume
pyAFQ/ # BIDS-formatted for tractography
config/ # Configuration files (acqp.txt, index.txt)

Each subject's outputs live within the appropriate derivatives subdirectory. For example:

derivatives/
DTIFIT/
sub-001/
sub-001_dtifit_FA.nii.gz
sub-001_dtifit_MD.nii.gz
sub-001_dtifit_RD.nii.gz
sub-001_dtifit_AD.nii.gz
sub-002/
...

This structure keeps raw data separate from processed outputs and groups outputs by processing stage.


Reference Implementation​

The full pipeline described in this tutorial has been implemented and run end to end on a real multi-shell dataset:

Repository: github.com/DiffusionTensorImaging-Repos/SDN-IMPACT-DTI

It includes batch processing scripts, configuration files, and the QC output from each step. Use it as a reference when adapting the pipeline to your own data — see the Worked Example page for what it contains.


Getting Practice Data​

The Practice Data page lists sample datasets suitable for working through this tutorial.