[fmriprep] fmap "intendedFor" differs from source fieldmap... and relevant issues

Summary of what happened:

Hi all,

I have several questions regarding fieldmaps and distortion correction in fmriprep. I’d first like to report what I’m observing. I ask whether this is intended behaviorl; If not, I’d love to know how to troubleshoot.

  • observation 1: Number of fieldmaps for sourcedata and fmriprep output differ - is this intended behavior?
  • observation 2: Number of fmriprep-generated-fmaps differ from subject to subject
  • observation 3: json IntendedFor field differs between sourcedata and fmriprep

Thank you in advance for your help.

Observation 1: Number of fieldmaps for sourcedata and fmriprep output differ - is this intended behavior?

  • In this example, I grab the same participant, comparing sourcedata vs. fmriprep fmap numbers
  • sourcedata has 2 fieldmaps
  • fmriprep generates 3 fieldmaps for the same sub/session
# source data: {SOURCEDIR}/sub-0061/ses-04/fmap
sub-0061_ses-04_acq-mb8_dir-ap_run-01_epi.json    sub-0061_ses-04_acq-mb8_dir-ap_run-02_epi.nii.gz  sub-0061_ses-04_acq-mb8_dir-pa_run-02_epi.json
sub-0061_ses-04_acq-mb8_dir-ap_run-01_epi.nii.gz  sub-0061_ses-04_acq-mb8_dir-pa_run-01_epi.json    sub-0061_ses-04_acq-mb8_dir-pa_run-02_epi.nii.gz
sub-0061_ses-04_acq-mb8_dir-ap_run-02_epi.json    sub-0061_ses-04_acq-mb8_dir-pa_run-01_epi.nii.gz

# fmriprep data: {FMRIPREPDIR}/sub-0061/ses-04/fmap
sub-0061_ses-04_acq-mb8_fmapid-auto00002_desc-coeff_fieldmap.nii.gz    sub-0061_ses-04_acq-mb8_fmapid-auto00003_desc-preproc_fieldmap.json
sub-0061_ses-04_acq-mb8_fmapid-auto00002_desc-epi_fieldmap.nii.gz      sub-0061_ses-04_acq-mb8_fmapid-auto00003_desc-preproc_fieldmap.nii.gz
sub-0061_ses-04_acq-mb8_fmapid-auto00002_desc-preproc_fieldmap.json    sub-0061_ses-04_acq-mb8_fmapid-auto00004_desc-coeff_fieldmap.nii.gz
sub-0061_ses-04_acq-mb8_fmapid-auto00002_desc-preproc_fieldmap.nii.gz  sub-0061_ses-04_acq-mb8_fmapid-auto00004_desc-epi_fieldmap.nii.gz
sub-0061_ses-04_acq-mb8_fmapid-auto00003_desc-coeff_fieldmap.nii.gz    sub-0061_ses-04_acq-mb8_fmapid-auto00004_desc-preproc_fieldmap.json
sub-0061_ses-04_acq-mb8_fmapid-auto00003_desc-epi_fieldmap.nii.gz      sub-0061_ses-04_acq-mb8_fmapid-auto00004_desc-preproc_fieldmap.nii.gz

