Skip to main content

DWIPrep: A Robust Preprocessing Pipeline for dMRI Data

This pipeline is being developed and maintaing Yaniv Assaf's lab at Tel Aviv University, as an open-source tool for preprocessing of dMRI data.

DWIPrep is a diffusion magnetic resonance image (dMRI) data preprocessing pipeline that is designed to provide an easily accessible, robust and dynamic interface, allowing basic pre-processing for both within-subject (plasticity) and between-subjects datasets, envolving a wide variety of dMRI scan acquisitions.
The dMRIPrep pipeline uses a combination of tools from well-known software packages, including FSL, MRtrix3, SPM and CAT12. This pipeline was designed to provide a potentially best preprocessing pipeline for a wide range of dMRI data acquisition parameters, and will be updated as new neuroimaging software become available.

This tool allows you to easily do the following:

  • Preprocess a wide variety of dMRI data, from raw NIfTI (structured to follow the BIDS format) to fully preprocessed form.
  • Account for specific preprocessing procedures that are crucial of analyzing plasticity (i.e, within-subjects) datasets.
  • Automate processing steps.

Preprocessing (including demonstrations):

  1. Extraction of opposite phase-encoding DWI's B0 volumes for later Susceptability Distortions Correction (SDC).

  2. Motion & Susceptability Distortions Correction (SDC) using FSL's topup1 and Eddy2, as implemented via MRTrix3's dwifslpreproc3. Note that the pipeline assumes opposite phase encoding directions, as it was found to be optimal for SDC4.

    Figure 1: AP and PA represent the opposite, uncorrected, B0 volumes - extracted from opposite phase-encoded DWIs, "corrected" stands for post-SDC implementation of dwifslpreproc.

  3. B1 field inhomogeneity correction for a DWI volume series, using the N4 algorithm as provided in ANTs* (N4BiasFieldCorrection)5, as implemented in MRTtrix3's dwibiascorrect3.

* In case ANTs is not installed in user's computer, the pipeline will use FSL's fast algorithm6,7, which is discouraged due to its dependency on DWI's brain masking.


Estimation of diffusion (kurtosis) tensor & tensor-derived parameters

Following the preprocessing of DWI data, the pipeline automatically estimates several, widely used, tensor-derived parameters:

  1. Estimation of diffusion tensor using MRTrix3 tensor2metric implementation of the Weighted Linear Least Squares estimation of diffusion MRI parameters8.
  2. Generation of tensor-derived parameters maps9,10


Registration pipeline

Longitudinal (Multi-sessions)

To account for registration-induced biases, we've implemented a within-subject (i.e, between-sessions) registration pipeline, before normalizing subject's data into standard space. This implementation includes the following steps:

  1. Registration of subject’s first session ("pre") b0 to it’s second one (“post”) b0 and vice versa (post's b0 to pre's b0), using FSL’s flirt11,12, with a mutual information cost function.
  2. Calculation of forward and backward halfway transformation matrices (pre to post and post to pre, accordingly) using FSL’s avscle.
  3. Applying halfway transformation to both sessions’ b0 (forward to pre, backward to post), registrating them into subject's "middle" space.
  4. Calculating subject’s average (between sessions) b0, as the average of both coregistered b0s.

5. Same procedure is applied to register (between-sessions) subjects’ anatomical (T1) images.

Co-registrations and Normalization

Note that all registerations procedures denoted below, when performed on a longitudinal dataset, do so for the within-subject (between-sessions) registered images.

Coregistration (DWI to T1)

Coregistration, in this case, refers to the registration of images of different modalities (i.e DWI, T1, etc.) of the same subject. Coregisteration is performed using FSL's epi_reg script, performing appropriate linear registration between subject's B0 and T1 images.

Normalization

By default, the normalization procedure conducted as part of this pipeline makes use of the Computational Anatomy Toolbox (CAT) for SPM. Since it requires MATLAB and SPM to be installed, the pipeline will resort to using FSL's fsl_anat script.

CAT12

CAT12 is a structural preprocessing tool offered as an addition to the Statistical Parametric Mapping (SPM) toolbox. It offers robust spatial normalization algorithms, as well as a Quality Assurance (QA) score regarding the structural image being processed, for example:

fsl_anat

In case the user doesn't have MATLAB/SPM/CAT12 installed, the pipeline will resort to performing the spatial normalization using FSL's fsl_anat, which includes the following:

  1. Reorientation to standard (MNI) orientation using fslreorient2std.
  2. Automatically cropping the image using robustfov.
  3. Bias-field correction (RF/B1-inhomogeneity-correction) using FAST.
  4. Registration to standard space (linear and nonlinear) using FLIRT and FNIRT.
  5. Brain extraction (FNIRT-based)
  6. Tissue-type segmentation using FAST.
  7. Subcortical structure segmentation using FIRST. A summarized presentation of the anatomical preprocessing conducted via fsl_anat:

Inverse registration

