[fmriprep & dcm2bids] fieldmap(SDC) and multiple runs(func)

Summary of what happened:

I have magnitude1, magnitude2, and phasediff fieldmaps. For the functional files, there are 2 runs of resting-state.
I am using dcm2bids and fMRIPrep, and running with the following config file does enable SDC in fMRIPrep.

However, I am curious if I have configured the config file correctly.

1. Did I correctly include “IntendedFor”, “B0FieldIdentifier”, and “B0FieldSource”?

Below is an excerpt from the current config file.

  • resting
    “id”: “id_task-rest”,
    “datatype”: “func”,
    “B0FieldSource”: [“phasediff_fmap0”, “mag1_fmap0”, “mag2_fmap0”]

  • fieldmap - magnitude1
    “datatype”: “fmap”,
    “sidecar_changes”: {
    “IntendedFor”: “id_task-rest”,
    “B0FieldIdentifier”: “mag1_fmap0”
    }

  • fieldmap - magnitude2
    “datatype”: “fmap”,
    “sidecar_changes”: {
    “IntendedFor”: “id_task-rest”,
    “B0FieldIdentifier”: “mag2_fmap0”
    }

  • fieldmap - phasediff
    “datatype”: “fmap”,
    “sidecar_changes”: {
    “IntendedFor”: “id_task-rest”,
    “B0FieldIdentifier”: “phasediff_fmap0”
    }

2. When there are multiple runs (2 runs) in resting-state fmri, do I need to specify each run in the config file? With the current config file (not specifying each run), multiple run files (01, 02) are automatically created in the BIDS format.

3. When running dcm2bids with the following config file, only run-01(in resting fmri) is specified in the “IntendedFor” field in the fmap folder’s JSON file. Can I make it automatically specify both runs (run-01 and run-02) using the dcm2bids config file?

e.g.

  • Curruent output: "IntendedFor": "bids::sub-037\\ses-1\\func\\sub-037_ses-1_task-rest_run-01_bold.nii"
  • Desired output: "IntendedFor": "bids::sub-037\\ses-1\\func\\sub-037_ses-1_task-rest_run-01_bold.nii", "bids::sub-037\\ses-1\\func\\sub-037_ses-1_task-rest_run-02_bold.nii"

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

fmriprep-docker D:/test2 D:/test2/derivatives participant --fs-license-file D:/freesurfer.txt

Version:

fMRIPrep v23.2.3
Dcm2bidsVersion: 3.1.1

Environment (Docker, Singularity / Apptainer, custom installation):

dcm2bids(anaconda)
fmriprep-docker

Screenshots / relevant information:

current entire config file (for dcm2bids)

{
  "dcm2niixOptions": "-ba n",
  "descriptions": [
    {
      "datatype": "anat",
      "suffix": "T1w",
      "criteria": {
        "SeriesDescription": "t1*",
        "EchoTime": 0.00236,
        "RepetitionTime": 2.3
      },
      "sidecar_changes": {
        "ProtocolName": "T1"
      }
    },
    {
      "datatype": "anat",
      "suffix": "T2w",
      "criteria": {
        "SeriesDescription": "t2*",
        "EchoTime": 0.093,
        "RepetitionTime": 9
      },
      "sidecar_changes": {
        "ProtocolName": "T2"
      }
    },
    {
      "id": "id_task-rest",
      "datatype": "func",
      "suffix": "bold",
      "custom_entities": "task-rest",
      "criteria": {
        "EchoTime": 0.03,
        "RepetitionTime": 2
      },
      "sidecar_changes": {
        "TaskName": "rest",
        "B0FieldSource": ["phasediff_fmap0", "mag1_fmap0", "mag2_fmap0"]
      }
    },
    {
      "datatype": "fmap",
      "suffix": "magnitude1",
      "criteria": {
        "ProtocolName": "field_map",
        "EchoTime": 0.00492
      },
      "sidecar_changes": {
        "IntendedFor": ["id_task-rest"],
        "B0FieldIdentifier": "mag1_fmap0"
      }
    },
    {
      "datatype": "fmap",
      "suffix": "magnitude2",
      "criteria": {
        "ProtocolName": "field_map",
        "EchoTime": 0.00738,
        "ImageType": ["ORIGINAL", "PRIMARY", "M", "ND"]
      },
      "sidecar_changes": {
        "IntendedFor": "id_task-rest",
        "B0FieldIdentifier": "mag2_fmap0"
      }
    },
    {
      "datatype": "fmap",
      "suffix": "phasediff",
      "criteria": {
        "ProtocolName": "field_map",
        "EchoTime": 0.00738,
        "ImageType": ["ORIGINAL", "PRIMARY", "P", "ND", "PHASE"]
      },
      "sidecar_changes": {
        "IntendedFor": ["id_task-rest"],
        "B0FieldIdentifier": "phasediff_fmap0"
      }
    }
  ]
}

I have the following information:

  • When setting the “IntendedFor” using dcm2bids, it is inputted as a BIDS URL. This does not work with fMRIPrep.
  • For fieldmap correction (SDC), a pair of BOLD file and fieldmap file is used. In this case, instead of “IntendedFor” in the JSON file, “B0FieldIdentifier” and “B0FieldSource” are used. Currently, it is recommended to use both “IntendedFor” and “B0FieldIdentifier” according to BIDS documentation.

Hi @jj0012345,

Everything you set looks correct. I think it’s a bug in dcm2bids that the IntendedFor isn’t propagating above run-1 if multiple BOLD files fit a criteria.

That being said, when both B0FieldSource/Identified and IntendedFor are present, fmriprep will go with B0FieldSource, so as long as that is making the pairings you expect, you should be good to go.

Best,
Steven

Thank you for your quick reply!

These should all be “B0FieldIdentifier”: “fmap0”. By making them different, you are indicating that these files contribute to distinct B0Field estimates. You want to make them the same to indicate that these files are all needed to create one field estimate.

Thank you for your reply.
So can I do it like this? b0FieldSource also changed.

  • resting
    “id”: “id_task-rest”,
    “datatype”: “func”,
    “B0FieldSource”: “phasediff_fmap0”

  • fieldmap - magnitude1
    “datatype”: “fmap”,
    “sidecar_changes”: {
    “IntendedFor”: “id_task-rest”,
    “B0FieldIdentifier”: “phasediff_fmap0”
    }

  • fieldmap - magnitude2
    “datatype”: “fmap”,
    “sidecar_changes”: {
    “IntendedFor”: “id_task-rest”,
    “B0FieldIdentifier”: “phasediff_fmap0”
    }

  • fieldmap - phasediff
    “datatype”: “fmap”,
    “sidecar_changes”: {
    “IntendedFor”: “id_task-rest”,
    “B0FieldIdentifier”: “phasediff_fmap0”
    }

Or can I just make the magnitude the same?
(e.g.

  • func(b0fieldsource: fmap0, phasediff_fmap0)
  • magnitude1(b0fieldidentifer:fmap0)
  • magnitude2(b0fieldidentifer:fmap0)
  • phasediff(b0fieldidentifer: phasediff_fmap0)

)

Your first example, all phasediff_fmap0 should work.