Development and clinical implementation of eclipse scripting‐based automated patient‐specific collision avoidance software

Abstract Purpose Increased use of Linac‐based stereotactic radiosurgery (SRS), which requires highly noncoplanar gantry trajectories, necessitates the development of efficient and accurate methods of collision detection during the treatment planning process. This work outlines the development and clinical implementation of a patient‐specific computed tomography (CT) contour‐based solution that utilizes Eclipse Scripting to ensure maximum integration with clinical workflow. Methods The collision detection application uses triangle mesh structures of the gantry and couch, in addition to the body contour of the patient taken during CT simulation, to virtually simulate patient treatments. Collision detection is performed using Binary Tree Hierarchy detection methods. Algorithm accuracy was first validated for simple cuboidal geometry using a calibration phantom and then extended to an anthropomorphic phantom simulation by comparing the measured minimum distance between structures to the predicted minimum distance for all allowable orientations. The collision space was tested at couch angles every 15° from 90 to 270 with the gantry incremented by 5° through the maximum trajectory. Receiver operating characteristic curve analysis was used to assess algorithm sensitivity and accuracy for predicting collision events. Following extensive validation, the application was implemented clinically for all SRS patients. Results The application was able to predict minimum distances between structures to within 3 cm. A safety margin of 1.5 cm was sufficient to achieve 100% sensitivity for all test cases. Accuracy obtained was 94.2% with the 5 cm clinical safety margin with 100% true positive collision detection. A total of 88 noncoplanar SRS patients have been currently tested using the application with one collision detected and no undetected collisions occurring. The average time for collision testing per patient was 2 min 58 s. Conclusions A collision detection application utilizing patient CT contours was developed and successfully clinically implemented. This application allows collisions to be detected early during the planning process, avoiding patient delays and unnecessary resource utilization if detected during delivery.


| INTRODUCTION
Potential collisions in radiation therapy are a burden on clinical resources when detected late in the treatment process and, when undetected, a detriment to patient safety and equipment maintenance. Collisions can be difficult to detect during the treatment planning stage, especially with techniques that utilize noncoplanar arcs such as Stereotactic Radiosurgery (SRS) and stereotactic body radiation therapy (SBRT). As the number and complexity of these treatments increase, the probability of a gantry to patient and/or couch collision likewise increases. The purpose of this work is the development and clinical implementation of a simple and automated patientspecific collision detection application that can be easily incorporated into current clinical workflow.
A common method of collision prevention involves the use of pretreatment simulation on a Linac. This simulation increases total patient time on the Linac, which negatively impacts patient quality of life as well as increases resource utilization for the treatment unit.
A potential collision discovered at the time of treatment would lead to the treatment plan being re-planned and re-approved, requiring additional staff hours from the Radiation Oncologist, Dosimetrist, and Physicist. The treatment itself will also have to be delayed which is an inconvenience for the patient and could be detrimental to the whole patient treatment outcome. Any additional time that the patient is required to be on the treatment couch also increases patient discomfort due to the rigid nature of immobilization systems.
Current strategies to prevent re-planning make use of gantry and couch angles taken from look-up tables and predetermined noncoplanar arc arrangements based on the isocenter location in the brain. These arrangements tend to be highly conservative to limit the chance of a collision. Conservative gantry trajectories limit the number of available control points for the dose optimization process which could negatively impact plan quality.
Several solutions have been proposed and developed for collision prediction and avoidance. [1][2][3] One class of solutions uses simple geometric shape modeling to provide a visual or mathematical approximation of the collision-free space. 4,5 The geometric class solution suffers from a lack of patient-specific modeling and therefore has limited accuracy. Two dominant methods have emerged for incorporating patient-specific body and plan details into collision prediction models. Surface models of patients are acquired either by threedimensional (3D) optical scanning or from patient body contours created during planning computed tomography (CT) simulation. Optical scanning accuracy is limited by the number of cameras, camera positioning, fidelity of the scanning system, length of scan, and room registration technique. Yu et al. 6 assert a maximum 1.5-cm measurement error on the body extremities for a 1.8 m tall phantom using a handheld scanner. Cardan et al. report a maximum spatial accuracy of 3 cm for certain components of a 3D scan using a static 3 camera system 7 . CT plan data accuracy is limited by the contouring accuracy, size of the scan, reproducibility, and slice width. Varian Medical Systems (Palo Alto, CA, USA) has provided their own solution in the form of HyperArc™, which allows the user to select from a set of known possible trajectories for a predefined immobilization system. Use of HyperArc™, however, is limited to the Encompass™ immobilization system from Qfix (Avondale, Pennsylvania, USA). Aside from the vendor solution provided by Varian, other solutions to collision avoidance suffer from a lack of integration with the clinical treatment planning system and clinical workflow.
In this work, we showcase easy-to-use and effective integration of a collision avoidance application with current clinical workflow.
This application was created using eclipse scripting application programming interface (ESAPI) (Varian Medical Systems). ESAPI is highly integrated with the Eclipse treatment planning system and provides access to patient-specific plan parameters. Polygon mesh geometry from the patient body and couch contour is used to perform the collision check with an in-house collision detection algorithm described in the methods. The application acts as a stand-alone tool accessible from the eclipse treatment planning system (TPS), which allows for simultaneous use of this application and the Eclipse TPS. Furthermore, this is the first collision detection application to utilize automatic registration of a variety of immobilization devices to patient anatomy, for both visual and numerical verification, all contained within the treatment planning system.  (Fig. 1). For the outer plastic casing, measurements were taken of the head circumference at various heights and linearly interpolated to determine the circumference between these measured points. Fourteen centimeter of the gantry head casing, most relevant to collision prevention, was modeled. Limited gantry modeling allows for a decrease in calculation time. For the gantry face, all major projections, including the locking pins and horseshoe tray insert, were measured for their diameter and projection distance as seen in Fig. 1.

