==== Front ArXiv ArXiv arxiv ArXiv 2331-8422 Cornell University arXiv:2305.18572v1 2305.18572 1 preprint Article Beam mask and sliding window-facilitated deep learning-based accurate and efficient dose prediction for pencil beam scanning proton therapy Zhang Lian PhD 1* Holmes Jason M. PhD 1* Liu Zhengliang MS 2 Vora Sujay A. MD 1 Sio Terence T. MD, MS 1 Vargas Carlos E. MD 1 Yu Nathan Y. MD 1 Keole Sameer R. MD 1 Schild Steven E. MD 1 Bues Martin PhD 1 Li Sheng PhD 3 Liu Tianming PhD 2 Shen Jiajian PhD 1 Wong William W. MD 1 Liu Wei PhD 1 1 Department of Radiation Oncology, Mayo Clinic, Phoenix, AZ 85054, USA 2 Department of Computer Science, University of Georgia, Athens, GA 30602, USA 3 Department of Data Science, University of Virginia, Charlottesville, VA 22903, USA * Co-first authors who contribute to this paper equally Corresponding author: Wei Liu, PhD, Professor of Radiation Oncology, Department of Radiation Oncology, Mayo Clinic Arizona, 5777 E. Mayo Boulevard, Phoenix, AZ 85054; Liu.Wei@mayo.edu. 29 5 2023 arXiv:2305.18572v1https://creativecommons.org/licenses/by/4.0/ This work is licensed under a Creative Commons Attribution 4.0 International License, which allows reusers to distribute, remix, adapt, and build upon the material in any medium or format, so long as attribution is given to the creator. The license allows for commercial use. nihpp-2305.18572v1.pdf Background: Accurate and efficient dose calculation is essential for on-line adaptive planning in proton therapy. Deep learning (DL) has shown promising dose prediction results in photon therapy. However, there is a scarcity of DL-based dose prediction methods specifically designed for proton therapy. Successful dose prediction method for proton therapy should account for more challenging dose prediction problems in pencil beam scanning proton therapy (PBSPT) due to its sensitivity to heterogeneities. Purpose: To develop a DL-based PBSPT dose prediction workflow with high accuracy and balanced complexity to support on-line adaptive proton therapy clinical decision and subsequent replanning. Methods: PBSPT plans of 103 prostate cancer patients (93 for training and the other 10 for independent testing) and 83 lung cancer patients (73 for training and the other 10 for independent testing) previously treated at our institution were included in the study, each with CTs, structure sets, and plan doses calculated by the in-house developed Monte-Carlo dose engine (considered as the ground truth in the model training and testing). For the ablation study, we designed three experiments corresponding to the following three methods: 1) Experiment 1, the conventional region of interest (ROI) (composed of targets and organs-at-risk (OARs)) method. 2) Experiment 2, the beam mask (generated by raytracing of proton beams) method to improve proton dose prediction. 3) Experiment 3, the sliding window method for the model to focus on local details to further improve proton dose prediction. A fully connected 3D-Unet was adopted as the backbone. Dose volume histogram (DVH) indices, 3D Gamma passing rates with a criterion of 3%/3mm/10%, and dice coefficients for the structures enclosed by the iso-dose lines between the predicted and the ground truth doses were used as the evaluation metrics. The calculation time for each proton dose prediction was recorded to evaluate the method’s efficiency. Results: Compared to the conventional ROI method, the beam mask method improved the agreement of DVH indices for both targets and OARs and the sliding window method further improved the agreement of the DVH indices (for lung cancer, CTV D98 absolute deviation: 0.74±0.18 vs. 0.57±0.21 vs. 0.54±0.15 Gy[RBE], ROI vs. beam mask vs. sliding window methods, respectively). For the 3D Gamma passing rates in the target, OARs, and BODY (outside target and OARs), the beam mask method can improve the passing rates in these regions and the sliding window method further improved them (for prostate cancer, targets: 96.93%±0.53% vs. 98.88%±0.49% vs. 99.97%±0.07%, BODY: 86.88%±0.74% vs. 93.21%±0.56% vs. 95.17%±0.59%). A similar trend was also observed for the dice coefficients. In fact, this trend was especially remarkable for relatively low prescription isodose lines (for lung cancer, 10% isodose line dice: 0.871±0.027 vs. 0.911±0.023 vs. 0.927±0.017). The dose predictions for all the testing cases were completed within 0.25s. Conclusions: An accurate and efficient deep learning-augmented proton dose prediction framework has been developed for PBSPT, which can predict accurate dose distributions not only inside but also outside ROI efficiently. The framework can potentially further reduce the initial planning and adaptive replanning workload in PBSPT. ==== Body pmc1. Introduction Pencil beam scanning proton therapy (PBSPT) is a highly adaptable modern beam delivery technique that reduces the dose to healthy tissues as compared to x-ray radiation modalities while not requiring compensators or apertures in most cases[1–13]. PSBPT, however, is more sensitive to range and setup uncertainties in clinical practice as compared to x-ray modalities[14–22]. During the fractionated course of treatment using PBSPT, the patient’s anatomical structure tends to change due to weight loss or tumor shrinkage and there may also be random or systemic range and positioning uncertainties[23–31]. As a result, the actual dose received by the patient may deviate from the initially planned dose. To compensate for the potential range and positioning uncertainties, robust optimization is adopted in clinical practice[32–51], however, robust optimization does not account for anatomical changes that may happen during the course of treatment[24]. Adaptive radiotherapy (ART) is a technique designed to address inter-fractional anatomical changes by periodically re-imaging the patient, contouring the new images (or propagating the prior ones), determining whether the original treatment plan is still adequate, and subsequently redoing the treatment planning if not[25, 26, 52]. Conventional ART techniques are costly, requiring a high clinical workload as well as potentially placing a greater burden on the staffs[53–55]. Additionally, because the patient anatomy may change on daily or hourly time scales, for example due to bladder or gas fill, conventional ART techniques may be inadequate[56, 57]. Ideally, a patient would be imaged, their imaging contoured, and the treatment planning performed (if necessary) within minutes, thereby mitigating anatomical changes on these timescales, known as “online” ART[25, 26, 58]. With recent advances in AI-based auto-contouring, able be performed adequately in minutes, the major bottleneck in achieving online ART today, is long dose calculation times, especially in the context of Monte Carlo-based robust optimization[25, 59, 60]. Recently, deep learning (DL) networks have been introduced for dose prediction for photon-based modalities[61]. AI models have the distinct advantage over conventional dose calculation techniques in that they are extremely fast, typically less than 1 second[62, 63]. Fan et al. proposed a Residual Network to predict the dose distribution for intensity-modulated radiation therapy (IMRT) in head-and-neck cancer patients and achieved a clinically acceptable dose distribution for most test cases[64]. Nguyen et al. used a U-net architecture for dose prediction in prostate cancer patients treated with photon therapy and achieved a comparable dose distribution with the dose calculated by conventional means[65]. Other studies have reported similar results using DL for tomotherapy and stereotactic body radiation therapy[66, 67]. Although there have been numerous studies on the use of DL for dose prediction in photon therapy, further research is still needed to predict optimal PBSPT dose distributions. Predicting dose for PBSPT is challenging due to the intrinsic sensitivity of proton dose distribution to anatomical heterogeneities[14]. Dose distributions for PBSPT are therefore highly varied from one patient to another, even for similar treatment sites, as compared with photon-based treatments. DL-based dose prediction methods specifically for proton therapy are still scare in the literatures compared to photon therapy[68–75]. In this study we aimed to develop a DL-based approach for PBSPT dose prediction to support on-line adaptive proton therapy decision making and potentially the following-up adaptive re-planning. We developed a 3D U-net model using a beam mask to improve the model performance instead of the spot map related information. The beam mask can be generated in a straightforward manner, depending only on the beam angles, making it more practical and deployable in clinical scenario. To further improve the dose prediction accuracy, especially for the low dose regions outside the targets and organs-at-risk (OARs) (defined as regions of interest (ROI)), we proposed a novel ‘sliding window’ method to have the network concentrate on the local details. Compared to previously published reports, our proposed approach has higher PBSPT dose prediction accuracy and simpler implementation, which is more practical for routine clinical use. 2. Material and Methods 2.1 Patient data For training and testing data, we retrospectively selected 103 prostate cancer and 83 lung cancer patients treated with PBSPT at our institution. For each disease site, 10 cases were randomly selected as the testing group, 5 cases were randomly selected as the validation group during model training, and the others were used for model training. the contours for the target and OARs were examined and approved by experienced radiation oncologists. Prostate cases were prescribed with a dose of 70.0 Gy[RBE] in 28 fractions while lung cases were prescribed with a dose ranging from 50.0 Gy[RBE] to 60.0 Gy[RBE] with 25 to 30 fractions respectively. Treatment plans were designed for each patient based on his/her anatomy using different beam angles and configurations. The plan doses for all the patients included in this study were generated using the our in-house treatment planning system (TPS), Shiva[20, 25, 47, 48, 76–81], which utilizes a Virtual Particle Monte Carlo (VPMC) dose engine[80]. Dose volume constraints for both prostate and lung cases were determined based on our institution clinical standards. 2.2 Data preprocessing First, the CTs, structure set, and VPMC-calculated dose DICOM files for each patient were extracted and converted to 3D matrices. All the 3D matrices were first resampled to a 2.5 mm grid from the original resolution, and then rigid-registered to a reference case selected from the corresponding site to align the data. The CT HU number and the dose matrices were normalized to have a mean value of 0 and a variance of 1, respectively. We used a box with a dimension of 350 × 450 × 550 centered on the target to crop to ensure all the regions potentially influencing the dose distribution would be included in the model training for all the training and testing data. Zero padding was adopted if the dimension of the processed matrices is less than the cropping box. A volumetric binary bitmask was then created for each ROI, setting the value to 1 for voxels inside the contour and 0 for those outside the contour. To distinguish the ROI, each ROI will be assigned a specific integer number. For prostate, ROI include CTV, bladder, spaceOAR, left/right femoral head, penile bulb, and rectum. For lung, ROI include CTV, spinal cord, spinal cord prv, esophagus, heart, and total lung. In summary, after preprocessing, the aligned and cropped data for each patient was represented by the CT matrices, contour mask matrices, and dose matrices. 2.3 Beam mask generation Since the beam paths significantly impacted dose distributions in PBSPT, we enhanced the beam mask method for dose prediction in photon therapy proposed by Peng et al. that provided the DL model with additional beam path information[82]. In addition to the CT and structure bitmask inputs, our 3D beam mask generation method involved extracting beam path information from the radiotherapy treatment plan. We produced the 3D beam masks by assigning a value of 1 to voxels within the beam paths and 0 outside of them by raytracing of the proton beams. Several enhancements to the beam mask were proposed to improve the dose prediction accuracy for proton therapy as follows. To enhance the dose prediction accuracy at the target distal edge region, we expanded the beam mask margin by 3 mm along the beam direction. For the multi-beam overlapped regions outside the target, the assigned beam mask value will be set to be the value of the sum of the number of beams passing through the regions. This will enforce the model to concentrate on the multi-beam overlapped regions to improve the dose prediction accuracy in these regions. 2.4 Model Architecture and workflow A fully connected 3D U-Net was adopted as the model backbone, taking multi-channels of 3D matrix as input. The 3D input matrix was a concatenation of the pre-processed CT matrices, contour bitmask matrices, and beam mask matrices, depending on the training approach utilized. The model was trained to produce a 3D dose matrix as output based on the ground-truth dose matrix. For clinical testing and deployment, the trained model can be further integrated to Shiva for adaptive proton plan evaluation and potential replanning, as shown in Figure 1. 2.5 Enhanced model training with sliding windowing To improve the model performance, the model training were enhanced using the sliding window technique to concentrate on local details[26]. During the model training, a sliding window with a size of 3×3×3 voxels was randomly selected within the beam mask region and ROI regions. Within the box, the corresponding beam mask values were set to 0, instead of 1. This technique allows the model to concentrate more on local details. The Smooth L1 loss between the predicted dose and the ground truth dose was used as the objective function for the model training as following: L(d,d^)=1N∑i=1NsmoothL1(di-d^i) in which smoothL1(x)=f(x)=0.5x2if |x|<1|x|-0.5,otherwise where L is the total loss function value, di is the ground truth dose at the ith voxel, and d^i is the predicted dose at the ith voxel. The Adam optimizer was used to minimize the loss function with the default Reduce-LR-On-Plateau learning rate in PyTorch. To preserve the global information as much as possible, the whole 3D pre-processed matrices as described in the data preprocessing section were used in the input channels for model training as instead of the patch method dividing the whole matrix to many smaller patches during the model training[63]. Random rotation and translation were used to augment the data to avoid overfitting[83]. The models were trained on four NVIDIA Tesla A100 GPUs each with 80 GB on board RAM memory for 200 epochs. 2.6 Ablation study To understand the effectiveness of each component of the proposed strategies, three experiments were designed step-by-step as follows. Experiment 1 used the CT images and contour bitmasks as the input channels for the model training. Experiment 2 added the beam mask into the input channel besides the CT images and contour bitmasks as used in Experiment 1. For Experiment 3, the sliding window strategy was further added to the model training on top of Experiment 2. Ten prostate cancer and 10 lung cancer cases were used to test the performance for each experiment. In evaluating the accuracy of the dose prediction, we adopted three different evaluation metrics. DVH indices were adopted at first. For DVH index comparison, D2 and D98 for the CTV, Dmean for bladder, spaceOAR, femoral heads, penile bulb, rectum, esophagus, heart, and total lung, and Dmax for spinal cord, spinal cord prv were used. Next, we used the 3D Gamma passing rate with a criterion of 3%/3mm/10% following the AAPM Task Group (TG) report No. 218 recommendation to show the 3D spatial dose distribution agreement between the predicted dose and the ground-truth dose in targets, ROI, and Body (outside ROI), respectively[84]. Finally, we evaluated the 3D spatial dose distribution agreement by the dice coefficients of the structures enclosed by the iso-dose lines (from 10% of the prescription dose to 90% of the prescription dose in an increment of 10%) between the predicted and the ground truth doses. The dice coefficient shows the volumetric similarity between the two volumes. 3. Results 3.1 Comparison of dose distributions Figure 2 shows the distributions of the predicted dose from three different experiments and the ground truth dose in the transversal plane (for prostate) and in the sagittal plane (for lung) of one typical prostate (Fig. 2(a)) and one typical lung (Fig. 2(b)) cancer patient. The dose distribution differences in the corresponding planes between the predicted dose and the ground truth dose of the selected patients were also shown. 3.2 Comparison of DVHs Figure 3 shows the DVHs of the predicted doses from three different experiments and the ground truth doss of one typical prostate (Fig. 3(a)) and one typical lung (Fig. 3(b)) cancer patient. Both figures show that the beam mask model predicted the dose more accurately than the ROI model, while the random sliding window method further improved the dose prediction accuracy than the beam mask method. Figures 4 shows the absolute deviation of the DVH indices of targets and OARs between the ground truth dose and the predicted doses from three different experiments of the testing cases for prostate and lung. Prostate CTV D98 absolute deviation is 0.53±0.22 Gy[RBE], 0.45±0.25 Gy[RBE], and 0.41±0.27 Gy[RBE] for Experiment 1, 2, and 3 respectively. Lung CTV D98 absolute deviation is 0.74±0.18 Gy[RBE], 0.57±0.21 Gy[RBE], and 0.54±0.15 Gy[RBE] for Experiment 1, 2, and 3, respectively. For prostate and lung CTV D2, the absolute deviation is 0.81±0.25 Gy[RBE] and 0.94±0.44 Gy[RBE] in Experiment 1. The D2 absolute deviation is reduced in Experiment 2 by 0.15 Gy[RBE] and 0.19 Gy[RBE] on average. It is further reduced by 0.1 Gy[RBE] on average in Experiment 3. For the comparison of the DVH indices of OARs, the predicted DVH index absolute deviation of the Dmean and Dmax between the ground truth dose and the predicted doses from three different experiments of the testing cases for prostate and lung were all within clinical tolerance. For most OARs, the absolute Dmean deviation were around 0.1 Gy[RBE] on average lower in Experiment 2 compared to Experiment 1. Experiment 3 further reduced the Dmean absolute deviation by 0.05 Gy[RBE] on average compared to Experiment 2. For Dmax of spinal cord and spinal cord prv in lung, the absolute deviation were relatively significant with 0.95±0.19 Gy[RBE] and 1.2±0.27 Gy[RBE] in Experiment 1, respectively. The absolute deviations were reduced to 0.73±0.16 Gy[RBE] and 0.94±0.31 Gy[RBE] in Experiment 2 and further reduced to 0.67±0.15 Gy[RBE] and 0.91±0.28 Gy[RBE] in Experiment 3, respectively. Moreover, the absolute deviation of Dmean of SpaceOAR, which is an implant used in prostate cancer patients treated with PBSPT to protect the rectum, were 0.51±0.22 Gy[RBE], 0.38±0.17 Gy[RBE], and 0.36±0.12 Gy[RBE] for the three experiments respectively. This shows good dose prediction accuracy even in the implant with further improvements from Experiments 2 and 3. 3.3 3D Gamma evaluation Figure 5 shows the 3D Gamma passing rates (3%3mm/10%) within targets, OARs, and BODY (outside ROI) of the testing cases for prostate and lung, respectively. Compared to the Gamma passing rates in Experiment 1, the Gamma passing rates improved for target and OARs in Experiment 2 (prostate targets: 96.93%±0.53% vs. 98.88%±0.49%, lung targets: 93.37%±0.68% vs. 95.31%±0.71%, prostate OARs: 93.21%±0.80% vs. 95.29±0.59%, lung OARs: 90.91%±0.87% vs. 92.7% ± 0.73%). Compared to targets and OARs, the improvements in Gamma passing rates for BODY in Experiment 2 were more remarkable (prostate BODY: 86.88%±0.74% vs. 93.21%±0.56%, lung BODY: 85.14%±0.89% vs. 91.26%±0.61%). The Gamma passing rates were further improved in Experiment 3 by around 1% in targets and by 1.5% in OARs and BODY on average compared to Experiment 2. 3.4 Dice coefficient evaluation Figure 6 shows the dice coefficients of the structures enclosed by the iso-dose lines (from 10% of the prescription dose to 90% of the prescription dose in a increment of 10%) between the predicted and the ground truth doses of the testing cases for prostate and lung. In general, the average dice coefficients improved for most isodose lines in Experiment 2 compared to Experiment 1. Further improvements were observed in Experiment 3 with a few exceptions: prostate 70% isodose lines between Experiment 1 and Experiment 2, prostate 50% isodose lines between Experiment 2 and Experiment 3, and lung 70% isodose lines between Experiment 2 and Experiment 3, which show comparable dice coefficients. For high percentage isodose lines, slight improvements were observed among three experiments, for example, the 90% isodose lines (prostate 90% isodose lines: 0.959±0.009 vs. 0.971±0.012 vs. 0.979±0.005, lung 90% isodose lines: 0.937±0.029 vs. 0.951±0.011 vs. 0.957±0.023, from the three experiments respectively). For low percentage isodose lines, the improvements among three experiments were remarkable, for example, the 10% isodose lines (prostate 10% isodose lines: 0.895±0.027 vs. 0.927±0.021 vs. 0.945±0.019, lung 10% isodose lines: 0.871±0.027 vs. 0.911±0.023 vs. 0.927±0.017, from the three experiments respectively). 4. Discussion In ART, obtaining a rapid and accurate proton dose distribution based on verification imaging data is critical. This will greatly enhance the efficiency of online ART decision-making, and the subsequent adaptive replanning[75, 85]. Compared to IMRT treatment planning, PBSPT is more sensitive to uncertainties. Additionally, the large number of spots in PBSPT also results in long dose optimization time. To quickly generate sufficiently accurate dose distributions in PBSPT, regardless of the method, remains a challenge. In this study, we introduced the beam mask and the sliding window methods, which greatly improved the conventional ROI method for the dose prediction in PBSPT. Overall, the 3D Gamma passing rates were 99.97±0.07%, 97.18±0.57%, and 95.17%±0.59%. for the testing prostate cases and 96.55±0.34%, 95.09±0.61%, and 92.79±0.53% for the testing lung cases within target, OARs, and BODY, respectively. The dose predictions for all the testing cases were completed within 0.25s. The improved predicted PBSPT doses using our proposed beam mask and sliding window methods met our institutional clinical requirement to have a 3D Gamma passing of 95% with a criterion of 3%/3mm/10%[86–88]. In this study, we introduced the beam mask and sliding window methods to improve the performance of PBSPT dose prediction. For the beam mask method, we observed improvements in DVH index accuracy such as D2, D98, and Dmean, for both targets and OARs with bigger improvements in spinal cord Dmax. The introduction of the random sliding window further improved the DVH index accuracy, demonstrating the effectiveness of these two methods from a clinical perspective. It is worth noting that for some prostate patients with implants, such as the SpaceOAR, our proposed methods could accurately predict Dmean of these structures. This suggests that, in addition to predicting the dose distributions of human tissue structures, the model also performs well in predicting the dose to non-human tissue implants. To further illustrate the 3D spatial dose distribution agreement between the predicted dose and the ground-truth dose, we used 3D Gamma evaluation with a criterion of 3%/3mm/10%. In the past literatures based on the ROI, usually only the dose related metrics within ROI were reported[61–66, 73–75]. However, the dose prediction accuracy outside ROI is also clinically important, especially for the identification of possible hot spots outside the ROI and the protection of important OARs not included in the ROI due to various reasons such as omission, mistakes, or limitations due to the TPS. This is a significant limitation of prior studies since, although the dose prediction accuracy within targets is clinically relevant, it is more trivial for the DL models to predict the dose distribution within targets since the optimized dose distribution is approximately uniform within targets. In terms of evaluating the DL models, the dose prediction accuracy outside the ROI is more indicative of the model’s performance. One possible reason for poor performance outside the ROI in prior studies might be that by using the ROI as input, the DL model emphasizes more on the ROI but less on the regions along the beam path outside the ROI. To avoid this possible bias, we evaluated the 3D Gamma passing rates in three regions: targets, OARs, and BODY (outside ROI). The beam mask and sliding window methods significantly improved the 3D Gamma passing rates for both the testing prostate and lung cancer patients in all regions compared to the conventional ROI method. Relative to the targets and OARs, our methods greatly improved the Gamma passing rates in the BODY, outside of ROI. The use of the beam mask allows the model to be exposed to more beam path information, resulting in a more accurate dose distribution along the beam path. Furthermore, the random sliding window method led to higher loss in small local areas during the model training, thereby steering the model to pay more attention to local details. The combination of these two methods led to a significant increase in the Gamma passing rates in targets, OARs, and particularly BODY (outside the ROI). The dice coefficients, reflecting the volumetric similarity of the structures enclosed by the iso-dose lines (from 10% of the prescription dose to 90% of the prescription dose in an increment of 10%) between the predicted and the ground truth doses, further prove this point. Our proposed methods have high dice coefficients in the high percentage isodose lines-enclosed regions, demonstrating good performance of the proposed methods within targets and the target penumbra regions. In the low percentage isodose lines-enclosed regions, such as 10%, our methods significantly improved the corresponding dice coefficients, indicating substantial improvement in the dose prediction accuracy outside the ROI. These results suggested that our proposed methods can achieve clinically accurate results not only in the ROI, but also outside the ROI. This is of great clinical significance for online adaptive proton therapy in clinical decision making and subsequent replanning. Recently, several studies have been published on proton dose prediction. For example, some studies focused on DL-based proton dose calculation engine development considering basic physics to accelerate the proton dose calculation[68–70]. Another direction was to convert dose distributions calculated by the pencil beam algorithm in proton therapy to more accurate dose distribution calculated by a Monte Carlo dose engine with deep-learning methods[71]. Some studies have attempted to use the ROI method to train DL models to predict PBSPT plan dose distributions[73]. While these methods had achieved acceptable accuracies in the targets, they often showed considerable deviations in certain OARs, especially outside the ROI. Subsequent studies used the modulated spots weights optimized using a pencil beam-based dose engine as the input channel and converted the dose distribution derived by a pencil-beam-based dose engine to the more accurate dose distribution derived from MC-based methods[74]. Though the accuracy was improved, this approach required extensive computation and time for pencil-beam-based optimization to get the spots weights. This limited its clinical applications, especially in timesensitive online adaptive proton therapy. Another recently published study adopted a different approach, also using the ROI method for dose prediction in PBSPT. While the Gamma passing rate (3%/3mm/10%) for the BODY was only around 85%, a manual post-processing method was employed to replace the specific voxel dose in the predicted dose distribution, making the corresponding dose distribution within the ROI more clinically reasonable. The post-processed dose was then used for the dose mimicking based plan generation[75]. Although the study demonstrated that the final deliverable plans were clinically acceptable in the test cases, the postprocessing method used in the dose prediction process raised concerns about physics interpretability and accuracy in clinical scenarios where specific voxel doses were manually replaced. From a clinical perspective, it is more accurate, efficient, and acceptable to obtain a dose distribution close to the ground truth dose distribution directly rather than post-processing a notso-accurate dose distribution. Our proposed method balanced model accuracy and complexity. The use of beam masks and sliding windows remarkably improves the dose prediction both inside and outside the ROI compared to the ROI method. Moreover, the generation of the beam masks only requires beam angles, without the need for complex beamline and spots weight calculations. The random sliding window method is straightforward to implement, making it simpler to deploy the developed software in clinical scenarios, particularly in adaptive radiotherapy. Since all the PBSPT plans used for the model training and testing were calculated by the Monte Carlo (MC)-based dose engine, we can achieve dose distribution with an accuracy comparable to the ones calculated by the Monte Carlo-based dose engine in prostate and lung cancer patients treated with PBSPT. Moreover, the dose predictions for all the testing cases were completed within 0.25s, which is much faster than any existing MC-based dose engines, even those that utilize GPU acceleration for MC calculations. As a result, our methods make real-time plan dose prediction of PBSPT plans possible with comparable accuracy as MC-based methods. It is important to note the limitations of this study. While the model provides highly accurate dose predictions for prostate cancer patients, its accuracy for lung cancer patients, although clinically acceptable, is relatively lower in comparison. This is due to the tissue heterogeneities in thoracic disease site, which is often more challenging for dose calculation in PBSPT. Additionally, the beam configurations for lung patients are more varied than those for prostate patients. In our subsequent studies, we will collect more lung cancer patients to further fine tune the DL model, improving its accuracy in lung cancer. However, considering that prostate cancer patients account for nearly 40% of patients treated at our proton centers, this model holds immense value in reducing the workload at our center and the proton centers, which treat lots of prostate cancer patients. 5. Conclusion In summary, we have proposed an improved PBSPT dose prediction method utilizing the beam mask and the random sliding window methods. This method predicts dose distributions that closely resemble the ground truth diose distributions for both prostate and lung cancer patients, both within and outside the ROI. It strikes an optimal balance between the model accuracy and complexity, providing accurate dose predictions without the need for complicated pre-calculated energy layer and spots weight information, making it easy to be implemented in routine clinical use. This dose prediction method can be utilized for online adaptive proton therapy in clinical decision making and subsequent replanning. Acknowledgments This research was supported by the National Cancer Institute (NCI) Career Developmental Award K25CA168984, Arizona Biomedical Research Commission Investigator Award, the Lawrence W. and Marilyn W. Matteson Fund for Cancer Research, and the Kemper Marley Foundation. Figure 1. Workflow of the deep learning framework for dose prediction in pencil beam scanning proton therapy. Figure 2. Distributions of the predicted dose from three different experiments and the ground truth dose in the transversal plane (for prostate) and in the sagittal plane (for lung) of one typical prostate (Fig. 2(a)) and one typical lung (Fig. 2(b)) cancer patient Figure 3. DVHs of the predicted doses from three different experiments and the ground truth dose of one typical prostate (Fig. 3(a)) and one typical lung (Fig. 3(b)) cancer patient. Solid line: ground-truth dose; dash line: Experiment 1, dash dot line: Experiment 2; dot line: Experiment 3. Figure 4. Boxplot (minimum, first quartile, median, third quartile, and maximum, respectively) of absolute deviation of the DVH indices of targets and OARs between the ground truth dose and the predicted doses from three different experiments of the testing cases for prostate and lung. Experiment1, Experiment 2 and Experiment 3 correspond to 1 (red), 2 (blue) and 3 (green) in the figure. Figure 5. 3D Gamma passing rates (3%3mm/10%) within targets, OARs, and BODY (outside ROI) of the testing cases for prostate and lung, 10 cases from the testing group each (green circles). The dotted lines represent the trend of the average value of all the testing cases by each group. Figure 6. Dice coefficients of the structures enclosed by the iso-dose lines (from 10% of the prescription dose to 90% of the prescription dose in an increment of 10%) between the predicted and the ground truth doses of the testing cases for prostate (Fig. 6(a)) and lung (Fig. 6(b)). Table 1. Model training configurations for the conventional ROI model, the beam mask model, and the beam mask with sliding window model ROI model Beam mask model Sliding window model Epoch 200 200 200 Batch size 2 2 2 Training time 6.9 h 7.2 h 7.8 h Predicting time 0.216 s 0.228 s 0.239 s Conflicts of Interest Notification Terence T. Sio provides strategic and scientific recommendations as a member of the Advisory Board and speaker for Novocure, Inc., Catalyst Pharmaceuticals, Inc. and Galera Pharmaceutics, which are not in any way associated with the content presented in this manuscript. Ethical considerations This research was approved by the Mayo Clinic Arizona institutional review board (IRB, 13–005709). The informed consent was waived by IRB protocol. Only CT image and dose-volume data were used in this study. All patient-related health information was removed prior to the analysis and publication of the study. ==== Refs References 1. Kooy H.M. , , A case study in proton pencil-beam scanning delivery. Int J Radiat Oncol Biol Phys, 2010. 76 (2 ): p. 624–30.20117294 2. Schild S.E. , , Proton beam therapy for locally advanced lung cancer: A review. World journal of clinical oncology, 2014. 5 (4 ): p. 568–75.25302161 3. Yu N.Y. , , Early Outcomes of Patients With Locally Advanced Non-small Cell Lung Cancer Treated With Intensity-Modulated Proton Therapy Versus Intensity-Modulated Radiation Therapy: The Mayo Clinic Experience. Advances in Radiation Oncology. 4. Yu N.Y. , , Cardiopulmonary Toxicity Following Intensity-Modulated Proton Therapy (IMPT) Versus Intensity-Modulated Radiation Therapy (IMRT) for Stage III Non-Small Cell Lung Cancer. Clinical Lung Cancer, 2022. 23 (8 ): p. e526–e535.36104272 5. Bhangoo R.S. , , Acute Toxicities and Short-Term Patient Outcomes After Intensity-Modulated Proton Beam Radiation Therapy or Intensity-Modulated Photon Radiation Therapy for Esophageal Carcinoma: A Mayo Clinic Experience. Advances in Radiation Oncology, 2020. 5 (5 ): p. 871–879.33083649 6. Frank S.J. , , Multifield Optimization Intensity Modulated Proton Therapy for Head and Neck Tumors: A Translation to Practice. International Journal of Radiation Oncology Biology Physics, 2014. 89 (4 ): p. 846–853.24867532 7. Chang J.Y. , , Consensus Guidelines for Implementing Pencil-Beam Scanning Proton Therapy for Thoracic Malignancies on Behalf of the PTCOG Thoracic and Lymphoma Subcommittee. International Journal of Radiation Oncology*Biology*Physics, 2017. 99 (1 ): p. 41–50.28816159 8. Bhangoo R.S. , , Intensity Modulated Proton Therapy for Hepatocellular Carcinoma: Initial Clinical Experience. Advances in Radiation Oncology, 2021. 6 (4 ): p. 100675.34409199 9. Zeng J. , , Consensus Statement on Proton Therapy in Mesothelioma. Practical Radiation Oncology, 2021. 11 (2 ): p. 119–133.32461036 10. Liu C. , , Dosimetric comparison of distal esophageal carcinoma plans for patients treated with small-spot intensity-modulated proton versus volumetric-modulated arc therapies. J Appl Clin Med Phys, 2019. 20 (7 ): p. 15–27.31112371 11. Liu C. , , Small-spot intensity-modulated proton therapy and volumetric-modulated arc therapies for patients with locally advanced non-small-cell lung cancer: A dosimetric comparative study. J Appl Clin Med Phys, 2018. 19 (6 ): p. 140–148.30328674 12. Chuong M.D. , , Executive Summary of Clinical and Technical Guidelines for Esophageal Cancer Proton Beam Therapy From the Particle Therapy Co-Operative Group Thoracic and Gastrointestinal Subcommittees. Frontiers in Oncology, 2021. 11 . 13. Chiang J.S. , , Proton beam radiotherapy for patients with early-stage and advanced lung cancer: a narrative review with contemporary clinical recommendations. J Thorac Dis, 2021. 13 (2 ): p. 1270–1285.33717598 14. Paganetti H. , Range uncertainties in proton therapy and the role of Monte Carlo simulations. Phys Med Biol, 2012. 57 (11 ): p. R99–117.22571913 15. Liu W ., ed. Robustness quantification and robust optimization in intensity-modulated proton therapy. Particle Radiotherapy: Emerging Technology for Treatment of Cancer, ed. Rath A. and Sahoo N. . 2015, Springer. 16. Liu W. , , Robustness quantification methods comparison in volumetric modulated arc therapy to treat head and neck cancer. Practical Radiation Oncology, 2016. 6 (6 ): p. E269–E275.27025166 17. Lomax A.J. , Intensity modulated proton therapy and its sensitivity to treatment uncertainties 1: the potential effects of calculational uncertainties. Physics in Medicine and Biology, 2008. 53 (4 ): p. 1027–1042.18263956 18. Lomax A.J. , Intensity modulated proton therapy and its sensitivity to treatment uncertainties 2: the potential effects of inter-fraction and inter-field motions. Physics in Medicine and Biology, 2008. 53 (4 ): p. 1043–1056.18263957 19. Quan M. , , Preliminary evaluation of multi-field and single-field optimization for the treatment planning of spot-scanning proton therapy of head and neck cancer Med. Phys., 2013. 40 : p. 081709.23927306 20. Shan J. , , Intensity-modulated proton therapy (IMPT) interplay effect evaluation of asymmetric breathing with simultaneous uncertainty considerations in patients with non-small cell lung cancer. Med Phys, 2020. 47 (11 ): p. 5428–5440.32964474 21. Matney J. , , Effects of Respiratory Motion on Passively Scattered Proton Therapy Versus Intensity Modulated Photon Therapy for Stage III Lung Cancer: Are Proton Plans More Sensitive to Breathing Motion? International Journal of Radiation Oncology Biology Physics, 2013. 87 (3 ): p. 576–582.24074932 22. Matney J.E. , , Perturbation of water-equivalent thickness as a surrogate for respiratory motion in proton therapy. J Appl Clin Med Phys, 2016. 17 (2 ): p. 5795. 23. Placidi L. , , Effect of Anatomic Changes on Pencil Beam Scanned Proton Dose Distributions for Cranial and Extracranial Tumors. Int J Radiat Oncol Biol Phys, 2017. 97 (3 ): p. 616–623.28011049 24. Li H. , , Robust optimization in intensity-modulated proton therapy to account for anatomy changes in lung cancer patients. Radiotherapy and Oncology, 2015. 114 (3 ): p. 367–372.25708992 25. Feng H. , , GPU-accelerated Monte Carlo-based online adaptive proton therapy: A feasibility study. Medical Physics, 2022. 49 (6 ): p. 3550–3563.35443080 26. Ding Y. , , Deep-Learning-based Fast and Accurate 3D CT Deformable Image Registration in Lung Cancer. arXiv preprint arXiv:2304.11135, 2023. 27. Liu W. , System and Method For Robust Intensity-modulated Proton Therapy Planning, U.S.P.a.T. Office, Editor. 2014: U.S. 28. Tryggestad E.J. , , Managing treatment-related uncertainties in proton beam radiotherapy for gastrointestinal cancers. Journal of gastrointestinal oncology, 2020. 11 (1 ): p. 212–224.32175124 29. Zaghian M. , , Comparison of linear and nonlinear programming approaches for “worst case dose” and “minmax” robust optimization of intensity-modulated proton therapy dose distributions. J Appl Clin Med Phys, 2017. 18 (2 ): p. 15–25.28300378 30. Zaghian M. , , An Automatic Approach for Satisfying Dose-Volume Constraints in Linear Fluence Map Optimization for IMPT. J Cancer Ther, 2014. 5 (2 ): p. 198–207.25506501 31. Park P.C. , , Statistical Assessment of Proton Treatment Plans Under Setup and Range Uncertainties. International Journal of Radiation Oncology*Biology*Physics, 2013. 86 (5 ): p. 100713. 32. Liu W. , , Robust optimization of intensity modulated proton therapy. Med Phys, 2012. 39 (2 ): p. 1079–91.22320818 33. Liu W. , , Effectiveness of robust optimization in intensity-modulated proton therapy planning for head and neck cancers. Med Phys, 2013. 40 (5 ): p. 051711.23635259 34. Li H. , , Robust optimization in intensity-modulated proton therapy to account for anatomy changes in lung cancer patients. Radiother Oncol, 2015. 114 (3 ): p. 367–72.25708992 35. Liu C. , , Robust Optimization for Intensity-Modulated Proton Therapy to Redistribute High Linear Energy Transfer (LET) from Nearby Critical Organs to Tumors in Head and Neck Cancer. Int J Radiat Oncol Biol Phys, 2020. 36. Liu C. , , Technical Note: Treatment planning system (TPS) approximations matter - comparing intensity-modulated proton therapy (IMPT) plan quality and robustness between a commercial and an in-house developed TPS for nonsmall cell lung cancer (NSCLC). Med Phys, 2019. 46 (11 ): p. 4755–4762.31498885 37. Liu C.B. , , Impact of Spot Size and Spacing on the Quality of Robustly Optimized Intensity Modulated Proton Therapy Plans for Lung Cancer. International Journal of Radiation Oncology Biology Physics, 2018. 101 (2 ): p. 479–489.29550033 38. Liu W. , , PTV-based IMPT optimization incorporating planning risk volumes vs robust optimization. Medical Physics, 2013. 40 (2 ): p. 021709–8.23387732 39. Liu W. , , Influence of robust optimization in intensity-modulated proton therapy with different dose delivery techniques. Med Phys, 2012. 39 . 40. Liu W. , , Impact of respiratory motion on worst-case scenario optimized intensity modulated proton therapy for lung cancers. Practical Radiation Oncology, 2015. 5 (2 ): p. e77–86.25413400 41. Liu W. , , Dosimetric benefits of robust treatment planning for intensity modulated proton therapy for base-of-skull cancers. Practical Radiation Oncology, 2014. 4 : p. 384–91.25407859 42. Liu W. , , Exploratory study of the association of volumetric modulated arc therapy (VMAT) plan robustness with local failure in head and neck cancer. J Appl Clin Med Phys, 2017. 18 (4 ): p. 76–83. 43. Liu W. , , Exploratory Study of 4D versus 3D Robust Optimization in Intensity Modulated Proton Therapy for Lung Cancer. International Journal of Radiation Oncology Biology Physics, 2016. 95 (1 ): p. 523–533.26725727 44. Liu W. , , Robust optimization in intensity-modulated proton therapy. Med. Phys., 2012. 39 : p. 1079–1091.22320818 45. An Y. , , Robust treatment planning with conditional value at risk chance constraints in intensity- modulated proton therapy. Medical Physics, 2017. 44 (1 ): p. 28–36.28044325 46. An Y. , , Robust intensity-modulated proton therapy to reduce high linear energy transfer in organs at risk. Medical Physics, 2017. 44 (12 ): p. 6138–6147.28976574 47. Feng H. , , Per-voxel constraints to minimize hot spots in linear energy transfer (LET)-guided robust optimization for base of skull head and neck cancer patients in IMPT. Med. Phys., 2021. 48. Feng H. , , Technical Note: 4D robust optimization in small spot intensity-modulated proton therapy (IMPT) for distal esophageal carcinoma. Med Phys, 2021. 49. Feng H. , , Beam angle comparison for distal esophageal carcinoma patients treated with intensity-modulated proton therapy. J Appl Clin Med Phys, 2020. 21 (11 ): p. 141–152. 50. Shan J. , , A novel and individualized robust optimization method using normalized dose interval volume constraints (NDIVC) for intensity-modulated proton radiotherapy. Med Phys, 2018. 51. Shan J. , , Robust optimization in IMPT using quadratic objective functions to account for the minimum MU constraint. Medical Physics, 2018. 45 (1 ): p. 460–469.29148570 52. Yan D. , , Adaptive radiation therapy. Phys Med Biol, 1997. 42 (1 ): p. 123–32.9015813 53. Wu Q.J. , , Adaptive radiation therapy: technical components and clinical applications. Cancer J, 2011. 17 (3 ): p. 182–9.21610472 54. Sonke J.J. , Aznar M. , and Rasch C. , Adaptive Radiotherapy for Anatomical Changes. Semin Radiat Oncol, 2019. 29 (3 ): p. 245–257.31027642 55. Wu C. , , Re-optimization in adaptive radiotherapy. Phys Med Biol, 2002. 47 (17 ): p. 3181–95.12361217 56. Paganetti H. , , Adaptive proton therapy. Phys Med Biol, 2021. 66 (22 ). 57. Simone C.B. 2nd , , Comparison of intensity-modulated radiotherapy, adaptive radiotherapy, proton radiotherapy, and adaptive proton radiotherapy for treatment of locally advanced head and neck cancer. Radiother Oncol, 2011. 101 (3 ): p. 376–82.21663988 58. Lim-Reinders S. , , Online Adaptive Radiation Therapy. Int J Radiat Oncol Biol Phys, 2017. 99 (4 ): p. 994–1003.28916139 59. Rigaud B. , , Automatic Segmentation Using Deep Learning to Enable Online Dose Optimization During Adaptive Radiation Therapy of Cervical Cancer. Int J Radiat Oncol Biol Phys, 2021. 109 (4 ): p. 1096–1110.33181248 60. Feng H. , , GPU-accelerated Monte Carlo-based online adaptive proton therapy: A feasibility study. Med Phys, 2022. 49 (6 ): p. 3550–3563.35443080 61. Wang M. , , A Review on Application of Deep Learning Algorithms in External Beam Radiotherapy Automated Treatment Planning. Front Oncol, 2020. 10 : p. 580919.33194711 62. Chen X. , , A feasibility study on an automated method to generate patient-specific dose distributions for radiotherapy using deep learning. Med Phys, 2019. 46 (1 ): p. 56–64.30367492 63. Nguyen D. , , 3D radiotherapy dose prediction on head and neck cancer patients with a hierarchically densely connected U-net deep learning architecture. Phys Med Biol, 2019. 64 (6 ): p. 065020.30703760 64. Fan J. , , Automatic treatment planning based on three-dimensional dose distribution predicted from deep learning technique. Med Phys, 2019. 46 (1 ): p. 370–381.30383300 65. Nguyen D. , , A feasibility study for predicting optimal radiation therapy dose distributions of prostate cancer patients from patient anatomy using deep learning. Sci Rep, 2019. 9 (1 ): p. 1076.30705354 66. Liu Z. , , A deep learning method for prediction of three-dimensional dose distribution of helical tomotherapy. Med Phys, 2019. 46 (5 ): p. 1972–1983.30870586 67. Wang W. , , Deep Learning-Based Fluence Map Prediction for Pancreas Stereotactic Body Radiation Therapy With Simultaneous Integrated Boost. Adv Radiat Oncol, 2021. 6 (4 ): p. 100672.33997484 68. Neishabouri A. , , Long short-term memory networks for proton dose calculation in highly heterogeneous tissues. Med Phys, 2021. 48 (4 ): p. 1893–1908.33332644 69. Zhang X. , , Dose calculation in proton therapy using a discovery cross-domain generative adversarial network (DiscoGAN). Med Phys, 2021. 48 (5 ): p. 2646–2660.33594673 70. Pastor-Serrano O. and Perko Z. , Millisecond speed deep learning based proton dose calculation with Monte Carlo accuracy. Phys Med Biol, 2022. 67 (10 ). 71. Wu C. , , Improving Proton Dose Calculation Accuracy by Using Deep Learning. Mach Learn Sci Technol, 2021. 2 (1 ). 72. Javaid U. , , Denoising proton therapy Monte Carlo dose distributions in multiple tumor sites: A comparative neural networks architecture study. Phys Med, 2021. 89 : p. 93–103.34358755 73. Guerreiro F. , , Deep learning prediction of proton and photon dose distributions for paediatric abdominal tumours. Radiother Oncol, 2021. 156 : p. 36–42.33264639 74. Wang W. , , Feasibility study of fast intensity-modulated proton therapy dose prediction method using deep neural networks for prostate cancer. Med Phys, 2022. 49 (8 ): p. 5451–5463.35543109 75. Borderias-Villarroel E. , , Machine learning-based automatic proton therapy planning: Impact of post-processing and dose-mimicking in plan robustness. Med Phys, 2023. 76. Deng W. , , Hybrid 3D analytical linear energy transfer calculation algorithm based on precalculated data from Monte Carlo simulations. Med Phys, 2019. 77. Deng W. , , Technical Note: Integrating an open source Monte Carlo code “MCsquare” for clinical use in intensity-modulated proton therapy. Med Phys, 2020. 78. Holmes J. , , Collimating individual beamlets in pencil beam scanning proton therapy, a dosimetric investigation. Front Oncol, 2022. 12 : p. 1031340.36439436 79. Holmes J. , , Technical note: Evaluation and second check of a commercial Monte Carlo dose engine for small-field apertures in pencil beam scanning proton therapy. Medical Physics, 2022. 49 (5 ): p. 3497–3506.35305269 80. Shan J. , , Virtual Particle Monte Carlo (VPMC), a new concept to avoid simulating secondary particles in proton therapy dose calculation. Medical Physics, 2022. 81. Younkin J.E. , , Clinical Validation of a Ray-Casting Analytical Dose Engine for Spot Scanning Proton Delivery Systems. Technol Cancer Res Treat, 2019. 18 : p. 1533033819887182. 82. Peng Y. , , Accuracy Improvement Method Based on Characteristic Database Classification for IMRT Dose Prediction in Cervical Cancer: Scientifically Training Data Selection. Front Oncol, 2022. 12 : p. 808580.35311133 83. Liu S. , , Technical Note: A cascade 3D U-Net for dose prediction in radiotherapy. Med Phys, 2021. 48 (9 ): p. 5574–5582.34101852 84. Miften M. , , Tolerance limits and methodologies for IMRT measurement-based verification QA: Recommendations of AAPM Task Group No. 218. Med Phys, 2018. 45 (4 ): p. e53–e83.29443390 85. Valdes G. , , Clinical decision support of radiotherapy treatment planning: A data-driven machine learning strategy for patient-specific dosimetric decision making. Radiother Oncol, 2017. 125 (3 ): p. 392–397.29162279 86. Farr J.B. , , Clinical commissioning of intensity-modulated proton therapy systems: Report of AAPM Task Group 185. Med Phys, 2021. 48 (1 ): p. e1–e30.33078858 87. Hernandez Morales D. , , Automation of routine elements for spot-scanning proton patient-specific quality assurance. Med Phys, 2019. 46 (1 ): p. 5–14.30339270 88. Allred B.C. , , A method for quantitative evaluations of scanning-proton dose distributions. J Appl Clin Med Phys, 2021. 22 (4 ): p. 193–201.33780142