ValueError: Fieldmap-less (SyN) estimation was requested, but PhaseEncodingDirection information appears to be absent. fMRIprep v. 22.0.2

Dear all,

We are trying to preprocess our BOLD data with --use-syn-sdc with the update version. The data were collected using GE 3T scanner. Here is the error message:

ValueError: Fieldmap-less (SyN) estimation was requested, but PhaseEncodingDirection information appears to be absent.

Here is our script:

bids_root_dir=bids_test5_fieldmaplessonly
subj=3172101920
nthreads=4
mem=40
container=singularity

fmriprep $bids_root_dir $bids_root_dir/derivatives
participant
–participant-label $subj
–skip-bids-validation
–md-only-boilerplate
–fs-license-file /scratch/g/jgoveas/R01_nii/baseline_mid/bids/license.txt
–fs-no-reconall
–output-spaces MNI152NLin2009cAsym:res-2
–nthreads $nthreads
–mem_mb $mem_mb
–ignore slicetiming
–ignore fieldmaps
–use-syn-sdc
-w fmriprep_work_MID

Here are our data:
anat/
-sub-3172101920_ses-1_T1w.json
-sub-3172101920_ses-1_T1w.nii
func/
-sub-3172101920_ses-1_task-mid1_bold.json
-sub-3172101920_ses-1_task-mid1_bold.nii
-sub-3172101920_ses-1_task-mid2_bold.json
-sub-3172101920_ses-1_task-mid2_bold.nii

We were able to run this successfully using v. 20.2.3. The only difference was that we added --ignore fieldmaps.

Thank you for your help!

Hi,

Do you have PhaseEncodingDirection tag in your sub-XX_ses-1_task-TASK_bold.json files?

Hi and welcome to Neurostars!

@jsein’s suggestion of where to look is indeed correct. I was going to add a few additional pointers:

This flag is not suggested, see more here. I would also not suggest ignoring slicetiming (unless you have a really fast TR or expect lots of motion), but that is a personal preference. You should not need the --ignore fieldmaps flag if you do not have an fmap folder. Are your data otherwise BIDS valid?

Best,
Steven

Hi Jsein,

Thank you for your response. Yep, I have the PhaseEncodingDirection in the bold.json. Do I need to remove it?

Thanks!

Can you print the contents of the json file here?

Hi Steven,

Thanks for your response/suggestions. I will remove the -fs-no-reconall flag. We use MB6 with TR=800ms. I use --ignore fieldmaps because I usually have the fmap (pepolar) folder. But since I can’t get this to run, so I removed the fmap folder to see if the script would run successfully. Unfortunately, the data are not bids validated. I haven’t been able to figure it out but I need to work on it.

Thanks,
Nuttaon

Here is the bold.json

