Datasets:

Modalities:
Text
Formats:
json
Languages:
English
Size:
< 1K
Libraries:
Datasets
pandas
License:
PortPy_Dataset / README.md
PortPy's picture
Update README.md
78d769e verified
metadata
license: cc-by-nc-4.0
language:
  - en
size_categories:
  - n>1T
configs:
  - config_name: default
    data_files:
      - split: train
        path: data_info.jsonl

PortPy: Planning and Optimization for Radiation Therapy

Data Overview

PortPy equips researchers with a robust benchmark patient dataset, sourced from the FDA-approved Eclipse commercial treatment planning system through its API. This dataset embodies all necessary elements for optimizing various machine configurations such as beam angles, aperture shapes, and leaf movements. It includes

  1. Dose Influence Matrix (AKA dose deposition matrix, dij matrix): The dose contribution of each beamlet to each voxel,
  2. Beamlets/Voxels Details: Detailed information about the position and size of beamlets/voxels,
  3. Expert-Selected Benchmark Beams: An expert clinical physicist has carefully selected benchmark beams, providing reference beams for comparison and benchmarking,
  4. Benchmark IMRT Plan: A benchmark IMRT plan generated using our in-house automated treatment planning system called ECHO (YouTube Video, Paper). This plan serves as a benchmark for evaluating new treatment planning algorithms.
  5. Benchmark Clinical Criteria: A set of clinically relevant mean/max/DVH criteria for plan evaluation. Currently, this set encompasses only the Lung 2GyΓ—30 protocol but will be expanded in the future to more protocols as well as TCP/NTCP evaluation functions.

Subsequently, create a directory titled './data' in the current project directory and transfer the downloaded file into it. For example, ./data/Lung_Phantom_Patient_1. We have adopted the widely-used JSON and HDF5 formats for data storage. HDFViwer can be utilized to view the contents of the HDF5 files.

Note: Initially, we will utilize a lung dataset from TCIA. The original DICOM CT images and structure sets are not included in the PortPy dataset and need to be directly downloaded from the TCIA. Users can fetch the TCIA collection ID and the TCIA subject ID for each PortPy patient using the get_tcia_metadata() method in PortPy and subsequently download the data from TCIA (see imrt_tps_import)

Data Fields

Each beam is divided into small 2D beamlets/spots, and the patient’s body is divided into small 3D voxels. Eclipse is used to calculate the dose contribution of each beamlet to every voxel, resulting in a dose influence matrix (also called a dose deposition matrix or dij matrix). Relevant beamlet and voxel information (e.g., size, coordinates) is stored, as well as CT data (e.g., voxel Hounsfield Units, coordinates) and structure data (e.g., structure names, masks).

The scripts adopt the data format, where:

  • Light-weight metadata is stored in human-readable .json files.

  • Large datasets (e.g., dose influence matrices) are stored in .h5 (HDF5) files.

A typical output folder structure for a patient is shown below:

Example JSON and HDF5 Files

Beam_0_metadata.json

Below is an example .json file for a beam. Notice how the larger data arrays (e.g., beamlets, influence matrices) point to external .h5 files with specific tags. For instance, "influenceMatrixSparse_File": "Beam_0_Data.h5/inf_matrix_sparse", means the influence matrix is stored in a file named Beam_0_Data.h5 under a tag named inf_matrix_sparse.

{
  "ID": 0,
  "gantry_angle": 0,
  "collimator_angle": 0,
  "couch_angle": 0,
  "iso_center": {
    "x_mm": 119.2041,
    "y_mm": 60.53891,
    "z_mm": -9.122542
  },
  "beamlets": {
    "id_File": "Beam_0_Data.h5/beamlets/id",
    "width_mm_File": "Beam_0_Data.h5/beamlets/width_mm",
    "height_mm_File": "Beam_0_Data.h5/beamlets/height_mm",
    "position_x_mm_File": "Beam_0_Data.h5/beamlets/position_x_mm",
    "position_y_mm_File": "Beam_0_Data.h5/beamlets/position_y_mm",
    "MLC_leaf_idx_File": "Beam_0_Data.h5/beamlets/MLC_leaf_idx"
  },
  "jaw_position": {
    "top_left_x_mm": -5,
    "top_left_y_mm": 40,
    "bottom_right_x_mm": 97.5,
    "bottom_right_y_mm": -60
  },
  "influenceMatrixSparse_File": "Beam_0_Data.h5/inf_matrix_sparse",
  "influenceMatrixFull_File": "Beam_0_Data.h5/inf_matrix_full",
  "MLC_leaves_pos_y_mm_File": "Beam_0_Data.h5/MLC_leaves_pos_y_mm"
}
Beam_0_Data.h5

