Skip to main content

A Python module that compares an original DICOM file with its deidentified counterpart and returns the differences between the two.

Project description

CI PyPI PyPI - Python Version Code style: black

Dicomdiff

A comprehensive Python module for analyzing DICOM file pseudonymization and de-identification processes. Dicomdiff enables researchers and healthcare professionals to evaluate, compare, and validate different pseudonymization methods by providing detailed analysis of how DICOM tags are transformed during de-identification.

What Dicomdiff Does

Core Functionality:

  • Individual File Comparison: Compare original DICOM files with their de-identified versions to detect specific changes
  • Pseudonymization Method Analysis: Evaluate and compare different pseudonymization approaches across multiple files
  • Cross-Method Comparison: Analyze how different pseudonymization tools handle the same source data
  • Consistency Validation: Check whether pseudonymization methods behave consistently across datasets
  • Tag Transformation Tracking: Monitor how specific DICOM tags are modified, removed, or preserved during pseudonymization

Installation

Install the module using pip

  pip install dicomdiff

Usage

Compare two DICOM files in Python

from dicomdiff.main import compare_dicom_files, print_differences

original_file = "path to original dcm file"
deidentified_file = "path to de-identified dcm file"

result = compare_dicom_files(original_file, deidentified_file) # compare the files
print_differences(result) # print the results

Compare two pseudonymization methods

from idiscore.defaults import create_default_core
from dicomdiff.pseudonymizer import InferredPseudonymizer
from dicomdiff.summary import generate_pseudonymization_summary

pseudonymizer_A = create_default_core()
pseudonymizer_B = InferredPseudonymizer(mapping, output_files)

# List of DICOM file paths to analyze
file_paths = ["path/to/file1.dcm", "path/to/file2.dcm"]

# Generate comparison summary
summary_df = generate_pseudonymization_summary(
    file_paths=file_paths,
    pseudonymizer_a=pseudonymizer_A,
    pseudonymizer_b=pseudonymizer_B
)

Compare two DICOM files using CLI

# Compare two DICOM files
dicomdiff compare file1.dcm file2.dcm

# Filter results
dicomdiff compare file1.dcm file.dcm --changed

CLI Flags

Flag Description
--changed Show only tags that have different values between files
--removed Show only tags that exist in original but not in de-identified file
--added Show only tags that exist in de-identified but not in original file
--unchanged Show only tags that have identical values in both files

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

dicomdiff-0.3.1.tar.gz (22.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

dicomdiff-0.3.1-py3-none-any.whl (24.9 kB view details)

Uploaded Python 3

File details

Details for the file dicomdiff-0.3.1.tar.gz.

File metadata

  • Download URL: dicomdiff-0.3.1.tar.gz
  • Upload date:
  • Size: 22.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/2.1.3 CPython/3.10.17 Linux/6.11.0-1014-azure

File hashes

Hashes for dicomdiff-0.3.1.tar.gz
Algorithm Hash digest
SHA256 71a83defda9c8f53b5a91364aae6c5b74c523c8fc07ac736615e53627d1e511a
MD5 6a06b1aa09dd02e8d3b9f49230e032df
BLAKE2b-256 92b862eb8948319ec3ee67330a69bed05faadbb1f3e7c17d76aa87cf864cc948

See more details on using hashes here.

File details

Details for the file dicomdiff-0.3.1-py3-none-any.whl.

File metadata

  • Download URL: dicomdiff-0.3.1-py3-none-any.whl
  • Upload date:
  • Size: 24.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/2.1.3 CPython/3.10.17 Linux/6.11.0-1014-azure

File hashes

Hashes for dicomdiff-0.3.1-py3-none-any.whl
Algorithm Hash digest
SHA256 e2e4ba96d48af48f278dbfc4b5293bbd72c11a0bd461616e1c5cdf9b3082e0a9
MD5 a238d68f07fde450db58d745d5e3483a
BLAKE2b-256 387700af9fc5b01182455b0aaa929c8a45b2784f85ac187857ca1961bbb04489

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page