fMRIprep 21.0.0 error

Dear experts,

I recently updated fMRIprep to the version 21.0.0. However, when I run the same command I was running with the previous version (20.5.2) I get the following error:

220120-10:10:34,638 nipype.workflow IMPORTANT:
         Running fMRIPrep version 21.0.0
         License NOTICE ##################################################
         fMRIPrep 21.0.0
         Copyright 2021 The NiPreps Developers.
         This product includes software developed by
         the NiPreps Community (https://nipreps.org/).
         Portions of this software were developed at the Department of
         Psychology at Stanford University, Stanford, CA, US.
         This software redistributes the versioneer Python package, which is
         Public domain source code.
         This software is also distributed as a Docker container image.
         The bootstraping file for the image ("Dockerfile") is licensed
         under the MIT License.
         This software may be distributed through an add-on package called
         "Docker Wrapper" that is under the BSD 3-clause License.
         #################################################################
220120-10:10:34,769 nipype.workflow IMPORTANT:
         Building fMRIPrep's workflow:
           * BIDS dataset path: /EBC/home/mblesa/study_5y/PRUEBA/BIDs_data.
           * Participant list: ['007'].
           * Run identifier: 20220120-101019_997160e3-3ca0-469b-a2bc-6921d0acc84d.
           * Output spaces: MNI152NLin2009cAsym:res-2.
           * Pre-run FreeSurfer's SUBJECTS_DIR: /EBC/home/mblesa/study_5y/PRUEBA/derivatives/sourcedata/freesurfer.
Process Process-2:
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 324, in find_estimators
    fm.FieldmapFile(fmap.path, metadata=fmap.get_metadata())
AttributeError: 'NoneType' object has no attribute 'path'

The command is:

export SINGULARITYENV_TEMPLATEFLOW_HOME=/home/fmriprep/.cache/templateflow

mkdir -p derivatives/
mkdir -p $2/${NAME}_working_directory
singularity run -C -B /EBC:/EBC,$2:/opt/templateflow fmriprep_21.0.0.simg $2/BIDs_data $2/derivatives participant --participant-label ${NAME} -w $2/${NAME}_working_directory --nthreads 16 --omp-nthreads 16 --fs-license-file /EBC/local/infantFS/freesurfer/license.txt --output-space MNI152NLin2009cAsym:res-2 --force-syn --stop-on-first-crash --skip_bids_validation > $PWD/derivatives/log_fMRIprep_sub-${NAME}.txt

Any clue with this?

Another question, if I run the command without sudo it doesn’t work, it says memory error, I’m also trying to figure out the reason, any advice? Thanks in advance.

Best regards,

Manuel

Did you use a fresh working directory?

Yes, I delete it before and create it again

Just also checking, is the dataset bids valid, and is this error subject specific?

Thanks,
Steven

Also, can you print the outputs of the tree command on that subject folder? I’m curious what the fmaps look like, given the error traceback.

Hi,

Here is the output of the tree command:

sub-007/
β”œβ”€β”€ anat
β”‚   β”œβ”€β”€ sub-007_T1w.json
β”‚   β”œβ”€β”€ sub-007_T1w.nii.gz
β”‚   β”œβ”€β”€ sub-007_T2w.json
β”‚   └── sub-007_T2w.nii.gz
β”œβ”€β”€ dwi
β”‚   β”œβ”€β”€ sub-007_dwi.bval
β”‚   β”œβ”€β”€ sub-007_dwi.bvec
β”‚   β”œβ”€β”€ sub-007_dwi.json
β”‚   └── sub-007_dwi.nii.gz
β”œβ”€β”€ fmap
β”‚   β”œβ”€β”€ sub-007_dir-PA_epi.json
β”‚   β”œβ”€β”€ sub-007_dir-PA_epi.nii.gz
β”‚   β”œβ”€β”€ sub-007_magnitude1.json
β”‚   β”œβ”€β”€ sub-007_magnitude1.nii.gz
β”‚   β”œβ”€β”€ sub-007_magnitude2.json
β”‚   β”œβ”€β”€ sub-007_magnitude2.nii.gz
β”‚   β”œβ”€β”€ sub-007_phasediff.json
β”‚   └── sub-007_phasediff.nii.gz
└── func
    β”œβ”€β”€ sub-007_task-pixar1_bold.json
    β”œβ”€β”€ sub-007_task-pixar1_bold.nii.gz
    β”œβ”€β”€ sub-007_task-pixar2_bold.json
    β”œβ”€β”€ sub-007_task-pixar2_bold.nii.gz
    β”œβ”€β”€ sub-007_task-sesame_bold.json
    └── sub-007_task-sesame_bold.nii.gz

4 directories, 22 files

It happens for all the subjects. The bids validator doesn’t complain (I know now it’s skipped). Is there any relevant change to this between the two versions? Thanks for your help.

Best regards,

Manuel

Hmm, it’s not immediately clear to me what the problem is. I know 21.0.0 overhauled the SDC system, which is where it seems things are failing here. Can you try two things please? 1) Could you run the most recent bids validtor on this dataset and print the output? 2) try ignoring the fieldmaps --ignore fieldmaps?

