Git Product home page Git Product logo

idiscore's People

Contributors

pyup-bot avatar sjoerdk avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

Forkers

mkt-eds twjubb-cb

idiscore's Issues

Add command line interface for creating DICOM examples

  • IDIS Core version: 1.1.0

Description

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...

Make safe private and PII lists more readable

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"

Add tests for example files

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

Rebase annotations on dicomgenerator AnnotatedDataset

  • IDIS version 1.1.0

Description

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:

  • Get live DICOM files
  • Convert to editable
  • Manually change PII so that it is unrecognizable, but still true to the original format.
  • Add annotations to specific tags so indicate PII for testing later

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

Basic examples in docs fail due to missing metadata

  • IDIS Core version: 1.0.1
  • Python version: 3.8
  • Operating System: Ubuntu

This library seems to still be undergoing maintenance, so a quick observation.

Description

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.

What I Did

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

Likely fix

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!).

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.