Replies: 1 comment 8 replies
-
|
Currently, the validation result is mostly meant to be used for console display (and for some testing), but the format is far from ideal for post-processing. I'm not sure about your workflow. Assuming you have a root path where all DICOM files reside that you want to validate, you could do something like this (note: this is out of my head and not tested): # download and process the needed revision of the DICOM standard - needs only to be done once for a given standard
dicom_info_path = str(Path.home() / "dicom-validator" # this is the default
reader = EditionReader(dicom_info_path)
reader.get_revision("2025b") # could also use "current" for the current standard
# validate all DICOM files in the path (this is recursive)
# alternatively, you could iterate over the files yourself and validate each separately
# - probably the better way for a large number of files
json_path = Path(dicom_info_path, "json")
dicom_info = EditionReader.load_dicom_info(json_path)
validator = DicomFileValidator(dicom_info)
result = validator.validate(dicom_file_path)
for file_path, errors in result.items():
for module, module_errors in errors.items():
# 'module' is the name of the module in the standard where the violation occurs
for error_msg, tags in module_errors:
# error_msg is the message that is logged, e.g. 'Tag (0018,1000) (Device Serial Number) is missing'
# tags is a list of related tags (mostly only one)
# this has to be added to the database in some form, depending on your needs
...You could structure your database in a similar way, e.g. a I actually had in mind to structure the result in a way that is better machine-readable (e.g. at least use error codes instead of error messages, and construct the messages from these), but until now this has not been needed. Maybe it's time for this now - I'm open to suggestions or feature requests (see #205). |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Hello developers
I'm currently prototyping a tool to bulk-validate a big load of DICOM files. My goal is to save the information from validate_iods within a small SQLite database to check, which DICOM tags are missing or unexpected to get a big picture of what to optimize in the configuration of our systems.
I tried a few different ways, but I can't make it work, that I can save the information generated bi DicomValidateFile into an object.
Is there a way I can achieve this?
Thanks
Beta Was this translation helpful? Give feedback.
All reactions