Dcm2bids trouble with duplicates

Hi all, I’ve been using dcm2bids to process some functional and structural MRI data, and I’ve been having trouble with duplicates. For some participants we have duplicate scans (e.g. if the scanner had to be stopped and restarted half way through an acquisition), so I’ve included the “dup_method” command in the config json file.

dcm2bids appends ‘run-X’ to the file if it finds duplicates. From the docs:

“dup_method”: “run”
run is the default behavior and will add ‘_run-’ to the customEntities of the acquisition if it finds duplicate destination roots.

The issue is that we’ve got two functional runs, which I’ve labelled as ‘run-01’ and ‘run-02’ in the “custom_entities” field in the config. In the example dataset I’m working on at the moment, the first run was restarted so there are two ‘run 1’ files.

So when I run dcm2bids, I end up with the two duplicate acquisitions for the first functional run (i.e. the false start and the real first run) getting labelled as ‘run-01’ and ‘run-02’, while my actual run 2 gets lost into the ether:

sub-01_task-facehouse_acq-LC_dir-PA_run-01_bold.nii.gz (false start)
sub-01_task-facehouse_acq-LC_dir-PA_run-01_bold.json (false start)
sub-01_task-facehouse_acq-LC_dir-PA_run-02_bold.nii.gz (actually run 1)
sub-01_task-facehouse_acq-LC_dir-PA_run-02_bold.json (actually run 1)

dcm2bids also displays a warning showing that it has renamed my files:

Filename was reordered according to BIDS entity table order:
from:   sub-01_task-facehouse_acq-LC_dir-PA_run-01_run-02_bold
to:     sub-01_task-facehouse_acq-LC_dir-PA_run-02_bold

I’ve tried using “dup_method”: “dup” in the config file, but the exact same thing happens.

Is there any way I can suppress the renaming of files, or get it to add “duplicate” or something other than “run”?


Hi @Tom and welcome to neurostars!

What if you do acq-1/2 in the custom entities specification to separate your first and second scan, and let the run-<> label handle duplicates?


Hi Steven

Thanks for your reply!

Yes that seems to work… it’s now labelled the duplicates as ‘run-01’ and ‘run-02’, and my actual runs are identified in the acq field.

While I’m here - I’m not sure what the difference is between "dup_method":"run" and "dup_method":"dup" - I’ve tried both methods (using acq to label the runs) and they seems to produce identical outputs



Hi @Tom,

That is explained here, but I think should be doing what you think it does (that it, add dup-<> to file names): Use advanced commands - dcm2bids documentation

I don’t know why it is not working for you, but at the very least, dup-<> is not a BIDS-valid label anyway, so maybe it’s for the best it didn’t work!