Fmriprep error: problem with phasediff and magnitude 1 image

Hi all.
I am new to fMRI Prep. I’ve done lots of reading on forums and troubleshooting but can can’t resolve an issue I am having.

I’m trying to run fMRIPrep with singularity on a HPC cluster. I have a single anatomical (T1w) image, a multi-echo multi-slice resting state sequence and fieldmaps (2 magnitude images and a phase diff image). I get a warning immediately in the terminal :

1: [WARN] Each _phasediff.nii[.gz] file should be associated with a _magnitude1.nii[.gz] file. (code: 92 - MISSING_MAGNITUDE1_FILE)
./sub-86202065/fmap/sub-86202065_acq-greph_phasediff.nii.gz

The directory tree for each sub is attached.

Do I need to manually edit the .json file of the phase diff image to associate it with mag 1? I have already manually edited the .json file for the phasediff image to include the 2 echo times associated with mag1 and mag2 respectively.

Thank you,
rebecca

Hi,

I think this warning is linked to the fact that the magnitude1 file and phasediff file don’t have the same name. You could try to name them:
sub-EF20422_acq-gre_magnitude1{.nii.gz,.json} and sub-EF20422_acq-gre_phasediff{.nii.gz,.json} for instance

1 Like

Thank you for our quick reply, I appreciate it. Another question: in the phasediff .json file, should there be an “IntendedFor” field with the paths to each of the 4 resting state images (for the 4 echos)?

First point: which fmriprep version are you using?

Recently, It was recommended to the tags B0FieldIdentifier and B0FieldSource in addition to IntendedFor (more details here: Magnetic Resonance Imaging - Brain Imaging Data Structure v1.7.0).

Yes I think you should populate the json files for both _magnitude1 and _phasediff files with the fields: ÌntendedForandB0FieldIdentifier`. See the example in the example for case 1 in the link I pasted.

I am using fmriprep version 1.4.0

I would encourage you to upgrade to one of the newest version: like 21.0.2 for instance. You can see the list of versions here along with the corresponding changes here: Releases · nipreps/fmriprep · GitHub

Hi,
Me again. Thank you for your help previously with this error. Your advice regarding changing the file names of the magnitude 1 and phase diff images to ensure they were named the same, resolved the error I was getting. I have now encountered another error.

I am using fMRIPrep v 21.0.1 on one subject, and now I am getting this error:

File “/opt/conda/lib/python3.8/site-packages/sdcflows/fieldmaps.py”, line 385, in attrs_post_init
raise ValueError(
ValueError: Only one phase-encoding direction found across sources.

My fmap dir for that subject is attached as screenshot

When I check the meta data (.json) for mag 1 and phase diff images the phase encode direction is listed as “i-”. This is the same for the functional resting state multi-echo multi-band sequence.
However, for the reverse phase images (labeled in the fmap dir as dir-LRecho1_epi.nii.gz (for 1 through 4), the phase encode is “i”.

Question: foes fMRIPrep use both the fieldmaps and reverse phase images for B0 correction? Do I need to alter the phase encode dir as listed in the meta data?

Finally (sanity check): in the .json file for the phase diff I have added IntendedFor and then the path to to functional resting state scans (1-4 as there are 4 echos). Do I also need to add this into the mag 1 (and mag 2) meta data files? If the relative path can be given & my dir structure is
rawdata
-sub-86202065/
-anat
-func
-fmap
how do I specify the path to the rs images in the func dir for the fmap .json files?