Fmriprep Susceptibility distortion correction: None

Hello Steven,
I’ve just encountered the same problem, would you mind sharing your script with me as well? Many thanks!

sincerely,
Pin-Wei

Hi Steven - I also encountered the same problem. Would you mind sharing your scripts? Thanks a lot.

Assumes there’s no ses-* level. Make bids the path to your BIDS root directory. You’ll have to change the definitions for fmaps_func_jsons and fmaps_dwi_jsons to include the proper search string to find the appropriate jsons. Also assumes that all fmri fmaps apply to all fmri niftis. If these assumptions aren’t correct for you hopefully there’s enough here that you can adapt to meet your needs.

import json
import os
import glob
bids = ''
subs = glob.glob(bids+'sub*')

for sub in subs:
    func_niis = [x.replace(sub+'/','') for x in glob.glob(sub+'/func/*.nii*')]
    dwi_niis = [x.replace(sub+'/','') for x in glob.glob(sub+'/dwi/*.nii*')] 
    fmaps_func_jsons = glob.glob(sub+'/fmap/*fMRI*.json')
    fmaps_dwi_jsons = glob.glob(sub+'/fmap/*dwi*.json')
    for file in fmaps_func_jsons:
        with open(file) as f:
            data = json.load(f)
        IF = {"IntendedFor":func_niis}
        data.update(IF)
        with open(file, 'w') as outfile:
            json.dump(data, outfile,indent=2,sort_keys=True)
    
    for file in fmaps_dwi_jsons:
        with open(file) as f:
            data = json.load(f)
        IF = {"IntendedFor":dwi_niis}
        data.update(IF)
        with open(file, 'w') as outfile:
            json.dump(data, outfile,indent=2,sort_keys=True)

Hi Steven. Thank you so much!

Hi @Steven . It seems the current fmriprep version only accepts the IntendedFor field as a relative path to the subject directory (i tried the “bids::sub-/func/_bold.nii.gz” format suggested in BIDS and it wouldn’t perform SDC), even though this is deprecated in the current BIDS version, is that correct?

https://bids-specification.readthedocs.io/en/stable/04-modality-specific-files/01-magnetic-resonance-imaging-data.html#fieldmap-data

1 Like

Yes, fmriprep at the moment does not accept the BIDS URI (the format you tried).

Hi,

I’m using dcm2bids version 3.1.1 to generate bids compatible files for a dataset containing field-maps. The field-maps contains the IntendedFor tag:

"IntendedFor": [
        "bids::sub-16/ses-01/func/sub-16_ses-01_task-co2cvr_run-01_bold.nii.gz",
        "bids::sub-16/ses-01/func/sub-16_ses-01_task-rscvr_run-01_bold.nii.gz",
        "bids::sub-16/ses-01/func/sub-16_ses-01_task-bhcvr_run-01_bold.nii.gz"
    ]

However fMRIPrep version: 23.2.0a3 don’t seem to recognize the field-maps since the html report file reads: “Susceptibility distortion correction: None”

1 Like

Hi @gusma,

fMRIPrep does not support the BIDS URI. Please remove bids::sub-16/ from all of the fields.

Best,
Steven

1 Like

Okay thanks, do fmriprep supports B0FieldSource/B0FieldIdentifier?

Yes it should support B0FieldSource/B0FieldIdentifier

Yes you are right, it works. I should have listened to the recommendation on the BIDS website to use both IntendedFor and B0FieldSource/B0FieldIdentifier to maximize compatibility.

Thanks for the help!

1 Like

Only use one scheme in your data. Using both may have unintended side effects

Okay, I now implemented both and it seems to work, what can happen? And do you mean that the BIDS specification is wrong when it says:

B0FieldIdentifier and B0FieldSource duplicate the capabilities of the original IntendedFor approach (see below), while permitting more complex use cases. It is RECOMMENDED to use both approaches to maintain compatibility with tools that support older datasets.

I don’t know how SDCFlows (which fmriprep uses) handles multiple specifications. If the SDC looks good in your end then keep doing what you’re doing, but be sure to check for quality of SDC.

Okay I see, since the IntendedFor uses BIDS URI, it seems that this tag is ignored for now. Maybe it would have been a problem otherwise and maybe it will be a problem in the future if fMRIPrep starts recognizing BIDS URI.

Hi @Steven and @tsalo

I have the same issue, I am really struggling to solve this issue. The fMRIprep do not do the susceptibility distraction correction. In the .html fMRIprep results report file, I do not see the susceptibility distraction correction images. I do use dcm2bids (version 3.2.0) to do the bidsification. As you suggest here, I removed bids::sub-SEEG02 from my field map .json files (see bellow). I have T1, field map and resting fMRI data. Below is my the field map .json files. I am attaching my data


tree too. Kindly help me to solve this issue. Note: the letter ‘i’ in in intendedFor is small letter, when I tried by just making it ti capital letter ‘I’, fMRIprep throw error called ‘unrecognized json file’.

"BidsGuess": [
    "fmap",
    "_acq-EPI_dir-AP_run-1007_epi"
],
"ConversionSoftware": "dcm2niix",
"ConversionSoftwareVersion": "v1.0.20240202",
"Dcm2bidsVersion": "3.2.0",
"intendedFor": [
    "ses-01/func/sub-SEEG02_ses-01_task-rest_acq-abcd_run-01_bold.nii.gz"
]

I

Hi @RaySneha , and welcome to neurostars!

The “i” in IntendedFor needs to be capitalized.

Best,
Steven

Dear @Steven ,

I greatly appricited your help, thank you so much for your quick replay even in weekend.

So, when i change the “i” in intendorFor to capilatl “I”, fMRIprep throws bellow error:

Traceback (most recent call last):
  File "/opt/conda/envs/fmriprep/bin/fmriprep", line 8, in <module>
    sys.exit(main())
  File "/opt/conda/envs/fmriprep/lib/python3.10/site-packages/fmriprep/cli/run.py", line 43, in main
    parse_args()
  File "/opt/conda/envs/fmriprep/lib/python3.10/site-packages/fmriprep/cli/parser.py", line 812, in parse_args
    validate_input_dir(config.environment.exec_env, opts.bids_dir, opts.participant_label)
  File "/opt/conda/envs/fmriprep/lib/python3.10/site-packages/fmriprep/utils/bids.py", line 185, in validate_input_dir
    subprocess.check_call(['bids-validator', str(bids_dir), '-c', temp.name])
  File "/opt/conda/envs/fmriprep/lib/python3.10/subprocess.py", line 369, in check_call
    raise CalledProcessError(retcode, cmd)
subprocess.CalledProcessError: Command '['bids-validator', '/data/ucsfocd/data/mri/SEEG_subjects/nifti/rawdata', '-c', '/tmp/tmpkpsinw1e.jsonb']' returned non-zero exit status 1.

Hi @RaySneha,

This sounds like a separate issue that your dataset is not passing BIDS validation. You should open a new issue under Software Support category and fill in all info that is requested by the post template.

Best,
Steven

1 Like