RT-Utils

Why?

RT-Utils is a user friendly tool motivated to allow physicians and other users to view the results of segmentation performed on a series of DICOM images. RT-Utils allows the user to create or load RT Structs, extract 3D masks from RT Struct ROIs, easily add one or more regions of interest, and save the resulting RT Struct in just a few lines of code! You can also use the RT-Utils for merging two existing RT Structs to one file. 

Where to find it?

RT-utils is hosted on a public GitHub repository, has been gained great attention and seeking for collaborative development. You can freely access the software repository via our github page. (https://github.com/qurit/rt-utils

How to install it?

The module deployment on PyPi ensures effortless distribution and installation. 

 pip install rtutils

Sample results

The results of a generated ROI with a dummy mask, as viewed in Slicer

The results of a generated ROI with a liver segmentation model, as viewed in Slicer. (Note the underlying patient data has been hidden)


 

Introduction

The increasing demands of automated analysis, segmentation and outcome prediction taks necessitate the utilization of AI-based approaches in the medical field often require Digital Imaging and Communications in Medicine (DICOM) images, along with radiation therapy (RT) structures used as masks.  However, the performance of AI approaches can vary when applied to data from different sources, or different conversion techniques. The DICOM standard "radiotherapy structure set (RT-struct) object serves the purpose of transferring patient structures and associated information among devices both within and outside the radiotherapy department. Primarily, it encompasses data concerning regions of interest (ROIs) and points of interest, such as dose reference points.

Although tools exist to convert DICOM images and RT-Structures into other data formats, the rapidly evolving landscape of deep learning techniques for medical imaging in radiotherapy, the practical implementation of auto-segmentation solutions in clinical settings remains uncommon. This scarcity can be attributed to the absence of accessible open-source frameworks capable of effectively processing DICOM RT-Structure Sets. Also, there are currently limited specialized Python modules designed for converting NumPy arrays into RT-Structures.

To facilitate the conversion between discrete medical images and DICOM RT-structs formats, our RT-utils package offer crucial functionalities. Furthermore, in the realm of DL model inference and image transformations, some existing tools such as  Lifex, 3D Slicer and dcmrtstruct2nii currently have limitations when it comes to processing DICOM RT-structure data.  Recognizing this, we propose the development of a Python toolkit to streamline the manipulation of DICOM images and RT-Structures. Such a toolkit could significantly enhance efficiency and save valuable time during data preprocessing and prediction stages, particularly for medical researchers.

Available Manipulations

When referring to manipulation, we are describing the user's capability to load existing RT-Struct files or generate new ones based on DICOM series. Once this is achieved, users gain the ability to perform the following actions:

  • Create a novel Region of Interest (ROI) within the RT Struct from a binary mask. Optionally, users can define the color, name, and description of the RT Struct.
  • Enumerate the names of all ROIs contained within the RT Struct.
  • Load ROI masks from the RT Struct by specifying their respective names.
  • Preserve the RT Struct by either providing a name or a path for storage.

Handling of DICOM Headers

Our approach to managing DICOM headers is straightforward. We initially incorporate all the headers required to render the RT Struct file valid. Subsequently, we transfer as many headers as possible from the input DICOM series—such as patient name, patient age, etc. Additionally, as users introduce ROIs within the RT Struct, these will be dynamically integrated into the appropriate sequences within the RT Struct.

Discrepancies with existing tools

RT-struct to Mask conversion, Converted masks overlaid on PET scans, RT-utils: Our approach. PET values are scaled in the range of (0,1)




 

Incorporating an ROI Mask

For the `add_roi` method, the ROI mask should adhere to a specific format: a 3D array where each 2D slice forms a binary mask. Within this context, a pixel value of one within the mask signifies that the pixel pertains to the ROI for a given slice. Crucially, the number of slices within the array should match the number of slices in your DICOM series. The first slice in the array corresponds to the smallest slice location in the DICOM series, the second slice corresponds to the second slice location, and so forth.

How to cite RT-utils

If you are incorporating RT-Utils into your projects, you can cite this work:

Shrestha A, Watkins A, Yousefirizi F, Rahmim A, Uribe CF (2024). RT-utils: A Minimal Python Library for RT-struct Manipulation. arXiv preprint arXiv:2405.06184.

Back to top