HDF5 (Hierarchical Data Format version 5) is a common and powerful format that is supported by most programming languages. It is designed to store and organize large amounts of complex data using a flexible, hierarchical structure, allowing efficient access, compression, and storage of multidimensional arrays. The following example shows the hierarchical data for a beam. HDFViwer can be used to see through a .h5 file.

Beam_0_Data.h5
β”‚
β”œβ”€β”€ beamlets/
β”‚   β”œβ”€β”€ id               (1D array of beamlet IDs)
β”‚   β”œβ”€β”€ width_mm         (1D array of beamlet widths in mm)
β”‚   β”œβ”€β”€ height_mm        (1D array of beamlet heights in mm)
β”‚   β”œβ”€β”€ position_x_mm    (1D array of x positions in mm)
β”‚   β”œβ”€β”€ position_y_mm    (1D array of y positions in mm)
β”‚   └── MLC_leaf_idx     (1D array of MLC leaf indices)
β”‚
β”œβ”€β”€ inf_matrix_sparse    (Sparse influence matrix)
β”œβ”€β”€ inf_matrix_full      (Full influence matrix)
└── MLC_leaves_pos_y_mm (MLC leaves positions in mm in y direction)

How to use it

You can load the dataset with the following lines of code.

#!pip install portpy (# Install portpy )
import portpy.photon as pp

# Use PortPy DataExplorer class to explore and download PortPy data from HuggingFace. Please modify 'local_download_dir' in case
# if you want to download data to custom local directory
data = pp.DataExplorer(hf_repo_id="PortPy-Project/PortPy_Dataset", local_download_dir=r'../hugging_face_data')

# display overview of the patients available in portpy
data.display_list_of_patients()

#pick up a patient to create a treament plan
data.patient_id = 'Lung_Patient_16'

# download data for the given patient
data.filter_and_download_hf_dataset()

# display patient metadata
data.display_patient_metadata()

Team

PortPy is a community project initiated at Memorial Sloan Kettering Cancer Center (MSK). It is currently developed and maintained by Masoud Zarepisheh (Principal Investigator, zarepism@mskcc.org) and Gourav Jhanwar (Lead Developer, jhanwarg@mskcc.org). Other team members include: Mojtaba Tefagh (Optimization/AI/ML expert from University of Edinburgh), Linda Hong (Medical Physicist from MSK), Vicki Taasti (Proton Physicist from Aarhus University), and Saad Nadeem (AI/Imaging expert from MSK).

Attribution

This dataset is derived from the publicly available NSCLC-Radiomics dataset hosted on The Cancer Imaging Archive (TCIA).

Original Data Citation: Aerts, H. J. W. L., Wee, L., Rios Velazquez, E., Leijenaar, R. T. H., Parmar, C., Grossmann, P., Carvalho, S., Bussink, J., Monshouwer, R., Haibe-Kains, B., Rietveld, D., Hoebers, F., Rietbergen, M. M., Leemans, C. R., Dekker, A., Quackenbush, J., Gillies, R. J., Lambin, P. (2014). Data From NSCLC-Radiomics (version 4) [Data set]. The Cancer Imaging Archive. https://doi.org/10.7937/K9/TCIA.2015.PF0M9REI

The original imaging data was processed by the authors of this repository by:

  • Adding beam configurations.
  • Creating influence matrices suitable for radiotherapy treatment planning optimization.
  • Adding benchmark plans using in-house automated treatment planning system ECHO.
  • Storing the data in the standardized PortPy data format for research and educational purposes.