Fieldmap correction gone wrong

Summary of what happened:

I am running fmriprep on my data with fieldmap (2 magnitude images + 1 phase diff image). The output image looks weird, and very distorted. Any idea on possible reason?

Command used (and if a helper script was used, a link to the helper script or the command generated):

export SINGULARITYENV_TEMPLATEFLOW_HOME=/home/fmriprep/.cache/templateflow
/usr/bin/singularity run \
    --contain \
    --cleanenv \
    -B /tmp -B /data -B /data1 -B /data2 -B /data3 -B /n -B /cm/shared -B /data/fmriprep-workdir \
    /cm/shared/singularity/images/fmriprep-23.0-latest.simg \
    /data/achowdhury/Regret/derivatives \
    /data/achowdhury/Regret/fmriprepoutput \
    participant \
    --fs-license-file /cm/shared/freesurfer-license.txt \
    --participant_label 02 \
    --output-spaces MNI152NLin2009cAsym:res-2 anat func fsaverage \
    --n_cpus 4 \
    --mem-mb 8192 \
    --notrack \
    --dummy-scans 8 \
    --use-aroma \
    --skip-bids-validation \
    --fs-no-reconall \
    -vv \
    -w  /data/fmriprep-workdir/achowdhury

Version:

fmriprep version number. Default: 23.0-latest

Environment (Docker, Singularity, custom installation):

Singularity on a computing cluster

Data formatted according to a validatable standard? Please provide the output of the validator:

ExperimentalWarning: The fs.promises API is experimental
	1: [WARN] Task scans should have a corresponding events.tsv file. If this is a resting state scan you can ignore this warning or rename the task to include the word "rest". (code: 25 - EVENTS_TSV_MISSING)
		./sub-01/func/sub-01_task-regret_run-01_bold.nii.gz
		./sub-02/func/sub-02_task-regret_run-01_bold.nii.gz
		./sub-03/func/sub-03_task-regret_run-01_bold.nii.gz
		./sub-04/func/sub-04_task-regret_run-01_bold.nii.gz
		./sub-05/func/sub-05_task-regret_run-01_bold.nii.gz
		./sub-06/func/sub-06_task-regret_run-01_bold.nii.gz
		./sub-07/func/sub-07_task-regret_run-01_bold.nii.gz
		./sub-08/func/sub-08_task-regret_run-01_bold.nii.gz
		./sub-09/func/sub-09_task-regret_run-01_bold.nii.gz
		./sub-10/func/sub-10_task-regret_run-01_bold.nii.gz
		... and 28 more files having this issue (Use --verbose to see them all).

	Please visit https://neurostars.org/search?q=EVENTS_TSV_MISSING for existing conversations about this issue.

	2: [WARN] Not all subjects/sessions/runs have the same scanning parameters. (code: 39 - INCONSISTENT_PARAMETERS)
		./sub-01/func/sub-01_task-regret_run-01_bold.nii.gz
		./sub-02/func/sub-02_task-regret_run-01_bold.nii.gz
		./sub-03/func/sub-03_task-regret_run-01_bold.nii.gz
		./sub-04/func/sub-04_task-regret_run-01_bold.nii.gz
		./sub-06/func/sub-06_task-regret_run-01_bold.nii.gz
		./sub-07/func/sub-07_task-regret_run-01_bold.nii.gz
		./sub-08/func/sub-08_task-regret_run-01_bold.nii.gz
		./sub-09/func/sub-09_task-regret_run-01_bold.nii.gz
		./sub-12/func/sub-12_task-regret_run-01_bold.nii.gz
		./sub-13/func/sub-13_task-regret_run-01_bold.nii.gz
		... and 23 more files having this issue (Use --verbose to see them all).

	Please visit https://neurostars.org/search?q=INCONSISTENT_PARAMETERS for existing conversations about this issue.

	3: [WARN] The recommended file /README is missing. See Section 03 (Modality agnostic files) of the BIDS specification. (code: 101 - README_FILE_MISSING)

	Please visit https://neurostars.org/search?q=README_FILE_MISSING for existing conversations about this issue.

	4: [WARN] The Authors field of dataset_description.json should contain an array of fields - with one author per field. This was triggered based on the presence of only one author field. Please ignore if all contributors are already properly listed. (code: 102 - TOO_FEW_AUTHORS)

Relevant log outputs (up to 20 lines):

Screenshots / relevant information:

I do not have a pic of the erroneous outputs at this moment as I gave deleted them but I can try to upload them later. In any case,
I am attaching the BOLD file and fieldmap:

Thanks in advance.

Hi @e0046902,

I have relabeled your post as Software Support and added the corresponding post template, please fill in the other requested information by editing your so we an best help. Also, in the Screenshots section, please post the SDC images from the HTML report.

Best,
Steven

