Skip to content

Commit 2f3a7d2

Browse files
committed
ENH: issue a warning when number of suffixes isnt twice the number of echoes
1 parent 0eb5fbd commit 2f3a7d2

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

heudiconv/convert.py

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -550,7 +550,14 @@ def save_converted_files(res, item_dicoms, bids_options, outtype, prefix, outnam
550550
# _sbref sequences reconstructing magnitude and phase generate
551551
# two NIfTI files IN THE SAME SERIES, so we cannot just add
552552
# the suffix, if we want to be bids compliant:
553-
if bids_file and this_prefix_basename.endswith('_sbref') and len(suffixes)>len(echo_times):
553+
if bids_file and this_prefix_basename.endswith('_sbref') \
554+
and len(suffixes) > len(echo_times):
555+
if len(suffixes) != len(echo_times)*2:
556+
lgr.warning(
557+
"Got %d suffixes for %d echo times, which isn't "
558+
"multiple of two as if it was magnitude + phase pairs",
559+
len(suffixes), len(echo_times)
560+
)
554561
# Check to see if it is magnitude or phase reconstruction:
555562
if 'M' in fileinfo.get('ImageType'):
556563
mag_or_phase = 'magnitude'

0 commit comments

Comments
 (0)