Package: portpy
What is PortPy?PortPy, short forPlanning andOptimization forRadiationTherapy, represents a collective effort to establish an open-source Python library dedicated to advancing the development and clinical implementation of cancer radiotherapy treatment planning algorithms. This initiative encompasses planning methodologies for Intensity Modulated Radiation Therapy (IMRT), Volumetric Modulated Arc Therapy (VMAT), along with other emerging modalities. PortPy provides clinical-grade data and coding resources that fosterbenchmarking,reproducibility, andcommunity development.ContentsWhat can you do with PortPy?Quick StartHow to contribute?The limitations of current versionDataInstallationTeamWhat can you do with PortPy?PortPy facilitates thedesign,testing, andclinical validationof your treatment planning algorithms. This includes both cutting-edge AI-based models and traditional optimization techniques. PortPy provides:Benchmark DatasetAccess to data required for optimization, extracted directly from the FDA-approved Eclipse treatment planning system via its APIA current set of data from 50 lung patients, which will be expanded to 100 lung patients by the end of 2023Abenchmark IMRT planfor each patient, created using our in-house automated planning system (Edelman Award Finalist YouTube Video,Paper)Benchmark Algorithms:Offering globally optimal solutions for:Dose Volume Histogram (DVH) constraints (seedvh_constraint_optimization.ipynb)IMRT Beam Orientation Optimization (BOO) (seebeam_orientation_optimization.ipynb)Volumetric Modulated Arc Therapy (VMAT) (seevmat_optimization.ipynb)VisualizationBasic built-in visualization tools (e.g., DVH, dose distribution) are integrated into PortPy (see (seebasic_tutorial.ipynb))Enhanced visualizations are available through the integration with the popular open-source3DSlicerpackage (see3d_slicer_integration.ipynb)EvaluationPortPy IMRT plans with optimal fluence can be imported into Eclipse for leaf sequencing and final clinical evaluations  (seeeclipse_integration.ipynb)PortPy IMRT/VMAT plans can be imported into FDA approved TPS( e.g. Eclipse, Raystation) using DICOM RT Plan file for final clinical evaluations  (seeTPS-integration.ipynb)Plans can also be evaluated within PortPy using well-established clinical protocols (e.g., Lung 2Gyx30, seebasic_tutorial.ipynb)Future updates will include more standardized RTOG metrics and outcome models (TCP/NTCP)OptimizationPortPy provides high-level optimization problem formulation and access to both free and commercial optimization engines through the integration with a popular open-sourceCVXPypackage (seebasic_tutorial.ipynb)Commercial engines (e.g.,MOSEK,CPLEX,GUROBI) are also free for academic and research useAI-Based PlanningThe PortPy.AI module provides a framework for exploring AI-driven treatment planning  (seedose_prediction_pipeline.ipynb)The newly added PortPy.AI module includes a tutorial on predicting a 3D-dose distribution and converting the prediction into a deliverable planQuick StartTo grasp the primary features of PortPy, we highly recommend exploring thebasic_tutorial.ipynbnotebookTo understand how to import a PortPy plan into Eclipse for final evaluations, browse through theeclipse_integration.ipynbnotebookTo create dicom RT Plan file from PortPy plan and import into FDA approved commercial TPS (e.g. Eclipse, Raystation), please browse throughTPS-integration.ipynbnotebookTo learn about enhanced visualization techniques using the 3D-Slicer package, refer to the3d_slicer_integration.ipynbnotebookFor algorithm benchmarking, the global optimal solutions are provided for non-convex optimization problems resulting from beam angle optimizationbeam_orientation_optimization.ipynb, incorporating DVH constraintsdvh_constraint_optimization.ipynb, and VMAT optimizationvmat_optimization.ipynbusing the mixed-integer programming on down-sampled data.If you encounter computational challenges with large-scale optimization problems, you can opt for down-sampling the voxels/beamlets, as illustrated in thedown_samplingnotebook, or further sparsify the influence matrix, as demonstrated in theinf_matrix_sparsificationnotebook.To learn about creating a final deliverable plan using AI based model, please refer todose_prediction_pipeline.ipynbnotebook.How to contribute?To maintain the lightweight nature and user-friendliness of PortPy modules, our aim is to include only fundamental functionalities, along with benchmark data and algorithms. We will establish separate repositories within thePortPy-Project orgainizationfor projects developed by our team using PortPy as a platform. This is similar to what we've done for projects likeLowDimRTandVMAT.If you're interested in contributing to existing PortPy modules or wish to create a new module, we encourage you to contact us first. This will help ensure that our objectives and priorities are aligned. If you use PortPy to build your own package, you're welcome to host your package within thePortPy-Project orgainization. Alternatively, you can host your package on your own GitHub page. In this case, please inform us so that we can fork it and feature it under the PortPy-Project organization.The limitations of current version of PortPyCurrent version of PortPy has the following limitations which would be addressed in the future updates:You can only work with the benchmark dataset provided in this PortPy repo and cannot use your own dataset for now.PortPy.Photon and PortPy.AI are the only modules available. You cannot do proton research with the current version. Please useOpenTPSfor proton research.DataPortPy 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 includesDose Influence Matrix:The dose contribution of each beamlet to each voxel,Beamlets/Voxels Details:Detailed information about the position and size of beamlets/voxels,Expert-Selected Benchmark Beams:An expert clinical physicist has carefully selected benchmark beams, providing reference beams for comparison and benchmarking,Benchmark IMRT Plan:A benchmark IMRT plan generated using our in-house automated treatment planning system called ECHO (Edelman Award Finalist YouTube Video,Paper). This plan serves as a benchmark for evaluating new treatment planning algorithms.To access these resources, users are advised to download the latest version of the dataset, which can be foundhere. 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.Note:Initially, we will utilize a lung dataset fromTCIA. 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 theTCIA collection IDand theTCIA subject IDfor each PortPy patient using theget_tcia_metadata()method in PortPy and subsequently download the data from TCIA (seeeclipse_integration.ipynb)InstallationInstall using pip:Run the command 'pip install portpy'Install using conda:Run the command 'conda install -c conda-forge portpy'Install from source:Clone this repository using 'git clonehttps://github.com/PortPy-Project/PortPy.git'Navigate to the repository with 'cd portpy'Install the dependencies within a Python virtual environment or Anaconda environment. To set up in a Python virtual environment, install all the dependencies specified in requirements.txt as follows:Create the virtual environment with 'python3 -m venv venv'Activate the environment with 'source venv/bin/activate'Install the requirements using '(venv) pip install -r requirements.txt'TeamPortPy is a community project initiated atMemorial Sloan Kettering Cancer Center. It is currently developed and maintained by:NameExpertiseInstitutionMasoud ZarepishehTreatment Planning and OptimizationMSKSaad NadeemComputer Vision and AI in Medical ImagingMSKGourav JhanwarAlgorithm Design and DevelopmentMSKMojtaba TefaghMathematical Modeling and Reinforcement LearningSUTVicki TaastiPhysics and Planning of Proton TherapyMAASTROSadegh AlamAdaptive Treatment Planning and ImagingCornellSeppo TuomaalaEclispe API ScriptingVARIANLicensePortPy code is distributed underApache 2.0 with Commons Clauselicense, and is available for non-commercial academic purposes.ReferenceIf you find our work useful in your research or if you use parts of this code please cite ourAAPM'23 abstract:@article{jhanwar2023portpy,
  title={Portpy: An Open-Source Python Package for Planning and Optimization in Radiation Therapy Including Benchmark Data and Algorithms},
  author={Jhanwar, Gourav and Tefagh, Mojtaba and Taasti, Vicki T and Alam, Sadegh R and Tuomaala, Seppo and Nadeem, Saad and Zarepisheh, Masoud},
  journal={AAPM 65th Annual Meeting & Exhibition},
  year={2023}
}