I am writing to clarify some questions regarding Susceptibility Distortion Correction (SDC) in fMRIPrep:
If fieldmaps (fmap) are provided in a valid BIDS format, will fMRIPrep automatically detect and apply them for SDC? If not, what command-line option should I explicitly use to enable SDC?
The fMRIPrep documentation states:
βPlease note that all routines for susceptibility-derived distortion correction have been excised off of fMRIPrep for utilization on other projects (e.g., dMRIPrep). For more detailed documentation on SDC routines, check on www.nipreps.org/sdcflows.β*
Does this mean that fMRIPrep no longer implements SDC at all, or just that the implementation has been modularized and can still be invoked?
I have fieldmaps available, but the final fMRIPrep report shows βSusceptibility distortion correction: Noneβ. My file structure follows BIDS convention, so I am wondering why SDC was not applied.
Command used (and if a helper script was used, a link to the helper script or the command generated):
[ERR] 'IntendedFor' field needs to point to an existing file. (code: 37 - INTENDED_FOR)
./sub-0002/ses-01/fmap/sub-0002_ses-01_dir-AP_epi.nii.gz
Evidence: bids::sub-0002/ses-01/func/sub-0002_ses-01_task-multi_run-1_bold.nii.gz
./sub-0002/ses-01/fmap/sub-0002_ses-01_dir-AP_epi.nii.gz
Evidence: bids::sub-0002/ses-01/func/sub-0002_ses-01_task-multi_run-2_bold.nii.gz
However, the files do exist at the specified locations. Could you please clarify the correct format for the IntendedFor field when using absolute BIDS URIs?
In the future please use the Software Support post template which helps organize your post and asks for relevant information. You can see I edited in for you this time, and there is still missing information you can provide by editing your post. You can also see that I have edited your code/terminal text accordingly with the </> button in the text editor. Please use that for future code/terminal text.
No, you need to use IntendedFor or B0FieldIdentifier/B0FieldSource method (keep in mind if both are specified, fMRIPrep will default to the B0 metadata even if it is incorrect).
Thank you very much for your detailed explanation. Regarding the path issue, I have resolved it by referring to the example on the BIDS website. Thanks again!
Hello @Steven ,
I am having the same issue. I see: Susceptibility distortion correction: None even though my IntendedFor field is correct.
Although I do not get any error regarding βfile not foundβ
My code:
bids_root_dir=/home/lotlikar/EXSD_MRI_dataAnalyses
subj=EXSD02
nthreads=6
mem=24 #gb
container=docker #docker or singularity
workdir=/home/lotlikar/WorkingDir
#Begin:
#Convert virtual memory from gb to mb
mem=`echo "${mem//[!0-9]/}"` #remove gb at end
mem_mb=`echo $(((mem*1000)-5000))` #reduce some memory for buffer space during pre-processing
#export FSL license
export FS_LICENSE=home/lotlikar/EXSD_MRI_dataAnalyses/code/license.txt
#Run fmriprep
fmriprep-docker $bids_root_dir/ $bids_root_dir/derivatives/ \
participant \
--participant-label $subj \
--md-only-boilerplate \
--fs-license-file license.txt \
--output-spaces MNI152NLin2009cAsym:res-2 \
--nthreads $nthreads \
--stop-on-first-crash \
--write-graph\
--bids-filter-file /home/lotlikar/EXSD_MRI_dataAnalyses/code/T2SessionfMRIprep.json \
--mem_mb $mem_mb \
--skip-bids-validation\
--ignore slicetiming\
-w $workdir```
For task-bold, I am using fmap , acq-2mm, dir AP and PA. Here is the IntendedFor field from the fmapβs JSON file. Its same for both the directions
Hi @Steven
I ran the bids validator in the command line and got the following errors:
[ERROR] MISSING_DATASET_DESCRIPTION A dataset_description.json file is required in the root of the dataset
Please visit https://neurostars.org/search?q=MISSING_DATASET_DESCRIPTION for existing conversations about this issue.
[ERROR] NOT_INCLUDED Files with such naming scheme are not part of BIDS specification. This error is most commonly caused by typos in file names that make them not BIDS compatible. Please consult the specification and make sure your files are named correctly. If this is not a file naming issue (for example when including files not yet covered by the BIDS specification) you should include a ".bidsignore" file in your dataset (see https://github.com/bids-standard/bids-validator#bidsignore for details). Please note that derived (processed) data should be placed in /derivatives folder and source data (such as DICOMS or behavioural logs in proprietary formats) should be placed in the /sourcedata folder.
/bids-validator
Please visit https://neurostars.org/search?q=NOT_INCLUDED for existing conversations about this issue.
[ERROR] INVALID_LOCATION The file has a valid name, but is located in an invalid directory.
/ses-T0/func/sub-EXSD02_ses-T0_task-rest_run-02_echo-3_bold.nii.gz - Expected location: /sub-EXSD02/ses-T0/
/ses-T0/func/sub-EXSD02_ses-T0_task-rest_run-02_echo-2_bold.json - Expected location: /sub-EXSD02/ses-T0/
72 more files with the same issue
Please visit https://neurostars.org/search?q=INVALID_LOCATION for existing conversations about this issue.
[ERROR] SIDECAR_KEY_REQUIRED A data file's JSON sidecar is missing a key listed as required.
TaskName
/ses-T0/func/sub-EXSD02_ses-T0_task-rest_run-02_echo-3_bold.nii.gz - Field description: Name of the task.
No two tasks should have the same name.
The task label included in the filename MAY be derived from this `"TaskName"` field
by removing all non-alphanumeric or `+` characters (that is, all except those matching `[0-9a-zA-Z+]`),
and potentially replacing spaces with `+` to ease readability.
For example `"TaskName"` `"faces n-back"` or `"head nodding"` could correspond to task labels
`faces+n+back` or `facesnback` and `head+nodding` or `headnodding`, respectively.
/ses-T0/func/sub-EXSD02_ses-T0_task-rest_run-01_echo-2_bold.nii.gz - Field description: Name of the task.
No two tasks should have the same name.
The task label included in the filename MAY be derived from this `"TaskName"` field
by removing all non-alphanumeric or `+` characters (that is, all except those matching `[0-9a-zA-Z+]`),
and potentially replacing spaces with `+` to ease readability.
For example `"TaskName"` `"faces n-back"` or `"head nodding"` could correspond to task labels
`faces+n+back` or `facesnback` and `head+nodding` or `headnodding`, respectively.
10 more files with the same issue
That may be too old to accept the BIDS-URI style of IntendedFor. The relative path version of IntendedFor (i.e. remove bids::sub-xxxx/ from all entries) should be backwards compatible, or you can upgrade fMRIPrep to incorporate other pipeline improvements (25.2.0 was released today).
Hi @Steven
After updating to the latest version, I have been running into a new error now. I removed the bids-filter-file argument and added the --session-label
RUNNING: docker run --rm -e DOCKER_VERSION_8395080871=28.4.0 -it -v /home/lotlikar/EXSD_MRI_dataAnalyses/code/license.txt:/opt/freesurfer/license.txt:ro -v /home/lotlikar/EXSD_MRI_dataAnalyses:/data:ro -v /home/lotlikar/EXSD_MRI_dataAnalyses/derivatives:/out -v /home/lotlikar/WorkingDir:/scratch nipreps/fmriprep:25.2.0 /data /out participant --participant-label EXSD02 --md-only-boilerplate --nthreads 6 --stop-on-first-crash --write-graph --session-label T2 --mem_mb 19000 --skip-bids-validation --ignore slicetiming -w /scratch --output-spaces MNI152NLin2009cAsym:res-2
Traceback (most recent call last):
File "/app/.pixi/envs/fmriprep/lib/python3.12/site-packages/upath/_protocol.py", line 51, in _fsspec_protocol_equals
o0 = _fsspec_registry_map[p0]
~~~~~~~~~~~~~~~~~~~~^^^^
File "/app/.pixi/envs/fmriprep/lib/python3.12/collections/__init__.py", line 1015, in __getitem__
return self.__missing__(key) # support subclasses that define __missing__
^^^^^^^^^^^^^^^^^^^^^
File "/app/.pixi/envs/fmriprep/lib/python3.12/collections/__init__.py", line 1007, in __missing__
raise KeyError(key)
KeyError: 'bids'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/app/.pixi/envs/fmriprep/bin/fmriprep", line 10, in <module>
sys.exit(main())
^^^^^^
File "/app/.pixi/envs/fmriprep/lib/python3.12/site-packages/fmriprep/cli/run.py", line 40, in main
parse_args()
File "/app/.pixi/envs/fmriprep/lib/python3.12/site-packages/fmriprep/cli/parser.py", line 920, in parse_args
config.from_dict({})
File "/app/.pixi/envs/fmriprep/lib/python3.12/site-packages/fmriprep/config.py", line 745, in from_dict
execution.load(settings, init=initialize('execution'), ignore=ignore)
File "/app/.pixi/envs/fmriprep/lib/python3.12/site-packages/fmriprep/config.py", line 245, in load
cls.init()
File "/app/.pixi/envs/fmriprep/lib/python3.12/site-packages/fmriprep/config.py", line 512, in init
cls._layout = BIDSLayout(
^^^^^^^^^^^
File "/app/.pixi/envs/fmriprep/lib/python3.12/site-packages/bids/layout/layout.py", line 187, in __init__
_indexer(self)
File "/app/.pixi/envs/fmriprep/lib/python3.12/site-packages/bids/layout/index.py", line 160, in __call__
self._index_metadata()
File "/app/.pixi/envs/fmriprep/lib/python3.12/site-packages/bids/layout/index.py", line 474, in _index_metadata
target = self._layout._root.joinpath(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/app/.pixi/envs/fmriprep/lib/python3.12/site-packages/upath/implementations/local.py", line 166, in joinpath
if not compatible_protocol("", *other):
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/app/.pixi/envs/fmriprep/lib/python3.12/site-packages/upath/_protocol.py", line 118, in compatible_protocol
if other_protocol and not _fsspec_protocol_equals(other_protocol, protocol):
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/app/.pixi/envs/fmriprep/lib/python3.12/site-packages/upath/_protocol.py", line 53, in _fsspec_protocol_equals
raise ValueError(f"Protocol not known: {p0}")
ValueError: Protocol not known: bids
fMRIPrep: Please report errors to https://github.com/nipreps/fmriprep/issues```
Has an error: (only pasting the first 2 file names. But this error is repeated for all files with resting state bold)
A data file's JSON sidecar is missing a key listed as required.
/sub-EXSD02/ses-T0/func/sub-EXSD02_ses-T0_task-rest_run-02_echo-3_bold.nii.gz (Field description: Name of the task. No two tasks should have the same name. The task label included in the filename MAY be derived from this `"TaskName"` field by removing all non-alphanumeric or `+` characters (that is, all except those matching `[0-9a-zA-Z+]`), and potentially replacing spaces with `+` to ease readability. For example `"TaskName"` `"faces n-back"` or `"head nodding"` could correspond to task labels `faces+n+back` or `facesnback` and `head+nodding` or `headnodding`, respectively. )
/sub-EXSD02/ses-T0/func/sub-EXSD02_ses-T0_task-rest_run-01_echo-2_bold.nii.gz (Field description: Name of the task. No two tasks should have the same name. The task label included in the filename MAY be derived from this `"TaskName"` field by removing all non-alphanumeric or `+` characters (that is, all except those matching `[0-9a-zA-Z+]`), and potentially replacing spaces with `+` to ease readability. For example `"TaskName"` `"faces n-back"` or `"head nodding"` could correspond to task labels `faces+n+back` or `facesnback` and `head+nodding` or `headnodding`, respectively. )
But I just tested if it is working with a slightly older version by passing the argument:
βimage nipreps/fmriprep:25.1.4 \ and using the --bids-fiter-file argument for a session.
It runs and does not throw any errors.
However, I would like to use the newest version as it allows --session-label usage.