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.
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 . 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?
However fMRIPrep version: 23.2.0a3 don’t seem to recognize the field-maps since the html report file reads: “Susceptibility distortion correction: None”
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.
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.
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’.