{
“Modality”: “MR”,
“MagneticFieldStrength”: 3,
“ImagingFrequency”: 127.772,
“Manufacturer”: “GE”,
“PulseSequenceName”: “epi”,
“InternalPulseSequenceName”: “EPI”,
“ManufacturersModelName”: “SIGNA Premier”,
“InstitutionName”: “Premier”,
“DeviceSerialNumber”: “00000000FLORIO1X”,
“StationName”: “PREM”,
“BodyPartExamined”: “BRAIN”,
“PatientPosition”: “HFS”,
“ProcedureStepDescription”: “PROJECT”,
“SoftwareVersions”: “27\LX\MR Software release:RX27.0_R03_1850.a”,
“MRAcquisitionType”: “2D”,
“SeriesDescription”: “MB6 T-fMRI 4A (MID) PE1”,
“ProtocolName”: “LAB”,
“ScanningSequence”: “EP\RM”,
“SequenceVariant”: “NONE”,
“ScanOptions”: “SAT_GEMS\EDR_GEMS\MP_GEMS\EPI_GEMS\HYPERBAND_GEMS\PFF\FS”,
“ImageType”: [“ORIGINAL”, “PRIMARY”, “OTHER”],
“SeriesNumber”: 27,
“AcquisitionTime”: “10:20:35.000000”,
“AcquisitionNumber”: 1,
“TriggerDelayTime”: 359840,
“SliceThickness”: 2.4,
“SpacingBetweenSlices”: 2.4,
“SAR”: 0.0729168,
“EchoTime”: 0.03,
“RepetitionTime”: 0.8,
“FlipAngle”: 50,
“PhaseEncodingPolarityGE”: “Unflipped”,
“CoilString”: “RM:32NovaHead2”,
“MultibandAccelerationFactor”: 6,
“PercentPhaseFOV”: 100,
“PercentSampling”: 100,
“AcquisitionMatrixPE”: 90,
“ReconMatrixPE”: 90,
“EffectiveEchoSpacing”: 0.000588944,
“TotalReadoutTime”: 0.052416,
“PixelBandwidth”: 5555.56,
“PhaseEncodingDirection”: “j-”,
“SliceTiming”: [
0,
0.4,
0.08,
0.48,
0.16,
0.56,
0.24,
0.72,
0.32,
0.64,
0,
0.4,
0.08,
0.48,
0.16,
0.56,
0.24,
0.72,
0.32,
0.64,
0,
0.4,
0.08,
0.48,
0.16,
0.56,
0.24,
0.72,
0.32,
0.64,
0,
0.4,
0.08,
0.48,
0.16,
0.56,
0.24,
0.72,
0.32,
0.64,
0,
0.4,
0.08,
0.48,
0.16,
0.56,
0.24,
0.72,
0.32,
0.64,
0,
0.4,
0.08,
0.48,
0.16,
0.56,
0.24,
0.72,
0.32,
0.64 ],
“ImageOrientationPatientDICOM”: [
1,
-0,
0,
-0,
1,
0 ],
“InPlanePhaseEncodingDirectionDICOM”: “COL”,
“ConversionSoftware”: “dcm2niix”,
“ConversionSoftwareVersion”: “v1.0.20210317”
}

Got it. What is your reasoning for opting for fieldmapless if you have pepolar fieldmaps? And what is the output from the BIDS validator? The JSON file looks fine upon first glance, but perhaps there is something wrong that is less apparent.

Here is the output from the BIDS validator.

I’m interested in testing the 3 SDC methods: (1) TOPUP, (2) TOPUP+fieldmapless, and (3) fieldmapless only.

Thank you!

Hi,

I would focus on fixing these errors before retrying fMRIPrep.

Best,
Steven

And just making sure, did you run this on your BIDS root directory (the one that contains the sub-* folders)? It seems strange that you would get that second error.

Hi @Nuttaon , I am surprised by this choicer of comparison:

What do you mean? What I would think would be to use a non-linear registration from bold space T1w space after topup rather than a linear one, the latter being the default in FMRIPREP.

Either way, I don’t know how you could implement this method within FMRIPREP.

Regarding the BIDS validator, as @Steven mentioned please be sure to give to the validator the PATH to your BIDS directory.
Also, I the errors persist, could you show us the tree of your BIDS directory?

i.e:

BIDS-DIRECTORY/
               sub-SUB/
                       ses-SES/
                               {anat/,func/,dwi/,fmap/ ...}
                                            sub-SUB_ses-SES_...

Hi all,

Thank you for your help! I have been working on bids validation. I still have two errors. Here is the tree of my data.

bidstest5/
├── dataset_description.json
├── derivatives
│ └── logs
└── sub-3172101920
└── ses-1
├── anat
│ ├── sub-3172101920_ses-1_FLAIR.json
│ ├── sub-3172101920_ses-1_FLAIR.nii
│ ├── sub-3172101920_ses-1_T1w.json
│ └── sub-3172101920_ses-1_T1w.nii
├── fmap
│ ├── sub-3172101920_ses-1_task-mid1_dir-AP_epi.json
│ ├── sub-3172101920_ses-1_task-mid1_dir-AP_epi.nii
│ ├── sub-3172101920_ses-1_task-mid1_dir-PA_epi.json
│ ├── sub-3172101920_ses-1_task-mid1_dir-PA_epi.nii
│ ├── sub-3172101920_ses-1_task-mid2_dir-AP_epi.json
│ ├── sub-3172101920_ses-1_task-mid2_dir-AP_epi.nii
│ ├── sub-3172101920_ses-1_task-mid2_dir-PA_epi.json
│ └── sub-3172101920_ses-1_task-mid2_dir-PA_epi.nii
└── func
├── sub-3172101920_ses-1_task-mid1_bold.json
├── sub-3172101920_ses-1_task-mid1_bold.nii
├── sub-3172101920_ses-1_task-mid2_bold.json
└── sub-3172101920_ses-1_task-mid2_bold.nii

