Skip to main content

A tool for checking DICOM compliance against a template

Project description

dicompare

dicompare is a DICOM validation tool designed to ensure compliance with study-specific imaging protocols and domain-specific guidelines while preserving data privacy. It provides multiple interfaces, including support for validation directly in the browser, leveraging WebAssembly (WASM), Pyodide, and the underlying pip package dicompare. dicompare is suitable for multi-site studies and clinical environments without requiring software installation or external data uploads.

dicompare supports DICOM session validation against templates based on:

  • Reference sessions: JSON schema files can be generated based on a reference MRI scanning session;
  • [TESTING] domain guidelines: Flexible guidelines for specific domains (currently QSM);
  • [FUTURE] landmark studies: Schema files based on landmark studies such as the HCP, ABCD, and UK BioBank projects.

Command-line interface (CLI) and application programming interface (API)

While you can run dicompare in your browser now without any installation, you may also use the underlying dicompare pip package if you wish to use the command-line interface (CLI) or application programming interface (API).

pip install dicompare

Command-line interface (CLI)

The package provides the following CLI entry points:

  • dcm-gen-session: Generate JSON schemas for DICOM validation.
  • dcm-check-session: Validate DICOM sessions against predefined schemas.
  1. Generate a session template
dcm-gen-session \
    --in_session_dir /path/to/dicom/session \
    --out_json_ref schema.json \
    --acquisition_fields ProtocolName SeriesDescription \
    --reference_fields EchoTime RepetitionTime

This will create a JSON schema describing the session based on the specified fields.

  1. Validate a DICOM Session
dicompare-session \
    --in_session /path/to/dicom/session \
    --json_ref schema.json \
    --out_json compliance_report.json

The tool will output a compliance summary, indicating deviations from the session template.

Python API

The dicompare package provides a Python API for programmatic schema generation and validation.

Generate a schema:

from dicompare.io import read_dicom_session

reference_fields = ["EchoTime", "RepetitionTime"]
acquisition_fields = ["ProtocolName", "SeriesDescription"]

session_data = read_dicom_session(
    session_dir="/path/to/dicom/session",
    acquisition_fields=acquisition_fields,
    reference_fields=reference_fields
)

# Save the schema as JSON
import json
with open("schema.json", "w") as f:
    json.dump(session_data, f, indent=4)

Validate a session:

from dicompare.io import read_json_session, read_dicom_session
from dicompare.compliance import check_session_compliance

# Load the schema
acquisition_fields, reference_fields, ref_session = read_json_session(json_ref="schema.json")

# Read the input session
in_session = read_dicom_session(
    session_dir="/path/to/dicom/session",
    acquisition_fields=acquisition_fields,
    reference_fields=reference_fields
)

# Perform compliance check
compliance_summary = check_session_compliance(
    in_session=in_session,
    ref_session=ref_session,
    series_map=None  # Optional: map series if needed
)

# Print compliance summary
for entry in compliance_summary:
    print(entry)

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

dicompare-0.1.23.tar.gz (37.0 kB view details)

Uploaded Source

Built Distribution

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

dicompare-0.1.23-py3-none-any.whl (41.0 kB view details)

Uploaded Python 3

File details

Details for the file dicompare-0.1.23.tar.gz.

File metadata

  • Download URL: dicompare-0.1.23.tar.gz
  • Upload date:
  • Size: 37.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.9.22

File hashes

Hashes for dicompare-0.1.23.tar.gz
Algorithm Hash digest
SHA256 a1b36df53b0a91817b781c634cdb7cfe17e4dcd82cf993a1b828c04b784ec8c8
MD5 c52e718c90265ef8e336e62dfd9fec70
BLAKE2b-256 56800dfa8b1beb0986cae87d25b4d279e4c126da398cb293b1fc03468d7a08f6

See more details on using hashes here.

File details

Details for the file dicompare-0.1.23-py3-none-any.whl.

File metadata

  • Download URL: dicompare-0.1.23-py3-none-any.whl
  • Upload date:
  • Size: 41.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.9.22

File hashes

Hashes for dicompare-0.1.23-py3-none-any.whl
Algorithm Hash digest
SHA256 a357dc6131dc0b8c5fafce14c29f94362c7b8ac775a2848c9c17da2e5e0e2454
MD5 47452213ba15062f2fe86a3cf259f47a
BLAKE2b-256 b8b713633f8de1a755d0ad80ccc252012ee3efd8fb5e6c6fbecc48c2e1f01e6e

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