I am trying to set up a heuristics file for a study with field maps, but I’m still confused after looking through the heudiconv example files and relevant parts of the BIDS 1.0.1 specification paper. The study acquires a field map before each functional/dwi scan type (i.e., one for each of four tasks and one for the dwi). The field maps correspond to case 4 in the BIDS specification, with two maps with different phase encoding directions.
First, should I use the “acq” field to denote the scan type the field map corresponds to? E.g., sub-01_ses-01_acq-rest_dir-PA_run-01_epi.nii.gz instead of
Second, the different directions are showing up as separate runs. Is that expected? E.g.,
Finally, and most importantly, how exactly do I add the “IntendedFor” field to the json? Can I do it in the heuristics file?
Thank you. Your answers are very helpful.
1 and 2 are pretty clear now, but I’m still stuck on 3. When you figure out “IntendedFor” post-conversion, how do you know which functional files correspond to each field map from the converted files? Do you compare the “AcquisitionDateTime” values from the jsons?
I’ve only worked with two acquisitions of field maps, but took advantage of the
acq-label from 1) to differentiate the two.
I have cobbled together something that should assign the appropriate scans for each field map based on the acquisition times, but I have a list of the absolute paths to the selected scan files. Do you know of a way to convert the absolute path to the necessary relative path with
@tsalo I’m not sure there is a grabbids function for that - what I have been doing is splitting the path I defined as the root of my project.
base = '/path/to/root'
rel_fmap = [x.split(base)[-1] for x in fieldmaps] # where fieldmaps is list of abspaths
Thanks. That works.
I’ve created a gist that adds the “IntendedFor” field to the fmap jsons based on acquisition time. I’ve tested it out on a couple of subjects, but I don’t know how well it will work on others. I’ll try to convert it to a real function at some point.