Normalizing diffusion images with fmriprep outputs/ANTS

Hi all, I was hoping someone could provide feedback on my attempts to piece together a normalization procedure for diffusion weighted images from a dataset where the functional/structural processing has been done with fmriprep.

My current approach is:

  1. apply subject’s _desc-brain_mask.nii.gz mask to subject’s _desc-preproc_T1w.nii.gz (both produced by fmriprep) to produce brain-only target for the DWI images, which are skull stripped

  2. use antsRegistration to register the mean b0 image (after preprocessing the DWI) to the masked T1w image produced in previous step, thereby generating an affine .mat file

  3. use ResampleImage resample on each subject’s _space-MNI152NLin2009cAsym_desc-preproc_T1w.nii.gz so that the subject’s MNI-warped brain matches the DWI voxel size (thanks to this post for revealing how it is done with func data in fmriprep… I guess that file is cleaned up(?), otherwise I could use it for this step since the DWI and functional data are the same resolution)

  4. use antsApplyTransforms to warp native DWI space stats volumes (e.g. FA; plus mean b0 volume for best comparison) to MNI space, calling both the affine .mat (step 2) file and the from-T1w_to-MNI152NLin2009cAsym_mode-image_xfm.h5 that was saved by fmriprep. The reference image would be the downsampled subject-specific MNI T1 from the previous step since it has subject-specific anatomy vs. the MNI template.

Ideally, the output is a DWI image in MNI space, where the process is informed by the subject’s anatomy and the output is not resampled to structural resolution at any point. I’m not sure if my process makes sense. In testing it out, the results seem to be close but not fully aligned-- e.g. the MNI space b0 DWI image and the downsampled MNI space subject brain are slightly off, esp in the z-dimension. I don’t know what the best options are for either the antsRegistration or the antsApplyTransforms calls, so it’s possible that some of the parameters I chose are limiting the results. Also possible that there’s a better procedure entirely. Would be great to hear if anyone has advice for specific flag values for antsRegistration/antsApplyTransforms or an alternate approach. Many thanks!

Hi @embers,

If you haven’t already processed the DWI data or are open to reprocessing, QSIPrep will output MNI transformations for your DWI images.


Hi, thanks for the suggestion-- have been looking through the QSIPrep docs and will definitely try it out-- also curious to see if this is roughly the normalization procedure there.

For anyone else finding this post, I think my problem was caused by having the affine specified before the MNI warp in the ansApplyTransformations call when they should be reverse ordered (it applies last first).