Skip to content

Commit 4efc525

Browse files
committed
tst: add single dicom and test for CSA header
1 parent 73c8e9f commit 4efc525

File tree

2 files changed

+25
-0
lines changed

2 files changed

+25
-0
lines changed

tests/data/axasc35.dcm

374 KB
Binary file not shown.

tests/test_dicoms.py

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
import os.path as op
2+
3+
import pytest
4+
5+
from heudiconv.external.pydicom import dcm
6+
from heudiconv.cli.run import main as runner
7+
from heudiconv.dicoms import parse_private_csa_header
8+
from .utils import TESTS_DATA_PATH
9+
10+
# Public: Private DICOM tags
11+
DICOM_FIELDS_TO_TEST = {
12+
'ProtocolName': 'tProtocolName'
13+
}
14+
15+
def test_private_csa_header(tmpdir):
16+
dcm_file = op.join(TESTS_DATA_PATH, 'axasc35.dcm')
17+
dcm_data = dcm.read_file(dcm_file)
18+
for pub, priv in DICOM_FIELDS_TO_TEST.items():
19+
# ensure missing public tag
20+
with pytest.raises(AttributeError):
21+
dcm.pub
22+
# ensure private tag is found
23+
assert parse_private_csa_header(dcm_data, pub, priv) != ''
24+
# and quickly run heudiconv with no conversion
25+
runner(['--files', dcm_file, '-c' 'none', '-f', 'reproin'])

0 commit comments

Comments
 (0)