Skip to content

Commit 82aff23

Browse files
authored
Merge pull request #250 from InstitutoDOr/master
Sort file names whenever multiple are generated by dcm2niix Trying to solve issue #249.
2 parents 37301b9 + a75167b commit 82aff23

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

heudiconv/convert.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -454,6 +454,7 @@ def save_converted_files(res, item_dicoms, bids, outtype, prefix, outname_bids,
454454
safe_copyfile(res.outputs.bvals, outname_bvals, overwrite)
455455

456456
if isinstance(res_files, list):
457+
res_files = sorted(res_files)
457458
# we should provide specific handling for fmap,
458459
# dwi etc which might spit out multiple files
459460

@@ -469,7 +470,7 @@ def save_converted_files(res, item_dicoms, bids, outtype, prefix, outname_bids,
469470

470471
# Also copy BIDS files although they might need to
471472
# be merged/postprocessed later
472-
bids_files = (res.outputs.bids
473+
bids_files = sorted(res.outputs.bids
473474
if len(res.outputs.bids) == len(res_files)
474475
else [None] * len(res_files))
475476

0 commit comments

Comments
 (0)