dicom-validator 0.7.1__tar.gz → 0.7.2__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {dicom_validator-0.7.1 → dicom_validator-0.7.2}/PKG-INFO +2 -2
- dicom_validator-0.7.2/dicom_validator/__init__.py +1 -0
- {dicom_validator-0.7.1 → dicom_validator-0.7.2}/dicom_validator/dump_dcm_info.py +1 -1
- {dicom_validator-0.7.1 → dicom_validator-0.7.2}/dicom_validator/spec_reader/condition.py +10 -10
- {dicom_validator-0.7.1 → dicom_validator-0.7.2}/dicom_validator/spec_reader/condition_grammar.py +2 -2
- {dicom_validator-0.7.1 → dicom_validator-0.7.2}/dicom_validator/spec_reader/condition_parser.py +4 -4
- {dicom_validator-0.7.1 → dicom_validator-0.7.2}/dicom_validator/spec_reader/enum_parser.py +6 -6
- {dicom_validator-0.7.1 → dicom_validator-0.7.2}/dicom_validator/spec_reader/part3_reader.py +11 -6
- {dicom_validator-0.7.1 → dicom_validator-0.7.2}/dicom_validator/spec_reader/part4_reader.py +1 -1
- {dicom_validator-0.7.1 → dicom_validator-0.7.2}/dicom_validator/spec_reader/part6_reader.py +1 -1
- {dicom_validator-0.7.1 → dicom_validator-0.7.2}/dicom_validator/spec_reader/serializer.py +1 -1
- {dicom_validator-0.7.1 → dicom_validator-0.7.2}/dicom_validator/tests/spec_reader/conftest.py +1 -1
- {dicom_validator-0.7.1 → dicom_validator-0.7.2}/dicom_validator/tests/spec_reader/test_condition.py +8 -8
- {dicom_validator-0.7.1 → dicom_validator-0.7.2}/dicom_validator/tests/spec_reader/test_edition_reader.py +1 -1
- {dicom_validator-0.7.1 → dicom_validator-0.7.2}/dicom_validator/tests/spec_reader/test_enum_parser.py +2 -1
- {dicom_validator-0.7.1 → dicom_validator-0.7.2}/dicom_validator/tests/spec_reader/test_part3_reader.py +29 -11
- {dicom_validator-0.7.1 → dicom_validator-0.7.2}/dicom_validator/tests/spec_reader/test_part6_reader.py +1 -1
- {dicom_validator-0.7.1 → dicom_validator-0.7.2}/dicom_validator/tests/test_cmdline_tools.py +1 -1
- {dicom_validator-0.7.1 → dicom_validator-0.7.2}/dicom_validator/tests/validator/conftest.py +1 -1
- {dicom_validator-0.7.1 → dicom_validator-0.7.2}/dicom_validator/tests/validator/test_iod_validator_func_groups.py +3 -1
- {dicom_validator-0.7.1 → dicom_validator-0.7.2}/dicom_validator/validator/iod_validator.py +7 -2
- {dicom_validator-0.7.1 → dicom_validator-0.7.2}/dicom_validator.egg-info/PKG-INFO +2 -2
- {dicom_validator-0.7.1 → dicom_validator-0.7.2}/dicom_validator.egg-info/requires.txt +1 -1
- {dicom_validator-0.7.1 → dicom_validator-0.7.2}/pyproject.toml +1 -1
- dicom_validator-0.7.1/dicom_validator/__init__.py +0 -1
- {dicom_validator-0.7.1 → dicom_validator-0.7.2}/LICENSE +0 -0
- {dicom_validator-0.7.1 → dicom_validator-0.7.2}/README.md +0 -0
- {dicom_validator-0.7.1 → dicom_validator-0.7.2}/dicom_validator/spec_reader/__init__.py +0 -0
- {dicom_validator-0.7.1 → dicom_validator-0.7.2}/dicom_validator/spec_reader/edition_reader.py +0 -0
- {dicom_validator-0.7.1 → dicom_validator-0.7.2}/dicom_validator/spec_reader/spec_reader.py +0 -0
- {dicom_validator-0.7.1 → dicom_validator-0.7.2}/dicom_validator/tag_tools.py +0 -0
- {dicom_validator-0.7.1 → dicom_validator-0.7.2}/dicom_validator/tests/__init__.py +0 -0
- {dicom_validator-0.7.1 → dicom_validator-0.7.2}/dicom_validator/tests/spec_reader/__init__.py +0 -0
- {dicom_validator-0.7.1 → dicom_validator-0.7.2}/dicom_validator/tests/spec_reader/test_condition_parser.py +0 -0
- {dicom_validator-0.7.1 → dicom_validator-0.7.2}/dicom_validator/tests/spec_reader/test_part4_reader.py +0 -0
- {dicom_validator-0.7.1 → dicom_validator-0.7.2}/dicom_validator/tests/spec_reader/test_spec_reader.py +0 -0
- {dicom_validator-0.7.1 → dicom_validator-0.7.2}/dicom_validator/tests/utils.py +0 -0
- {dicom_validator-0.7.1 → dicom_validator-0.7.2}/dicom_validator/tests/validator/__init__.py +0 -0
- {dicom_validator-0.7.1 → dicom_validator-0.7.2}/dicom_validator/tests/validator/test_dicom_file_validator.py +0 -0
- {dicom_validator-0.7.1 → dicom_validator-0.7.2}/dicom_validator/tests/validator/test_iod_validator.py +0 -0
- {dicom_validator-0.7.1 → dicom_validator-0.7.2}/dicom_validator/validate_iods.py +0 -0
- {dicom_validator-0.7.1 → dicom_validator-0.7.2}/dicom_validator/validator/__init__.py +0 -0
- {dicom_validator-0.7.1 → dicom_validator-0.7.2}/dicom_validator/validator/dicom_file_validator.py +0 -0
- {dicom_validator-0.7.1 → dicom_validator-0.7.2}/dicom_validator.egg-info/SOURCES.txt +0 -0
- {dicom_validator-0.7.1 → dicom_validator-0.7.2}/dicom_validator.egg-info/dependency_links.txt +0 -0
- {dicom_validator-0.7.1 → dicom_validator-0.7.2}/dicom_validator.egg-info/entry_points.txt +0 -0
- {dicom_validator-0.7.1 → dicom_validator-0.7.2}/dicom_validator.egg-info/top_level.txt +0 -0
- {dicom_validator-0.7.1 → dicom_validator-0.7.2}/setup.cfg +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: dicom-validator
|
|
3
|
-
Version: 0.7.
|
|
3
|
+
Version: 0.7.2
|
|
4
4
|
Summary: Python DICOM validator using input from DICOM specs in docbook format
|
|
5
5
|
Author-email: mrbean-bremen and contributors <hansemrbean@googlemail.com>
|
|
6
6
|
License: MIT
|
|
@@ -27,7 +27,7 @@ Classifier: Topic :: Scientific/Engineering :: Medical Science Apps.
|
|
|
27
27
|
Requires-Python: >=3.9
|
|
28
28
|
Description-Content-Type: text/markdown
|
|
29
29
|
License-File: LICENSE
|
|
30
|
-
Requires-Dist: pydicom
|
|
30
|
+
Requires-Dist: pydicom>=2.3
|
|
31
31
|
Requires-Dist: lxml
|
|
32
32
|
Requires-Dist: pyparsing>=3.2
|
|
33
33
|
Provides-Extra: dev
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
__version__ = "0.7.2"
|
|
@@ -62,7 +62,7 @@ class DataElementDumper:
|
|
|
62
62
|
value = value[: self.max_value_len] + "..."
|
|
63
63
|
|
|
64
64
|
indent = 2 * self.level
|
|
65
|
-
format_string = "{{}}{{}} {{:{}}} {{}} {{:4}} {{}} [{{}}]"
|
|
65
|
+
format_string = f"{{}}{{}} {{:{40 - indent}}} {{}} {{:4}} {{}} [{{}}]"
|
|
66
66
|
print(
|
|
67
67
|
format_string.format(
|
|
68
68
|
" " * indent, tag_id, name[: 40 - indent], vr, vm, prop, value
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import enum
|
|
2
|
-
from typing import Optional,
|
|
2
|
+
from typing import Optional, Any, Union
|
|
3
3
|
|
|
4
4
|
from dicom_validator.tag_tools import tag_name_from_id
|
|
5
5
|
|
|
6
6
|
|
|
7
|
-
ValuesType =
|
|
7
|
+
ValuesType = list[Union[str, int]]
|
|
8
8
|
|
|
9
9
|
|
|
10
10
|
class ConditionType(str, enum.Enum): # replace later with StrEnum from Python 3.11
|
|
@@ -132,8 +132,8 @@ class Condition:
|
|
|
132
132
|
self.tag = tag
|
|
133
133
|
self.index = index
|
|
134
134
|
self.values: ValuesType = values or []
|
|
135
|
-
self.and_conditions:
|
|
136
|
-
self.or_conditions:
|
|
135
|
+
self.and_conditions: list[Condition] = []
|
|
136
|
+
self.or_conditions: list[Condition] = []
|
|
137
137
|
self.other_condition: Optional[Condition] = None
|
|
138
138
|
|
|
139
139
|
def __repr__(self):
|
|
@@ -162,7 +162,7 @@ class Condition:
|
|
|
162
162
|
|
|
163
163
|
@classmethod
|
|
164
164
|
def read_condition(
|
|
165
|
-
cls, condition_dict:
|
|
165
|
+
cls, condition_dict: dict, condition: Optional["Condition"] = None
|
|
166
166
|
) -> "Condition":
|
|
167
167
|
"""Create or update a Condition object from a condition dict.
|
|
168
168
|
Parameters
|
|
@@ -194,14 +194,14 @@ class Condition:
|
|
|
194
194
|
condition.other_condition.type = condition_dict["other_cond"].get("type")
|
|
195
195
|
return condition
|
|
196
196
|
|
|
197
|
-
def
|
|
197
|
+
def result_dict(self) -> dict[str, Any]:
|
|
198
198
|
result = {"type": self.type}
|
|
199
199
|
result.update(self.write_condition(self))
|
|
200
200
|
return result
|
|
201
201
|
|
|
202
202
|
@classmethod
|
|
203
|
-
def write_condition(cls, condition: "Condition") ->
|
|
204
|
-
result:
|
|
203
|
+
def write_condition(cls, condition: "Condition") -> dict[str, Any]:
|
|
204
|
+
result: dict[str, Any] = {}
|
|
205
205
|
if condition.operator is not None:
|
|
206
206
|
result["op"] = condition.operator
|
|
207
207
|
if condition.tag is not None:
|
|
@@ -218,10 +218,10 @@ class Condition:
|
|
|
218
218
|
for or_condition in condition.or_conditions:
|
|
219
219
|
result["or"].append(cls.write_condition(or_condition))
|
|
220
220
|
if condition.other_condition is not None:
|
|
221
|
-
result["other_cond"] = condition.other_condition.
|
|
221
|
+
result["other_cond"] = condition.other_condition.result_dict()
|
|
222
222
|
return result
|
|
223
223
|
|
|
224
|
-
def to_string(self, dict_info:
|
|
224
|
+
def to_string(self, dict_info: dict) -> str:
|
|
225
225
|
"""Return a condition readable as part of a sentence."""
|
|
226
226
|
result = ""
|
|
227
227
|
if self.and_conditions:
|
{dicom_validator-0.7.1 → dicom_validator-0.7.2}/dicom_validator/spec_reader/condition_grammar.py
RENAMED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import string
|
|
2
2
|
from re import RegexFlag
|
|
3
|
-
from typing import
|
|
3
|
+
from typing import Optional
|
|
4
4
|
from urllib.parse import ParseResult
|
|
5
5
|
|
|
6
6
|
from pyparsing import (
|
|
@@ -479,7 +479,7 @@ class ConditionGrammar:
|
|
|
479
479
|
group, element = tag[1:-1].split(",")
|
|
480
480
|
return (int(group, 16) << 16) + int(element, 16)
|
|
481
481
|
|
|
482
|
-
def _tag_from_expression(self, tag_expr: ParseResult) ->
|
|
482
|
+
def _tag_from_expression(self, tag_expr: ParseResult) -> tuple[str, int]:
|
|
483
483
|
def is_index(item):
|
|
484
484
|
return len(item) == 1 and item.isnumeric()
|
|
485
485
|
|
{dicom_validator-0.7.1 → dicom_validator-0.7.2}/dicom_validator/spec_reader/condition_parser.py
RENAMED
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
from typing import Dict
|
|
2
|
-
|
|
3
1
|
from pyparsing import ParseException
|
|
4
2
|
|
|
5
3
|
from dicom_validator.spec_reader.condition import (
|
|
@@ -21,7 +19,7 @@ class ConditionParser:
|
|
|
21
19
|
other data sets) are ignored.
|
|
22
20
|
"""
|
|
23
21
|
|
|
24
|
-
def __init__(self, dict_info:
|
|
22
|
+
def __init__(self, dict_info: dict) -> None:
|
|
25
23
|
self._dict_info = dict_info
|
|
26
24
|
self._uid_dict_info = {}
|
|
27
25
|
for tag, info in dict_info.items():
|
|
@@ -40,7 +38,9 @@ class ConditionParser:
|
|
|
40
38
|
"""
|
|
41
39
|
cache_key = condition_str
|
|
42
40
|
if not debug and cache_key in self._condition_cache:
|
|
43
|
-
return Condition.read_condition(
|
|
41
|
+
return Condition.read_condition(
|
|
42
|
+
self._condition_cache[cache_key].result_dict()
|
|
43
|
+
)
|
|
44
44
|
|
|
45
45
|
condition = self._parse_with_grammar(condition_str, self._grammar, debug)
|
|
46
46
|
if not debug:
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import re
|
|
2
|
-
from typing import Callable, Optional,
|
|
2
|
+
from typing import Callable, Optional, Any
|
|
3
3
|
|
|
4
4
|
from pydicom.valuerep import VR, INT_VR, STR_VR
|
|
5
5
|
|
|
@@ -21,9 +21,9 @@ class EnumParser:
|
|
|
21
21
|
self, find_section: Callable[[str], Optional[ElementTree.Element]]
|
|
22
22
|
) -> None:
|
|
23
23
|
self._find_section = find_section
|
|
24
|
-
self._enum_cache:
|
|
24
|
+
self._enum_cache: dict[str, dict] = {}
|
|
25
25
|
|
|
26
|
-
def parse(self, node: ElementTree.Element, vr: VR) ->
|
|
26
|
+
def parse(self, node: ElementTree.Element, vr: VR) -> list[dict]:
|
|
27
27
|
"""Searches for enumerated values in the tag description and in linked sections.
|
|
28
28
|
Returns a list of the allowed values, or an empty list if none found.
|
|
29
29
|
"""
|
|
@@ -56,7 +56,7 @@ class EnumParser:
|
|
|
56
56
|
# any other VR does not make sense here
|
|
57
57
|
return []
|
|
58
58
|
|
|
59
|
-
def parse_variable_list(self, var_list) ->
|
|
59
|
+
def parse_variable_list(self, var_list) -> dict:
|
|
60
60
|
# we assume that a variablelist contains enumerated values or defined terms
|
|
61
61
|
# we ignore defined terms, as they do not limit the possible values
|
|
62
62
|
title = var_list.find(self.docbook_ns + "title")
|
|
@@ -75,7 +75,7 @@ class EnumParser:
|
|
|
75
75
|
term = item.find(self.docbook_ns + "term")
|
|
76
76
|
if term is not None:
|
|
77
77
|
terms.append(term.text)
|
|
78
|
-
result:
|
|
78
|
+
result: dict[str, Any] = {}
|
|
79
79
|
if terms:
|
|
80
80
|
result["val"] = terms
|
|
81
81
|
if index > 0:
|
|
@@ -83,7 +83,7 @@ class EnumParser:
|
|
|
83
83
|
|
|
84
84
|
return result
|
|
85
85
|
|
|
86
|
-
def parse_linked_variablelist(self, node) ->
|
|
86
|
+
def parse_linked_variablelist(self, node) -> dict:
|
|
87
87
|
for xref in node.findall(f"{self.docbook_ns}para/{self.docbook_ns}xref"):
|
|
88
88
|
link = xref.attrib.get("linkend")
|
|
89
89
|
if link and link.startswith("sect_"):
|
|
@@ -8,7 +8,6 @@ import logging
|
|
|
8
8
|
from itertools import groupby
|
|
9
9
|
|
|
10
10
|
import sys
|
|
11
|
-
from typing import Dict
|
|
12
11
|
|
|
13
12
|
from dicom_validator.spec_reader.condition import (
|
|
14
13
|
Condition,
|
|
@@ -28,14 +27,14 @@ from dicom_validator.spec_reader.spec_reader import (
|
|
|
28
27
|
# Instead of implementing a full parser for these cases, we may define them here.
|
|
29
28
|
# CAUTION: The same tag may appear with different conditions in different contexts
|
|
30
29
|
# (different sequences), which will not be handled automatically by SPECIAL_CASES
|
|
31
|
-
SPECIAL_CASES:
|
|
30
|
+
SPECIAL_CASES: dict[str, Condition] = {}
|
|
32
31
|
|
|
33
32
|
|
|
34
33
|
class Part3Reader(SpecReader):
|
|
35
34
|
"""Reads information from PS3.3 in docbook format."""
|
|
36
35
|
|
|
37
36
|
def __init__(self, spec_dir, dict_info):
|
|
38
|
-
super(
|
|
37
|
+
super().__init__(spec_dir)
|
|
39
38
|
self.part_nr = 3
|
|
40
39
|
self._dict_info = dict_info
|
|
41
40
|
self._iod_descriptions = {}
|
|
@@ -140,7 +139,7 @@ class Part3Reader(SpecReader):
|
|
|
140
139
|
nodes_with_subnodes = []
|
|
141
140
|
for iod_node in all_iod_nodes:
|
|
142
141
|
sub_nodes = self._find_sections_with_title_endings(
|
|
143
|
-
iod_node, iod_def_endings
|
|
142
|
+
iod_node, iod_def_endings, depth=2
|
|
144
143
|
)
|
|
145
144
|
if sub_nodes:
|
|
146
145
|
nodes_with_subnodes.append(iod_node)
|
|
@@ -386,13 +385,13 @@ class Part3Reader(SpecReader):
|
|
|
386
385
|
def _get_functional_group_macros(self, iod_node):
|
|
387
386
|
macros = {}
|
|
388
387
|
group_macro_sections = self._find_sections_with_title_endings(
|
|
389
|
-
iod_node, (" Functional Group Macros",)
|
|
388
|
+
iod_node, (" Functional Group Macros",), depth=1
|
|
390
389
|
)
|
|
391
390
|
if len(group_macro_sections) == 1:
|
|
392
391
|
macros = self._collect_modules(group_macro_sections[0], check_rowspan=False)
|
|
393
392
|
return macros
|
|
394
393
|
|
|
395
|
-
def _find_sections_with_title_endings(self, node, title_endings):
|
|
394
|
+
def _find_sections_with_title_endings(self, node, title_endings, depth=0):
|
|
396
395
|
section_nodes = self._findall(node, ["section"])
|
|
397
396
|
found_nodes = []
|
|
398
397
|
for sections_node in section_nodes:
|
|
@@ -403,4 +402,10 @@ class Part3Reader(SpecReader):
|
|
|
403
402
|
[title.endswith(title_ending) for title_ending in title_endings]
|
|
404
403
|
):
|
|
405
404
|
found_nodes.append(sections_node)
|
|
405
|
+
if depth > 0:
|
|
406
|
+
found_nodes.extend(
|
|
407
|
+
self._find_sections_with_title_endings(
|
|
408
|
+
sections_node, title_endings, depth=depth - 1
|
|
409
|
+
)
|
|
410
|
+
)
|
|
406
411
|
return found_nodes
|
|
@@ -15,7 +15,7 @@ class Part4Reader(SpecReader):
|
|
|
15
15
|
"""Reads information from PS3.4 in docbook format."""
|
|
16
16
|
|
|
17
17
|
def __init__(self, spec_dir):
|
|
18
|
-
super(
|
|
18
|
+
super().__init__(spec_dir)
|
|
19
19
|
self.part_nr = 4
|
|
20
20
|
self._sop_class_uids = {} # SOP Class UID --> chapter
|
|
21
21
|
self._chapters = {} # chapter --> SOP Class UID list
|
|
@@ -11,7 +11,7 @@ class Part6Reader(SpecReader):
|
|
|
11
11
|
"""Reads information from PS3.4 in docbook format."""
|
|
12
12
|
|
|
13
13
|
def __init__(self, spec_dir):
|
|
14
|
-
super(
|
|
14
|
+
super().__init__(spec_dir)
|
|
15
15
|
self.part_nr = 6
|
|
16
16
|
self._uids = None
|
|
17
17
|
self._data_elements = None
|
{dicom_validator-0.7.1 → dicom_validator-0.7.2}/dicom_validator/tests/spec_reader/test_condition.py
RENAMED
|
@@ -91,7 +91,7 @@ class TestConditionRead:
|
|
|
91
91
|
)
|
|
92
92
|
|
|
93
93
|
condition = test_condition()
|
|
94
|
-
cond_dict = condition.
|
|
94
|
+
cond_dict = condition.result_dict()
|
|
95
95
|
test_condition()
|
|
96
96
|
assert (
|
|
97
97
|
condition.to_string(dict_info) == 'Dose Summation Type is equal to "BEAM", '
|
|
@@ -117,7 +117,7 @@ class TestConditionRead:
|
|
|
117
117
|
)
|
|
118
118
|
|
|
119
119
|
condition = test_condition()
|
|
120
|
-
cond_dict = condition.
|
|
120
|
+
cond_dict = condition.result_dict()
|
|
121
121
|
test_condition()
|
|
122
122
|
assert condition.to_string(dict_info) == "Number of Frames is greater than 1"
|
|
123
123
|
|
|
@@ -140,7 +140,7 @@ class TestConditionRead:
|
|
|
140
140
|
)
|
|
141
141
|
|
|
142
142
|
condition = test_condition()
|
|
143
|
-
cond_dict = condition.
|
|
143
|
+
cond_dict = condition.result_dict()
|
|
144
144
|
test_condition()
|
|
145
145
|
assert condition.to_string(dict_info) == "Number of Frames is less than 20"
|
|
146
146
|
|
|
@@ -163,7 +163,7 @@ class TestConditionRead:
|
|
|
163
163
|
)
|
|
164
164
|
|
|
165
165
|
condition = test_condition()
|
|
166
|
-
cond_dict = condition.
|
|
166
|
+
cond_dict = condition.result_dict()
|
|
167
167
|
test_condition()
|
|
168
168
|
assert (
|
|
169
169
|
condition.to_string(dict_info) == "Frame Increment Pointer points to "
|
|
@@ -187,7 +187,7 @@ class TestConditionRead:
|
|
|
187
187
|
)
|
|
188
188
|
|
|
189
189
|
condition = test_condition()
|
|
190
|
-
cond_dict = condition.
|
|
190
|
+
cond_dict = condition.result_dict()
|
|
191
191
|
test_condition()
|
|
192
192
|
assert condition.to_string(dict_info) == "Pixel Data exists"
|
|
193
193
|
|
|
@@ -228,7 +228,7 @@ class TestConditionRead:
|
|
|
228
228
|
return cond
|
|
229
229
|
|
|
230
230
|
condition = test_condition()
|
|
231
|
-
cond_dict = condition.
|
|
231
|
+
cond_dict = condition.result_dict()
|
|
232
232
|
test_condition()
|
|
233
233
|
assert (
|
|
234
234
|
condition.to_string(dict_info)
|
|
@@ -259,7 +259,7 @@ class TestConditionRead:
|
|
|
259
259
|
return cond
|
|
260
260
|
|
|
261
261
|
condition = test_condition()
|
|
262
|
-
cond_dict = condition.
|
|
262
|
+
cond_dict = condition.result_dict()
|
|
263
263
|
test_condition()
|
|
264
264
|
assert (
|
|
265
265
|
condition.to_string(dict_info)
|
|
@@ -297,5 +297,5 @@ class TestConditionRead:
|
|
|
297
297
|
return cond
|
|
298
298
|
|
|
299
299
|
condition = test_condition()
|
|
300
|
-
cond_dict = condition.
|
|
300
|
+
cond_dict = condition.result_dict()
|
|
301
301
|
test_condition()
|
|
@@ -50,7 +50,7 @@ class TestReadPart3:
|
|
|
50
50
|
|
|
51
51
|
@pytest.mark.parametrize(
|
|
52
52
|
"revision,iod_name",
|
|
53
|
-
[("2015b", "Computed Tomography Image IOD"), ("
|
|
53
|
+
[("2015b", "Computed Tomography Image IOD"), ("2025c", "CT Image IOD")],
|
|
54
54
|
indirect=["revision"],
|
|
55
55
|
scope="session",
|
|
56
56
|
)
|
|
@@ -64,7 +64,7 @@ class TestReadPart3:
|
|
|
64
64
|
|
|
65
65
|
@pytest.mark.parametrize(
|
|
66
66
|
"revision,module_nr",
|
|
67
|
-
[("2015b", 27), ("
|
|
67
|
+
[("2015b", 27), ("2025c", 29)],
|
|
68
68
|
indirect=["revision"],
|
|
69
69
|
scope="session",
|
|
70
70
|
)
|
|
@@ -78,7 +78,7 @@ class TestReadPart3:
|
|
|
78
78
|
assert module["ref"] == "C.7.5.1"
|
|
79
79
|
assert module["use"] == "M"
|
|
80
80
|
|
|
81
|
-
@pytest.mark.parametrize("revision", ["2015b", "
|
|
81
|
+
@pytest.mark.parametrize("revision", ["2015b", "2025c"], indirect=True)
|
|
82
82
|
def test_optional_iod_module(self, reader):
|
|
83
83
|
description = reader.iod_description(chapter="A.38.1")
|
|
84
84
|
assert "modules" in description
|
|
@@ -90,7 +90,7 @@ class TestReadPart3:
|
|
|
90
90
|
|
|
91
91
|
@pytest.mark.parametrize(
|
|
92
92
|
"revision,desc_nr",
|
|
93
|
-
[("2015b", 110), ("
|
|
93
|
+
[("2015b", 110), ("2025c", 174)],
|
|
94
94
|
indirect=["revision"],
|
|
95
95
|
scope="session",
|
|
96
96
|
)
|
|
@@ -103,7 +103,7 @@ class TestReadPart3:
|
|
|
103
103
|
|
|
104
104
|
@pytest.mark.parametrize(
|
|
105
105
|
"revision,macro_nr",
|
|
106
|
-
[("2015b", 24), ("
|
|
106
|
+
[("2015b", 24), ("2025c", 28)],
|
|
107
107
|
indirect=["revision"],
|
|
108
108
|
scope="session",
|
|
109
109
|
)
|
|
@@ -135,9 +135,27 @@ class TestReadPart3:
|
|
|
135
135
|
assert condition.tag == "(0008,0008)"
|
|
136
136
|
assert condition.values == ["ORIGINAL", "MIXED"]
|
|
137
137
|
|
|
138
|
+
def test_nested_group_macros(self, reader):
|
|
139
|
+
descriptions = reader.iod_descriptions()
|
|
140
|
+
# the Ophthalmic Optical Coherence Tomography B-scan Volume Analysis IOD
|
|
141
|
+
# is found at a level below the usual one
|
|
142
|
+
macros = descriptions["A.84"]["group_macros"]
|
|
143
|
+
assert len(macros) == 9
|
|
144
|
+
|
|
145
|
+
# the RT Second Generation IODs are at a lower level than usual
|
|
146
|
+
assert "A.86.1.14" in descriptions
|
|
147
|
+
macros = descriptions["A.86.1.14"]["group_macros"]
|
|
148
|
+
assert not macros
|
|
149
|
+
assert "A.86.1.15" in descriptions
|
|
150
|
+
macros = descriptions["A.86.1.15"]["group_macros"]
|
|
151
|
+
assert len(macros) == 16
|
|
152
|
+
assert "A.86.1.16" in descriptions
|
|
153
|
+
macros = descriptions["A.86.1.16"]["group_macros"]
|
|
154
|
+
assert len(macros) == 16
|
|
155
|
+
|
|
138
156
|
@pytest.mark.parametrize(
|
|
139
157
|
"revision,desc_nr",
|
|
140
|
-
[("2015b", 9), ("
|
|
158
|
+
[("2015b", 9), ("2025c", 14)],
|
|
141
159
|
indirect=["revision"],
|
|
142
160
|
scope="session",
|
|
143
161
|
)
|
|
@@ -152,7 +170,7 @@ class TestReadPart3:
|
|
|
152
170
|
|
|
153
171
|
@pytest.mark.parametrize(
|
|
154
172
|
"revision,desc_nr, seq_desc_nr",
|
|
155
|
-
[("2015b", 3, 3), ("
|
|
173
|
+
[("2015b", 3, 3), ("2025c", 7, 4)],
|
|
156
174
|
indirect=["revision"],
|
|
157
175
|
scope="session",
|
|
158
176
|
)
|
|
@@ -183,7 +201,7 @@ class TestReadPart3:
|
|
|
183
201
|
|
|
184
202
|
@pytest.mark.parametrize(
|
|
185
203
|
"revision,desc_nr",
|
|
186
|
-
[("2015b",
|
|
204
|
+
[("2015b", 452), ("2025c", 667)],
|
|
187
205
|
indirect=["revision"],
|
|
188
206
|
scope="session",
|
|
189
207
|
)
|
|
@@ -193,7 +211,7 @@ class TestReadPart3:
|
|
|
193
211
|
|
|
194
212
|
@pytest.mark.parametrize(
|
|
195
213
|
"revision,include_nr",
|
|
196
|
-
[("2015b", 9), ("
|
|
214
|
+
[("2015b", 9), ("2025c", 10)],
|
|
197
215
|
indirect=["revision"],
|
|
198
216
|
scope="session",
|
|
199
217
|
)
|
|
@@ -226,7 +244,7 @@ class TestReadPart3:
|
|
|
226
244
|
assert enums == [{"val": ["FAILURE", "WARNING", "INFORMATIVE"]}]
|
|
227
245
|
|
|
228
246
|
@pytest.mark.parametrize(
|
|
229
|
-
"revision", ["2015b", "
|
|
247
|
+
"revision", ["2015b", "2025c"], indirect=True, scope="session"
|
|
230
248
|
)
|
|
231
249
|
def test_linked_enum_values(self, reader):
|
|
232
250
|
description = reader.module_description("10.24")
|
|
@@ -239,7 +257,7 @@ class TestReadPart3:
|
|
|
239
257
|
assert tag["enums"] == [{"val": ["CONTINUOUS", "TRIGGERED", "AUTOMATIC"]}]
|
|
240
258
|
|
|
241
259
|
@pytest.mark.parametrize(
|
|
242
|
-
"revision", ["2015b", "
|
|
260
|
+
"revision", ["2015b", "2025c"], indirect=True, scope="session"
|
|
243
261
|
)
|
|
244
262
|
def test_graphic_annotation_sequence(self, reader):
|
|
245
263
|
description = reader.module_description("C.10.5")
|
|
@@ -15,7 +15,7 @@ class TestPart6Reader:
|
|
|
15
15
|
|
|
16
16
|
def test_data_elements(self, dict_reader):
|
|
17
17
|
elements = dict_reader.data_elements()
|
|
18
|
-
assert len(elements) ==
|
|
18
|
+
assert len(elements) == 5250
|
|
19
19
|
|
|
20
20
|
def test_sop_class_uids(self, dict_reader):
|
|
21
21
|
sop_class_uids = dict_reader.sop_class_uids()
|
|
@@ -22,7 +22,7 @@ def dicom_fixture_path(fixture_path):
|
|
|
22
22
|
|
|
23
23
|
|
|
24
24
|
@pytest.mark.order(0)
|
|
25
|
-
@pytest.mark.parametrize("revision", ["2015b", "
|
|
25
|
+
@pytest.mark.parametrize("revision", ["2015b", "2025c"])
|
|
26
26
|
def test_validate_sr(revision, caplog, standard_path, dicom_fixture_path):
|
|
27
27
|
# test also for 2015b to test an issue causing an exception
|
|
28
28
|
rtdose_path = dicom_fixture_path / "rtdose.dcm"
|
|
@@ -166,7 +166,9 @@ class TestIODValidatorFuncGroups:
|
|
|
166
166
|
def test_macro_not_allowed_in_shared_group(self, validator):
|
|
167
167
|
result = validator.validate()
|
|
168
168
|
# Frame Anatomy Sequence (present in shared groups)
|
|
169
|
-
assert has_tag_error(
|
|
169
|
+
assert has_tag_error(
|
|
170
|
+
result, "Frame Content", "(0020,9111)", "not allowed in Shared Group"
|
|
171
|
+
)
|
|
170
172
|
|
|
171
173
|
@pytest.mark.shared_macros([])
|
|
172
174
|
@pytest.mark.per_frame_macros([PIXEL_MEASURES])
|
|
@@ -224,10 +224,13 @@ class IODValidator:
|
|
|
224
224
|
is_per_frame = self._in_per_frame_group
|
|
225
225
|
|
|
226
226
|
allowed = True
|
|
227
|
+
msg_postfix = ""
|
|
227
228
|
if condition and "F" in condition["type"] and is_shared:
|
|
228
229
|
required, allowed = False, False
|
|
230
|
+
msg_postfix = " in Shared Group"
|
|
229
231
|
elif condition and "S" in condition["type"] and is_per_frame:
|
|
230
232
|
required, allowed = False, False
|
|
233
|
+
msg_postfix = " in Per-Frame Group"
|
|
231
234
|
elif usage[0] == "M":
|
|
232
235
|
required = True
|
|
233
236
|
elif usage[0] == ConditionType.UserDefined:
|
|
@@ -280,7 +283,9 @@ class IODValidator:
|
|
|
280
283
|
for tag_id_string in module_info:
|
|
281
284
|
tag_id = self._tag_id(tag_id_string)
|
|
282
285
|
if tag_id in self._dataset_stack[-1].dataset:
|
|
283
|
-
message = self._incorrect_tag_message(
|
|
286
|
+
message = self._incorrect_tag_message(
|
|
287
|
+
tag_id, "not allowed" + msg_postfix
|
|
288
|
+
)
|
|
284
289
|
errors.setdefault(message, []).append(tag_id_string)
|
|
285
290
|
return errors
|
|
286
291
|
return self._validate_attributes(module_info, False)
|
|
@@ -652,7 +657,7 @@ class IODValidator:
|
|
|
652
657
|
def _tag_context_message(self):
|
|
653
658
|
if len(self._dataset_stack) > 1:
|
|
654
659
|
m = " > ".join([item.name for item in self._dataset_stack])
|
|
655
|
-
context = f" in
|
|
660
|
+
context = f" in {m}"
|
|
656
661
|
return context
|
|
657
662
|
return ""
|
|
658
663
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: dicom-validator
|
|
3
|
-
Version: 0.7.
|
|
3
|
+
Version: 0.7.2
|
|
4
4
|
Summary: Python DICOM validator using input from DICOM specs in docbook format
|
|
5
5
|
Author-email: mrbean-bremen and contributors <hansemrbean@googlemail.com>
|
|
6
6
|
License: MIT
|
|
@@ -27,7 +27,7 @@ Classifier: Topic :: Scientific/Engineering :: Medical Science Apps.
|
|
|
27
27
|
Requires-Python: >=3.9
|
|
28
28
|
Description-Content-Type: text/markdown
|
|
29
29
|
License-File: LICENSE
|
|
30
|
-
Requires-Dist: pydicom
|
|
30
|
+
Requires-Dist: pydicom>=2.3
|
|
31
31
|
Requires-Dist: lxml
|
|
32
32
|
Requires-Dist: pyparsing>=3.2
|
|
33
33
|
Provides-Extra: dev
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
__version__ = "0.7.1"
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{dicom_validator-0.7.1 → dicom_validator-0.7.2}/dicom_validator/spec_reader/edition_reader.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{dicom_validator-0.7.1 → dicom_validator-0.7.2}/dicom_validator/tests/spec_reader/__init__.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{dicom_validator-0.7.1 → dicom_validator-0.7.2}/dicom_validator/validator/dicom_file_validator.py
RENAMED
|
File without changes
|
|
File without changes
|
{dicom_validator-0.7.1 → dicom_validator-0.7.2}/dicom_validator.egg-info/dependency_links.txt
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|