hi @Steven @Chris_Rorden, thank you. I have populated the related fields in the form, except the picture of the output from preprocessing. I deleted that previously but should be able to upload it later. Otherwise, I have provided all required information.

Thank you very much for your help!

Maybe this thread can enlighten you?

Hi @jsein @Steven,

I tried skull-stripping only the phasediff image before feeding it into fmriprep, and the output is still very distorted:

image

Indeed, I looked at your dataset and tried fmriprep v23 vs fmriprep v20.2.6 on your raw data and the difference is dramatic:

Référence image, not corrected for SDC:

Référence SDC-corrected: fmriprep v20.2.6:

Référence SDC-corrected: fmriprep v23:

Note 1: The difference of contrast in image for correction version of v20.2.6 vs v23 is that in fmriprep v20.2.6, I used the SBref image as reference, whereas for fmriprep v23, I ignored the SBref.

Note 2: In fact in fmriprep v23, I did not proved a masked 'phasediffimage but the phasediff`image was well masked when I looked at it in the working directory. The issue seems to be coming in the creation of the field coefficient, with B-Spline functions. Here is the look at the fieldmap applied for fmriprep v23:

@jsein Thanks.

So would it be right to say fmriprep v23 is not suitable for use with magnitude+phasediff fieldmap correction?

I’m having what looks like the same issue. Used fMRIPrep v23 and got “corrected” BOLD images that look quite distorted in posterior areas around the occipital lobe:

Any new info on this issue?

Please try fmriprep v23.0.2 where a fix may have solved this issue:

Thanks @jsein, and apologies for not being more clear. I did use the latest version:
About
fMRIPrep version: 23.0.2
fMRIPrep command: /opt/conda/bin/fmriprep /home/cmccabe/data/NTR/data/NTR0019_bids /home/cmccabe/data/NTR/data/work participant --participant-label NTR0019 --fs-license-file /home/wgraves/software/freesurfer/license.txt
Date preprocessed: 2023-05-04 09:30:50 -0400

Happy to try other stuff though!

Thank you @wwgraves for sharing this example of SDC going wrong with fmriprep v 23.0.2! Do you confirm that the SDC correction method used in your case by fmriprep v23.0.2 is the “phase difference” case?

May you try with fmriprep v20.2.7 and confirm that the SDC correction is still much better with this earlier version?

Yes, as far as I know it’s a “phase difference” case. I used the field map sequence that came with our Siemens Prisma. Using dcm2bids output two magnitude images, and one phase image, where the phase image had two echo times. That’s why I assume it’s a phase difference map. Please let me know if there’s a better way to verify.
I’m running fMRIPrep v20.2.7 now. I’ll post here once I’ve gotten a chance to take a look at the results!

Indeed, what you report sounds exactly like the the phase difference method for SDC.

Yes @jsein, it turns out changing only the fMRIPrep version to 20.2.7 led to WAY better distortion correction:

In light of this, I’ll be interested to hear what developers think about next steps.

1 Like

@jsein @Steven Replying to confirm that phasediff fieldmap correction is still providing incorrect distortion correction in the latest fmriprep versions. Only version 20.2.7 seems to work with phasediff fieldmap input.

1 Like

@wwgraves @jsein @Steven So far only solution seems to be to convert the phasediff + magnitude fieldmap into a rad/s fieldmap (and appropriately name it as per direct fieldmap under BIDS convention) before feeding it to fmriprep.

Instructions on how to create a rad/s fieldmap are found in the FSL website: FUGUE/Guide - FslWiki

2 Likes

Dear all,

after updating fmriprep to version 23.1.3 we unfortunately have encountered similar problems. We acquired our fieldmaps also at a Siemens MAGNETOM Prisma Scanner, and used two magnitude and the phasediff images for fieldmap correction.

Resulting fieldmaps using fmriprep version 23.1.3:

These fieldmaps then resulted also in heavily distorted func images, like shown in the post above. These problems did not occure when using fmriprep version 20.2.1. Our current workaround is therefore to simply use fmriprep 20.2.1 for this project, but we would be also highly interested in using newer versions of fmriprep in the future for our projects. Would very much apprecite any help or official fix for this problem!

Best
Simon

Hi Simon,

The cause of these failures was identified and the fix will be released in the next version (23.2).

Best,
Chris

4 Likes

Note to readers of this thread that 23.2.0a1 is out, which is a pre-release. It is “feature complete”, in that everything we intend to have in 23.2.0 is in it, but we want to give some time for people to run tests and catch bugs before we make it the obvious latest release. If you had any of the issues described here, we would love to hear from you about how it runs.

1 Like

Actually, before everybody’s off to the races, please wait on 23.2.0a2, which should be out by tomorrow morning. @Steven found a bug that will affect anybody using T2w images and we’re fixing it ASAP.

2 Likes