Fmriprep Susceptibility distortion correction: None

Hi,

I am using fmriprep v20.2.1 via the fmriprep-docker container and I have fieldmaps available for my dataset (in the /fmap/ folder). The BIDS validator does not give me any error/ warning, however the fmriprep output summary says:

Susceptibility distortion correction: None

As I understand no specific argument is necessary in order to invoke distortion correction. The pipeline runs without error.

I read somewhere else about an “IntendedFor” field in the fieldmap’s .json files - is this required now and wasn’t previously?

I had used an older version of fmriprep (v1.5.2) previously on another dataset and fieldmap correction were automatically conducted.

Thanks in advance.

Marius

Yes, in the bids fmap folder, you should put an intended for field in the JSON files so fmriprep can associate them (or use the fieldmapless distortion method, syn-sdc). I have a simple script to automate this in jupyter / python, let me know if you’d want it.

Best,
Steven

1 Like

Thanks, Steven. I would appreciate if you send me the script. I also found it now in the bids-specification docs.
Best, Marius

Hi Steven,
I’m running into this same problem now - if you don’t mind also sharing your script with me, it’d be much appreciated!

Thanks,
Fareshte

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”

Hi @gusma,

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

Best,
Steven

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.