phantom

Effective DICOM anonymization in Python

https://github.com/cyrilzakka/phantom

Science Score: 44.0%

This score indicates how likely this project is to be science-related based on various indicators:

  • CITATION.cff file
    Found CITATION.cff file
  • codemeta.json file
    Found codemeta.json file
  • .zenodo.json file
    Found .zenodo.json file
  • DOI references
  • Academic publication links
  • Committers with academic emails
  • Institutional organization owner
  • JOSS paper metadata
  • Scientific vocabulary similarity
    Low similarity (13.8%) to scientific vocabulary

Keywords

anonymization dicom medical-image-processing medical-imaging pydicom
Last synced: 6 months ago · JSON representation ·

Repository

Effective DICOM anonymization in Python

Basic Info
  • Host: GitHub
  • Owner: cyrilzakka
  • Language: Python
  • Default Branch: main
  • Homepage:
  • Size: 2.28 MB
Statistics
  • Stars: 4
  • Watchers: 2
  • Forks: 1
  • Open Issues: 0
  • Releases: 0
Topics
anonymization dicom medical-image-processing medical-imaging pydicom
Created about 3 years ago · Last pushed about 3 years ago
Metadata Files
Readme Citation

README.md

Phantom: DICOM Anonymization

Phantom is a simple python module intended to simplify medical DICOM anonymization for medical machine-learning applications. Please keep in mind that we do NOT guarantee IRB-validated outputs and are not liable for any breaches of patient privacy.

Installation

bash git clone https://github.com/cyrilzakka/Phantom.git cd Phantom Phantom relies on a few dependencies to run: bash pip install -r requirements.txt

Usage

Metadata (Alpha)

Phantom maintains a very strict paradigm for anonymization to ensure a maximum degree of privacy. Identifiers specified in a base.yaml are kept within the metadata of the DICOM file, while everything else, inluding private metadata is purged. Pixel data is always preserved.

To anonymize DICOM metadata, simply run: bash python meta/metadata.py -s /path/to/dicoms -c /path/to/config.yaml where config.yaml is a simple YAML specifying the attributes to keep in the DICOM. yaml --- base.yaml --- base: keep: ['PatientsSex'] # keys to keep in the DICOM metadata list<str> jitter: {'PatientBirthDate': 30} # keys to jitter specified as a dict dict<str:int> generate: ['PatientID'] # keys to replace with a randomized ID list<str>

As DICOMs become more complex, we resort to modularity to keep anonymization manageable. Phantom configs can be composed together to create more complex anonymization pipelines. As an example, here we create a new echo.yaml configuration that inherits from base.yaml above. while appending modality-specific attributes like HeartRate or NumberOfFrames. Please keep in mind that in the case of inheritance any keys specified within either configuration files will be kept. yaml --- echo.yaml --- echo: defaults: 'base' keep: ['HeartRate', 'NumberOfFrames'] jitter: {'AcquisitionDateTime': 30, 'StudyDate': 30} generate: []

Burned Annotations

DICOM modalities occasionally contain burned annotations, or patient data embedded within the pixels of the images. While this is often difficult to detect and remove without some sort of machine-learning approach, medical imaging modalities with a temporal dimension (e.g. echocardiograms) offer a simple solution via static pixel masking. This can be quickly achieved using the TemporalMaskingPipeline: bash python pixel/temporal_mask.py -s /path/to/dicoms -d /path/to/destination

Disclaimer

This project is still in the alpha phase of development and is likely to experience some breaking changes as a result. If you run into any errors, please make sure to update the package first before opening an issue.

Issues

If you have an issues, feature requests, or simply want to contribute, please do not hesitate to submit a pull request.

Owner

  • Name: Cyril Zakka, MD
  • Login: cyrilzakka
  • Kind: user
  • Location: Palo Alto, California
  • Company: @hiesingerlab

Medical Doctor, Postdoctoral Fellow at Stanford Medicine.

Citation (CITATION.cff)

cff-version: 1.2.0
message: "If you use this toolbox, please consider citing it as below:"
authors:
- family-names: "Zakka"
  given-names: "Cyril"
  orcid: "https://orcid.org/0000-0001-8446-2349"
- family-names: "Chaurasia"
  given-names: "Akash"
  orcid: "https://orcid.org/0000-0003-3438-3313"
- family-names: "Shad"
  given-names: "Rohan"
  orcid: "https://orcid.org/0000-0002-0453-9041"
- family-names: "Hiesinger"
  given-names: "William"
  orcid: "https://orcid.org/0000-0002-3548-2578"
title: "Phantom: DICOM Anonymization Tools"
version: 0.0.1
date-released: 2023-01-19
url: "https://github.com/cyrilzakka/"

GitHub Events

Total
Last Year

Committers

Last synced: 8 months ago

All Time
  • Total Commits: 9
  • Total Committers: 2
  • Avg Commits per committer: 4.5
  • Development Distribution Score (DDS): 0.111
Past Year
  • Commits: 0
  • Committers: 0
  • Avg Commits per committer: 0.0
  • Development Distribution Score (DDS): 0.0
Top Committers
Name Email Commits
Cyril Zakka 1****a 8
Akash Chaurasia a****7@y****m 1

Issues and Pull Requests

Last synced: 8 months ago

All Time
  • Total issues: 0
  • Total pull requests: 1
  • Average time to close issues: N/A
  • Average time to close pull requests: less than a minute
  • Total issue authors: 0
  • Total pull request authors: 1
  • Average comments per issue: 0
  • Average comments per pull request: 0.0
  • Merged pull requests: 1
  • Bot issues: 0
  • Bot pull requests: 0
Past Year
  • Issues: 0
  • Pull requests: 0
  • Average time to close issues: N/A
  • Average time to close pull requests: N/A
  • Issue authors: 0
  • Pull request authors: 0
  • Average comments per issue: 0
  • Average comments per pull request: 0
  • Merged pull requests: 0
  • Bot issues: 0
  • Bot pull requests: 0
Top Authors
Issue Authors
Pull Request Authors
  • akashc1 (1)
Top Labels
Issue Labels
Pull Request Labels

Dependencies

requirements.txt pypi
  • Pillow *
  • numpy *
  • omegaconf *
  • opencv-python *
  • pydicom *