Skip to content

Commit f113da1

Browse files
committed
RF: reduce duplication and log at DEBUG what was our assumption when we extracted sequence_name
1 parent 5c329be commit f113da1

File tree

1 file changed

+13
-9
lines changed

1 file changed

+13
-9
lines changed

heudiconv/dicoms.py

Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -94,15 +94,19 @@ def create_seqinfo(
9494
series_desc = get_typed_attr(dcminfo, "SeriesDescription", str, "")
9595
protocol_name = get_typed_attr(dcminfo, "ProtocolName", str, "")
9696

97-
if dcminfo.get([0x18, 0x24]):
98-
# GE and Philips
99-
sequence_name = dcminfo[0x18, 0x24].value
100-
elif dcminfo.get([0x19, 0x109C]):
101-
# Siemens
102-
sequence_name = dcminfo[0x19, 0x109C].value
103-
elif dcminfo.get([0x18, 0x9005]):
104-
# Siemens XA
105-
sequence_name = dcminfo[0x18, 0x9005].value
97+
for k, m in (
98+
([0x18, 0x24], "GE and Philips"),
99+
([0x19, 0x109C], "Siemens"),
100+
([0x18, 0x9005], "Siemens XA"),
101+
):
102+
if v := dcminfo.get(k):
103+
sequence_name = v.value
104+
lgr.debug(
105+
"Identified sequence name as %s coming from the %r family of MR scanners",
106+
sequence_name,
107+
m,
108+
)
109+
break
106110
else:
107111
sequence_name = ""
108112

0 commit comments

Comments
 (0)