Here are the error message.



Thank you!

Hi,

You’re almost there!

Fieldmaps should not have the task level. You can use the acq level, e.g. sub-3172101920_ses-1_acq-mid1_dir-AP_epi.json to make it clear that this fieldmap is associated with the mid1 fMRI scan (however, the IntendedFor field of the JSON is what fMRIPrep will use to determine fieldmap associations).

As for the second error, your func JSON files need a TaskName field, e.g. TaskName: mid1.

Best,
Steven

Thank you! My data is finally bid validated.

However, when I ran the following script, I still got the error message " ValueError: Fieldmap-less (SyN) estimation was requested, but PhaseEncodingDirection information appears to be absent."

fmriprep $bids_root_dir $bids_root_dir/derivatives
participant
–participant-label $subj
–md-only-boilerplate
–fs-license-file /license.txt
–fs-no-reconall
–output-spaces MNI152NLin2009cAsym:res-2
–nthreads $nthreads
–mem_mb $mem_mb
–ignore slicetiming
–ignore fieldmaps
–use-syn-sdc
-w fmriprep_work_MID

Please advice. Thank you.

Hi,

What is the full log returned by fMRIPrep? Are you running with Docker/Singularity (recommended) or python? What is the full script you call fMRIPrep in?

Best,
Steven

Hi Steven,

I used Singularity.

Here is the script to call fMRIprep.

#!/bin/bash

#Read the input file list
while read -r input; do
subj=$(basename “$input”)
echo $input
#Place each job in the queue
cat > temp.sh <<EOF
#!/bin/bash
#SBATCH --job-name=Task_$subj
#SBATCH --mail-type=ALL
#SBATCH --mail-user=Email
#SBATCH --ntasks=2
#SBATCH --cpus-per-task=12
#SBATCH --mem-per-cpu=7gbs
#SBATCH --time=01-00:00:00
#SBATCH --output=Out_files/%x-%j.out
#SBATCH --account=GR

settup env

module load singularity
module load fsl/6.0.4
module load python/3.9.1
module load fmriprep/22.0.2
source ~/myPython39venv/bin/activate
python --version
cd /scratch/g/GR1/GR2/Task/PROJECT
chmod 777 ./fmriprep.sh
./fmriprep.sh subj >> Log_files/{subj}.log
EOF

chmod a+wrx temp.sh
sbatch temp.sh
done <"$1"

rm temp.sh

echo ‘All jobs send’

#Show that the job is queued
squeue -u whoami

Here is the fMRIprep.sh
#settup env

#User inputs:
bids_root_dir=/scratch/g/GR1/GR2/Task/PROJECT/bidstest5/
#subj=3172101920
subj=$1
nthreads=4
mem=40 #gb
container=singularity

#Begin:

#Convert virtual memory from gb to mb
mem=echo "${mem//[!0-9]/}" #remove gb at end
mem_mb=echo $(((mem*1000)-5000)) #reduce some memory for buffer space during pre-processing

export FS_LICENSE=license.txt \

fmriprep $bids_root_dir $bids_root_dir/derivatives
participant
–participant-label $subj
–md-only-boilerplate
–fs-license-file /license.txt
–fs-no-reconall
–output-spaces MNI152NLin2009cAsym:res-2
–nthreads $nthreads
–mem_mb $mem_mb
–ignore slicetiming
–ignore fieldmaps
–use-syn-sdc
-w fmriprep_work_MID

The content in the subj_list.txt is
subj-ID

Below is the log output.

==========================================
SLURM_JOB_ID = 478028
SLURM_NODELIST = cn59

