[dcm2bids & fmriprep] SDC is not working on multiple files only

Summary of what happened:

Hi, experts

I got the fmriprep results ‘Susceptibility distortion correction: FMB (field map-based) - phase-difference map’ in case I analyzed just one fMRI file.
However, when analyzing three files in the same way, the following error appears:
KeyError: “‘phasediff_fmap0’ is already in mapping”

I don’t know if this config file is the correct way.
These fMRI fieldmap files were gained in Simens and had two magnitude files and one phasediff file.

Below is the explanation in part of the config file.
I put “B0FieldSource”: [“phasediff_fmap0”] in func(rest) section.
Also put “B0FieldIdentifier”: “phasediff_fmap0” in two magnitude sections and one phasediff section.

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

1. [dcm2bdis] config file

{
  "dcm2niixOptions": "-ba n",
  "descriptions": [
    {
      "datatype": "anat",
      "suffix": "T1w",
      "criteria": {
        "SeriesDescription": "t1*",
        "EchoTime": 0.00236,
        "RepetitionTime": 2.3
      },
      "sidecar_changes": {
        "ProtocolName": "T1"
      }
    },
    {
      "datatype": "anat",
      "suffix": "FLAIR",
      "criteria": {
        "SeriesDescription": "t2*",
        "EchoTime": 0.093,
        "RepetitionTime": 9
      },
      "sidecar_changes": {
        "ProtocolName": "FLAIR"
      }
    },
    {
      "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"]
      }
    },
    {
      "datatype": "fmap",
      "suffix": "magnitude1",
      "criteria": {
        "ProtocolName": "field_map",
        "EchoTime": 0.00492
      },
      "sidecar_changes": {
        "IntendedFor": ["id_task-rest"],
        "B0FieldIdentifier": "phasediff_fmap0"
      }
    },
    {
      "datatype": "fmap",
      "suffix": "magnitude2",
      "criteria": {
        "ProtocolName": "field_map",
        "EchoTime": 0.00738,
        "ImageType": ["ORIGINAL", "PRIMARY", "M", "ND"]
      },
      "sidecar_changes": {
        "IntendedFor": "id_task-rest",
        "B0FieldIdentifier": "phasediff_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"
      }
    }
  ]
}

2. [fmriprep-docker] command

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

Version:

dcm2bids version: 3.2.0
Based on BIDS version: v1.9.0
fMRIPrep v24.0.1
bids-validator 1.14.8

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

dcm2bids(anaconda)
fmriprep-docker

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

PS C:\Users\user> bids-validator d:\t13
bids-validator@1.14.8
(node:36360) Warning: Closing directory handle on garbage collection
(Use `node --trace-warnings ...` to show where the warning was created)
This dataset appears to be BIDS compatible.
        Summary:                 Available Tasks:        Available Modalities:
        17 Files, 138.5MB        rest                    MRI
        1 - Subject
        1 - Session


        If you have any questions, please post on https://neurostars.org/tags/bids.

Relevant log outputs (up to 20 lines):

KeyError: "'phasediff_fmap0' is already  in mapping"
fMRIPrep: Please report errors to https://github.com/nipreps/fmriprep/issues

Screenshots / relevant information:

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.

A post was merged into an existing topic: [fmriprep & dcm2bids] KeyError: “‘phasediff_fmap0’ is already in mapping”