Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fmriprep gets confused by a fieldmap string in the acq-label #264

Open
marcelzwiers opened this issue Feb 14, 2022 · 1 comment
Open

Fmriprep gets confused by a fieldmap string in the acq-label #264

marcelzwiers opened this issue Feb 14, 2022 · 1 comment
Labels
bug Something isn't working
Milestone

Comments

@marcelzwiers
Copy link
Contributor

marcelzwiers commented Feb 14, 2022

What happened?

I have BIDS valid data that consist (amongst others) of a fieldmap file named fmap/sub-003_ses-mri01_acq-fieldmap2p0iso68slices_run-1_magnitude1.nii.gz. If I run fmriprep I get this error message:

Process Process-2:
Traceback (most recent call last):
  File "/opt/conda/lib/python3.8/site-packages/sdcflows/fieldmaps.py", line 340, in __attrs_post_init__
    FieldmapFile(
  File "<attrs generated init sdcflows.fieldmaps.FieldmapFile>", line 11, in __init__
    __attr_validator_path(self, __attr_path, self.path)
  File "/opt/conda/lib/python3.8/site-packages/sdcflows/fieldmaps.py", line 203, in check_path
    raise FileNotFoundError(
FileNotFoundError: File path </project/3015089.01/deep-brain_EPI/bids_GEmap_mb3me2/sub-003/ses-mri01/fmap/sub-003_ses-mri01_acq-magnitude2p0iso68slices_run-1_magnitude1.nii.gz> does not exist, is a broken link, or it is not a file

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/opt/conda/lib/python3.8/multiprocessing/process.py", line 315, in _bootstrap
    self.run()
  File "/opt/conda/lib/python3.8/multiprocessing/process.py", line 108, in run
    self._target(*self._args, **self._kwargs)
  File "/opt/conda/lib/python3.8/site-packages/fmriprep/cli/workflow.py", line 118, in build_workflow
    retval["workflow"] = init_fmriprep_wf()
  File "/opt/conda/lib/python3.8/site-packages/fmriprep/workflows/base.py", line 85, in init_fmriprep_wf
    single_subject_wf = init_single_subject_wf(subject_id)
  File "/opt/conda/lib/python3.8/site-packages/fmriprep/workflows/base.py", line 324, in init_single_subject_wf
    fmap_estimators = find_estimators(
  File "/opt/conda/lib/python3.8/site-packages/sdcflows/utils/wrangler.py", line 281, in find_estimators
    e = fm.FieldmapEstimation(
  File "<attrs generated init sdcflows.fieldmaps.FieldmapEstimation>", line 7, in __init__
    self.__attrs_post_init__()
  File "/opt/conda/lib/python3.8/site-packages/sdcflows/fieldmaps.py", line 348, in __attrs_post_init__
    raise ValueError(
ValueError: A fieldmap or phase-difference estimation type was found, but an anatomical reference (magnitude1 file) is missing.

However, the error disappears and everything runs normally if I simply change/remove the fieldmap substring in the fmap filename (i.e. change the acq label), e.g. to fmap/sub-003_ses-mri01_acq-2p0iso68slices_run-1_magnitude1.nii.gz.

What command did you use?

unset PYTHONPATH; export PYTHONNOUSERSITE=1; singularity run --cleanenv /opt/fmriprep/21.0.1/fmriprep-21.0.1.simg bids_GEmap_mb3me2 bids_GEmap_mb3me2/derivatives/fmriprep participant -w \$TMPDIR --participant-label 003 --fs-license-file /opt_host/fmriprep/license.txt --mem_mb 20000 --omp-nthreads 2 --nthreads 2

What version of fMRIPrep are you running?

21.0.1

How are you running fMRIPrep?

Singularity

Is your data BIDS valid?

Yes

Are you reusing any previously computed results?

No

Please copy and paste any relevant log output.

No response

Additional information / screenshots

No response

@marcelzwiers marcelzwiers added the bug Something isn't working label Feb 14, 2022
@marcelzwiers marcelzwiers changed the title Fmriprep gets confused by the acq label Fmriprep gets confused by a fieldmap string in the acq-label Feb 14, 2022
@effigies effigies transferred this issue from nipreps/fmriprep Feb 14, 2022
@effigies
Copy link
Member

Looks like the issue is here:

self.sources.append(
FieldmapFile(
sources[0]
.replace("fieldmap", "magnitude")
.replace("diff", "1")
.replace("phase", "magnitude")
)
)

We should use more BIDS-aware filename munging, rather than relying on simple string matching and replacing.

@effigies effigies added this to the 20.0.13 milestone Feb 14, 2022
marcelzwiers added a commit to marcelzwiers/sdcflows that referenced this issue Apr 16, 2024
…. files named `sub-01-acq-fieldmap_magnitude1.nii.gz` (see github issue nipreps#264)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants