dicom-validator 0.6.2__tar.gz → 0.6.4__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.6.2 → dicom_validator-0.6.4}/PKG-INFO +32 -18
- {dicom_validator-0.6.2 → dicom_validator-0.6.4}/README.md +29 -16
- dicom_validator-0.6.4/dicom_validator/__init__.py +1 -0
- {dicom_validator-0.6.2 → dicom_validator-0.6.4}/dicom_validator/spec_reader/condition.py +24 -4
- {dicom_validator-0.6.2 → dicom_validator-0.6.4}/dicom_validator/spec_reader/condition_parser.py +4 -0
- {dicom_validator-0.6.2 → dicom_validator-0.6.4}/dicom_validator/spec_reader/part3_reader.py +6 -4
- {dicom_validator-0.6.2 → dicom_validator-0.6.4}/dicom_validator/tests/spec_reader/conftest.py +1 -1
- {dicom_validator-0.6.2 → dicom_validator-0.6.4}/dicom_validator/tests/spec_reader/test_condition.py +32 -0
- {dicom_validator-0.6.2 → dicom_validator-0.6.4}/dicom_validator/tests/spec_reader/test_condition_parser.py +8 -0
- {dicom_validator-0.6.2 → dicom_validator-0.6.4}/dicom_validator/tests/spec_reader/test_part3_reader.py +14 -14
- {dicom_validator-0.6.2 → dicom_validator-0.6.4}/dicom_validator/tests/spec_reader/test_part6_reader.py +4 -4
- {dicom_validator-0.6.2 → dicom_validator-0.6.4}/dicom_validator/tests/test_cmdline_tools.py +1 -1
- {dicom_validator-0.6.2 → dicom_validator-0.6.4}/dicom_validator/tests/utils.py +1 -1
- {dicom_validator-0.6.2 → dicom_validator-0.6.4}/dicom_validator/tests/validator/conftest.py +1 -1
- {dicom_validator-0.6.2 → dicom_validator-0.6.4}/dicom_validator/tests/validator/test_dicom_file_validator.py +4 -4
- {dicom_validator-0.6.2 → dicom_validator-0.6.4}/dicom_validator/tests/validator/test_iod_validator.py +62 -0
- {dicom_validator-0.6.2 → dicom_validator-0.6.4}/dicom_validator/tests/validator/test_iod_validator_func_groups.py +17 -1
- {dicom_validator-0.6.2 → dicom_validator-0.6.4}/dicom_validator/validator/iod_validator.py +33 -33
- {dicom_validator-0.6.2 → dicom_validator-0.6.4}/dicom_validator.egg-info/PKG-INFO +32 -18
- {dicom_validator-0.6.2 → dicom_validator-0.6.4}/pyproject.toml +2 -1
- dicom_validator-0.6.2/dicom_validator/__init__.py +0 -1
- {dicom_validator-0.6.2 → dicom_validator-0.6.4}/LICENSE +0 -0
- {dicom_validator-0.6.2 → dicom_validator-0.6.4}/dicom_validator/dump_dcm_info.py +0 -0
- {dicom_validator-0.6.2 → dicom_validator-0.6.4}/dicom_validator/spec_reader/__init__.py +0 -0
- {dicom_validator-0.6.2 → dicom_validator-0.6.4}/dicom_validator/spec_reader/edition_reader.py +0 -0
- {dicom_validator-0.6.2 → dicom_validator-0.6.4}/dicom_validator/spec_reader/enum_parser.py +0 -0
- {dicom_validator-0.6.2 → dicom_validator-0.6.4}/dicom_validator/spec_reader/part4_reader.py +0 -0
- {dicom_validator-0.6.2 → dicom_validator-0.6.4}/dicom_validator/spec_reader/part6_reader.py +0 -0
- {dicom_validator-0.6.2 → dicom_validator-0.6.4}/dicom_validator/spec_reader/serializer.py +0 -0
- {dicom_validator-0.6.2 → dicom_validator-0.6.4}/dicom_validator/spec_reader/spec_reader.py +0 -0
- {dicom_validator-0.6.2 → dicom_validator-0.6.4}/dicom_validator/tag_tools.py +0 -0
- {dicom_validator-0.6.2 → dicom_validator-0.6.4}/dicom_validator/tests/__init__.py +0 -0
- {dicom_validator-0.6.2 → dicom_validator-0.6.4}/dicom_validator/tests/spec_reader/__init__.py +0 -0
- {dicom_validator-0.6.2 → dicom_validator-0.6.4}/dicom_validator/tests/spec_reader/test_edition_reader.py +0 -0
- {dicom_validator-0.6.2 → dicom_validator-0.6.4}/dicom_validator/tests/spec_reader/test_enum_parser.py +0 -0
- {dicom_validator-0.6.2 → dicom_validator-0.6.4}/dicom_validator/tests/spec_reader/test_part4_reader.py +0 -0
- {dicom_validator-0.6.2 → dicom_validator-0.6.4}/dicom_validator/tests/spec_reader/test_spec_reader.py +0 -0
- {dicom_validator-0.6.2 → dicom_validator-0.6.4}/dicom_validator/tests/validator/__init__.py +0 -0
- {dicom_validator-0.6.2 → dicom_validator-0.6.4}/dicom_validator/validate_iods.py +0 -0
- {dicom_validator-0.6.2 → dicom_validator-0.6.4}/dicom_validator/validator/__init__.py +0 -0
- {dicom_validator-0.6.2 → dicom_validator-0.6.4}/dicom_validator/validator/dicom_file_validator.py +0 -0
- {dicom_validator-0.6.2 → dicom_validator-0.6.4}/dicom_validator.egg-info/SOURCES.txt +0 -0
- {dicom_validator-0.6.2 → dicom_validator-0.6.4}/dicom_validator.egg-info/dependency_links.txt +0 -0
- {dicom_validator-0.6.2 → dicom_validator-0.6.4}/dicom_validator.egg-info/entry_points.txt +0 -0
- {dicom_validator-0.6.2 → dicom_validator-0.6.4}/dicom_validator.egg-info/requires.txt +0 -0
- {dicom_validator-0.6.2 → dicom_validator-0.6.4}/dicom_validator.egg-info/top_level.txt +0 -0
- {dicom_validator-0.6.2 → dicom_validator-0.6.4}/setup.cfg +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: dicom-validator
|
|
3
|
-
Version: 0.6.
|
|
3
|
+
Version: 0.6.4
|
|
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
|
|
@@ -12,7 +12,7 @@ Keywords: dicom, python
|
|
|
12
12
|
Classifier: License :: OSI Approved :: MIT License
|
|
13
13
|
Classifier: Intended Audience :: Developers
|
|
14
14
|
Classifier: Intended Audience :: Healthcare Industry
|
|
15
|
-
Classifier: Development Status ::
|
|
15
|
+
Classifier: Development Status :: 4 - Beta
|
|
16
16
|
Classifier: Environment :: Console
|
|
17
17
|
Classifier: Programming Language :: Python
|
|
18
18
|
Classifier: Programming Language :: Python :: 3.8
|
|
@@ -20,6 +20,7 @@ Classifier: Programming Language :: Python :: 3.9
|
|
|
20
20
|
Classifier: Programming Language :: Python :: 3.10
|
|
21
21
|
Classifier: Programming Language :: Python :: 3.11
|
|
22
22
|
Classifier: Programming Language :: Python :: 3.12
|
|
23
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
23
24
|
Classifier: Operating System :: POSIX :: Linux
|
|
24
25
|
Classifier: Operating System :: MacOS
|
|
25
26
|
Classifier: Operating System :: Microsoft :: Windows
|
|
@@ -56,7 +57,7 @@ DICOM standard.
|
|
|
56
57
|
|
|
57
58
|
*Disclaimer:*
|
|
58
59
|
No guarantees are given for the correctness of the results.
|
|
59
|
-
This is
|
|
60
|
+
This is beta-stage software which is mostly developed as a proof of concept.
|
|
60
61
|
Also check the limitations for `validate_iods` described below.
|
|
61
62
|
|
|
62
63
|
*Note:*
|
|
@@ -75,18 +76,18 @@ pip install dicom-validator
|
|
|
75
76
|
|
|
76
77
|
## Usage
|
|
77
78
|
```
|
|
78
|
-
validate_iods
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
dump_dcm_info
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
79
|
+
validate_iods [-h] [--standard-path STANDARD_PATH]
|
|
80
|
+
[--revision REVISION] [--force-read] [--recreate-json]
|
|
81
|
+
[--suppress-vr-warnings] [--verbose]
|
|
82
|
+
dicomfiles [dicomfiles ...]
|
|
83
|
+
|
|
84
|
+
dump_dcm_info [-h] [--standard-path STANDARD_PATH]
|
|
85
|
+
[--revision REVISION] [--max-value-len MAX_VALUE_LEN]
|
|
86
|
+
[--show-tags [SHOW_TAGS [SHOW_TAGS ...]]]
|
|
87
|
+
[--show-image-data] [--recreate-json]
|
|
88
|
+
dicomfiles [dicomfiles ...]
|
|
88
89
|
```
|
|
89
|
-
Use the `--help` option for each script do get usage info.
|
|
90
|
+
Use the `--help` option for each script do get more specific usage info.
|
|
90
91
|
|
|
91
92
|
## Access to the DICOM standard
|
|
92
93
|
|
|
@@ -163,17 +164,24 @@ Process finished with exit code 6
|
|
|
163
164
|
As mentioned, if the evaluation of conditions fails, the related module or
|
|
164
165
|
tag is considered optional, which may hide some non-conformity.
|
|
165
166
|
Condition evaluation may fail if:
|
|
166
|
-
- the needed information is not contained in the DICOM file (e.g. verbose
|
|
167
|
-
descriptions like "if the Patient is an animal")
|
|
167
|
+
- the needed information is not directly contained in the DICOM file (e.g. verbose
|
|
168
|
+
descriptions like "if the Patient is an animal", "if the image has been calibrated" etc.)
|
|
168
169
|
- the information is related to other DICOM files (e.g. referenced images)
|
|
169
170
|
- the parsing failed because the condition is too complicated, unexpected,
|
|
170
171
|
or due to a bug (please write an issue if you encounter such a problem)
|
|
171
172
|
|
|
172
173
|
#### Retired tags
|
|
173
|
-
|
|
174
|
+
Only the given standard is used to evaluate the files. If
|
|
174
175
|
the DICOM file has been written using an older standard, it may conform to
|
|
175
176
|
that standard, but not to the newest one. Tags that are retired in the
|
|
176
177
|
version of the standard used for parsing are not considered at all.
|
|
178
|
+
You can always check against an older standard by using the `--revision` option.
|
|
179
|
+
|
|
180
|
+
#### Enumerated values and defined terms
|
|
181
|
+
Most enumerated values are checked against, but some are ignored due to parsing issues.
|
|
182
|
+
Support for more cases may be added in the future.
|
|
183
|
+
Defined terms are _not_ checked, because they are allowed to be user-defined, which means
|
|
184
|
+
that any value may be valid.
|
|
177
185
|
|
|
178
186
|
#### Unsupported cases (support may be added in future versions)
|
|
179
187
|
- SOP classes not in the table in PS3.3 such as Presentation States are not
|
|
@@ -223,7 +231,9 @@ c:\dev\DICOM Data\SR\image12.dcm
|
|
|
223
231
|
|
|
224
232
|
## Build executable on Windows
|
|
225
233
|
|
|
226
|
-
|
|
234
|
+
A self-contained Windows executable is contained in the release artifacts.
|
|
235
|
+
|
|
236
|
+
Here is a sample workflow to build such an executable yourself:
|
|
227
237
|
```powershell
|
|
228
238
|
# Clone the repository
|
|
229
239
|
git clone git@github.com:pydicom/dicom-validator.git
|
|
@@ -239,3 +249,7 @@ pip install -r requirements-dev.txt
|
|
|
239
249
|
# Build executables. They will be placed in the `dist` subfolder.
|
|
240
250
|
pyinstaller dicom-validator.spec -y
|
|
241
251
|
```
|
|
252
|
+
|
|
253
|
+
## Contributing
|
|
254
|
+
Contributions are very welcome. If you submit a pull request for a bugfix
|
|
255
|
+
or a new feature, please make sure to also write respective tests.
|
|
@@ -21,7 +21,7 @@ DICOM standard.
|
|
|
21
21
|
|
|
22
22
|
*Disclaimer:*
|
|
23
23
|
No guarantees are given for the correctness of the results.
|
|
24
|
-
This is
|
|
24
|
+
This is beta-stage software which is mostly developed as a proof of concept.
|
|
25
25
|
Also check the limitations for `validate_iods` described below.
|
|
26
26
|
|
|
27
27
|
*Note:*
|
|
@@ -40,18 +40,18 @@ pip install dicom-validator
|
|
|
40
40
|
|
|
41
41
|
## Usage
|
|
42
42
|
```
|
|
43
|
-
validate_iods
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
dump_dcm_info
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
43
|
+
validate_iods [-h] [--standard-path STANDARD_PATH]
|
|
44
|
+
[--revision REVISION] [--force-read] [--recreate-json]
|
|
45
|
+
[--suppress-vr-warnings] [--verbose]
|
|
46
|
+
dicomfiles [dicomfiles ...]
|
|
47
|
+
|
|
48
|
+
dump_dcm_info [-h] [--standard-path STANDARD_PATH]
|
|
49
|
+
[--revision REVISION] [--max-value-len MAX_VALUE_LEN]
|
|
50
|
+
[--show-tags [SHOW_TAGS [SHOW_TAGS ...]]]
|
|
51
|
+
[--show-image-data] [--recreate-json]
|
|
52
|
+
dicomfiles [dicomfiles ...]
|
|
53
53
|
```
|
|
54
|
-
Use the `--help` option for each script do get usage info.
|
|
54
|
+
Use the `--help` option for each script do get more specific usage info.
|
|
55
55
|
|
|
56
56
|
## Access to the DICOM standard
|
|
57
57
|
|
|
@@ -128,17 +128,24 @@ Process finished with exit code 6
|
|
|
128
128
|
As mentioned, if the evaluation of conditions fails, the related module or
|
|
129
129
|
tag is considered optional, which may hide some non-conformity.
|
|
130
130
|
Condition evaluation may fail if:
|
|
131
|
-
- the needed information is not contained in the DICOM file (e.g. verbose
|
|
132
|
-
descriptions like "if the Patient is an animal")
|
|
131
|
+
- the needed information is not directly contained in the DICOM file (e.g. verbose
|
|
132
|
+
descriptions like "if the Patient is an animal", "if the image has been calibrated" etc.)
|
|
133
133
|
- the information is related to other DICOM files (e.g. referenced images)
|
|
134
134
|
- the parsing failed because the condition is too complicated, unexpected,
|
|
135
135
|
or due to a bug (please write an issue if you encounter such a problem)
|
|
136
136
|
|
|
137
137
|
#### Retired tags
|
|
138
|
-
|
|
138
|
+
Only the given standard is used to evaluate the files. If
|
|
139
139
|
the DICOM file has been written using an older standard, it may conform to
|
|
140
140
|
that standard, but not to the newest one. Tags that are retired in the
|
|
141
141
|
version of the standard used for parsing are not considered at all.
|
|
142
|
+
You can always check against an older standard by using the `--revision` option.
|
|
143
|
+
|
|
144
|
+
#### Enumerated values and defined terms
|
|
145
|
+
Most enumerated values are checked against, but some are ignored due to parsing issues.
|
|
146
|
+
Support for more cases may be added in the future.
|
|
147
|
+
Defined terms are _not_ checked, because they are allowed to be user-defined, which means
|
|
148
|
+
that any value may be valid.
|
|
142
149
|
|
|
143
150
|
#### Unsupported cases (support may be added in future versions)
|
|
144
151
|
- SOP classes not in the table in PS3.3 such as Presentation States are not
|
|
@@ -188,7 +195,9 @@ c:\dev\DICOM Data\SR\image12.dcm
|
|
|
188
195
|
|
|
189
196
|
## Build executable on Windows
|
|
190
197
|
|
|
191
|
-
|
|
198
|
+
A self-contained Windows executable is contained in the release artifacts.
|
|
199
|
+
|
|
200
|
+
Here is a sample workflow to build such an executable yourself:
|
|
192
201
|
```powershell
|
|
193
202
|
# Clone the repository
|
|
194
203
|
git clone git@github.com:pydicom/dicom-validator.git
|
|
@@ -204,3 +213,7 @@ pip install -r requirements-dev.txt
|
|
|
204
213
|
# Build executables. They will be placed in the `dist` subfolder.
|
|
205
214
|
pyinstaller dicom-validator.spec -y
|
|
206
215
|
```
|
|
216
|
+
|
|
217
|
+
## Contributing
|
|
218
|
+
Contributions are very welcome. If you submit a pull request for a bugfix
|
|
219
|
+
or a new feature, please make sure to also write respective tests.
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
__version__ = "0.6.4"
|
|
@@ -21,6 +21,8 @@ class ConditionType(str, enum.Enum): # replace later with StrEnum from Python 3
|
|
|
21
21
|
# mandatory if the condition is fulfilled,
|
|
22
22
|
# otherwise another condition will be checked
|
|
23
23
|
MandatoryOrConditional = "MC"
|
|
24
|
+
# not allowed if the condition is fulfilled, may be present otherwise
|
|
25
|
+
NotAllowedOrUserDefined = "NU"
|
|
24
26
|
# mandatory in the per-frame functional groups,
|
|
25
27
|
# not allowed in the shared functional groups
|
|
26
28
|
MandatoryPerFrame = "MF"
|
|
@@ -109,10 +111,28 @@ class Condition:
|
|
|
109
111
|
self.other_condition: Optional[Condition] = None
|
|
110
112
|
|
|
111
113
|
def __repr__(self):
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
f"
|
|
115
|
-
|
|
114
|
+
attribs = []
|
|
115
|
+
if self.type:
|
|
116
|
+
attribs.append(f"Condition type={self.type.value}")
|
|
117
|
+
if self.and_conditions:
|
|
118
|
+
attribs.append(
|
|
119
|
+
f"({' AND '.join([repr(cond) for cond in self.and_conditions])})"
|
|
120
|
+
)
|
|
121
|
+
elif self.or_conditions:
|
|
122
|
+
attribs.append(
|
|
123
|
+
f"({' OR '.join([repr(cond) for cond in self.or_conditions])})"
|
|
124
|
+
)
|
|
125
|
+
else:
|
|
126
|
+
if self.operator is not None:
|
|
127
|
+
attribs.append(f"op='{self.operator.value}'")
|
|
128
|
+
if self.tag:
|
|
129
|
+
tag = f"tag={self.tag}"
|
|
130
|
+
if self.index:
|
|
131
|
+
tag += f"[{self.index}]"
|
|
132
|
+
attribs.append(tag)
|
|
133
|
+
if self.values:
|
|
134
|
+
attribs.append(f"values={self.values}")
|
|
135
|
+
return " ".join(attribs)
|
|
116
136
|
|
|
117
137
|
@classmethod
|
|
118
138
|
def read_condition(
|
{dicom_validator-0.6.2 → dicom_validator-0.6.4}/dicom_validator/spec_reader/condition_parser.py
RENAMED
|
@@ -99,6 +99,7 @@ class ConditionParser:
|
|
|
99
99
|
"shall be present if ",
|
|
100
100
|
"required for images where ",
|
|
101
101
|
"required only if",
|
|
102
|
+
"shall not be present if",
|
|
102
103
|
)
|
|
103
104
|
condition_lower = condition_str.lower()
|
|
104
105
|
for prefix in condition_prefixes:
|
|
@@ -107,6 +108,9 @@ class ConditionParser:
|
|
|
107
108
|
condition_str = condition_str[len(prefix) + index :]
|
|
108
109
|
condition_str = self._fix_condition(condition_str)
|
|
109
110
|
condition = self._parse_tag_expressions(condition_str)
|
|
111
|
+
if prefix.startswith("shall not"):
|
|
112
|
+
if condition.type == ConditionType.MandatoryOrUserDefined:
|
|
113
|
+
condition.type = ConditionType.NotAllowedOrUserDefined
|
|
110
114
|
return condition
|
|
111
115
|
# special handling for functional group restrictions
|
|
112
116
|
if " not be used as a shared functional group" in condition_lower:
|
|
@@ -265,10 +265,12 @@ class Part3Reader(SpecReader):
|
|
|
265
265
|
}
|
|
266
266
|
if tag_id in SPECIAL_CASES:
|
|
267
267
|
current_descriptions[-1][tag_id]["cond"] = SPECIAL_CASES[tag_id]
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
268
|
+
# include type 3 as there may be conditions for not allowed tags
|
|
269
|
+
elif tag_type in ("1C", "2C", "3"):
|
|
270
|
+
cond = self._condition_parser.parse(self._find_all_text(columns[3]))
|
|
271
|
+
if cond.type != ConditionType.UserDefined:
|
|
272
|
+
# no need to save user defined - it means no condition
|
|
273
|
+
current_descriptions[-1][tag_id]["cond"] = cond
|
|
272
274
|
info = self._dict_info.get(tag_id)
|
|
273
275
|
if info:
|
|
274
276
|
enum_values = self._enum_parser.parse(columns[3], info["vr"])
|
{dicom_validator-0.6.2 → dicom_validator-0.6.4}/dicom_validator/tests/spec_reader/test_condition.py
RENAMED
|
@@ -35,6 +35,38 @@ class TestConditionRead:
|
|
|
35
35
|
assert len(condition.and_conditions) == nr_and_cond
|
|
36
36
|
assert len(condition.or_conditions) == nr_or_cond
|
|
37
37
|
|
|
38
|
+
def test_repr_for_simple_condition(self):
|
|
39
|
+
cond_dict = {
|
|
40
|
+
"type": ConditionType.MandatoryOrUserDefined,
|
|
41
|
+
"op": ConditionOperator.EqualsValue,
|
|
42
|
+
"tag": "(0008,0008)",
|
|
43
|
+
"index": 1,
|
|
44
|
+
"values": ["SECONDARY"],
|
|
45
|
+
}
|
|
46
|
+
condition = Condition.read_condition(cond_dict)
|
|
47
|
+
assert repr(condition) == (
|
|
48
|
+
"Condition type=MU op='=' tag=(0008,0008)[1] values=['SECONDARY']"
|
|
49
|
+
)
|
|
50
|
+
|
|
51
|
+
def test_repr_for_complex_condition(self):
|
|
52
|
+
cond_dict = {
|
|
53
|
+
"type": ConditionType.MandatoryOrUserDefined,
|
|
54
|
+
"and": [
|
|
55
|
+
{"tag": "(0010,0010)", "op": ConditionOperator.Present},
|
|
56
|
+
{
|
|
57
|
+
"or": [
|
|
58
|
+
{"tag": "(0010,0020)", "op": ConditionOperator.Absent},
|
|
59
|
+
{"tag": "(0010,0030)", "op": ConditionOperator.Absent},
|
|
60
|
+
]
|
|
61
|
+
},
|
|
62
|
+
],
|
|
63
|
+
}
|
|
64
|
+
condition = Condition.read_condition(cond_dict)
|
|
65
|
+
assert repr(condition) == (
|
|
66
|
+
"Condition type=MU (op='+' tag=(0010,0010) AND "
|
|
67
|
+
"(op='-' tag=(0010,0020) OR op='-' tag=(0010,0030)))"
|
|
68
|
+
)
|
|
69
|
+
|
|
38
70
|
def test_read_type_only(self):
|
|
39
71
|
self.check_condition(
|
|
40
72
|
{"type": ConditionType.UserDefined}, ConditionType.UserDefined
|
|
@@ -138,6 +138,14 @@ class TestSimpleConditionParser:
|
|
|
138
138
|
assert result.operator == ConditionOperator.EqualsValue
|
|
139
139
|
assert result.values == ["CIRCLE", "ELLIPSE"]
|
|
140
140
|
|
|
141
|
+
def test_not_allowed_on_condition(self, parser):
|
|
142
|
+
result = parser.parse(
|
|
143
|
+
"Shall not be present if Rescale Intercept (0028,1052) is present."
|
|
144
|
+
)
|
|
145
|
+
assert result.type == ConditionType.NotAllowedOrUserDefined
|
|
146
|
+
assert result.operator == ConditionOperator.Present
|
|
147
|
+
assert result.tag == "(0028,1052)"
|
|
148
|
+
|
|
141
149
|
|
|
142
150
|
class TestValueConditionParser:
|
|
143
151
|
def test_equality_tag(self, parser):
|
|
@@ -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"), ("2024e", "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), ("2024e", 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", "2024e"], 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), ("2024e", 155)],
|
|
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), ("2024e", 28)],
|
|
107
107
|
indirect=["revision"],
|
|
108
108
|
scope="session",
|
|
109
109
|
)
|
|
@@ -137,7 +137,7 @@ class TestReadPart3:
|
|
|
137
137
|
|
|
138
138
|
@pytest.mark.parametrize(
|
|
139
139
|
"revision,desc_nr",
|
|
140
|
-
[("2015b", 9), ("
|
|
140
|
+
[("2015b", 9), ("2024e", 14)],
|
|
141
141
|
indirect=["revision"],
|
|
142
142
|
scope="session",
|
|
143
143
|
)
|
|
@@ -151,18 +151,18 @@ class TestReadPart3:
|
|
|
151
151
|
assert description["(0012,0031)"]["type"] == "2"
|
|
152
152
|
|
|
153
153
|
@pytest.mark.parametrize(
|
|
154
|
-
"revision,desc_nr",
|
|
155
|
-
[("2015b", 3), ("
|
|
154
|
+
"revision,desc_nr, seq_desc_nr",
|
|
155
|
+
[("2015b", 3, 3), ("2024e", 7, 4)],
|
|
156
156
|
indirect=["revision"],
|
|
157
157
|
scope="session",
|
|
158
158
|
)
|
|
159
|
-
def test_sequence_inside_module_description(self, reader, desc_nr):
|
|
159
|
+
def test_sequence_inside_module_description(self, reader, desc_nr, seq_desc_nr):
|
|
160
160
|
description = reader.module_description("C.7.2.3")
|
|
161
161
|
assert len(description) == desc_nr
|
|
162
162
|
assert "(0012,0083)" in description
|
|
163
163
|
assert "items" in description["(0012,0083)"]
|
|
164
164
|
sequence_description = description["(0012,0083)"]["items"]
|
|
165
|
-
assert len(sequence_description) ==
|
|
165
|
+
assert len(sequence_description) == seq_desc_nr
|
|
166
166
|
assert "(0012,0020)" in sequence_description
|
|
167
167
|
assert (
|
|
168
168
|
sequence_description["(0012,0020)"]["name"] == "Clinical Trial Protocol ID"
|
|
@@ -183,7 +183,7 @@ class TestReadPart3:
|
|
|
183
183
|
|
|
184
184
|
@pytest.mark.parametrize(
|
|
185
185
|
"revision,desc_nr",
|
|
186
|
-
[("2015b", 451), ("
|
|
186
|
+
[("2015b", 451), ("2024e", 583)],
|
|
187
187
|
indirect=["revision"],
|
|
188
188
|
scope="session",
|
|
189
189
|
)
|
|
@@ -193,7 +193,7 @@ class TestReadPart3:
|
|
|
193
193
|
|
|
194
194
|
@pytest.mark.parametrize(
|
|
195
195
|
"revision,include_nr",
|
|
196
|
-
[("2015b", 9), ("
|
|
196
|
+
[("2015b", 9), ("2024e", 10)],
|
|
197
197
|
indirect=["revision"],
|
|
198
198
|
scope="session",
|
|
199
199
|
)
|
|
@@ -226,7 +226,7 @@ class TestReadPart3:
|
|
|
226
226
|
assert enums == [{"val": ["FAILURE", "WARNING", "INFORMATIVE"]}]
|
|
227
227
|
|
|
228
228
|
@pytest.mark.parametrize(
|
|
229
|
-
"revision", ["2015b", "
|
|
229
|
+
"revision", ["2015b", "2024e"], indirect=True, scope="session"
|
|
230
230
|
)
|
|
231
231
|
def test_linked_enum_values(self, reader):
|
|
232
232
|
description = reader.module_description("10.24")
|
|
@@ -239,7 +239,7 @@ class TestReadPart3:
|
|
|
239
239
|
assert tag["enums"] == [{"val": ["CONTINUOUS", "TRIGGERED", "AUTOMATIC"]}]
|
|
240
240
|
|
|
241
241
|
@pytest.mark.parametrize(
|
|
242
|
-
"revision", ["2015b", "
|
|
242
|
+
"revision", ["2015b", "2024e"], indirect=True, scope="session"
|
|
243
243
|
)
|
|
244
244
|
def test_graphic_annotation_sequence(self, reader):
|
|
245
245
|
description = reader.module_description("C.10.5")
|
|
@@ -15,17 +15,17 @@ 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) == 5197
|
|
19
19
|
|
|
20
20
|
def test_sop_class_uids(self, dict_reader):
|
|
21
21
|
sop_class_uids = dict_reader.sop_class_uids()
|
|
22
|
-
assert len(sop_class_uids) ==
|
|
22
|
+
assert len(sop_class_uids) == 308
|
|
23
23
|
assert "1.2.840.10008.1.1" in sop_class_uids
|
|
24
24
|
assert sop_class_uids["1.2.840.10008.1.1"] == "Verification SOP Class"
|
|
25
25
|
|
|
26
26
|
def test_uid_type(self, dict_reader):
|
|
27
27
|
xfer_syntax_uids = dict_reader.uids("Transfer Syntax")
|
|
28
|
-
assert len(xfer_syntax_uids) ==
|
|
28
|
+
assert len(xfer_syntax_uids) == 62
|
|
29
29
|
assert "1.2.840.10008.1.2.4.80" in xfer_syntax_uids
|
|
30
30
|
assert (
|
|
31
31
|
xfer_syntax_uids["1.2.840.10008.1.2.4.80"]
|
|
@@ -38,7 +38,7 @@ class TestPart6Reader:
|
|
|
38
38
|
assert "Transfer Syntax" in uids
|
|
39
39
|
assert "SOP Class" in uids
|
|
40
40
|
uid_nr = sum([len(uid_dict) for uid_dict in uids.values()])
|
|
41
|
-
assert uid_nr ==
|
|
41
|
+
assert uid_nr == 461
|
|
42
42
|
|
|
43
43
|
def test_sop_class_name(self, dict_reader):
|
|
44
44
|
assert (
|
|
@@ -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", "2024e"])
|
|
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"
|
|
@@ -7,7 +7,7 @@ def has_tag_error(messages, module_name, tag_id_string, error_kind, text=""):
|
|
|
7
7
|
for message in messages[module_name]:
|
|
8
8
|
# we allow for both the presence or absence of the tag name,
|
|
9
9
|
# as the tag may not be in the fixture dictionary
|
|
10
|
-
if re.match(rf"Tag \{tag_id_string[:-1]}\).* (is )?{error_kind}.*", message):
|
|
10
|
+
if re.match(rf"Tag \({tag_id_string[1:-1]}\).* (is )?{error_kind}.*", message):
|
|
11
11
|
return text in message if text else True
|
|
12
12
|
return False
|
|
13
13
|
|
|
@@ -2,7 +2,7 @@ import os
|
|
|
2
2
|
from pathlib import Path
|
|
3
3
|
|
|
4
4
|
import pytest
|
|
5
|
-
from pydicom import
|
|
5
|
+
from pydicom import dcmwrite
|
|
6
6
|
from pydicom.dataset import Dataset, FileDataset, FileMetaDataset
|
|
7
7
|
|
|
8
8
|
from dicom_validator.validator.dicom_file_validator import DicomFileValidator
|
|
@@ -51,14 +51,14 @@ class TestFakeDicomFileValidator:
|
|
|
51
51
|
file_dataset = FileDataset(
|
|
52
52
|
filename, Dataset(), file_meta=self.create_metadata()
|
|
53
53
|
)
|
|
54
|
-
|
|
54
|
+
dcmwrite(filename, file_dataset, write_like_original=False)
|
|
55
55
|
self.assert_fatal_error(validator, filename, "Missing SOPClassUID")
|
|
56
56
|
|
|
57
57
|
def test_unknown_sop_class(self, validator):
|
|
58
58
|
dataset = Dataset()
|
|
59
59
|
dataset.SOPClassUID = "Unknown"
|
|
60
60
|
file_dataset = FileDataset("test", dataset, file_meta=self.create_metadata())
|
|
61
|
-
|
|
61
|
+
dcmwrite("test", file_dataset, write_like_original=False)
|
|
62
62
|
self.assert_fatal_error(
|
|
63
63
|
validator, "test", "Unknown SOPClassUID (probably retired): Unknown"
|
|
64
64
|
)
|
|
@@ -79,7 +79,7 @@ class TestFakeDicomFileValidator:
|
|
|
79
79
|
dataset = Dataset()
|
|
80
80
|
dataset.SOPClassUID = "1.2.840.10008.5.1.4.1.1.2" # CT Image Storage
|
|
81
81
|
file_dataset = FileDataset("test", dataset, file_meta=self.create_metadata())
|
|
82
|
-
|
|
82
|
+
dcmwrite("test", file_dataset, write_like_original=False)
|
|
83
83
|
error_dict = validator.validate("test")
|
|
84
84
|
assert len(error_dict) == 1
|
|
85
85
|
errors = error_dict["test"]
|
|
@@ -82,6 +82,21 @@ class TestIODValidator:
|
|
|
82
82
|
# Patient Breed Description -> type 2C, but no parsable condition
|
|
83
83
|
assert not has_tag_error(result, "Patient", "(0010,2292)", "missing")
|
|
84
84
|
|
|
85
|
+
@pytest.mark.tag_set(
|
|
86
|
+
{
|
|
87
|
+
"SOPClassUID": uid.CTImageStorage,
|
|
88
|
+
"PatientName": "XXX",
|
|
89
|
+
"PatientID": "ZZZ",
|
|
90
|
+
"MultienergyCTAcquisition": "YES",
|
|
91
|
+
"CTAdditionalXRaySourceSequence": [],
|
|
92
|
+
}
|
|
93
|
+
)
|
|
94
|
+
def test_not_allowed_tag(self, validator):
|
|
95
|
+
result = validator.validate()
|
|
96
|
+
|
|
97
|
+
assert "fatal" not in result
|
|
98
|
+
assert has_tag_error(result, "CT Image", "(0018,9360)", "not allowed")
|
|
99
|
+
|
|
85
100
|
@pytest.mark.tag_set(
|
|
86
101
|
{
|
|
87
102
|
"SOPClassUID": uid.CTImageStorage,
|
|
@@ -461,6 +476,53 @@ class TestIODValidator:
|
|
|
461
476
|
"(value: 1, allowed: 8, 9, 10, 11, 12, 13, 14, 15, 16)",
|
|
462
477
|
)
|
|
463
478
|
|
|
479
|
+
@pytest.mark.tag_set(
|
|
480
|
+
{
|
|
481
|
+
"SOPClassUID": uid.EnhancedXAImageStorage,
|
|
482
|
+
"PatientName": "XXX",
|
|
483
|
+
"PatientID": "ZZZ",
|
|
484
|
+
"ImageType": "DERIVED",
|
|
485
|
+
"PresentationLUTShape": "",
|
|
486
|
+
}
|
|
487
|
+
)
|
|
488
|
+
def test_empty_type_1_enum_value(self, validator):
|
|
489
|
+
result = validator.validate()
|
|
490
|
+
|
|
491
|
+
# Presentation LUT Shape: incorrect enum value
|
|
492
|
+
assert has_tag_error(
|
|
493
|
+
result,
|
|
494
|
+
"Enhanced XA/XRF Image",
|
|
495
|
+
"(2050,0020)",
|
|
496
|
+
"is empty",
|
|
497
|
+
)
|
|
498
|
+
|
|
499
|
+
@pytest.mark.tag_set(
|
|
500
|
+
{
|
|
501
|
+
"SOPClassUID": uid.OphthalmicPhotography8BitImageStorage,
|
|
502
|
+
"PatientName": "XXX",
|
|
503
|
+
"PatientID": "ZZZ",
|
|
504
|
+
"PatientEyeMovementCommanded": "",
|
|
505
|
+
"PupilDilated": "",
|
|
506
|
+
}
|
|
507
|
+
)
|
|
508
|
+
def test_empty_type_2_enum_value(self, validator):
|
|
509
|
+
# regression test for #147
|
|
510
|
+
result = validator.validate()
|
|
511
|
+
|
|
512
|
+
assert not has_tag_error(
|
|
513
|
+
result,
|
|
514
|
+
"Ophthalmic Photography Acquisition Parameters",
|
|
515
|
+
"(0022,0005)",
|
|
516
|
+
"value is not allowed",
|
|
517
|
+
)
|
|
518
|
+
|
|
519
|
+
assert not has_tag_error(
|
|
520
|
+
result,
|
|
521
|
+
"Ophthalmic Photography Acquisition Parameters",
|
|
522
|
+
"(0022,000D)",
|
|
523
|
+
"value is not allowed",
|
|
524
|
+
)
|
|
525
|
+
|
|
464
526
|
@pytest.mark.tag_set(
|
|
465
527
|
{
|
|
466
528
|
"SOPClassUID": uid.MRImageStorage,
|
|
@@ -96,6 +96,10 @@ FRAME_CONTENT = {"FrameContentSequence": [{"FrameReferenceDateTime": "2000010112
|
|
|
96
96
|
|
|
97
97
|
PIXEL_MEASURES = {"PixelMeasuresSequence": [{"PixelSpacing": "0.1\\0.1"}]}
|
|
98
98
|
|
|
99
|
+
TIMING_RELATED_PARAMS = {
|
|
100
|
+
"MRTimingAndRelatedParametersSequence": [{"RFEchoTrainLength": None}]
|
|
101
|
+
}
|
|
102
|
+
|
|
99
103
|
|
|
100
104
|
class TestIODValidatorFuncGroups:
|
|
101
105
|
"""Tests IODValidator for functional groups."""
|
|
@@ -125,7 +129,7 @@ class TestIODValidatorFuncGroups:
|
|
|
125
129
|
in group_result
|
|
126
130
|
)
|
|
127
131
|
assert (
|
|
128
|
-
"Tag (5200,9230) (Per-
|
|
132
|
+
"Tag (5200,9230) (Per-Frame Functional Groups Sequence) is empty"
|
|
129
133
|
in group_result
|
|
130
134
|
)
|
|
131
135
|
|
|
@@ -172,3 +176,15 @@ class TestIODValidatorFuncGroups:
|
|
|
172
176
|
result = validator.validate()
|
|
173
177
|
# Frame Anatomy Sequence (present in shared groups)
|
|
174
178
|
assert has_tag_error(result, "Pixel Measures", "(0028,9110)", "not allowed")
|
|
179
|
+
|
|
180
|
+
@pytest.mark.shared_macros([TIMING_RELATED_PARAMS])
|
|
181
|
+
@pytest.mark.per_frame_macros([FRAME_CONTENT])
|
|
182
|
+
def test_empty_tag_in_shared_group(self, validator):
|
|
183
|
+
# regression test for KeyError in this case
|
|
184
|
+
validator._dataset.SOPClassUID = uid.MRSpectroscopyStorage
|
|
185
|
+
validator._dataset.ImageType = "ORIGINAL\\PRIMARY"
|
|
186
|
+
result = validator.validate()
|
|
187
|
+
# RF Echo Train Length
|
|
188
|
+
assert has_tag_error(
|
|
189
|
+
result, "MR Timing and Related Parameters", "(0018,9240)", "empty"
|
|
190
|
+
)
|
|
@@ -79,7 +79,7 @@ class FunctionalGroupInfo:
|
|
|
79
79
|
break
|
|
80
80
|
else:
|
|
81
81
|
# other errors (unexpected tag, missing value) shall always remain
|
|
82
|
-
result[error] =
|
|
82
|
+
result[error] = shared[error]
|
|
83
83
|
|
|
84
84
|
for error in per_frame:
|
|
85
85
|
if "missing" in error:
|
|
@@ -374,14 +374,11 @@ class IODValidator:
|
|
|
374
374
|
condition_dict = None
|
|
375
375
|
if attribute_type in ("1", "2"):
|
|
376
376
|
tag_required, tag_allowed = True, True
|
|
377
|
-
elif
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
)
|
|
383
|
-
else:
|
|
384
|
-
tag_required, tag_allowed = False, True
|
|
377
|
+
elif "cond" in attribute:
|
|
378
|
+
condition_dict = attribute["cond"]
|
|
379
|
+
tag_required, tag_allowed = self._object_is_required_or_allowed(
|
|
380
|
+
condition_dict
|
|
381
|
+
)
|
|
385
382
|
else:
|
|
386
383
|
tag_required, tag_allowed = False, True
|
|
387
384
|
error_kind = None
|
|
@@ -394,9 +391,9 @@ class IODValidator:
|
|
|
394
391
|
value = self._dataset_stack[-1].dataset[tag_id].value
|
|
395
392
|
vr = self._dataset_stack[-1].dataset[tag_id].VR
|
|
396
393
|
if value_required:
|
|
397
|
-
if value is None or isinstance(value, Sequence) and not value:
|
|
394
|
+
if value is None or isinstance(value, (Sequence, str)) and not value:
|
|
398
395
|
error_kind = "empty"
|
|
399
|
-
if value is not None:
|
|
396
|
+
if value is not None and (not isinstance(value, str) or value):
|
|
400
397
|
if not isinstance(value, MultiValue):
|
|
401
398
|
value = [value]
|
|
402
399
|
for i, v in enumerate(value):
|
|
@@ -445,57 +442,60 @@ class IODValidator:
|
|
|
445
442
|
"""
|
|
446
443
|
if isinstance(condition, str):
|
|
447
444
|
condition = json.loads(condition)
|
|
448
|
-
|
|
445
|
+
condition_type = condition["type"]
|
|
446
|
+
if ConditionType(condition_type).user_defined:
|
|
449
447
|
return False, True
|
|
450
|
-
|
|
451
|
-
if
|
|
448
|
+
matches = self._composite_object_matches_condition(condition)
|
|
449
|
+
if matches:
|
|
450
|
+
if condition_type == ConditionType.NotAllowedOrUserDefined:
|
|
451
|
+
return False, False
|
|
452
452
|
return True, True
|
|
453
453
|
allowed = (
|
|
454
|
-
|
|
455
|
-
or
|
|
456
|
-
and self.
|
|
454
|
+
condition_type == ConditionType.MandatoryOrUserDefined
|
|
455
|
+
or condition_type == ConditionType.MandatoryOrConditional
|
|
456
|
+
and self._composite_object_matches_condition(condition["other_cond"])
|
|
457
457
|
)
|
|
458
458
|
return False, allowed
|
|
459
459
|
|
|
460
|
-
def
|
|
461
|
-
"""Checks if an attribute
|
|
462
|
-
in the current dataset.
|
|
460
|
+
def _composite_object_matches_condition(self, condition):
|
|
461
|
+
"""Checks if an attribute matches the given composite condition.
|
|
463
462
|
|
|
464
463
|
Parameters
|
|
465
464
|
----------
|
|
466
465
|
condition : dict
|
|
467
|
-
The condition
|
|
466
|
+
The condition dictionary.
|
|
468
467
|
|
|
469
468
|
Returns
|
|
470
469
|
-------
|
|
471
470
|
bool
|
|
472
|
-
`True` if the attribute
|
|
471
|
+
`True` if the attribute matches the condition.
|
|
473
472
|
"""
|
|
474
473
|
if "and" in condition:
|
|
475
|
-
|
|
476
|
-
self.
|
|
474
|
+
matches = all(
|
|
475
|
+
self._composite_object_matches_condition(cond)
|
|
476
|
+
for cond in condition["and"]
|
|
477
477
|
)
|
|
478
478
|
elif "or" in condition:
|
|
479
|
-
|
|
480
|
-
self.
|
|
479
|
+
matches = any(
|
|
480
|
+
self._composite_object_matches_condition(cond)
|
|
481
|
+
for cond in condition["or"]
|
|
481
482
|
)
|
|
482
483
|
else:
|
|
483
|
-
|
|
484
|
-
return
|
|
484
|
+
matches = self._matches_condition(condition)
|
|
485
|
+
return matches
|
|
485
486
|
|
|
486
|
-
def
|
|
487
|
-
"""Checks if an attribute
|
|
488
|
-
depending on the given condition.
|
|
487
|
+
def _matches_condition(self, condition):
|
|
488
|
+
"""Checks if an attribute matches the given condition.
|
|
489
489
|
|
|
490
490
|
Parameters
|
|
491
491
|
----------
|
|
492
492
|
condition : dict
|
|
493
|
-
The condition dict
|
|
493
|
+
The condition dict.
|
|
494
494
|
|
|
495
495
|
Returns
|
|
496
496
|
-------
|
|
497
497
|
bool
|
|
498
|
-
`True` if the attribute
|
|
498
|
+
`True` if the attribute matches the condition in the dataset.
|
|
499
499
|
"""
|
|
500
500
|
tag_id = self._tag_id(condition["tag"])
|
|
501
501
|
tag_value = None
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: dicom-validator
|
|
3
|
-
Version: 0.6.
|
|
3
|
+
Version: 0.6.4
|
|
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
|
|
@@ -12,7 +12,7 @@ Keywords: dicom, python
|
|
|
12
12
|
Classifier: License :: OSI Approved :: MIT License
|
|
13
13
|
Classifier: Intended Audience :: Developers
|
|
14
14
|
Classifier: Intended Audience :: Healthcare Industry
|
|
15
|
-
Classifier: Development Status ::
|
|
15
|
+
Classifier: Development Status :: 4 - Beta
|
|
16
16
|
Classifier: Environment :: Console
|
|
17
17
|
Classifier: Programming Language :: Python
|
|
18
18
|
Classifier: Programming Language :: Python :: 3.8
|
|
@@ -20,6 +20,7 @@ Classifier: Programming Language :: Python :: 3.9
|
|
|
20
20
|
Classifier: Programming Language :: Python :: 3.10
|
|
21
21
|
Classifier: Programming Language :: Python :: 3.11
|
|
22
22
|
Classifier: Programming Language :: Python :: 3.12
|
|
23
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
23
24
|
Classifier: Operating System :: POSIX :: Linux
|
|
24
25
|
Classifier: Operating System :: MacOS
|
|
25
26
|
Classifier: Operating System :: Microsoft :: Windows
|
|
@@ -56,7 +57,7 @@ DICOM standard.
|
|
|
56
57
|
|
|
57
58
|
*Disclaimer:*
|
|
58
59
|
No guarantees are given for the correctness of the results.
|
|
59
|
-
This is
|
|
60
|
+
This is beta-stage software which is mostly developed as a proof of concept.
|
|
60
61
|
Also check the limitations for `validate_iods` described below.
|
|
61
62
|
|
|
62
63
|
*Note:*
|
|
@@ -75,18 +76,18 @@ pip install dicom-validator
|
|
|
75
76
|
|
|
76
77
|
## Usage
|
|
77
78
|
```
|
|
78
|
-
validate_iods
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
dump_dcm_info
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
79
|
+
validate_iods [-h] [--standard-path STANDARD_PATH]
|
|
80
|
+
[--revision REVISION] [--force-read] [--recreate-json]
|
|
81
|
+
[--suppress-vr-warnings] [--verbose]
|
|
82
|
+
dicomfiles [dicomfiles ...]
|
|
83
|
+
|
|
84
|
+
dump_dcm_info [-h] [--standard-path STANDARD_PATH]
|
|
85
|
+
[--revision REVISION] [--max-value-len MAX_VALUE_LEN]
|
|
86
|
+
[--show-tags [SHOW_TAGS [SHOW_TAGS ...]]]
|
|
87
|
+
[--show-image-data] [--recreate-json]
|
|
88
|
+
dicomfiles [dicomfiles ...]
|
|
88
89
|
```
|
|
89
|
-
Use the `--help` option for each script do get usage info.
|
|
90
|
+
Use the `--help` option for each script do get more specific usage info.
|
|
90
91
|
|
|
91
92
|
## Access to the DICOM standard
|
|
92
93
|
|
|
@@ -163,17 +164,24 @@ Process finished with exit code 6
|
|
|
163
164
|
As mentioned, if the evaluation of conditions fails, the related module or
|
|
164
165
|
tag is considered optional, which may hide some non-conformity.
|
|
165
166
|
Condition evaluation may fail if:
|
|
166
|
-
- the needed information is not contained in the DICOM file (e.g. verbose
|
|
167
|
-
descriptions like "if the Patient is an animal")
|
|
167
|
+
- the needed information is not directly contained in the DICOM file (e.g. verbose
|
|
168
|
+
descriptions like "if the Patient is an animal", "if the image has been calibrated" etc.)
|
|
168
169
|
- the information is related to other DICOM files (e.g. referenced images)
|
|
169
170
|
- the parsing failed because the condition is too complicated, unexpected,
|
|
170
171
|
or due to a bug (please write an issue if you encounter such a problem)
|
|
171
172
|
|
|
172
173
|
#### Retired tags
|
|
173
|
-
|
|
174
|
+
Only the given standard is used to evaluate the files. If
|
|
174
175
|
the DICOM file has been written using an older standard, it may conform to
|
|
175
176
|
that standard, but not to the newest one. Tags that are retired in the
|
|
176
177
|
version of the standard used for parsing are not considered at all.
|
|
178
|
+
You can always check against an older standard by using the `--revision` option.
|
|
179
|
+
|
|
180
|
+
#### Enumerated values and defined terms
|
|
181
|
+
Most enumerated values are checked against, but some are ignored due to parsing issues.
|
|
182
|
+
Support for more cases may be added in the future.
|
|
183
|
+
Defined terms are _not_ checked, because they are allowed to be user-defined, which means
|
|
184
|
+
that any value may be valid.
|
|
177
185
|
|
|
178
186
|
#### Unsupported cases (support may be added in future versions)
|
|
179
187
|
- SOP classes not in the table in PS3.3 such as Presentation States are not
|
|
@@ -223,7 +231,9 @@ c:\dev\DICOM Data\SR\image12.dcm
|
|
|
223
231
|
|
|
224
232
|
## Build executable on Windows
|
|
225
233
|
|
|
226
|
-
|
|
234
|
+
A self-contained Windows executable is contained in the release artifacts.
|
|
235
|
+
|
|
236
|
+
Here is a sample workflow to build such an executable yourself:
|
|
227
237
|
```powershell
|
|
228
238
|
# Clone the repository
|
|
229
239
|
git clone git@github.com:pydicom/dicom-validator.git
|
|
@@ -239,3 +249,7 @@ pip install -r requirements-dev.txt
|
|
|
239
249
|
# Build executables. They will be placed in the `dist` subfolder.
|
|
240
250
|
pyinstaller dicom-validator.spec -y
|
|
241
251
|
```
|
|
252
|
+
|
|
253
|
+
## Contributing
|
|
254
|
+
Contributions are very welcome. If you submit a pull request for a bugfix
|
|
255
|
+
or a new feature, please make sure to also write respective tests.
|
|
@@ -12,7 +12,7 @@ classifiers = [
|
|
|
12
12
|
"License :: OSI Approved :: MIT License",
|
|
13
13
|
"Intended Audience :: Developers",
|
|
14
14
|
"Intended Audience :: Healthcare Industry",
|
|
15
|
-
"Development Status ::
|
|
15
|
+
"Development Status :: 4 - Beta",
|
|
16
16
|
"Environment :: Console",
|
|
17
17
|
"Programming Language :: Python",
|
|
18
18
|
"Programming Language :: Python :: 3.8",
|
|
@@ -20,6 +20,7 @@ classifiers = [
|
|
|
20
20
|
"Programming Language :: Python :: 3.10",
|
|
21
21
|
"Programming Language :: Python :: 3.11",
|
|
22
22
|
"Programming Language :: Python :: 3.12",
|
|
23
|
+
"Programming Language :: Python :: 3.13",
|
|
23
24
|
"Operating System :: POSIX :: Linux",
|
|
24
25
|
"Operating System :: MacOS",
|
|
25
26
|
"Operating System :: Microsoft :: Windows",
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
__version__ = "0.6.2"
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{dicom_validator-0.6.2 → dicom_validator-0.6.4}/dicom_validator/spec_reader/edition_reader.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
|
{dicom_validator-0.6.2 → dicom_validator-0.6.4}/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
|
{dicom_validator-0.6.2 → dicom_validator-0.6.4}/dicom_validator/validator/dicom_file_validator.py
RENAMED
|
File without changes
|
|
File without changes
|
{dicom_validator-0.6.2 → dicom_validator-0.6.4}/dicom_validator.egg-info/dependency_links.txt
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|