nipy / heudiconv

Flexible DICOM conversion into structured directory layouts
https://heudiconv.readthedocs.io
Other
234 stars 125 forks source link

Inconsistent behavior when there shouldn't be several study UIDs #683

Open neurorepro opened 1 year ago

neurorepro commented 1 year ago

When they are several study UIDs, using the --files options only displays a warning which can be missed by the user in the output and heudiconv semi-silently skip converting files (no errors):

heudiconv -o outdir --files indir -f convertall -s s01 -c none

https://github.com/nipy/heudiconv/blob/f4e4896bba90c31c468f59cea03cfa273c79fe29/heudiconv/parser.py#L281-L290

While in the case of using the -d option, it generates an error:

heudiconv -d indir/*/*/*.dcm -o outdir -f convertall -s s01 -c none

https://github.com/nipy/heudiconv/blob/f4e4896bba90c31c468f59cea03cfa273c79fe29/heudiconv/dicoms.py#L293-L300

This behavior difference is mentioned by MG as a comment in the code mentioned above:

MG - should this blow up to mimic -d invocation?

I suggest to also throw an error instead of a simple warning when using --files so that the behavior is consistent with -d, as per #682