Following the "forward" registration (i.e, from subject to average space), and only if a parcellation atlas in MNI space is given as input for the pipeline, a "backward" registration (i.e from MNI to native space) is performed to transform the parcellation atlas into subject's space. Note that this behaviour is promoted due to our agenda to promote region-based analyses (RBA), as described in our paper13 (under review). For example, a reverse registration performed on the Brainnetome parcellation atlas14:


References

  1. Andersson, J. L., Skare, S., & Ashburner, J. (2003). How to correct susceptibility distortions in spin-echo echo-planar images: application to diffusion tensor imaging. Neuroimage, 20(2), 870-888.
  2. Andersson, J. L., & Sotiropoulos, S. N. (2016). An integrated approach to correction for off-resonance effects and subject movement in diffusion MR imaging. Neuroimage, 125, 1063-1078.
  3. Tournier, J. D., Smith, R., Raffelt, D., Tabbara, R., Dhollander, T., Pietsch, M., ... & Connelly, A. (2019). MRtrix3: A fast, flexible and open software framework for medical image processing and visualisation. NeuroImage, 202, 116137.
  4. Gu, X., & Eklund, A. (2019). Evaluation of six phase encoding based susceptibility distortion correction methods for diffusion MRI. Frontiers in neuroinformatics, 13, 76.
  5. Tustison, N. J., Avants, B. B., Cook, P. A., Zheng, Y., Egan, A., Yushkevich, P. A., & Gee, J. C. (2010). N4ITK: improved N3 bias correction. IEEE transactions on medical imaging, 29(6), 1310-1320.
  6. Zhang, Y.; Brady, M. & Smith, S. Segmentation of brain MR images through a hidden Markov random field model and the expectation-maximization algorithm. IEEE Transactions on Medical Imaging, 2001, 20, 45-57
  7. Smith, S. M.; Jenkinson, M.; Woolrich, M. W.; Beckmann, C. F.; Behrens, T. E.; Johansen-Berg, H.; Bannister, P. R.; De Luca, M.; Drobnjak, I.; Flitney, D. E.; Niazy, R. K.; Saunders, J.; Vickers, J.; Zhang, Y.; De Stefano, N.; Brady, J. M. & Matthews, P. M. Advances in functional and structural MR image analysis and implementation as FSL. NeuroImage, 2004, 23, S208-S219
  8. Veraart, J.; Sijbers, J.; Sunaert, S.; Leemans, A. & Jeurissen, B. Weighted linear least squares estimation of diffusion MRI parameters: strengths, limitations, and pitfalls. NeuroImage, 2013, 81, 335-346
  9. Basser, P. J.; Mattiello, J. & Lebihan, D. MR diffusion tensor spectroscopy and imaging. Biophysical Journal, 1994, 66, 259-267
  10. Westin, C. F.; Peled, S.; Gudbjartsson, H.; Kikinis, R. & Jolesz, F. A. Geometrical diffusion measures for MRI from tensor basis analysis. Proc Intl Soc Mag Reson Med, 1997, 5, 1742
  11. Jenkinson, M., Bannister, P., Brady, M., Smith, S., 2002. Improved optimization for the robust and accurate linear registration and motion correction of brain images. Neuroimage 17, 825-841.
  12. Jenkinson, M., Smith, S., 2001. A global optimisation method for robust affine registration of brain images. Med Image Anal 5, 143-156.
  13. Ben-Zvi, G., Hofstetter, S., Tavor, I. & Assaf, Y. (2021). Measuring neuroplasticity with diffusion MRI: experimental considerations. (under review)
  14. Fan, L., Li, H., Zhuo, J., Zhang, Y., Wang, J., Chen, L., ... & Jiang, T. (2016). The human brainnetome atlas: a new brain atlas based on connectional architecture. Cerebral cortex, 26(8), 3508-3526.

Metadata

Release files for dwiprep 0.1.5

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for dwiprep 0.1.5
File Size Uploaded
dwiprep-0.1.5.tar.gz 39.0 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for dwiprep 0.1.5
File Interpreter ABI Platform
dwiprep-0.1.5-py3-none-any.whl Python 3 none any Details

Total release size: 77.3 kB

Release files / dwiprep-0.1.5.tar.gz

Download URL dwiprep-0.1.5.tar.gz
Size 39.0 kB
Tags Source
SHA-256 checksum
How to use checksums
43800f4dcc663c6eceae1b643347711c4d7d0543a2602e69faf3dbe49ce92166
BLAKE2b-256 checksum
How to use checksums
56224282b09e1399cd6dd1c0b03d6998290a34d26e5e6956a72c9d98d4962b64
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.4.2 importlib_metadata/4.0.1 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.60.0 CPython/3.8.10

Release files / dwiprep-0.1.5-py3-none-any.whl

Download URL dwiprep-0.1.5-py3-none-any.whl
Size 38.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
5654da301634df38165f758073554c5133e22091afc4e9ab5fda12d3e9e3fe3e
BLAKE2b-256 checksum
How to use checksums
a76192cc71aa89db6dd1993e3a01b72203c20aba8ce8ac301c6759f202884834
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.4.2 importlib_metadata/4.0.1 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.60.0 CPython/3.8.10

Release history Release notifications | RSS feed

This release

0.1.5 This release

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page