An open‐source software for monitoring intrafraction motion during external beam radiation therapy based on superimposition of contours of projected ROIs on cine‐MV images

Abstract Purpose To present an open‐source software (https://github.com/CHUSRadOncPhys/FluoMV) for monitoring intrafraction motion that is based on the visualization of superimposed contours of projected region‐of‐interests from DICOM RTSTRUCT files on cine‐MV images acquired and displayed in real‐time during radiation therapy delivery. Clinical use with prostate gold fiducial markers is presented. Methods Projections of regions of interest (ROI) in the reference frame of the electronic portal imaging device are computed offline for different gantry angles before the first treatment fraction. During treatment delivery, the contrast of portal images is automatically adjusted using a histogram equalization algorithm. The projections associated with the current gantry angle are then superimposed on the images in real time. This allows the therapist to evaluate if the imaged structures of interest remain within their respective contours during treatment delivery and to potentially interrupt the treatment if deemed necessary. The spatial accuracy of the method was evaluated by imaging a ball bearing phantom in a set‐up where the position of the projected ROI is highly sensitive to gantry angle errors. The visibility of fiducial markers during one fraction of seven different volumetric modulated arc therapy (VMAT) prostate treatments is characterized. Results The geometric validation showed a negligible systematic error μ < 0.1 mm for the position of the projections. The random errors associated with the time accuracy of the gantry angle readout were characterized by standard deviations σ ≤ 0.6 mm. The VMAT clinical treatments showed that the fiducial markers were frequently visible, allowing for a meaningful clinical use. Conclusions The results demonstrate that the method presented is sufficiently accurate to be used for intrafraction monitoring of patients. The fact that this method could be implemented on many modern linacs at little to no cost and with no additional dose delivered to the patients makes this solution very attractive for improving patient care and safety in radiation therapy.

no additional dose delivered to the patients makes this solution very attractive for improving patient care and safety in radiation therapy. During treatment delivery, intrafraction positioning errors may occur due to internal organ or patient motion. Margins are usually applied to the target volume during treatment planning to account for these effects. Motion management systems can also be used to monitor the patient position during treatments. Available solutions include optical surface imaging, 1 Varian RPM, 2 MV, 3 and kV 4,5 imaging with or without fiducial markers, magnetic resonance imaging (MRI), 6 ultrasound imaging, 7 and radiofrequency (RF) implants. 8 Those systems often include an automatic beam-gating functionality that can start and stop the radiation based on the position of the target volume relative to predefined thresholds.
The intrafraction monitoring systems mentioned above have one or more disadvantages. First and foremost, the costs associated with additional hardware, such as optical, ultrasound, and RF implants monitoring systems, can be a disincentive, while integrated magnetic resonance (MR)-Linac solutions are simply out of reach for most radiation therapy centers because of their high costs. Kilovoltage imaging techniques give additional radiation doses to the patient which may pose a health risk, especially when many fractions are delivered. 9 Another drawback of many real-time kV imaging systems is that the images are acquired in a plane orthogonal to the treatment beam. Therefore, it is not possible to guarantee that the beam does not miss the target, as it would be the case if the images were acquired in the beam's eye view geometry. As for the use of fiducial markers and RF implants, it requires additional invasive medical procedures with associated risks. Lastly, optical monitoring techniques of the patient surface are unable to detect errors related to internal organ movements, such as the displacement of the prostate due to gas movement in the rectum or bladder filling.
Cine-MV imaging has been the subject of many publications. [10][11][12] In most of those, the target volume is tracked by detecting fiducial markers or image features. However, few of them have implemented solutions that use contours defined during treatment planning to evaluate the intrafraction motion of structures of interest, 13 as is done with other imaging modalities 14,15 and for the evaluation of interfraction positioning with DRRs 16 and CBCT. 4,17 The purpose of this work is to present an open-source software that uses superimposition of contours of projected regions of interests (ROIs) on cine-MV images to monitor intrafraction motion of patients with Elekta linacs (Elekta Limited). A validation of its spatial accuracy and a presentation of its clinical use with patients treated for prostate cancer using volumetric modulated arc therapy (VMAT) with implanted gold fiducial markers are also presented. By making our software open source, we hope to give clinicians a useful tool to assess the accuracy of intrafraction positioning of patients in their clinics. The software can be downloaded on GitHub (https://github.c om/CHUSRadOncPhys/FluoMV) and instructions for installation and use are provided.

| MATERIALS AND METHODS
The software was designed for Elekta linacs equipped with a Perki-nElmer electronic portal imaging device (EPID) and has been tested on Synergy and Infinity linac models. The software includes a ROI projection module that can be run on a quad-core CPU or on a NVI-DIA graphics processing unit (GPU) for faster computation, and an acquisition module that runs on the computer connected to the EPID. The EPID is an amorphous silicon detector panel (XRD 1640 AL5 P) that produces images of 1024 × 1024 pixels with a digital resolution of 16 bits per pixel. The EPID is located at a distance of 160 cm from the radiation source and has a field of view of 25.6 cm × 25.6 cm at the linac isocenter.

2.A | ROI projection module
The projections are computed from the ROIs defined by the radiation oncologist or the planner in a treatment planning system (TPS) and exported as a DICOM RTSTRUCT file. To compute the two-dimensional projections of a three-dimensional (3D) ROI, the linac geometry and the coordinates of the plan isocenter provided by the DICOM RTPLAN file are used. The first step of the projection algorithm is to create a 3D voxel grid with coordinates that matches those of the planning CT images. This grid contains binary values, where all voxels have a value of 0 except those inside the ROI to be projected. Secondly, for a given gantry angle and for each group of 2 × 2 detector elements of the EPID, 1 the equation parameters of the straight line passing by the position of the pixel and the position of the radiation source are determined. Then, for each X, Y, and Z plane of the grid that contain at least one voxel with a value of 1, the coordinates of the point of intersection of the plane with the line are calculated and rounded to the nearest integer to find in which voxel the intersection occurs. As soon as an intersection occurs in a voxel with a nonzero value, the computation for this EPID detector element is stopped and a value of 1 is set to its corresponding pixel on a two-dimensional (2D) binary map that represents the EPID image. If this condition is never met for a given detector element, the corresponding pixel in the binary map is set to 0. The contours of the projected ROI are then generated by selecting only the pixels of the binary projection map with a value of 1 that have at least one of their eight neighbors with a value of zero or that is located on a boundary of the map.
For a given patient, this projection process is done only once, before the first fraction of the treatment, for every desired ROI, at intervals of 0.5°over 360°. The data are saved in a file accessible by the computer that controls the EPID. At the time of treatment, the therapists use the graphical user interface to enter the patient identification number, select the prescription, and the contours they want to visualize during treatment delivery. Finally, the projected contours are superimposed on the live MV EPID images during treatment delivery. Since the projections are precomputed, the time efficiency of the projection algorithm has no effect on the real-time display of the contours during the treatments.  Once the preprocessing of the image is completed, histogram equalization is performed on pixels of value superior to a threshold in order to obtain a good contrast in the radiation-field region and thus be able to differentiate the structures of interest. By default, this threshold is 70% of the maximum gray-level value of the image but can be adjusted during the delivery with a scroll bar if the contrast is not deemed good enough. Pixels below this threshold are given a value of 0 and all the others have their gray-level value redistributed between 0 and 255. Once the contrast is adjusted, the precomputed projected ROIs are superimposed using the same colors specified in the TPS to be easily recognized. In addition, a checkbox list of the names of the ROIs is included in the software to allow users to choose whether or not to display any ROI at any time during the treatment. The whole process of image preprocessing, contrast adjustment, and superimposition of contours is sufficiently fast to be executed between two consecutive image readouts.

2.B | Acquisition modules
To determine which projection is to be displayed on the image, the gantry angle at which the image was acquired must be known.
As a first approximation, a gantry angle can be assigned to each image by linearly interpolating the gantry angles of the iCom messages to the timestamp of the image. However, this method neglects the effect of the time order of the readout of the columns of the panel detector elements which can be significant when the ROI projected contours are off-centre and the gantry rotation speed is high.
Physically, the panel is divided laterally (in the AB direction) into two independent sections that have their own electronic reading system.
The columns of the panel are parallel to the GT axis. The two sections are read synchronously, column by column, from the outside to LESSARD ET AL.
| 175 the inside of the panel. 19,20 Therefore, for the section on the linac A-side, the readout starts at column c ¼ 0 at t ¼ 0 and ends at col-  Figure 1 illustrates the geometry used for the analysis. When the gantry angle is θ, the radiation source is at position where SAD is the source-to-axis distance. The projection of the object located at O ¼ ðO x ; 0Þ can be found by calculating the vector: whereû is the unit vector along the u axis and: The angle β is positive when À90 ≤ θ ≤ 90 and negative otherwise.
The accuracy of the projections also depends on the repro- To evaluate the overall accuracy of the method, an end-to-end test was performed using a BB phantom. First, a CT scan of the phantom was obtained with a transverse resolution of 0.5 mm × 0.5 mm and a slice thickness of 1.0 mm. It was then imported in a treatment planning system. A treatment plan was generated with two 360°clockwise arc beams of fixed field size of 24 cm × 24 cm.
F I G . 1. The x and z axes represent the lateral and vertical axes in the treatment room and the u axis represents the projection axis at isocenter in the X-Z plane. The linac isocenter is located at the origin. When the gantry angle is θ, the radiation source is at position S θ ð Þ. The projectionP of an object located atÕ can be calculated by determining the vectorsC andR and deducing the angle β.
The monitor units were adjusted in order to have a constant angular speed of 1.5°/s for the first arc beam and 4.8°/s for the second arc beam, which correspond, respectively, to the minimum and maximum gantry speed of the VMAT plans in our clinic. The plan isocenter was positioned with an offset of 10 cm relative to the center of the BB in the lateral direction and with an offset of 5 cm in the longitudinal direction. In theory, this configuration is one of the most sensitive to gantry angle errors, mainly because of the lateral shift, as shown in Fig. 2. Then, the BB was contoured in the treatment planning system. The DICOM images, structures, and plan were exported and the projections were precomputed with the ROI projection module. Finally, during delivery, the calibrated EPID images were saved.
The projection errors were assessed retrospectively by computing the difference between the centroid of the BB and the centroid of the contours. The results are presented in Section 3.C.   axes (X,Y,Z) correspond to the lateral, longitudinal, and vertical axis in the reference frame of the treatment room with the linac isocenter as the origin. According to Fig. 1, the projection position error in the AB direction is defined as:

2.E | Clinical use cases
where ɛ is the gantry angle error. The results show that the projection error increases with increasing lateral distance of the object from the isocenter. For objects located at the edge of the panel, a gantry angle error as low as 1°can cause an error of up to 2.5 mm in the projections. Figure 2

3.D | Clinical use
An example of two images acquired during VMAT treatments is presented in Fig. 5. Figure 6 shows the number of fiducial markers that could be seen on each image acquired continuously during one frac- There are some limitations to the method proposed in this work.
The first one is the limited size of the EPID. Indeed, to avoid damaging the electronics of the detector, all treatments using beams with a field size larger than the detector are not eligible to this method. For this reason, when the projections are calculated with the ROI projection module before the treatments, each control point is verified in order to guarantee that the primary radiation field stays within the imaging area of the detector, with a small security margin, by using the leaves and jaws positions and the collimator angles contained in the DICOM RTPLAN. Another limitation is that the information is available in the beam's eye view only, which means that the position of the structures in the direction of the beam axis is not observable.
The main effect of a small displacement in this direction would be a dose variation of a few percent in these structures due to a change to their distance relative to the radiation source and/or a change in their radiological depth. However, this would have much lesser clinical and dosimetric consequences than missing the target, which is why the beam's eye view geometry is preferable for 2D imaging. 21 Also, as mentioned in the introduction, implantation of markers in the prostate is an invasive medical procedure and has associated risks. In our clinic, we already consider that the benefits of using markers for interfraction CBCT registration are sufficiently large compared to the risks of the procedure, so the software was used with patients who already have markers implanted.
One more limitation of the method is that the monitoring is lim- between images, the correlation between the trajectory of a marker and the trajectory of a contour can be used to identify the reference contour. Nevertheless, this uncertainty does not usually last long because it is common to see more than one marker (34% of the time on average according to Table 1). Finally, the iCom messages may not be the best way to correlate the gantry angles with the images. Indeed, the exact time at which the readout of the gantry angle is performed is not given with high precision in the messages. The gantry angle imprecision as well as the intrinsic resolution of the contours drawn on the images are the main limitations of the accuracy of the method but are small enough for our practical clinical use.
Despite the listed limitations, the proposed method contributes to improve the quality and safety of treatments. Preliminary clinical use of this method proved to be useful in our institution for VMAT treatments of prostate cancer with implanted fiducial markers. Indeed, prostate gland motion was frequently observed using this tool and in some cases the treatment beam was interrupted.
Our criterion for interrupting a treatment was that at least one fiducial marker systematically touches or crosses over its tolerance contour during several successive images. Treatments were resumed after a short pause or, when necessary, by performing a CBCT and repositioning the patient. These results are not presented here since it is not in the scope of this study to characterize the movements of the prostate during treatments. We also believe that this tool can be useful when deciding which PTV margins are adequate. Because the tolerance margins for intrafrac- This technique could also be applied to other treatment sites.
For anatomical regions where a significant contrast exists between the target and the normal tissues, such as lung, the technique could potentially be used without fiducial markers. This would be especially useful for lung SBRT treatments as they are longer to deliver, therefore increasing the risk of the target getting out of the tolerance margins. The common practice of performing intrafraction CBCTs 23 could be partially replaced by this technique. However, this site is proving to be challenging because the ability to discern the GTV from its surroundings depends on its density, its size, and its location.

| CONCLUSION
We introduced a free open-source software designed for intrafraction monitoring which uses projected ROIs contours in a beam's eye view geometry. We validated the accuracy of the technique and its clinical usefulness in a standard VMAT treatment delivery for prostate cancer patients with implanted fiducial markers. This technique has the major benefit of potentially improving patient care with very little upfront cost and no additional delivered dose.

ACKNOWLEDGMENTS
The authors would like to thank Patrick Delage for his useful comments.

CONF LICT OF I NTEREST
No conflicts of interest.

N O T E S
1 Detector elements were binned 2 × 2 to account for GPU limitations.
Therefore, the virtual EPID has 512 × 512 pixels instead of 1024 × 1024. 2 Here, we refer to the Elekta direction convention A-B sides and Gun-Target ends (GT) of the linear accelerator