Skip to main content

PyDicer: PYthon Dicom Image ConvertER

Welcome to PyDicer, a tool to ease the process of converting Radiotherapy DICOM data objects into a format typically used for research purposes. In addition to data conversion, functionality is provided to help analyse the data. This includes computing radiomic features, radiotherapy dose metrics and auto-segmentation metrics. PyDicer uses the NIfTI format to store data is a well defined file system structure. Tracking of these data objects in CSV files, also stored on the file system, provides an easy and flexible way to work with the converted data in your research.

The PyDicer documentation provides several examples and guides to help you get started with the tool. Here are a few PyDicer principles to keep in mind as you get started:

  • The working directory structure is standardised and generalisable for use with any DICOM dataset.
  • Use Pandas DataFrame's to work with converted data objects.
  • SimpleITK and PlatiPy are used under the hood for the image conversion, visualisation and analysis tasks.
  • Always inspect visualisations, plots and metrics produced by PyDicer in your working directory. Remember, PyDicer is a research tool so only use it for research purposes and expect the unexpected!

Installation

PyDicer currently supports Python version 3.8, 3.9 and 3.10. Install PyDicer in your Python environment using pip:

pip install pydicer

Supported Modalities

PyDicer currently supports converting and analysing the following DICOM modalities:

  • CT
  • MR
  • PT (Experimental)
  • RTSTRUCT
  • RTPLAN (Not converted since this only consists of meta data)
  • RTDOSE

Directory Structure

PyDicer will place converted and intermediate files into a specific directory structure. Visualisation, metrics computed and plots are also stored along side the converted data objects. Within the configured working directory [working], the following directories will be generated:

  • [working]/data: Directory in which converted data will be placed
  • [working]/quarantine: Files which couldn't be preprocessed or converted will be placed in here for you to investigate further
  • [working]/.pydicer: Intermediate files as well as log output will be stored in here
  • [working]/[dataset_name]: Clean datasets prepared using the Dataset Preparation Module will be stored in a directory with their name and will symbolically link to converted in the [working]/data directory

Pipeline

The pipeline handles fetching of the DICOM data to conversion and preparation of your research dataset. Here are the key steps of the pipeline:

  1. Input: various classes are provided to fetch DICOM files from the file system, DICOM PACS, TCIA or Orthanc. A TestInput class is also provided to supply test data for development/testing.

  2. Preprocess: The DICOM files are sorted and linked. Error checking is performed and resolved where possible.

  3. Conversion: The DICOM files are converted to the target format (NIfTI).

  4. Visualistion: Visualistions of data converted are prepared to assist with data selection.

  5. Dataset Preparation: The appropriate files from the converted data are selected to prepare a clean dataset ready for use in your research project!

  6. Analysis: Radiomics and Dose Metrics are computed on the converted data.

Getting Started

Running the pipeline is easy. The following script will get you started:

from pathlib import Path

from pydicer.input.test import TestInput
from pydicer import PyDicer

# Configure working directory
directory = Path("./testdata")
directory.mkdir(exist_ok=True, parents=True)

# Fetch some test DICOM data to convert
dicom_directory = directory.joinpath("dicom")
dicom_directory.mkdir(exist_ok=True, parents=True)
test_input = TestInput(dicom_directory)
test_input.fetch_data()

# Create the PyDicer tool object and add the dicom directory as an input location
pydicer = PyDicer(directory)
pydicer.add_input(dicom_directory)

# Run the pipeline
pydicer.run_pipeline()

Contributing

PyDicer is an open-source tool and contributions are welcome! Here are some ways you might consider contributing to the project:

  • Reporting issues on GitHub.
  • Correcting/extending the documentation.
  • Contributing a bug fix or extending some functionality.
  • Providing functionality to support additional DICOM modalities.
  • Giving the PyDicer project a star on GitHub.

For more information, see the Contributing documentation.

Authors

PyDicer was developed by the Ingham Medical Physics team in South-Western Sydney. It was developed as part of the Australian Cancer Data Network supported by the Australian Research Data Commons.

Metadata

Release files for pydicer 0.2.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for pydicer 0.2.0
File Size Uploaded Provenance Actions
pydicer-0.2.0.tar.gz 66.2 kB Without provenance Details for pydicer-0.2.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for pydicer 0.2.0
File Interpreter ABI Platform Actions
pydicer-0.2.0-py3-none-any.whl Python 3 none any Details for pydicer-0.2.0-py3-none-any.whl

Total release size: 147.9 kB

Release files / pydicer-0.2.0.tar.gz

Download URL pydicer-0.2.0.tar.gz
Size 66.2 kB
Tags Source
SHA-256 checksum
How to use checksums
9f0dd3b53931ca9100db9eb52f6725142570213eb184e26405c77dec709163be
BLAKE2b-256 checksum
How to use checksums
1c1761776171aa1d701b9d94dcac78ec34178dd0ab2db01a1da5404379d2bb25
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.7.1 CPython/3.9.16 Darwin/22.6.0

Release files / pydicer-0.2.0-py3-none-any.whl

Download URL pydicer-0.2.0-py3-none-any.whl
Size 81.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
a2306de1d6f54bb5f81424639eb4837eec152fed51a00194d918e08c29ee4c47
BLAKE2b-256 checksum
How to use checksums
2fe79c02ee7ae53945a0f8eb86c228267745af4df9ade448de7f2e9a93946851
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.7.1 CPython/3.9.16 Darwin/22.6.0

Security for pydicer 0.2.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.2.0 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page