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
| Step | Name | Purpose | Tool(s) |
|---|---|---|---|
| — | QSIPrep | Skull stripping, TOPUP, denoising, Gibbs removal, eddy, bias correction, and T1 alignment in one containerized run, with a QC report per participant | QSIPrep (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
| Step | Name | Purpose | Tool(s) |
|---|---|---|---|
| 1 | DICOM to NIfTI | Standardize raw scanner data | dcm2niix |
| 2 | Skull Stripping | Remove non-brain tissue | ANTs |
| 3 | B0 Concatenation | Merge AP/PA fieldmaps | FSL |
| 4 | TOPUP | Correct susceptibility distortions | FSL |
| 5 | Mean B0 | Create high-SNR reference image | FSL |
| 6 | Brain Masking | Define analysis region | FSL |
| 7 | Denoising & Gibbs | Remove noise and ringing artifacts | MRtrix3 |
| 8 | Eddy Correction | Correct motion and eddy currents | FSL |
Choosing a Route
| Route 1: QSIPrep | Route 2: Manual | |
|---|---|---|
| Suits | New studies, multi-site studies, anyone who wants a pinned and reproducible container | Learning what each correction does; acquisitions QSIPrep does not support; full control of every parameter |
| Input | BIDS tree (conversion done first) | Raw DICOM |
| Runs as | dcm2niix into BIDS, then one command per participant | Eight scripts per participant |
| Tools inside | FSL topup and eddy, MRtrix3 dwidenoise and mrdegibbs; SynthStrip for skull stripping; N4 bias correction on the DWI by default | ANTs for skull stripping; no DWI bias correction |
| T1 ↔ DWI | DWI resampled into the T1 grid; Step 10 skipped | Separate grids; Step 10 computes the transform |
| QC | One HTML report per participant | A check section on each step's page |
| Output | BIDS derivatives, linked into the required layout by the route page's script | The 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.
| Step | Name | Purpose | Tool(s) |
|---|---|---|---|
| 9 | Tensor Fitting | Compute FA, MD, RD, AD | FSL |
| 10 | Registration | Align T1 to diffusion space | FSL |
| 11 | Response Functions | Estimate per-tissue reference signals | MRtrix3 |
| 12 | FOD Estimation | Deconvolve to fiber orientation distributions | MRtrix3 |
| — | Outputs for Tractography | Verify outputs before tracking | — |
Optional Steps
These are covered in this tutorial but are not required to reach tractography.
| Name | Purpose | When it applies |
|---|---|---|
| BedpostX | Per-voxel fiber orientations for FSL probtrackx2 — the FSL counterpart to Steps 11–12, which do the same job for MRtrix3 tckgen | Only if your tractography tool is probtrackx2; pick one, not both |
| Shell Extraction | Isolate b-value shells | Tensor fitting — not for MSMT-CSD, which needs all shells |
| ICV Calculation | Estimate intracranial volume | As a statistical covariate |
| BIDS & pyAFQ | Organize for pyAFQ | pyAFQ'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
topuprequires 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) --
eddyrequires 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.