Also, are the IntendedFor fields set correctly in the fieldmap json files?

Hi @Steven,

The BIDs validator says:

File Path: You have to define β€˜TaskName’ for this file.

Type:		Error
File:		sub-007_task-pixar1_bold.nii.gz
Location:		Study/sub-007/func/sub-007_task-pixar1_bold.nii.gz
Reason:		You have to define 'TaskName' for this file. It can be included one of the following locations: /task-pixar1_bold.json, /sub-007/sub-007_task-pixar1_bold.json, /sub-007/func/sub-007_task-pixar1_bold.json
Type:		Error
File:		sub-007_task-pixar2_bold.nii.gz
Location:		Study/sub-007/func/sub-007_task-pixar2_bold.nii.gz
Reason:		You have to define 'TaskName' for this file. It can be included one of the following locations: /task-pixar2_bold.json, /sub-007/sub-007_task-pixar2_bold.json, /sub-007/func/sub-007_task-pixar2_bold.json
Type:		Error
File:		sub-007_task-sesame_bold.nii.gz
Location:		Study/sub-007/func/sub-007_task-sesame_bold.nii.gz
Reason:		You have to define 'TaskName' for this file. It can be included one of the following locations: /task-sesame_bold.json, /sub-007/sub-007_task-sesame_bold.json, /sub-007/func/sub-007_task-sesame_bold.json

======================================================

File Path: Task scans should have a corresponding events.tsv file. If this is a resting state scan you can ignore this warning or rename the task to include the word β€œrest”.

Type:		Warning
File:		sub-007_task-pixar1_bold.nii.gz
Location:		Study/sub-007/func/sub-007_task-pixar1_bold.nii.gz
Reason:		Task scans should have a corresponding events.tsv file. It can be included one of the following locations: /events.tsv, /task-pixar1_events.tsv, /sub-007/sub-007_events.tsv, /sub-007/sub-007_task-pixar1_events.tsv, /sub-007/func/sub-007_events.tsv, /sub-007/func/sub-007_task-pixar1_events.tsv
Type:		Warning
File:		sub-007_task-pixar2_bold.nii.gz
Location:		Study/sub-007/func/sub-007_task-pixar2_bold.nii.gz
Reason:		Task scans should have a corresponding events.tsv file. It can be included one of the following locations: /events.tsv, /task-pixar2_events.tsv, /sub-007/sub-007_events.tsv, /sub-007/sub-007_task-pixar2_events.tsv, /sub-007/func/sub-007_events.tsv, /sub-007/func/sub-007_task-pixar2_events.tsv
Type:		Warning
File:		sub-007_task-sesame_bold.nii.gz
Location:		Study/sub-007/func/sub-007_task-sesame_bold.nii.gz
Reason:		Task scans should have a corresponding events.tsv file. It can be included one of the following locations: /events.tsv, /task-sesame_events.tsv, /sub-007/sub-007_events.tsv, /sub-007/sub-007_task-sesame_events.tsv, /sub-007/func/sub-007_events.tsv, /sub-007/func/sub-007_task-sesame_events.tsv

======================================================

