Datasets:

Modalities:
Text
Formats:
json
Languages:
English
Size:
< 1K
Libraries:
Datasets
pandas
License:
PortPy commited on
Commit
d02c10d
Β·
verified Β·
1 Parent(s): c27466c

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +182 -12
README.md CHANGED
@@ -1,12 +1,182 @@
1
- ---
2
- license: apache-2.0
3
- language:
4
- - en
5
- size_categories:
6
- - 10B<n<100B
7
- configs:
8
- - config_name: default
9
- data_files:
10
- - split: train
11
- path: data_info.jsonl
12
- ---
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ license: apache-2.0
3
+ language:
4
+ - en
5
+ size_categories:
6
+ - 10B<n<100B
7
+ configs:
8
+ - config_name: default
9
+ data_files:
10
+ - split: train
11
+ path: data_info.jsonl
12
+ ---
13
+
14
+ ---
15
+ license: apache-2.0
16
+ language:
17
+ - en
18
+ size_categories:
19
+ - 10B<n<100B
20
+ configs:
21
+ - config_name: default
22
+ data_files:
23
+ - split: train
24
+ path: data_info.jsonl
25
+ ---
26
+ # PortPy: Planning and Optimization for Radiation Therapy
27
+
28
+ ## Data Overview
29
+
30
+ <img src="https://github.com/PortPy-Project/PortPy/blob/master/images/PortPy%20Data.png" align="right" width="50%" height="40%">
31
+
32
+ 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
33
+
34
+ 1. **Dose Influence Matrix (AKA dose deposition matrix, dij matrix):** The dose contribution of each beamlet to each voxel,
35
+ 2. **Beamlets/Voxels Details:** Detailed information about the position and size of beamlets/voxels,
36
+ 3. **Expert-Selected Benchmark Beams:** An expert clinical physicist has carefully selected benchmark beams, providing reference beams for comparison and benchmarking,
37
+ 4. **Benchmark IMRT Plan:** A benchmark IMRT plan generated using our in-house automated treatment planning system called ECHO ([YouTube Video](https://youtu.be/895M6j5KjPs), [Paper](https://aapm.onlinelibrary.wiley.com/doi/epdf/10.1002/mp.13572)). This plan serves as a benchmark for evaluating new treatment planning algorithms.
38
+ 5. **Benchmark Clinical Criteria:** A set of clinically relevant mean/max/DVH criteria for plan evaluation.
39
+ 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.
40
+
41
+ Subsequently, create a directory titled './data' in the current project directory and transfer the downloaded
42
+ file into it. For example, ./data/Lung_Phantom_Patient_1.
43
+ We have adopted the widely-used JSON and HDF5 formats for data storage.
44
+ [HDFViwer](https://www.hdfgroup.org/downloads/hdfview/) can be utilized to view the contents of the HDF5 files.
45
+
46
+
47
+
48
+ **Note:** Initially, we will utilize a lung dataset from [TCIA](https://wiki.cancerimagingarchive.net/display/Public/NSCLC-Radiomics). 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](https://github.com/PortPy-Project/PortPy/blob/master/examples/imrt_tps_import.ipynb))
49
+
50
+ ## Data Fields
51
+
52
+ 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).
53
+
54
+ The scripts adopt the data format, where:
55
+
56
+ - Light-weight metadata is stored in human-readable `.json` files.
57
+
58
+ - Large datasets (e.g., dose influence matrices) are stored in `.h5` (HDF5) files.
59
+
60
+
61
+ A typical output folder structure for a patient might look like this:
62
+
63
+ ```
64
+ β”‚
65
+ β”œβ”€β”€ Beams/
66
+ β”‚ β”œβ”€β”€ Beam_0_MetaData.json
67
+ β”‚ β”œβ”€β”€ Beam_0_Data.h5
68
+ β”‚ β”œβ”€β”€ Beam_1_MetaData.json
69
+ β”‚ β”œβ”€β”€ Beam_1_Data.h5
70
+ β”œβ”€β”€ CT_Data.h5
71
+ β”œβ”€β”€ CT_MetaData.json
72
+ └── StructureSet_MetaData.json
73
+ └── StructureSet_Data.h5
74
+
75
+ ```
76
+ #### Example JSON and HDF5 Files
77
+
78
+ ##### Beam_0_metadata.json
79
+ 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*.
80
+
81
+ ```json
82
+ {
83
+ "ID": 0,
84
+ "gantry_angle": 0,
85
+ "collimator_angle": 0,
86
+ "couch_angle": 0,
87
+ "iso_center": {
88
+ "x_mm": 119.2041,
89
+ "y_mm": 60.53891,
90
+ "z_mm": -9.122542
91
+ },
92
+ "beamlets": {
93
+ "id_File": "Beam_0_Data.h5/beamlets/id",
94
+ "width_mm_File": "Beam_0_Data.h5/beamlets/width_mm",
95
+ "height_mm_File": "Beam_0_Data.h5/beamlets/height_mm",
96
+ "position_x_mm_File": "Beam_0_Data.h5/beamlets/position_x_mm",
97
+ "position_y_mm_File": "Beam_0_Data.h5/beamlets/position_y_mm",
98
+ "MLC_leaf_idx_File": "Beam_0_Data.h5/beamlets/MLC_leaf_idx"
99
+ },
100
+ "jaw_position": {
101
+ "top_left_x_mm": -5,
102
+ "top_left_y_mm": 40,
103
+ "bottom_right_x_mm": 97.5,
104
+ "bottom_right_y_mm": -60
105
+ },
106
+ "influenceMatrixSparse_File": "Beam_0_Data.h5/inf_matrix_sparse",
107
+ "influenceMatrixFull_File": "Beam_0_Data.h5/inf_matrix_full",
108
+ "MLC_leaves_pos_y_mm_File": "Beam_0_Data.h5/MLC_leaves_pos_y_mm"
109
+ }
110
+ ```
111
+
112
+ ##### Beam_0_Data.h5
113
+ 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](https://www.hdfgroup.org/downloads/hdfview/) can be used to see through a .h5 file.
114
+ ```
115
+ Beam_0_Data.h5
116
+ β”‚
117
+ β”œβ”€β”€ beamlets/
118
+ β”‚ β”œβ”€β”€ id (1D array of beamlet IDs)
119
+ β”‚ β”œβ”€β”€ width_mm (1D array of beamlet widths in mm)
120
+ β”‚ β”œβ”€β”€ height_mm (1D array of beamlet heights in mm)
121
+ β”‚ β”œβ”€β”€ position_x_mm (1D array of x positions in mm)
122
+ β”‚ β”œβ”€β”€ position_y_mm (1D array of y positions in mm)
123
+ β”‚ └── MLC_leaf_idx (1D array of MLC leaf indices)
124
+ β”‚
125
+ β”œβ”€β”€ inf_matrix_sparse (Sparse influence matrix)
126
+ β”œβ”€β”€ inf_matrix_full (Full influence matrix)
127
+ └── MLC_leaves_pos_y_mm (MLC leaves positions in mm in y direction)
128
+ ```
129
+
130
+ ## How to use it
131
+ You can load the dataset with the following two lines of code.
132
+
133
+ ```python
134
+ from datasets import load_dataset
135
+
136
+ dataset = load_dataset("PortPy-Project/PortPy_Datset", split="split_0")
137
+ print(dataset)
138
+ Dataset({
139
+ features: ['patient_id', 'ct_data', 'ct_metadata', 'structureset_data', 'structureset_metadata', 'beam_data_paths', 'beam_metadata_paths', 'optimization_voxels_data', 'optimization_voxels_metadata', 'planner_beams', 'rt_dose_echo_imrt', 'rt_plan_echo_imrt'],
140
+ num_rows: 50
141
+ })
142
+
143
+ # load ct metadata for 1st patient
144
+ ct_metadata = load_dataset("json", data_files=dataset[0]['ct_metadata'])
145
+ print(ct_metadata)
146
+
147
+ DatasetDict({
148
+ train: Dataset({
149
+ features: ['origin_xyz_mm', 'resolution_xyz_mm', 'size_xyz_mm', 'direction', 'ct_hu_3d_File'],
150
+ num_rows: 1
151
+ })
152
+ })
153
+
154
+ # load ct metadata for 1st patient
155
+ structureset_metadata = load_dataset("json", data_files=dataset[0]['structureset_metadata'])
156
+ print(structureset_metadata)
157
+
158
+ DatasetDict({
159
+ train: Dataset({
160
+ features: ['name', 'volume_cc', 'dicom_structure_name', 'fraction_of_vol_in_calc_box', 'structure_mask_3d_File'],
161
+ num_rows: 9
162
+ })
163
+ })
164
+
165
+ ```
166
+
167
+ # Team <a name="Team"></a>
168
+ PortPy is a community project initiated at [Memorial Sloan Kettering Cancer Center](https://www.mskcc.org/) (MSK). It is currently developed and maintained by [Masoud Zarepisheh](https://masoudzp.github.io/) (Principal Investigator, zarepism@mskcc.org) and [Gourav Jhanwar](https://github.com/gourav3017) (Lead Developer, jhanwarg@mskcc.org). Other team members include: [Mojtaba Tefagh](https://www.ed.ac.uk/profile/mojtaba-tefagh) (Optimization/AI/ML expert from University of Edinburgh), [Linda Hong](https://www.mskcc.org/profile/linda-hong) (Medical Physicist from MSK), [Vicki Taasti](https://scholar.google.com/citations?user=PEPyvewAAAAJ&hl=en) (Proton Physicist from Aarhus University), and [Saad Nadeem](https://nadeemlab.org/) (AI/Imaging expert from MSK).
169
+
170
+ # License <a name="License"></a>
171
+ PortPy code is distributed under **Apache 2.0 with Commons Clause** license, and is available for non-commercial academic purposes.
172
+
173
+ # Reference <a name="Reference"></a>
174
+ If you find our work useful in your research or if you use parts of this code please cite our [AAPM'23 abstract](https://aapm.confex.com/aapm/2023am/meetingapp.cgi/Paper/4208) :
175
+ ```
176
+ @article{jhanwar2023portpy,
177
+ title={Portpy: An Open-Source Python Package for Planning and Optimization in Radiation Therapy Including Benchmark Data and Algorithms},
178
+ author={Jhanwar, Gourav and Tefagh, Mojtaba and Taasti, Vicki T and Alam, Sadegh R and Tuomaala, Seppo and Nadeem, Saad and Zarepisheh, Masoud},
179
+ journal={AAPM 65th Annual Meeting & Exhibition},
180
+ year={2023}
181
+ }
182
+ ```