Skip to main content

RTDICOMTools

My collection of Tools that extend the capabilities of current, widespread radiotherapy DICOM manipulation repositories.

Table of Contents

Installation

To use this repository, Python 3.8 or higher is required. To install the required packages, run the following command:

pip install rtdicomtools

Then, you can import the classes from the repository:

from rtdicomtools import *

npViewer3D

This class is initialized with a np.array of a 3D volume. The entries can either be scalars or RGB color values. One can then slice the volume in any desired diection. Also features a side-by-side view which shows the current slice marked with an indication line. This class serves as the visuialization engine for some of the results produced by the other classes in this repository. Of course, it can also be used independently.


dcmStructureSet

This class is initialized with the path to a RTSTRUCT file. It can then be used to extract the structure names and their corresponding contours without the need for the referenced CT dataset. This is useful for when you have a RTSTRUCT file but not the CT dataset that it references - for example, when you have a RTSTRUCT file from a vendor that you want to use with a different treatment planning system, or patient privacy concerns prevent you from sharing the CT dataset. If the CT dataset is available, the contours can be drawn in the same scale as the CT dataset. This is useful for when you want to visualize the contours on top of the CT dataset.

Methods

Since the scale information is encoded in the referenced CT dataset, the contours are returned in an array of arbitrary dimensions. The scale can be adjusted later on, if the CT dataset is available. Check the documentation for methods that influence the grid size, spacing, etc.

dcmStructureSet.DrawAllContours()

This method will draw all contours in the RTSTRUCT file. It will return a np.array of all contours, colored in the respective structure color.

dcmStructureSet.DrawStructureContour(Structure, RemoveEmptySlices=True)

This method will draw all contours for the structure with the name Structure. It will return a np.array of all contours, colored in the respective structure color. If RemoveEmptySlices is set to True, it will remove any slices that do not contain any contours for the structure.

dcmStructureSet.DrawStructureContourSlice(Structure, Slice)

This method will draw the contours for the structure with the name Structure of a specific slice.

dcmStructureSet.getSliceIndices(Structure)

This method will return a list of all slice indices that contain contours for the structure


dcmMLC

This class is initialized with the path to a RTPLAN file. It can then be used to extract the MLC positions for each beam in the plan. Additionally, the MLC positions can be drawn, whether by control point, or the entire sequence. It also contains a method to find the centers of the MLC apertures.

Methods

dcmMLC.DrawEntireMLCSequence(rotate=False, draw_edges=True)

This method will draw the entire MLC sequence. It will return a np.array of all MLC positions. If rotate is set to True, it will rotate the MLC positions by the collimator angle. If draw_edges is set to True, it will draw the edges of the MLC positions.

dcmMLC.DrawMLCAperture(beam, control_point, rotate=False, draw_edges=True)

This method will draw the MLC aperture for a specific beam and control point. It will return a np.array of all MLC positions. If rotate is set to True, it will rotate the MLC positions by the collimator angle. If draw_edges is set to True, it will draw the edges of the MLC positions.

dcmMLC.FindApertureCenters(beam, control_point, lower_area_bound, upper_area_bound)

This method will find the centers of the MLC apertures for a specific beam and control point. It will return a list of tuples, where each tuple contains the x and y coordinates of the center of the aperture. The lower_area_bound and upper_area_bound parameters are used to filter out apertures that are too small or too large.

Metadata

Release files for rtdicomtools 1.0.1

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

Source distribution (sdist)

Source distribution for rtdicomtools 1.0.1
File Size Uploaded Provenance Actions
rtdicomtools-1.0.1.tar.gz 13.4 kB Without provenance Details for rtdicomtools-1.0.1.tar.gz

Built distribution (wheel)

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

Total release size: 26.8 kB

Release files / rtdicomtools-1.0.1.tar.gz

Download URL rtdicomtools-1.0.1.tar.gz
Size 13.4 kB
Tags Source
SHA-256 checksum
How to use checksums
96d3364a2a8adc4d037baf982f5c92bc361bb1721704535d4472c23c741c1770
BLAKE2b-256 checksum
How to use checksums
5f4273f84fde9da4067a0c4184cfb339770cd48ba867d70ade1e24666c81ce73
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.10.8

Release files / rtdicomtools-1.0.1-py3-none-any.whl

Download URL rtdicomtools-1.0.1-py3-none-any.whl
Size 13.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
501ea0343d8ba311427d0bd534ee4a07c9171f335e2ccc7e53cfeb9d9daa4c29
BLAKE2b-256 checksum
How to use checksums
b18f9b8d495b6760a3da59ac6795215264460d28d8f8f903c4e50eee308da739
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.10.8

Security for rtdicomtools 1.0.1

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

1.0.1 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