Observation 2: Number of fmriprep-generated-fmaps differ from subject to subject

  • In this example, I compare two participants and check fmriprep-generated fieldmap numbers
  • sub-0061 has 3 fieldmaps generated via fmriprep
    • (Note that sub-0061 sourcedata had 2 fieldmaps; listed above in #observation 1)
  • sub-0031 has 2 fieldmaps generated via fmriprep
  • Why do participants have different number of fmriprep-generated fmaps?
# sub-0061 fmriprep generated fmap number: 3
sub-0061_ses-04_acq-mb8_fmapid-auto00002_desc-coeff_fieldmap.nii.gz    sub-0061_ses-04_acq-mb8_fmapid-auto00003_desc-preproc_fieldmap.json
sub-0061_ses-04_acq-mb8_fmapid-auto00002_desc-epi_fieldmap.nii.gz      sub-0061_ses-04_acq-mb8_fmapid-auto00003_desc-preproc_fieldmap.nii.gz
sub-0061_ses-04_acq-mb8_fmapid-auto00002_desc-preproc_fieldmap.json    sub-0061_ses-04_acq-mb8_fmapid-auto00004_desc-coeff_fieldmap.nii.gz
sub-0061_ses-04_acq-mb8_fmapid-auto00002_desc-preproc_fieldmap.nii.gz  sub-0061_ses-04_acq-mb8_fmapid-auto00004_desc-epi_fieldmap.nii.gz
sub-0061_ses-04_acq-mb8_fmapid-auto00003_desc-coeff_fieldmap.nii.gz    sub-0061_ses-04_acq-mb8_fmapid-auto00004_desc-preproc_fieldmap.json
sub-0061_ses-04_acq-mb8_fmapid-auto00003_desc-epi_fieldmap.nii.gz      sub-0061_ses-04_acq-mb8_fmapid-auto00004_desc-preproc_fieldmap.nii.gz

# sub-0031 fmriprep generated fmap number: 2
sub-0031_ses-04_acq-mb8_fmapid-auto00001_desc-coeff_fieldmap.nii.gz    sub-0031_ses-04_acq-mb8_fmapid-auto00002_desc-coeff_fieldmap.nii.gz
sub-0031_ses-04_acq-mb8_fmapid-auto00001_desc-epi_fieldmap.nii.gz      sub-0031_ses-04_acq-mb8_fmapid-auto00002_desc-epi_fieldmap.nii.gz
sub-0031_ses-04_acq-mb8_fmapid-auto00001_desc-preproc_fieldmap.json    sub-0031_ses-04_acq-mb8_fmapid-auto00002_desc-preproc_fieldmap.json
sub-0031_ses-04_acq-mb8_fmapid-auto00001_desc-preproc_fieldmap.nii.gz  sub-0031_ses-04_acq-mb8_fmapid-auto00002_desc-preproc_fieldmap.nii.gz

Observation 3: json IntendedFor field differs between sourcedata and fmriprep

  • In this example, I check the intendedFor fields for sourcedata and fmriprep for an identical sub/ses

Sourcedata json IntendedFor

  • The IntendedFor field in the sourcedata lists all the corresponding runs with identical shim settings. This is automatically populated via Heudiconv
  • Notice that the sourcedata json only includes task A and B, as intended.

fmriprep json Intended For

  • However, fmriprep-generated IntendedFor field includes task A, B, and C (all of the tasks in ses-04)
  • It’s also listing all of the fmaps as RawSources (instead of just one)
# sourcedata fmap json for sub-0061, ses-04 first fieldmap. 
# NOTE: there are two fieldmaps in this specific session
  "IntendedFor": [
    "ses-04/func/sub-0061_ses-04_task-A_acq-mb8_run-01_bold.nii.gz",
    "ses-04/func/sub-0061_ses-04_task-A_acq-mb8_run-02_bold.nii.gz",
    "ses-04/func/sub-0061_ses-04_task-B_acq-mb8_run-01_bold.nii.gz",
    "ses-04/func/sub-0061_ses-04_task-B_acq-mb8_run-02_bold.nii.gz",
    "ses-04/func/sub-0061_ses-04_task-B_acq-mb8_run-03_bold.nii.gz",
    "ses-04/func/sub-0061_ses-04_task-B_acq-mb8_run-04_bold.nii.gz",
    "ses-04/func/sub-0061_ses-04_task-B_acq-mb8_run-05_bold.nii.gz",
    "ses-04/func/sub-0061_ses-04_task-B_acq-mb8_run-06_bold.nii.gz"
],...

# fmriprep fmap json
{
  "AnatomicalReference": "sub-0061_ses-04_acq-mb8_fmapid-auto00002_desc-epi_fieldmap.nii.gz",
  "AssociatedCoefficients": [
    "sub-0061_ses-04_acq-mb8_fmapid-auto00002_desc-coeff_fieldmap.nii.gz"
  ],
  "B0FieldIdentifier": "auto_00002",
  "IntendedFor": [
    "ses-04/func/sub-0061_ses-04_task-C_acq-mb8_run-01_bold.nii.gz",
    "ses-04/func/sub-0061_ses-04_task-C_acq-mb8_run-02_bold.nii.gz",
    "ses-04/func/sub-0061_ses-04_task-A_acq-mb8_run-01_bold.nii.gz",
    "ses-04/func/sub-0061_ses-04_task-A_acq-mb8_run-02_bold.nii.gz",
    "ses-04/func/sub-0061_ses-04_task-B_acq-mb8_run-01_bold.nii.gz",
    "ses-04/func/sub-0061_ses-04_task-B_acq-mb8_run-02_bold.nii.gz",
    "ses-04/func/sub-0061_ses-04_task-B_acq-mb8_run-03_bold.nii.gz",
    "ses-04/func/sub-0061_ses-04_task-B_acq-mb8_run-04_bold.nii.gz",
    "ses-04/func/sub-0061_ses-04_task-B_acq-mb8_run-05_bold.nii.gz",
    "ses-04/func/sub-0061_ses-04_task-B_acq-mb8_run-06_bold.nii.gz"
  ],
  "RawSources": [
    "/bids/sub-0061/ses-04/fmap/sub-0061_ses-04_acq-mb8_dir-ap_run-01_epi.nii.gz",
    "/bids/sub-0061/ses-04/fmap/sub-0061_ses-04_acq-mb8_dir-ap_run-02_epi.nii.gz",
    "/bids/sub-0061/ses-04/fmap/sub-0061_ses-04_acq-mb8_dir-pa_run-01_epi.nii.gz",
    "/bids/sub-0061/ses-04/fmap/sub-0061_ses-04_acq-mb8_dir-pa_run-02_epi.nii.gz"
  ],
  "Units": "Hz"
}
sub-0061_ses-04_acq-mb8_fmapid-auto00002_desc-preproc_fieldmap.json (END)

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

singularity run \
  --cleanenv \
  -B "${DCS}":/main \
  -B "${BIDS}":/bids \
  -B "${OUT}":/out \
  -B "${WORK}":/scratch \
  -B "${ANAT}":/anat \
  /users/${USER}/fmriprep_21.0.2.sif \
  /bids /out/fmriprep participant -w /scratch \
  "${flags[@]}"  \
  --notrack -vv --cifti-output 91k \
  --mem_mb 252000 --nprocs 56 --fs-subjects-dir /anat/sourcedata/freesurfer \
  --fs-license-file /main/fmriprep/tools/license.txt \
  --skip-bids-validation \
  --random-seed 2022 --skull-strip-fixed-seed \
  --bids-database-dir /main/inputs/bids_db 

Version:

fmriprep 21.0.2

Environment (Docker, Singularity, custom installation):

Singularity

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

Relevant log outputs (up to 20 lines):

Screenshots / relevant information:

Here’s my scanner sequence. Hope this helps to see the order of runs in relation to the fieldmaps

anat-scout_ses-04
fmap-epi_dir-ap_acq-mb8_run-01
fmap-epi_dir-pa_acq-mb8_run-01
func_run-01_task-A_acq-ap-mb8
func_run-02_task-A_acq-ap-mb8
func_run-01_task-B_acq-ap-mb8
func_run-02_task-B_acq-ap-mb8
func_run-03_task-B_acq-ap-mb8
func_run-04_task-B_acq-ap-mb8
func_run-05_task-B_acq-ap-mb8
func_run-06_task-B_acq-ap-mb8
anat-scout_ses-04
fmap-epi_dir-ap_acq-mb8_run-02
fmap-epi_dir-pa_acq-mb8_run-02
func_run-01_task-C_acq-ap-mb8
func_run-02_task-C_acq-ap-mb8
1 Like

Hi,

Is your dataset BIDS-valid? (according to the BIDS validator?)

Thank you for the question and apologies for the late response.
The dataset is BIDS-valid, but we skipped BIDS validator when running fmriprep, due to cluster performance reasons.

Curious to hear you thoughts on our pattern of fieldmaps!

@jsein Hello! I’d like to bump this message; two other members of the lab have observed this issue, too. What would be the best way to get help?