2.A.3 | Collision detection algorithm
Each structure used by the algorithm is segmented using oriented bounding boxes (OBBs) into a binary tree hierarchy (BTH) using topdown segmentation methods. BTH tree traversal collision detection methods are then used to find the minimum distance between structures. This type of algorithm improves efficiency over a simple pointto-point test, especially when dealing with large mesh structures.
The time for OBB Tree algorithm completion is given by the following equation 8 : As opposed to a point-to-point algorithm, which has an efficiency given by: N: total number of primitives (vertices) for all structures used.

2.B | Graphical user interface
The collision detection application runs as a stand-alone Eclipse Scripting plug-in, accessible from the treatment planning system.

3.A | Algorithm accuracy validation
The average difference between measured and calculated minimum distances for all gantry and couch angle combinations was −0.2 cm with a standard deviation of 0.7 cm. The largest overprediction was −2.9 cm and the largest underprediction was 2.4 cm. The minimum, maximum, and median difference for all allowable couch angles at each gantry angle can be seen in Fig. 5.

3.B | Clinical Validation
For the calibration phantom ROC curve, in Fig. 6, a safety margin of 1 cm resulted in 100% sensitivity and no false positives. The anthropomorphic phantom validation testing required a safety margin of 1.5 cm to achieve 100% sensitivity for all cases. The highest corresponding false positive rate for this margin was 0.9%. Table 2 shows ROC results with varying safety margins for the calibration and four test cases. At the clinical safety margin of 5 cm, algorithm accuracy dropped to a minimum of 94.2% which represents a 6% reduction in T A B L E 1 Categories for receiver operating characteristic analysis with collision detection.

3.C | Clinical implementation
During a 7-month period, a total of 88 SRS patients totaling 107 SRS patient plans were tested using the collision detection application. The application was able to correctly detect and prevent one SRS collision during this period. In addition, no collisions occurred that were unpredicted by the application. Before implementation of the application, as shown in Fig. 7 The majority of SRS patient plans were found to be highly conservative with gantry trajectory. A study of 35 patients, with 46 corresponding plans, found that on average each arc could be increased by 76°, omitting arcs that were already a 360 degree trajectory.

| DISCUSSION
This study improves on the accuracy of previous collision detection studies 4,5,9 through the use of a detailed CAD gantry model and The collision detection application has been purposefully designed to be easily usable at other clinics using the Truebeam system. The initial setup requires contours of immobilization structures used at the clinic, which are stored within the software for subsequent use. The use of our application for SRS technique was emphasized in this work but it can be expanded to any other treatment techniques or sites, provided the plan contours are a sufficient approximation of patient setup.