File Path: The recommended file /README is missing. See Section 03 (Modality agnostic files) of the BIDS specification.

Type:		Warning

======================================================

File Path: The Authors field of dataset_description.json should contain an array of fields - with one author per field. This was triggered because there are no authors, which will make DOI registration from dataset metadata impossible.

Type:		Warning

======================================================

This is the IntendedFor of the field maps:

"IntendedFor": [
    "func/sub-007_task-pixar1_bold.nii.gz",
    "func/sub-007_task-pixar2_bold.nii.gz",
    "func/sub-007_task-sesame_bold.nii.gz"
]

When I add --ignore fieldmaps it works:

singularity run -C -B /EBC:/EBC,$2:/opt/templateflow /EBC/home/mblesa/fmriprep_21.0.0.simg $2/BIDs_data $2/derivatives participant --participant-label ${NAME} -w $2/${NAME}_working_directory --nthreads 16 --omp-nthreads 16 --fs-license-file /EBC/local/infantFS/freesurfer/license.txt --output-space MNI152NLin2009cAsym:res-2 --ignore fieldmaps --stop-on-first-crash

Do I need to change something in the fieldmaps?

Best regards,

Manuel

Thank you for trying that, this is good to know!

Based on the first error from the validator output, can you add the TaskName field to all the bold json files? What goes in that field should match the task label of the .nii.gz file.

Also, I’m wondering if pixar1 and pixar2 shouldn’t instead be organized as run-1 and run-2 of the task pixar. That’s not something that would cause the validator to break, but just general BIDS convention.

Hope that works,
Steven

Hi,

I’ll do these modifications now. Do you think they are the cause of why the fieldmaps are not working?

pixar1 and 2 and in fact different tasks, are not two runs of the same acquisition (I know the names are confusing).

Best regards,

Manuel

Hi,

It is hard to say, as I do not know what goes all behind the scenes of BIDS validation, but the fewer errors the better! And understood regarding pixar names, feel free to keep those as is.

Steven

Hi,

I made the modifications. Now the bids validator only rises two warnings:
File Path: The recommended file /README is missing. See Section 03 (Modality agnostic files) of the BIDS specification.

	Type:		Warning

======================================================


File Path: The Authors field of dataset_description.json should contain an array of fields - with one author per field. This was triggered because there are no authors, which will make DOI registration from dataset metadata impossible.

	Type:		Warning

======================================================

However, now fMRIprep 21.0.0 doesn’t work even with --ignore fieldmaps (the same error as before)

Best regards,

Manuel

Now it works, I hade to remove also the --use-syn-sdc

The command that works is:

singularity run -C -B /EBC:/EBC,$2:/opt/templateflow /EBC/home/mblesa/fmriprep_21.0.0.simg $2/BIDs_data $2/derivatives participant --participant-label ${NAME} -w $2/${NAME}_working_directory --nthreads 16 --omp-nthreads 16 --fs-license-file /EBC/local/infantFS/freesurfer/license.txt --output-space MNI152NLin2009cAsym:res-2 --ignore fieldmaps --stop-on-first-crash --skip_bids_validation

But when I add anything about the distortion correction it crashes

Hmm, I wonder if it was conflicted about using your fmaps vs the SYN fieldmapless approach. Does it work if you don’t ignore fieldmaps and also remove the SYN flag? Also, don’t worry too much about validator warnings; they will generally not cause bids-apps to crash.

It doesn’t work either

Strange. I notice that you have both an EPI file as well as the magnitude1/2/phasediff files. Are those all for func files?

fMRIPrep currently does not handle only a reverse phase-encoded fmap (e.g. a PA fmap with an AP BOLD run). So, if applicable, try testing out removing the PA epi files, and just having the magnitude pairs and phasediff.

Steven

1 Like

Removing that file made the trick and now it works.

The problem is that the file was there for the diffusion analysis with QSIprep and in the .json file it says:

"IntendedFor": "dwi/sub-007_dwi.nii.gz"

Maybe it should be stored in another place?

Happy that it works! It’s strange that’s the case though, I would open a bug on fmriprep’s GitHub describing this because it should ignore files intended for dwi.