Skip to content

Commit 383525d

Browse files
authored
Merge pull request #753 from UNFmontreal/fix/xa_pulse_seq_name
extract sequence_name from PulseSequenceName on Siemens XA** data
2 parents 8e2c81b + 9afeae9 commit 383525d

File tree

2 files changed

+24
-1
lines changed

2 files changed

+24
-1
lines changed

heudiconv/dicoms.py

+5-1
Original file line numberDiff line numberDiff line change
@@ -92,13 +92,17 @@ def create_seqinfo(
9292
image_type = get_typed_attr(dcminfo, "ImageType", tuple, ())
9393
is_moco = "MOCO" in image_type
9494
series_desc = get_typed_attr(dcminfo, "SeriesDescription", str, "")
95+
protocol_name = get_typed_attr(dcminfo, "ProtocolName", str, "")
9596

9697
if dcminfo.get([0x18, 0x24]):
9798
# GE and Philips
9899
sequence_name = dcminfo[0x18, 0x24].value
99100
elif dcminfo.get([0x19, 0x109C]):
100101
# Siemens
101102
sequence_name = dcminfo[0x19, 0x109C].value
103+
elif dcminfo.get([0x18, 0x9005]):
104+
# Siemens XA
105+
sequence_name = dcminfo[0x18, 0x9005].value
102106
else:
103107
sequence_name = ""
104108

@@ -133,7 +137,7 @@ def create_seqinfo(
133137
dim4=size[3],
134138
TR=TR,
135139
TE=TE,
136-
protocol_name=dcminfo.ProtocolName,
140+
protocol_name=protocol_name,
137141
is_motion_corrected=is_moco,
138142
is_derived="derived" in [x.lower() for x in image_type],
139143
patient_id=dcminfo.get("PatientID"),

heudiconv/tests/test_dicoms.py

+19
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@
1212
from heudiconv.cli.run import main as runner
1313
from heudiconv.convert import nipype_convert
1414
from heudiconv.dicoms import (
15+
create_seqinfo,
16+
dw,
1517
embed_dicom_and_nifti_metadata,
1618
get_datetime_from_dcm,
1719
get_reproducible_int,
@@ -178,6 +180,23 @@ def test_get_datetime_from_dcm_wo_dt() -> None:
178180
assert get_datetime_from_dcm(XA30_enhanced_dcm) is None
179181

180182

183+
dicom_test_data = [
184+
(dw.wrapper_from_file(d_file), [d_file], op.basename(d_file))
185+
for d_file in glob(op.join(TESTS_DATA_PATH, "*.dcm"))
186+
]
187+
188+
189+
@pytest.mark.parametrize("mw,series_files,series_id", dicom_test_data)
190+
def test_create_seqinfo(
191+
mw: dw.Wrapper,
192+
series_files: list[str],
193+
series_id: str,
194+
) -> None:
195+
seqinfo = create_seqinfo(mw, series_files, series_id)
196+
assert seqinfo.sequence_name != ""
197+
pass
198+
199+
181200
def test_get_reproducible_int() -> None:
182201
dcmfile = op.join(TESTS_DATA_PATH, "phantom.dcm")
183202

0 commit comments

Comments
 (0)