EPI to T1w registration in fmriprep: Diffeomorphic registration from ANTs?




I’m dealing with small FOV “slab” data and the bbregister approach to the EPI-to-T1w registration does not perform well. I’ve previously used the ANTs SyN-based diffeomorphic registration for these types of tricky issues.

Is it possible to use the diffeomorphic registration with in the fmriprep pipeline? If not, how and where would you recommend running it?

With thanks!


Could you share an example report (with figures) and the ANTs parameters that used to work for you in the past?


Here is the report: https://www.dropbox.com/s/hwoj6xhn36ea6ps/fmriprep.zip?dl=0

You can see strong displacement between the slab EPI and the T1w.

And here’s the ANTs commands I used to run:

########example_func to Whole_Brain_EPI########

bet2 example_func.nii.gz example_func_brain.nii.gz -m -f 0.2

ANTS 3 -m MI[EPI_wholebrain_brain.nii.gz,example_func_brain.nii.gz,1,32] -i 0 -o example_func_brain_2_EPI_wholebrain-

WarpImageMultiTransform 3 example_func_brain.nii.gz example_func_brain_2_EPI_wholebrain.nii.gz -R EPI_wholebrain_brain.nii.gz example_func_brain_2_EPI_wholebrain-Affine.txt

#########EPI_wholebrain_brain to MPRAGE##########

ANTS 3 -m PR[MPRAGE_brain.nii.gz,EPI_wholebrain_brain.nii.gz,1,4] --use-Histogram-Matching --number-of-affine-iterations 10000x10000x10000x10000x10000 --rigid-affine true --affine-gradient-descent-option 0.5x0.95x1.e-4x1.e-4  --MI-option 32x16000 -o EPI_wholebrain_brain_2_MPRAGE- -i 0x0x0 -v -t SyN[0.5]

WarpImageMultiTransform 3 EPI_wholebrain_brain.nii.gz EPI_wholebrain_brain_2_MPRAGE.nii.gz -R MPRAGE_brain.nii.gz EPI_wholebrain_brain_2_MPRAGE-Affine.txt


Thank you for sending the reports. I had a look and I have to say the alignment looks pretty good to me

Could you point out to where the “strong displacement” is and how it is improved when yousing the alternative approach?


The displacement I was referring to was temporal lobe and cerebellum which you can clearly move in the animated fixed/moving visualisation.

I haven’t tried the ANTs approach on this registration, but have in the past where it seemed to do better than bbregister. Do you reckon it would make sense to try a two-step registration with bbregister first and the the diffeomorphic approach?


It would be great if you could share an annotated screenshot so we would be certain we are on the same page.

The SyN based susceptibility correction used in this run of FMRIPREP does already the diffeomorphic realignment of the bold image to contrast matched t1w image. It’s constrained to the phase encoding direction and regions of the brain where such distortions usually happen. In essence we are already combining non linear coregistration with BBR.


Sorry for the delay. Here’s the annotated screenshot. The temporal lobe is moving in and out of alignment.

Is it possible to have a full diffeomorphic realignment that’s not limited to a pre-determined range?


This is not currently supported, but could be added via an additional command line flag if you would be interested in sending a pull request (see https://github.com/poldracklab/fmriprep/blob/master/CONTRIBUTING.md).

Having said that I find this corregistration pretty good and don’t quite understand what do you mean by “the temporal lobe is moving in and out of alignment”…