 Research
 Open Access
 Published:
Treatment verification using Varian’s dynalog files in the Monte Carlo system PRIMO
Radiation Oncology volume 14, Article number: 67 (2019)
Abstract
Background
The PRIMO system is a computer software that allows the Monte Carlo simulation of linear accelerators and the estimation of the subsequent absorbed dose distributions in phantoms and computed tomographies. The aim of this work is to validate the methods incorporated in PRIMO to evaluate the deviations introduced in the dose distributions by errors in the positioning of the leaves of the multileaf collimator recorded in the dynalog files during patient treatment.
Methods
The reconstruction of treatment plans from Varian’s dynalog files was implemented in the PRIMO system. Dose distributions were estimated for volumetricmodulated arc therapy clinical cases of prostate and head&neck using the PRIMO fast Monte Carlo engine DPM. Accuracy of the implemented reconstruction methods was evaluated by comparing dose distributions obtained from the simulations of the plans imported from the treatment planning system with those obtained from the simulations of the plans reconstructed from the expected leaves positions recorded in the dynalog files. The impact on the dose of errors in the positions of the leaves was evaluated by comparing dose distributions estimated for plans reconstructed from expected leaves positions with dose distributions estimated from actual leaves positions. Gamma pass rate (GPR), a hereby introduced quantity named percentage of agreement (PA) and the percentage of voxels with a given systematic difference (α/Δ) were the quantities used for the comparisons. Errors were introduced in leaves positions in order to study the sensitivity of these quantities.
Results
A good agreement of the dose distributions obtained from the plan imported from the TPS and from the plan reconstructed from expected leaves positions was obtained. Not a significantly better agreement was obtained for an imported plan with an increased number of control points such as to approximately match the number of records in the dynalogs. When introduced errors were predominantly in one direction, the methods employed in this work were sensitive to dynalogs with rootmeansquare errors (RMS) ≥0.2 mm. Nevertheless, when errors were in both directions, only RMS >1.2 mm produced detectable deviations in the dose. The PA and the α/Δ showed more sensitive to errors in the leaves positions than the GPR.
Conclusions
Methods to verify the accuracy of the radiotherapy treatment from the information recorded in the Varian’s dynalog files were implemented and verified in this work for the PRIMO system. Tolerance limits could be established based on the values of PA and α/Δ. GPR _{3,3} is not recommended as a solely evaluator of deviations introduced in the dose by errors captured in the dynalog files.
Background
Modern radiation therapy techniques are based on the combination of multiple variables, such as the modulation of the beam intensity and the variation of the gantry rotation speed and the fluence output rate to maximize conformity of the dose to the planned target volumes (PTVs) and to spare organsatrisk (OARs). The increased complexity of the treatment planning and delivery attained by those techniques reinforces the necessity of implementing refined patientspecific quality assurance (QA) procedures.
Data contained in the dynalog files generated by the multileaf collimator (MLC) controller are a high resolution description of the dynamics of that device and, therefore, a faithful depiction of the beam intensity modulation in the actual patient treatment. A few reports have demonstrated that these data are valuable to assess the deviations introduced in the dose delivered to the patient by misplacements of the MLC leaves [1–3] and to establish indicators of the treatment delivery quality. Most of those reports describe inhouse methods based on replacing the original control points in the treatment plan with those generated from the data contained in the dynalog files to recalculate the dose using the treatment planning system (TPS) algorithm. The method used by Teke and coworkers [3], however, employs a generalpurpose Monte Carlo code to estimate the dose, thus making the verification process completely independent from the TPS, even when it relies on the TPS resources for visualization of the dose distributions.
The PRIMO system is a software that allows the Monte Carlo simulation of linear accelerators for the generation of phasespace files (PSFs) and the estimation of dose distributions in phantoms and computed tomographies (CT) [4]. The interaction with the system is managed by a friendly graphicaluser interface designed to spare the user of having to deal with the intricacies of the Monte Carlo method applied to radiation transport simulation. Furthermore, PRIMO has integrated functions for the analysis and visualization of simulated results including an environment for the comparison of dose distributions. PRIMO (version 0.3.1.1681) uses PENELOPE (version 2011) [5] as its main radiation transport engine. The Dose Planning Method (DPM v1.1) [6], a fast Monte Carlo radiation transport algorithm, has been recently implemented in PRIMO as an alternative Monte Carlo dose computation engine used to simulate dynamic plans [7, 8].
The aim of this work is to describe and validate the methods implemented in the PRIMO system –a freely distributed Monte Carlo program– for the verification of treatment delivery using the Varian’s dynalog files and to provide recommendations for the establishment of tolerance levels.
Methods
The guidelines for reporting Monte Carlo simulations, provided by the AAPM Task Group 268 [9], have been followed in the preparation of this work.
Plan reconstruction from dynalog files
Varian’s dynalog files are generated by the MLC controller during the delivery of dynamic treatments. The controller inserts a new record in the dynalog every 50 ms (20 ms for TrueBeam linacs). Two files are generated per treatment field, one per MLC carriage. The most relevant data included in the record are the beam status (ON/OFF), the beam holdoff indicator, the segment number, the position of the jaws, the gantry angle, the expected and actual positions of each MLC leaf and the fractional dose delivered at the instant marked by the record. Segment in this context refers to the time interval of transition between two control points as recorded in the original treatment plan.
A function to create a treatment plan employing data extracted from the dynalog files was coded in PRIMO. Hereafter, we shall call this plan the reconstructed plan to differentiate it from the original plan created in the TPS and exported as a DICOM RTPLAN file. Consequently, we shall refer to the original dose and to the reconstructed dose as the dose distributions estimated by the Monte Carlo simulation of the original and reconstructed plans, respectively. The control points of the reconstructed plan can be generated either from the expected or the actual MLC positions, both recorded in the dynalog files. For both cases the following options have been coded:

