Skip to content

Commit 254b383

Browse files
authored
BF: change comparison > 1 not >=1 for deciding multi-echo (#339) (+some pythonic styling)
Merge pull request #339 from dartmouth-pbs/bf-multiecho
2 parents f1d3d09 + ea9c672 commit 254b383

File tree

1 file changed

+7
-12
lines changed

1 file changed

+7
-12
lines changed

heudiconv/convert.py

Lines changed: 7 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -506,19 +506,14 @@ def save_converted_files(res, item_dicoms, bids, outtype, prefix, outname_bids,
506506
# series. To do that, the most straightforward way is to read the
507507
# echo times for all bids_files and see if they are all the same or not.
508508

509-
# Check for echotime information
510-
echo_times = set()
509+
# Check for varying echo times
510+
echo_times = set(
511+
load_json(b).get('EchoTime', None)
512+
for b in bids_files
513+
if b
514+
)
511515

512-
for bids_file in bids_files:
513-
if bids_file:
514-
# check for varying EchoTimes
515-
echot = load_json(bids_file).get('EchoTime', None)
516-
if echot is not None:
517-
echo_times.add(echot)
518-
519-
# To see if the echo times are the same, convert it to a set and see if
520-
# only one remains:
521-
is_multiecho = len(echo_times) >= 1 if echo_times else False
516+
is_multiecho = len(echo_times) > 1
522517

523518
### Loop through the bids_files, set the output name and save files
524519
for fl, suffix, bids_file in zip(res_files, suffixes, bids_files):

0 commit comments

Comments
 (0)