Skip to content

dwi-preprocessing-* – Preprocessing of raw diffusion weighted imaging (DWI) datasets

This pipeline corrects DWI datasets for motion, eddy current, magnetic susceptibility and bias field distortions, assuming that the data have been acquired using an EPI sequence.

To that aim, a reference b0 image is computed: if only one b0 is present, it will act as the b0 reference, otherwise, the reference will correspond to the average of the different b0s after registration to the first b0. Head-motion correction is performed by rigidly registering each DWI volume to the reference b0 and updating the b-vectors accordingly. These rigid transformations initialize the affine registrations between each DWI volume and the reference b0, for eddy current correction. These two registration steps are performed using the FSL flirt tool. The magnetic susceptibility correction is then performed using different strategies depending on the data available (see below), and all these corrections are combined into a single deformation field to minimize the number of interpolations. Finally, bias field correction is performed using the ANTs N4 bias correction algorithm.

Notes concerning the fieldmaps for the magnetic susceptibility corrections

Depending on the type of extra acquisition available (see details e.g. in the section 8.9 of the BIDS specifications), different magnetic susceptibility corrections are performed. Two approaches are currently implemented in Clinica:

  • No extra data: this is the case with the public Alzheimer’s Disease Neuroimaging Initiative (ADNI) dataset for instance. The phase unwrapping is simulated thanks to a non-linear registration towards the T1-weighted image, which does not suffer from these artifacts.

  • Phase difference image and at least one magnitude image (case 1 in the BIDS specifications, section 8.9)

The cases 2, 3 and 4 of the BIDS specifications aka the “two phase images and two magnitude images”, the “single, real fieldmap image” (showing the field inhomogeneity in each voxel) and the “multiple phase encoded directions” (topup) approaches are currently not implemented in Clinica, but will be integrated in the future.


If you only installed the core of Clinica, this pipeline needs the installation of ANTs and FSL on your computer. You can find how to install these software packages on the installation page.

Running the pipeline

The pipeline can be run with the following command lines depending on the type of magnetic susceptibility correction performed:

clinica run dwi-preprocessing-using-t1 bids_directory caps_directory
clinica run dwi-preprocessing-using-phasediff-fieldmap bids_directory caps_directory

  • bids_directory is the input folder containing the dataset in a BIDS hierarchy.
  • caps_directory is the output folder containing the results in a CAPS hierarchy.

If you want to run the pipeline on a subset of your BIDS dataset, you can use the -tsv flag to specify in a TSV file the participants belonging to your subset.


If your b0 images are not identical to 0 (e.g. 5 or 10, you can check this information by opening your *.bval file), you can use the --low_bval parameter to consider these images as b0s.


Please note that this pipeline will generate many temporary files. It can generate 3-4 GB of data for a dataset with 70 volumes. The more directions you have in the DWI dataset, the bigger the working directory.


Results are stored in the following folder of the CAPS hierarchy: subjects/sub-<participant_label>/ses-<session_label>/dwi/preprocessing.

The main output files are:

  • <source_file>_space-[T1w|b0]_preproc.[bval|bvec|nii.gz]: corrected DWI dataset where the first volume of the dataset is the reference b0.

  • <source_file>_brainmask.nii.gz: brain extracted image based on the reference b0.


If you ran the preprocessing pipeline using the T1-weighted image, your DWI dataset will be registered with the T1w image. Otherwise, your DWI dataset will be registered with the reference b0 image.

Describing this pipeline in your paper

Example of paragraph

These results have been obtained using the dwi-preprocessing pipeline of Clinica. For each subject, all raw DWI volumes were rigidly registered (6 degrees of freedom (dof)) to the reference b0 image (DWI volume with no diffusion sensitization) to correct for head motion. The diffusion weighting directions were appropriately updated [Leemans & Jones, 2009]. An affine registration (12 dof) was then performed between each DWI volume and the reference b0 to correct for eddy current distortions. These registrations were done using the FSL flirt tool (

  • (Preprocessing with a phase difference fieldmap) To correct for echo-planar imaging (EPI) induced susceptibility artifacts, the fieldmap image was used as proposed by [Jezzard and Balaban, 1995] with the FSL prelude/fugue tools.

  • (Preprocessing with a T1-weighted image) To correct for echo-planar imaging (EPI) induced susceptibility artifacts, the skull-stripped b0 images were registered to the T1-weighted image using the ANTs SyN registration algorithm [Avants et al., 2008; Leow et al., 2007]. The resulting deformation fields were then applied to the DWI volumes to align them with the T1 image.

Finally, the DWI volumes were corrected for nonuniform intensity using the ANTs N4 bias correction algorithm [Tustison et al.,, 2010]. A single multiplicative bias field from the reference b0 image was estimated, as suggested in [Jeurissen et al., 2014].


Easily access the papers cited on this page on Zotero.