1
Uniform reconstruction (UR): Reconstructing by uniformly sampling the records in the dynalog files, that is, by taking records at a given time interval. This interval can be freely chosen, with a minimum value of 50 ms (or 20 ms for TrueBeam linacs), in which case all records are considered.

2
Persegmentreconstruction (PSR): The segment number stored in the dynalog files is used to sample only those records in which a change of segment occurs. This reconstruction method renders the same number of control points as the original plan.

3
Persegmentreconstruction with error detection (PSRED): The reconstruction is made by including the records in which a change of segment occurs, in addition to all other records where at least one leaf is found having a position error above a given tolerance. The tolerance can be freely chosen starting from zero, in which case all records are considered. When the selected tolerance equals to or exceeds the maximum leaf error in the dynalog file, this reconstruction becomes equivalent to the PSR.
The PSR option reduces the number of control points to those in the original plan. This approach has the advantage of a faster Monte Carlo simulation because less time is employed in rearranging the simulation geometry from one segment to the next one. However, this method has the limitation that segments with large errors in the position of the leaves can be missed in the reconstruction. In order to overcome this limitation, the PSRED reconstruction option was coded, which allows to include segments with significant position errors.
The reconstructed and original dose are, by default, both estimated in the geometry of the patient created from the DICOM CT file exported by the TPS.
Dosevolume histogram percentage of agreement
In this work we introduce the percentage of agreement (PA) as an indicator of the similarity of two DVHs. Given DVH_{1} and DVH_{2}, the PA is defined as
where δ_{A} is the absolute value of the difference area under DVH_{1} and DVH_{2}, and where the areas under these histograms are named A_{1} and A_{2}, respectively.
To illustrate how δ_{A} is calculated, let us assume that the histograms are discrete functions and both have the same bin size Δd. In this case,
where V_{1,i} and V_{2,i} are the volume of DVH_{1} and DVH_{2} for the ith bin, respectively and N is the total number of bins.
Validation of the plan reconstruction
Two volumetricmodulated arc therapy (VMAT) clinical cases of prostate and head&neck were considered in this work. They were selected because of their differences in the region of the body treated, in the complexity of the MLC dynamics and in the range of leaves involved. In both cases the region inside the contour of the body of the patient is hereafter identified as body.
For the prostate case five PTVs were included in the analysis. Four were drawn as irregular rings involving the region of the prostate. Hereafter, they will be identified as PTV_{1} to PTV_{4} where PTV_{1} is the inner one. The fifth PTV, identified as PTV _{total} is an envelope of all other PTVs. The selected OARs were bladder and rectum.
For the head&neck case, two PTVs were considered, PTV_{1} a large region encompassing the lymph nodes of the left side of the neck, while PTV_{2} included the gross tumor plus margins. The spinal canal and the left and right parotid glands were selected as OARs.
The original plans were created with the Eclipse treatment planning system, version 13.6 (Varian, Palo Alto). A set of dynalog files corresponding to one treatment session was chosen arbitrarily for each clinical case. The linear accelerator employed was a Varian’s Clinac iX equipped with a Millennium 120 MLC.
Both clinical cases included in this work were real cases of treated patients. The treatment plans produced clinically acceptable dose distributions and successfully passed a TPS independent plan verification process.
Monte Carlo simulations were run using the PRIMO system. The simulation of the patientindependent part of the linac was done using PENELOPE as the Monte Carlo engine. That part was simulated once to tally a PSF with nominal energy 6 MV and initial beam parameters E=6.2 MeV, FWHM _{E}=0.186 MeV, FWHM _{focal spot size}=0.15 cm and beam divergence 2.5 degrees. Splitting roulette [10, 11] was employed as variancereduction technique. The rest of simulation parameters, including absorption energies, were those provided as default in PRIMO. The tallied PSF produces a dose distribution in water that reproduces well the measured dose profiles for the particular linac used, with a gamma pass rate GPR, i.e., the percentage of voxels that pass gamma analysis [12] with criteria 1%,1 mm, better than 95%. The size of the PSF is 23 Gigabytes. For the patientdependent part of the linac and the voxelized geometries, DPM was selected as the Monte Carlo radiation transport engine. Simulations were run for 1×10^{8} histories in a dual Xeon E52670V3 CPU with 12 cores each, and hyperthreading. The simple splitting variancereduction technique was applied in the patient geometry with a splitting factor of 300. The obtained dose distributions had an average standard statistical uncertainty less than 1% in all cases.
The accuracy of the implemented reconstruction algorithm was assessed by comparing the original dose (reference) with the expected dose i.e., the dose obtained from the simulation of the plan reconstructed from the expected positions (evaluated). The comparison of dose distributions was made by calculating the gamma pass rate with criteria 2%, 1 mm (GPR _{2,1}) and by evaluating the DVHs percentage of agreement. All the analysis was done with the functions available in the PRIMO system.
Sensitivity analysis
Sensitivity of the dose to the magnitude of errors in the position of the MLC leaves was evaluated by using the gamma pass rate (GPR) and the PA. For this purpose, the position errors captured in the dynalog files of the two clinical cases were magnified. Magnification was made by rescaling the errors up to a maximum error Σ. Only errors larger than 0.01 mm were magnified. For scaling, the altered “actual" position of a leaf, \(P^{\prime }_{a,}\) was calculated as,
where P_{e} is the expected position of the leaf, ε is the error of the leaf, i.e., ε=P_{e}−P_{a}, P_{a} is the actual position of the leaf and f is the scaling factor defined as,
where MLE is the maximum leaf error found in the dynalog files before scaling. Scaling was done twofold, by conserving the sign of ε and by replacing ε by ε on Eq. 3, i.e., forcing the altered actual leaf position to define a smaller aperture than the one defined by the expected position. The values of Σ used were 2.0, 3.0, 4.0, 5.0, 10.0 and 30.0 mm. Dose distributions estimated from the plans reconstructed from the actual (magnified) positions (hereafter actual dose) were compared to the expected doses. The PA, (GPR _{2,2}) and (GPR _{3,3}) were calculated for the body region, PTVs and OARs defined for the clinical cases. The rootmeansquare error (RMS) of all leaf positions in the dynalog files was evaluated in each case as,
where N is the total number of leaf position pairs present in the dynalog files, P_{e,i} and P_{a,i} are the ith pair of expected and actual leaf positions, respectively.
Additionally, systematic differences between the expected and actual dose distributions were determined by the method proposed by Kawrakow and Fippel [13]. The method allows to separate systematic differences from those given by statistical fluctuations of two dose distributions estimated by the Monte Carlo method. Systematic differences are reported as α/Δ pairs, where α is the percentage of voxels having a deviation Δ given in percentage of the reference maximum dose. Systematic differences were determined in the region inside the patient’s body contour and for voxels with a dose greater than 30% of the maximum reference dose.
For the reconstruction of all treatment plans in this work the UR option was used with a time interval of 50 ms i.e., all records in the dynalog files were considered.
Results
Verification of the plan reconstruction
Results of the comparison of the original and expected doses are shown in Table 1. The expected plans were reconstructed considering all the records in the dynalog files, i.e., 1536 and 1584 for the prostate and head&neck cases, respectively. Therefore, they describe the treatment dynamics with a higher time resolution than the original plans that included 177 and 194 control points (taken from the DICOM files) for the prostate and head&neck cases, respectively. However, the good agreement of the original dose of these lowresolution plans with the expected dose shown in Table 1, indicates that the impact of time resolution on the dose distribution is negligible. Table 1 also shows the comparison of the expected doses with original doses estimated from original plans in which the number of control points were increased to 1594 and 1561 for the prostate and head&neck cases, respectively. The additional control points were generated by linear interpolation of the MLC leaf positions and of the fractional dose. The agreement in these highresolution cases is not significantly better than for the lowresolution plans.
Table 2 shows the time needed to complete the simulation of the original low and highresolution plans and of the expected plan for both clinical cases studied in this work. Notice that in all cases the same voxel size (0.25 cm) ^{3}, number of histories simulated (10^{8}) and splitting (factor of 300) were used. Standard uncertainties of the dose averaged for all voxels with dose greater than half of the maximum dose were in the range between 0.7% and 0.8%. So, differences in the simulation time among the plans of a clinical case are exclusively determined by their different number of control points. Despite their similarity in the number of control points, the marked difference of the simulation time between the prostate (field size ≈12×12 cm ^{2}) and the head&neck case (field size ≈16×22 cm ^{2}) is mainly due to the different number of MLC leaves involved in the treatment. For this reason, considerably more time is employed in computing the radiation transport through the MLC in the head&neck plans than in the prostate plans.
Sensitivity analysis
The impact on the dose of magnifying leaf position errors ε by conserving its sign in Eq. 3 was small. This can be observed in Table 3 which shows the results of comparing the expected dose with the actual doses estimated for plans in which errors were scaled up to large values of 10 and 30 mm. For Σ=10 mm with RMS of 0.68 and 0.47 mm for the prostate and head&neck cases, respectively, the values obtained for PA and GPR _{2,2} are similar to those obtained for the comparison of the original doses with the expected doses. The impact on the dose is however noticeable for Σ=30 mm with RMS of 2.03 and 1.41 mm for the prostate and head&neck cases, respectively.
Contrastingly, when all the errors were forced to be in the same direction by replacing ε with ε on Eq. 3, the effect on the dose started to be noticeable for a RMS as small as 0.14 mm, as it is shown in Tables 4 and 5. Columns marked with an asterisk (^{∗}) correspond to the (unmodified) dynalog file as it was generated by the MLC controller during the treatment. Tables 4 and 5 also show that the PA is more sensitive than the GPR. GPR _{2,2} is insensitive to a RMS <0.24 mm for the head&neck case and to a RMS <0.28 mm for the prostate case. Values of GPR _{3,3} lower than 99% were obtained only for Σ=10.0 mm (not shown) for both clinical cases. It was observed that, in general, sensitivity of the GPR is dependable on the size of the region in which it is calculated. Notice e.g., that for Σ=10.0 mm, GPR _{2,2} drops to 0 for the small volume (13.5 cm^{3}) PTV _{1} of the prostate case; however, it is 98.4% for the body region with volume 28554 cm^{3}.
Table 6 shows the values of α/Δ and PA of PTV _{1} versus RMS obtained for the sensitivity tests that conserve or not the sign of the leaf position error ε. Both clinical cases are included, but not differentiated, in the table. The table shows that, as expected, systematic differences between the dose distributions are directly proportional to the RMS. It also shows that, with independence on the sign of the leaf position error, when roughly 50% or more voxels have systematic deviations larger than 1.2%, the value of PA is less than 99%. This suggests that PA ≤99% could be established as a threshold for treatment verification failure.
Discussion and conclusions
It was verified that the different time resolution of the original plan with respect to a reconstructed plan that includes all the records of the dynalog files does not have a significant impact in the dose distribution for the clinical cases analyzed in this work. That justifies to make the comparison of the dose obtained from the original lowresolution plan with the dose obtained from a plan reconstructed from (all) the actual positions in the dynalog files and still be valid to attribute dose deviations to errors in leaf positioning during treatment. The advantage of selecting this approach is a faster simulation of the lowresolution plan.
For the clinical cases used in this work it was found that relatively large deviations in the positions of the leaves, when they are not predominantly in one direction, do not produce a significant effect on the dose delivered to the patient. In these cases treatments with RMS <1.2 mm would pass the verification if made by the methods described here. When errors are predominantly in one direction as e.g., in the failure of a MLC carriage, they can be detected in the dose for RMS as low as 0.2 mm. These two findings put together indicate that the impact on the dose cannot just be inferred from the RMS. Instead, the PA evaluated in the PTVs and the percentage of voxels with a given systematic dose deviation are quite sensitive measures of that impact.
The methods described in this work are suitable to be included in a comprehensive patient QA program. In doing so, it must be considered that the PA, hereby introduced, showed to be more sensitive than GPR _{2,2}. Also that GPR _{3,3}, in general, and GPR _{2,2} evaluated for the patient body region, are not per se good evaluators of deviations introduced in the dose by errors captured in the dynalog files.
One advantage of the methods presented in this work for treatment verification is that they do not rely on the dose calculated by the TPS. The reference dose can be either the dose calculated from the plan data or from the expected leaves positions. A comparison with the TPS’s calculated dose would imply the necessity to separate the discrepancies produced by errors in treatment delivery from those derived from the different nature of the –Monte Carlo and TPS– dose calculation algorithms.
Abbreviations
 CT:

