sjoerdk / idiscore Goto Github PK
View Code? Open in Web Editor NEWDeidentification of DICOM images using Attribute Confidentiality Profiles
License: GNU General Public License v3.0
Deidentification of DICOM images using Attribute Confidentiality Profiles
License: GNU General Public License v3.0
idiscore: 1.1.0
All files in /examples should be executed as part of the standard tests.
Currently this is not the case, making it very easy for errors to creep in
IDIS includes a rudimentary implementation of a text-editor-editable version of a Dataset. This is meant to facilitate the creation of test cases for anonymization in the following way:
The current IDIS implementation of this is messy and not great.
The new implementation in dicomgenerator is better, cleaner and more easy to edit.
Remove IDIS implementation, replace with dicomgenerator one
This library seems to still be undergoing maintenance, so a quick observation.
Running Core.deidentify
seems to not produce a copy as otherwise described in the docs, and in fact produces a DICOM object that cannot be saved as it has neither preamble nor filemeta. If metadata is restored with pydicom
's fix_file_meta
, it can be saved, but not restored.
I'd expect, based on the library's self-stated objectives, that operations were available to apply a confidentiality profile + custom rules and not otherwise transform the DICOM object.
I have verified that the basic deidentification example of the library at https://github.com/sjoerdk/idiscore/blob/master/examples/deidentify_a_dataset_basic.py does not work:
import pydicom
from idiscore.core import Core, Profile
from idiscore.defaults import get_dicom_rule_sets
sets = get_dicom_rule_sets() # Contains official DICOM deidentification rules
profile = Profile( # Choose which rule sets to use
rule_sets=[sets.basic_profile, sets.retain_modified_dates, sets.retain_device_id]
)
core = Core(profile) # Create an deidentification core
# read a DICOM dataset from file and write to another
core.deidentify(pydicom.dcmread(my_own_file)).save_as("deidentified.dcm")
With traceback:
AttributeError Traceback (most recent call last)
<ipython-input-4-1f9729cc0bc5> in <cell line: 13>()
11
12 # read a DICOM dataset from file and write to another
---> 13 core.deidentify(pydicom.dcmread(mydicom)).save_as("deidentified.dcm")
~/.cache/pypoetry/virtualenvs/xray-data-registry-U7OvTqMo-py3.8/lib/python3.8/site-packages/pydicom/dataset.py in save_as(self, filename, write_like_original)
2059 Write a DICOM file from a :class:`FileDataset` instance.
2060 """
-> 2061 pydicom.dcmwrite(filename, self, write_like_original)
2062
2063 def ensure_file_meta(self) -> None:
~/.cache/pypoetry/virtualenvs/xray-data-registry-U7OvTqMo-py3.8/lib/python3.8/site-packages/pydicom/filewriter.py in dcmwrite(filename, dataset, write_like_original)
1036 if None in encoding:
1037 if tsyntax is None:
-> 1038 raise AttributeError(
1039 f"'{cls_name}.is_little_endian' and "
1040 f"'{cls_name}.is_implicit_VR' must be set appropriately "
AttributeError: 'Dataset.is_little_endian' and 'Dataset.is_implicit_VR' must be set appropriately before saving
In the apply_rules
method, the output object is initialized with a plain default deidentified = Dataset()
. This likely fails to copy the metadata over, and should be replaced with an actual deep copy (preferably optionally including pixel data!).
Currently these are rather deep python structures. See for example a SafePrivateDefinition:
safe_private = SafePrivateDefinition(
blocks=[
SafePrivateBlock(
tags=[
"0023[SIEMENS MED SP DXMG WH AWS 1]10",
"0023[SIEMENS MED SP DXMG WH AWS 1]11",
"00b1[TestCreator]01",
"00b1[TestCreator]02",
],
criterion=lambda x: x.Modality == "CT",
comment="Some test tags, only valid for CT datasets",
),
SafePrivateBlock(
tags=["00b1[othercreator]11", "00b1[othercreator]12"],
comment="Some more test tags, without a criterion",
),
]
)
This is hard to read and edit, easy to get wrong. Make this more like this:
if Modality == "CT" # Some test tags, only valid for CT datasets
"0023[SIEMENS MED SP DXMG WH AWS 1]10",
"0023[SIEMENS MED SP DXMG WH AWS 1]11",
"00b1[TestCreator]01",
"00b1[TestCreator]02",
"00b1[othercreator]11"
"00b1[othercreator]12"
To validate deidentification you need DICOM examples.
Currently this can only be done from code, which is cumbersome. Would be nice to have a command line interface to do
$ idiscore convert to_example <a_dicom_file>
created a_dicom_file.json DICOMExample...
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.