fMRIPrep Not Reading Field Maps

Summary of what happened:

We are trying to run fMRIPrep and having some difficulty with field maps (direction: PA) being read by our fMRI Prep script (see below). We have 5 different runs of the task (rest, task 1, rest, task 2, rest), so we also have a bids_filtering script for each run. Ideally, we would like to have one script running fMRIPrep with all of these 5 runs with their specific field map, but first we are trying to just start with the field maps working for 1 run.

Command used:

fMRIPrep Command:
for s in $(cat ${ROOTDIR}/MRI/subject_list.txt) ; do if [[ ! -d ${OUTDIR}/derivatives/fmriprep_rest_run1/${s} ]] ; then echo "let \"rnd = ${RANDOM} % 300\" ; sleep \${rnd} ; \ export TMPDIR=/lscratch/\${SLURM_JOBID} ; \ mkdir -p \${TMPDIR}/${s}.out \${TMPDIR}/${s}.wrk ; \ fmriprep ${ROOTDIR}/MRI/rawdata \${TMPDIR}/${s}.out participant --participant_label ${s} -w \${TMPDIR}/${s}.wrk --output-space MNI152NLin6Asym:res-2 T1w fsnative fsaverage fsaverage5 --nthreads 1 --omp-nthreads 1 --bids-filter-file ${ROOTDIR}/code/bids_filter_rest_run1.json --skip_bids_validation --notrack --dummy-scan 4; \ mkdir -p ${OUTDIR}/derivatives/fmriprep_rest_run1 ; \ rsync -a \${TMPDIR}/${s}.out/ ${OUTDIR}/derivatives/fmriprep_rest_run1 ; \ rm -rf \${TMPDIR}/${s}.out \${TMPDIR}/${s}.wrk " >> ${SWARMFILE} fi done

Bids_Filter_Rest_1:

{
  "bold": {
    "datatype": "func",
    "task": ["movie"], 
    "session": ["1"],
    "run": ["1"],
    "suffix": "bold"
  },
  "fmap": {
    "datatype": "fmap",
    "direction": ["PA"],
    "run": ["1"]
  }
}

Sample fmap file name:

sub-12345_ses-1_dir-opposite_run-1_epi.nii.gz

Version:

fMRIPrep 25.1.3

Hi @purnimaq and welcome to neurostars!

In the future please provide the full software template (for example, I see you deleted the part that asks for the BIDS validation report, which would be helpful here). Please also format code using tickmarks (or the </> button in the text editor). You can see I edited your code for you this time.

This is not a valid name. The dir-<> label normally takes values of AP/PA/SI/IS/LR/RL (depending on your phase encoding direction).

This will mean it will look for dir-PA in the filename.

You will also need to confirm the IntendedFor and/or B0FieldSource/Identifier metadata are filled out properly.

I also recommend to use a container (e.g., Docker/Singularity/Apptainer) to run these software.

Additionally, single-threaded code will run very slowly, did you mean to do that?

Best,
Steven

Hi Steven,

Thanks so much for your help here! Will keep the formatting requirements in mind moving forward.

We used your suggestions and now have fMRIPrep running with our PA field map. However, while it is running it is not applying the field map. Our output does not include a ‘no fmap detected’ line.

We only have a PA field map, not a AP and a PA, and so we are wondering if that is the issue here. Is it possible to run fMRIPrep with just a PA distortion correction, or do we need both PA and AP? If a singular distortion correction is possible, is there anything specific we need to put in to have them be applied? Thank you!

All the best,
Purnima

Hi @purnimaq,

I believe fMRI (unlike DWI) requires both AP/PA B0 epis to create the fieldmap (that is, the run itself cannot be used as one of the references). Confirmation that you set up your IntendedFor / B0Field metadata would help though.

If you do not have sufficient data create the fmap, I would instead recommend SynBOLD-DisCo to create a synthetic fieldmap.

Best,
Steven