Computed tomography
 DPM:

Dose planning method
 DVH:

Dosevolume histogram
 GPR:

Gamma pass rate
 IMRT:

Intensitymodulated radiation therapy
 MLC:

Multileaf collimator
 OAR:

Organatrisk
 PA:

Percentage of agreement
 PSF:

Phasespace file
 PTV:

Planned target volume
 QA:

Quality assurance
 RMS:

Root mean square
 TPS:

Treatment planning system
 VMAT:

Volumetricmodulated arc therapy
References
 1
Saito M, Kadoya N, Sato K, Ito K, Dobashi S, Takeda K, Onishi H, Jingu K. Comparison of DVHbased plan verification methods for VMAT: ArcCHECK3DVH system and dynalogbased dose reconstruction. J Appl Clin Med Phys. 2017; 18(4):206–14.
 2
CalvoOrtega JF, Teke T, Moragues S, Pozo M, Casals J. A Varian DynaLog file based procedure for patient dose volume histogram based IMRT QA. J App Clin Med Phys. 2014; 15(March):5–7.
 3
Teke T, Bergman AM, Kwa W, Gill B, Duzenli C, Popescu IA. Monte Carlo based patientspecific RapidArc QA using Linac log files. Med Phys. 2010; 37(1):116.
 4
Rodriguez M, Sempau J, Brualla L. PRIMO : A graphical environment for the Monte Carlo simulation of Varian and Elekta linacs. Strahlenther Onkol. 2013; 189:881–6.
 5
