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!