Python 3.9.1
Process Process-2:
Traceback (most recent call last):
File “/opt/conda/lib/python3.9/multiprocessing/process.py”, line 315, in _bootstrap
self.run()
File “/opt/conda/lib/python3.9/multiprocessing/process.py”, line 108, in run
self._target(*self._args, **self._kwargs)
File “/opt/conda/lib/python3.9/site-packages/fmriprep/cli/workflow.py”, line 114, in build_workflow
retval[“workflow”] = init_fmriprep_wf()
File “/opt/conda/lib/python3.9/site-packages/fmriprep/workflows/base.py”, line 91, in init_fmriprep_wf
single_subject_wf = init_single_subject_wf(subject_id)
File “/opt/conda/lib/python3.9/site-packages/fmriprep/workflows/base.py”, line 381, in init_single_subject_wf
raise ValueError(message)
ValueError: Fieldmap-less (SyN) estimation was requested, but PhaseEncodingDirection information appears to be absent.

Thanks for your help!
Nuttaon

Hi,

This does not appear to be a singularity command to me. A singularity fmriprep invocation would begin with something like singularity run fmriprep_22.0.2.img $bids_dir $output_dir participant [ARGS]

Hi,

I have set up the singularity but still got the same error.

Here is the new script:
singularity run /scratch/g/GR1/GR2/Task/fmriprep-22.0.2.simg $bids_root_dir $bids_root_dir/derivatives
participant
–participant-label $subj
–skip-bids-validation
–md-only-boilerplate
–fs-license-file /license.txt
–fs-no-reconall
–output-spaces MNI152NLin2009cAsym:res-2
–nthreads $nthreads
–mem_mb $mem_mb
–ignore slicetiming
–ignore fieldmaps
–use-syn-sdc
-w /scratch/g/GR1/GR2/Task/TOPUP_test1

Here is the log output:

SLURM_JOB_ID = 478116
SLURM_NODELIST = cn04

Python 3.9.1
Process Process-2:
Traceback (most recent call last):
File “/opt/conda/lib/python3.9/multiprocessing/process.py”, line 315, in _bootstrap
self.run()
File “/opt/conda/lib/python3.9/multiprocessing/process.py”, line 108, in run
self._target(*self._args, **self._kwargs)
File “/opt/conda/lib/python3.9/site-packages/fmriprep/cli/workflow.py”, line 114, in build_workflow
retval[“workflow”] = init_fmriprep_wf()
File “/opt/conda/lib/python3.9/site-packages/fmriprep/workflows/base.py”, line 91, in init_fmriprep_wf
single_subject_wf = init_single_subject_wf(subject_id)
File “/opt/conda/lib/python3.9/site-packages/fmriprep/workflows/base.py”, line 381, in init_single_subject_wf
raise ValueError(message)
ValueError: Fieldmap-less (SyN) estimation was requested, but PhaseEncodingDirection information appears to be absent.

Thank you.

Hi again,

In your script, it looks like your singularity call does not bound any directory to the singularity container using the -B option). Here is an example of a call I use :

singularity run -B /scratch/jsein/BIDS:/work,$HOME/.templateflow:/opt/templateflow --cleanenv /scratch/jsein/my_images/fmriprep-22.0.2.simg \
		 --fs-license-file /work/freesurfer/license.txt /work/$study /work/$study/derivatives/fmriprep  \
		 participant --participant-label $sub \
		 -w /work/temp_data_${study}\
		 --mem-mb 50000 --omp-nthreads 10 --nthreads 12  \
		 --fd-spike-threshold 0.5 --dvars-spike-threshold 2.0 --bold2t1w-dof 9 --cifti-output 91k   \
		 --output-spaces MNI152NLin2009cAsym MNI152NLin6Asym T1w --ignore slicetiming sbref \
		 --fs-subjects-dir /work/$study/derivatives/fmriprep/sourcedata/freesurfer --debug compcor \
		 --bids-filter-file /work/$study/code/fmriprep/bids-filter.json

I am not sure if it is a problem in your case but other than that everything looks there and I don’t see why this error is still popping up.