Salvat F, FernándezVarea JM, Sempau J. Penelope 2011—A Code System for Monte Carlo Simulation of Electron and Photon Transport. Issy de Molineaux, France: OECD Nuclear Energy Agency; 2011.
 6
Sempau J, Wilderman SJ, Bielajew AF. DPM, a fast, accurate Monte Carlo code optimized for photon and electron radiotherapy treatment planning dose calculations. Phys Med Biol. 2000; 45:2263–91.
 7
Rodriguez M, Brualla L. Manyintegrated core (MIC) technology for accelerating Monte Carlo simulation of radiation transport: A study based on the code DPM. Comput Phys Commun. 2018; 225:28–35.
 8
Rodriguez M, Sempau J, Baümer C, Timmermann B, Brualla L. DPM as a radiation transport engine for PRIMO. Radiat Oncol. 2018; 13:256.
 9
Sechopoulos I, Rogers DWO, BazalovaCarter M, Bolch WE, Heath EC, McNittGray MF, Sempau J, Williamson JF. RECORDS: improved Reporting of montE CarlO RaDiation transport Studies: Report of the AAPM Research Committee Task Group 268. Med Phys. 2018; 45:5–1.
 10
Rodriguez M, Sempau J, Brualla L. A combined approach of variancereduction techniques for the efficient Monte Carlo simulation of linacs. Phys Med Biol. 2012; 57:3013–24.
 11
