Skip to content

[B0FieldIdentifier] repeated between subjects makes fmriprep crash #455

@suxpert

Description

@suxpert

What happened?

I tried using B0FieldIdentifier and B0FieldSource for susceptibility distortion correction. According to BIDS Spec, I've added

"B0FieldIdentifier": "phdiff_fmap0",

in .../fmap/...phasediff.json, and added

"B0FieldSource": "phdiff_fmap0",

in .../func/...bold.json for each subjects. I.e., I use the same identifier for all subjects.

When I tried run fmriprep for multiple participants at once, I got the error.

Is it required that this identifier MUST be different across subjects? Or are there chances to improve fmriprep such that we only need the identifier be unique within one subject?

What command did you use?

ocker run -it --rm -v bids:/data:ro -v fmriprep:/out nipreps/fmriprep:24.0.1 --notrack --fs-no-reconall /data /out participant

What version of fMRIPrep are you running?

24.0.1

How are you running fMRIPrep?

Docker

Is your data BIDS valid?

Yes

Are you reusing any previously computed results?

No

Please copy and paste any relevant log output.

Process Process-2:
Traceback (most recent call last):
  File "/opt/conda/envs/fmriprep/lib/python3.11/multiprocessing/process.py", line 314, in _bootstrap
    self.run()
  File "/opt/conda/envs/fmriprep/lib/python3.11/multiprocessing/process.py", line 108, in run
    self._target(*self._args, **self._kwargs)
  File "/opt/conda/envs/fmriprep/lib/python3.11/site-packages/fmriprep/cli/workflow.py", line 126, in build_workflow
    retval['workflow'] = init_fmriprep_wf()
                         ^^^^^^^^^^^^^^^^^^
  File "/opt/conda/envs/fmriprep/lib/python3.11/site-packages/fmriprep/workflows/base.py", line 94, in init_fmriprep_wf
    single_subject_wf = init_single_subject_wf(subject_id)
                        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/conda/envs/fmriprep/lib/python3.11/site-packages/fmriprep/workflows/base.py", line 515, in init_single_subject_wf
    fmap_estimators, estimator_map = map_fieldmap_estimation(
                                     ^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/conda/envs/fmriprep/lib/python3.11/site-packages/fmriprep/workflows/base.py", line 763, in map_fieldmap_estimation
    fmap_estimators = find_estimators(
                      ^^^^^^^^^^^^^^^^
  File "/opt/conda/envs/fmriprep/lib/python3.11/site-packages/sdcflows/utils/wrangler.py", line 354, in find_estimators
    e = fm.FieldmapEstimation(
        ^^^^^^^^^^^^^^^^^^^^^^
  File "<attrs generated init sdcflows.fieldmaps.FieldmapEstimation>", line 7, in __init__
    self.__attrs_post_init__()
  File "/opt/conda/envs/fmriprep/lib/python3.11/site-packages/sdcflows/fieldmaps.py", line 434, in __attrs_post_init__
    _estimators[self.bids_id] = self.paths()
    ~~~~~~~~~~~^^^^^^^^^^^^^^
  File "/opt/conda/envs/fmriprep/lib/python3.11/site-packages/sdcflows/utils/bimap.py", line 144, in __setitem__
    raise KeyError(
KeyError: "'phdiff_fmap0' is already  in mapping"

Additional information / screenshots

Even when the identifier is the same across all subjects, it works normal if I run fmriprep for each subject separately via --participant-label. If we need to use different identifiers for each subjects, then the behavior of fmriprep differs when run for one subject versus run for multiple subjects, which seems unnatural.

Last but not least, if the identifier must be unique, why bids-validator passed with no error?

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions