@@ -319,6 +319,8 @@ def update_multiecho_name(metadata, filename, echo_times):
319
319
if any (ut in filename for ut in unsupported_types ):
320
320
return filename
321
321
322
+ assert isinstance (echo_times , list ), 'Argument "echo_times" must be a list.'
323
+
322
324
# Get the EchoNumber from json file info. If not present, use EchoTime
323
325
if 'EchoNumber' in metadata .keys ():
324
326
echo_number = metadata ['EchoNumber' ]
@@ -364,6 +366,8 @@ def update_uncombined_name(metadata, filename, channel_names):
364
366
if any (ut in filename for ut in unsupported_types ):
365
367
return filename
366
368
369
+ assert isinstance (channel_names , list ), 'Argument "channel_names" must be a list.'
370
+
367
371
# Determine the channel number
368
372
channel_number = '' .join ([c for c in metadata ['CoilString' ] if c .isdigit ()])
369
373
if not channel_number :
@@ -696,6 +700,8 @@ def save_converted_files(res, item_dicoms, bids_options, outtype, prefix, outnam
696
700
is_multiecho = len (set (filter (bool , echo_times ))) > 1 # Check for varying echo times
697
701
is_uncombined = len (set (filter (bool , channel_names ))) > 1 # Check for uncombined data
698
702
is_complex = 'M' in image_types and 'P' in image_types # Determine if data are complex (magnitude + phase)
703
+ echo_times = sorted (echo_times ) # also converts to list
704
+ channel_names = sorted (channel_names ) # also converts to list
699
705
700
706
### Loop through the bids_files, set the output name and save files
701
707
for fl , suffix , bids_file , bids_meta in zip (res_files , suffixes , bids_files , bids_metas ):
0 commit comments