Brualla L, Sauerwein W. On the efficiency of azimuthal and rotational splitting for Monte Carlo simulation of clinical linear accelerators. Rad Phys Chem. 2010; 79:929–32.
 12
Low D, Harms W, Mutic S, Purdy J. A technique for the quantitative evaluation of dose distributions. Med Phys. 1998; 25:656–61.
 13
Kawrakow I, Fippel M. Investigation of variance reduction techniques for Monte Carlo photon dose calculation using XVMC. Phys Med Biol. 2000; 45:2163–84.
Acknowledgments
Not applicable.
Funding
The authors acknowledge support by the Open Access Publication Fund of the University of DuisburgEssen.
The authors acknowledge funding by the Deutsche Forschungsgemeinschaft (DFG) project BR 4043/31.
Availability of data and materials
PRIMO is freely available at https://www.primoproject.net. The module for dynalog analysis is not yet publicly available in the currently distributed version 0.3.1.1681.
Author information
Affiliations
Contributions
MR coded the PRIMO module for analysis of dynalog files. LB coded the employed linac geometries and adapted them for dynamic treatment. Both authors conceived the work, conducted the statistical study, wrote the manuscript and revised it. Both authors read and approved the final manuscript.
Corresponding author
Ethics declarations
Ethics approval and consent to participate
Not applicable.
Consent for publication
Not applicable.
Competing interests
M Rodriguez and L Brualla declare that they have authored the PRIMO system.
Publisher’s Note
Springer Nature remains neutral with regard to jurisdictional claims in published maps and institutional affiliations.
Rights and permissions
Open Access This article is distributed under the terms of the Creative Commons Attribution 4.0 International License (http://creativecommons.org/licenses/by/4.0/), which permits unrestricted use, distribution, and reproduction in any medium, provided you give appropriate credit to the original author(s) and the source, provide a link to the Creative Commons license, and indicate if changes were made. The Creative Commons Public Domain Dedication waiver (http://creativecommons.org/publicdomain/zero/1.0/) applies to the data made available in this article, unless otherwise stated.
About this article
Cite this article
Rodriguez, M., Brualla, L. Treatment verification using Varian’s dynalog files in the Monte Carlo system PRIMO. Radiat Oncol 14, 67 (2019). https://doi.org/10.1186/s1301401912691
Received:
Accepted:
Published:
Keywords
 Monte Carlo
 DVH
 Dynalog