Skip to content

Commit fba9ad6

Browse files
committed
Replace removed pydicom API
- makes it compatible to pydicom 3 - also promote to beta state
1 parent 4f87e59 commit fba9ad6

File tree

4 files changed

+35
-21
lines changed

4 files changed

+35
-21
lines changed

CHANGES.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ The released versions correspond to PyPi releases.
99

1010
### Infrastructure
1111
* use the current DICOM standard (2024c) for testing
12+
* make the package compatible to `pydicom` 3.0
1213

1314
## [Version 0.6.2](https://pypi.python.org/pypi/dicom-validator/0.6.2) (2024-08-09)
1415
Fixes a regression in version 0.6.1.

README.md

Lines changed: 29 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ DICOM standard.
2121

2222
*Disclaimer:*
2323
No guarantees are given for the correctness of the results.
24-
This is alpha-stage software and mostly thought as a proof of concept.
24+
This is beta-stage software which is mostly developed as a proof of concept.
2525
Also check the limitations for `validate_iods` described below.
2626

2727
*Note:*
@@ -40,18 +40,18 @@ pip install dicom-validator
4040

4141
## Usage
4242
```
43-
validate_iods.py [-h] [--standard-path STANDARD_PATH]
44-
[--revision REVISION] [--force-read] [--recreate-json]
45-
[--verbose]
46-
dicomfiles [dicomfiles ...]
47-
48-
dump_dcm_info.py [-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 ...]
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 ...]
5353
```
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.
5555

5656
## Access to the DICOM standard
5757

@@ -128,17 +128,24 @@ Process finished with exit code 6
128128
As mentioned, if the evaluation of conditions fails, the related module or
129129
tag is considered optional, which may hide some non-conformity.
130130
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.)
133133
- the information is related to other DICOM files (e.g. referenced images)
134134
- the parsing failed because the condition is too complicated, unexpected,
135135
or due to a bug (please write an issue if you encounter such a problem)
136136

137137
#### Retired tags
138-
Also note that only the given standard is used to evaluate the files. If
138+
Only the given standard is used to evaluate the files. If
139139
the DICOM file has been written using an older standard, it may conform to
140140
that standard, but not to the newest one. Tags that are retired in the
141141
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.
142149

143150
#### Unsupported cases (support may be added in future versions)
144151
- 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
188195

189196
## Build executable on Windows
190197

191-
Here is a sample workflow:
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:
192201
```powershell
193202
# Clone the repository
194203
git clone git@github.com:pydicom/dicom-validator.git
@@ -204,3 +213,7 @@ pip install -r requirements-dev.txt
204213
# Build executables. They will be placed in the `dist` subfolder.
205214
pyinstaller dicom-validator.spec -y
206215
```
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.

dicom_validator/tests/validator/test_dicom_file_validator.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
from pathlib import Path
33

44
import pytest
5-
from pydicom import write_file
5+
from pydicom import dcmwrite
66
from pydicom.dataset import Dataset, FileDataset, FileMetaDataset
77

88
from dicom_validator.validator.dicom_file_validator import DicomFileValidator
@@ -51,14 +51,14 @@ def test_missing_sop_class(self, validator):
5151
file_dataset = FileDataset(
5252
filename, Dataset(), file_meta=self.create_metadata()
5353
)
54-
write_file(filename, file_dataset, write_like_original=False)
54+
dcmwrite(filename, file_dataset, write_like_original=False)
5555
self.assert_fatal_error(validator, filename, "Missing SOPClassUID")
5656

5757
def test_unknown_sop_class(self, validator):
5858
dataset = Dataset()
5959
dataset.SOPClassUID = "Unknown"
6060
file_dataset = FileDataset("test", dataset, file_meta=self.create_metadata())
61-
write_file("test", file_dataset, write_like_original=False)
61+
dcmwrite("test", file_dataset, write_like_original=False)
6262
self.assert_fatal_error(
6363
validator, "test", "Unknown SOPClassUID (probably retired): Unknown"
6464
)
@@ -79,7 +79,7 @@ def test_non_fatal_errors(self, validator):
7979
dataset = Dataset()
8080
dataset.SOPClassUID = "1.2.840.10008.5.1.4.1.1.2" # CT Image Storage
8181
file_dataset = FileDataset("test", dataset, file_meta=self.create_metadata())
82-
write_file("test", file_dataset, write_like_original=False)
82+
dcmwrite("test", file_dataset, write_like_original=False)
8383
error_dict = validator.validate("test")
8484
assert len(error_dict) == 1
8585
errors = error_dict["test"]

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ classifiers = [
1212
"License :: OSI Approved :: MIT License",
1313
"Intended Audience :: Developers",
1414
"Intended Audience :: Healthcare Industry",
15-
"Development Status :: 3 - Alpha",
15+
"Development Status :: 4 - Beta",
1616
"Environment :: Console",
1717
"Programming Language :: Python",
1818
"Programming Language :: Python :: 3.8",

0 commit comments

Comments
 (0)