Distortion correction errors?




I have been trying to implement fmriprep for preprocessing of my experiments.
Initially there were problems with the distortion correction via TOPUP method, in the pipeline, resulting in bizarre appearing images, even with swapped anterior and posterior directions. The dataset was an angulated one (-45 or 30 degress from the true axial plane). When I tried correction with the TOPUP routine in FSL, everything went well.
I had a hard trying to figure out what went wrong, but recently I tried it on a data that was aligned to the AC-PC line which worked well. I still can’t figure out what was the problem, but presume that it has something to do with the registration, or angulation.
I didn’t know where to start, so I can provide additional details, as probably needed.


Ho-Joon Lee.


Did you double check if your PhaseEncodingDirection values were set correctly? Could you share an example subject from this dataset so we could try to replicate the issue?


Although we are not completley sure whether the directions can change when the image acquisition planes are rotated.
We tried our best, to try to resolve this issues, and we tried several combinations of PhaseEncoding Directions only to make things worse.
We share an example file as requested.
Example file

Thanks in advance, and we really appreciate you having a look at the issue.


Ho-Joon Lee.


I’m running some more tests, but it seems that PhaseEncodingDirection in sub-03_task-rest_bold.json was incorrectly set to “j” instead of “j-”.


I am seeing something unusual after correcting the phase encoding direction (see https://github.com/poldracklab/fmriprep/issues/999). Is this the problem you were referring to in your original post?


Oh, sorry for the mistake. We actually tried different combinations for phase directions, in case we did not properly specify phase encoding directions, but there was no difference.


Yes, I think this is the issue that we ran into.
We used the --no-freesurfer tag, so FLIRT and BBR was used in our case.


Ok to sum up:

  • the correct PhaseEncodingDirection is “j”
  • there is indeed an issue when --no-freesurfer is used: https://github.com/poldracklab/fmriprep/issues/999
  • if you skip the --no-freesurfer flag (therefore use freesurfer) the results look good though due to different coregistration algorithm


Thanks for your help. We would definitely try again without the --no-freesurfer flag.
We would like to share our initial trials, since I have a slight concern regarding this has nothing to do with distortion correction.

The following are the phase encoding directions assigned for each pairs of SE EPI (fmap AP and PA) and the functional fmri (func AP)




The following is fmriprep run without the files and parameters in the json files relevant to topup correction, which aligns quite nicely with the MNI template, although with distortions.


Yes - I don’t believe the failure of coregistration is related to fieldmap correction.

I developed a fix if you would like to test it: https://github.com/poldracklab/fmriprep/pull/1003