heudiconv
heudiconv copied to clipboard
Adding values to .json sidecar directly (streamline fmap `intendedFor`)
While trying to set up fieldmaps, I'd like to assign a fieldmap to a specific run using the IntendedFor
value in the sidecar json metadata (e.g. BIDS Spec 8.3.5). In the cmmr_heuristic we get close, with the file and acquisition labeled correclty with logic comparing subsequent scans:
if (s.dim4 == 1) and ('rfMRI_REST_AP' in s.protocol_name):
if seqinfo[idx + 1][9] != 420:
continue
info[fmap_rest].append({'item': s.series_id, 'dir': 'AP', 'acq': ''})
In this example, it would be great to add the rest scan as a fieldmap target, e.g. the next sequence's series id / path to the IntendedFor
field in the json sidecar. As far as I can tell, however, there's no direct access to the json data, only the seqinfo dict, which has already been abstracted.
Is there currently a way to do this without re-engineering the whole seqinfo mechanism to handle metadata json attributes? Or, maybe it wouldn't be too terrible to include a json_metadata optional dict that is used to update the json later? One could certainly go through after the fact and edit them, but it would be great to have all the logic together in one file.
Either way, heudiconv has definitely matured since the last time I looked at it. Thanks for your continued work!
We worth adding passing custom fields for sidecar files in bids mode from the geriatric. Afaik it is not readily available, but I could be wrong
for siemens scanners intendedfor can be added quite easily based on shim comparison. i think @mgxd was going to add this in a postprocessing step and after ensuring the shim is extracted in the header.
Yep, I included the example to show that the logic for IntendedFor
is relatively straightforward and already in place; it's just the execution of getting it into the sidecar that I'm confused about.
I could possibly see adding extra custom metadata getting a little wonky due to order, because in this case the "full path" of the target rest hasn't been sniffed out by the loop, though that's not really a problem since you could specify it in this particular heuristic since you know what it will be.
Hi - is there any further guidance on how to accomplish this? We use a Siemens scanner.. Thanks!
Here is the file we use at our center. Feel free to use if you find it useful.