Help to adjust intendedFor using "post_op" in dcm2bids conf file


I am using dcm2bids to output BIDS format for fMRI prep. The intededFor in the fieldmaps that dcm2bids outputs start with bids::sub-xxx text that needs to be removed to make it work with fMRIprep. I am trying something like this in the beginning of the dcm2bids conf file but it clearly wrong:

“post_op”: [
“cmd”: “sed ‘s/bids::sub-…//g’ src_file dst_file”,
“datatype”: “fmap”,
“suffix”: [ “magnitude1”, “phasediff”]

This should also only work on the .json files, but it attempts to work on the image files as well


Hi @julian1 ,

You are right this operation works only on nifti files and has no impact on json files.
I would suggest you to run your sed command on all json files after the dcm2bids conversion.

You could also send a message to the fmriPrep and nipreps community so it can be fixed asap (see issue)


Thanks, than I know. The workaround is easy, but less elegant :grinning:

I agree but It doesn’t feel right to add this feature (post-op for json files) when this use case should be fixed in fmriPrep/nipreps in the first place. :man_shrugging: :see_no_evil: