/dicompyler-core

A library of core radiation therapy modules for DICOM RT used by dicompyler

Primary LanguagePythonOtherNOASSERTION

dicompyler-core

Binder pypi Python Version GH Actions Documentation Status coveralls Codacy Codecov Total Lines Code Size Zenodo

A library of core radiation therapy modules for DICOM / DICOM RT used by dicompyler. This package includes:

  • dicomparser: parse DICOM objects in an easy-to-use manner
  • dvh: Pythonic access to dose volume histogram (DVH) data
  • dvhcalc: Independent DVH calculation using DICOM RT Dose & RT Structure Set
  • dose: Pythonic access to RT Dose data including dose summation

Other information

Dependencies

  • numpy 1.2 or higher
  • pydicom 0.9.9 or higher (pydicom 1.0 compatible)
  • matplotlib 1.3.0 or higher (for DVH calculation)
  • Optional:
    • Pillow (for image display)
    • Shapely (for structure volume calculation)
    • scikit-image (for DVH interpolation)
    • scipy (for dose grid summation using interpolation)

Basic Usage

from dicompylercore import dicomparser, dvh, dvhcalc
dp = dicomparser.DicomParser("rtss.dcm")

# i.e. Get a dict of structure information
structures = dp.GetStructures()

>>> structures[5]
{'color': array([255, 128, 0]), 'type': 'ORGAN', 'id': 5, 'empty': False, 'name': 'Heart'}

# Access DVH data
rtdose = dicomparser.DicomParser("rtdose.dcm")
heartdvh = dvh.DVH.from_dicom_dvh(rtdose.ds, 5)

>>> heartdvh.describe()
Structure: Heart
DVH Type:  cumulative, abs dose: Gy, abs volume: cm3
Volume:    437.46 cm3
Max Dose:  3.10 Gy
Min Dose:  0.02 Gy
Mean Dose: 0.64 Gy
D100:      0.00 Gy
D98:       0.03 Gy
D95:       0.03 Gy
D2cc:      2.93 Gy

# Calculate a DVH from DICOM RT data
calcdvh = dvhcalc.get_dvh("rtss.dcm", "rtdose.dcm", 5)

>>> calcdvh.max, calcdvh.min, calcdvh.D2cc
(3.0899999999999999, 0.029999999999999999, dvh.DVHValue(2.96, 'Gy'))

Advanced Usage and Examples can be found in Binder: Binder

Citing dicompyler-core

A DOI for dicompyler-core with various citation styles can be found at Zenodo: Zenodo

Credits

This package was created with Cookiecutter and the audreyr/cookiecutter-pypackage project template.