Automated four-dimensional Monte Carlo workflow using log files and real-time motion monitoring

With emerging techniques for tracking and gating methods in radiotherapy of lung cancer patients, there is an increasing need for efficient four-dimensional Monte Carlo (4DMC) based quality assurance (QA). An automated and flexible workflow for 4DMC QA, based on the 4DdefDOSXYZnrc user code, has been developed in python. The workflow has been tested and verified using an in-house developed dosimetry system comprised of a dynamic thorax phantom constructed for plastic scintillator dosimetry. The workflow is directly compatible with any treatment planning system and can also be triggered by the appearance of linac log files. It has minimum user interaction and, with the use of linac log files, it provides a method for verification of the actually delivered dose in the patient geometry.


Introduction
Motion management in external beam radiotherapy is becoming increasingly sophisticated and the demands on quality assurance (QA) of advanced radiotherapy are therefore also increasing. One interesting example is the need for QA of emerging techniques for tracking and gating methods in radiotherapy of lung cancer patients. Many commercial treatment planning systems (TPS) have recognized difficulties to accurately calculate dose for dynamic treatments due to challenges related to breathing motion and heterogeneities. This has for example been shown for deep-inspiration breathhold (DIBH) intensity-modulated radiotherapy (IMRT) of lung cancer patients, where Monte Carlo (MC) calculations revealed large inaccuracies in the dose calculated by the TPS [1]. Monte Carlo is considered to be the gold standard among dose calculation algorithms and the use of MC-based QA (MCQA) for verification of external beam radiotherapy is widely recommended, especially in the case of four-dimensional treatments [2]. However, implementation of MCQA often involves procedures including several steps of manual interaction or its integration into one specific TPS using a designated interface. An automated MCQA workflow with minimum user interaction is much more desirable. Preferably this MCQA workflow would enable four-dimensional Monte Carlo (4DMC) which models synchronously the dynamic beam configurations and the motion and deformation of the patient anatomy.
The purpose of this study was to incorporate a solution for 4DMC into an automated MCQA workflow with the possibility to use linear accelerator (linac) log files and motion monitoring signals for both pre-treatment and per-fraction dose verification.

Workflow for four-dimensional Monte Carlo
In order to incorporate the synchronization between the dynamic beam configuration and the motion of the patient anatomy, MC simulations were carried out using 4DdefDOSXYZnrc. The 4DdefDOSXYZnrc code is an altered version of the EGSnrc [3] user code defDOSXYZnrc, where dose deposition is tracked in a deformed anatomy without altering the voxel grid [4,5]. It makes use of the source 20 of DOSXYZnrc for simulation of continuously varying beam configurations [6]. The 4DdefDOSXYZnrc user code samples a new geometry for each incident particle, which enables simulation of a continuously moving anatomy. The geometries are sampled by linearly interpolating a deformation vector field, determined from image registration between the reference phase and an extreme phase of the 4DCT, using the motion signal measured during treatment. The use of linac log files, deformation vector fields, and motion monitoring signal as an input for the 4DMC simulations is incorporated within a workflow solution for automated MCQA. The workflow is built up of a number of different modules, all written in python, which are executed sequentially without user interaction ( Table 1). The automation of the workflow depends on each module, at the end of execution, leaving data for the next module to process. The workflow is connected to the TPS by means of exports and imports done in the TPS. This implicitly means that the workflow is portable between TPSs. The first module reads and processes TPS exported DICOM files and the last module writes the resulting dose distributions as DICOM files. In addition to the original TPS DICOM files, the 4D workflow requires access to the deformation vector field and the motion monitoring signal. This access can be configured differently depending upon the deformable image registration software and motion monitoring system in use. Furthermore, the workflow can be initiated by the appearance of linac log files, which are used to write the DICOM input files needed to trigger the start of the workflow. Builds a voxalized phantom based on the CT data and information form the RT Structure Set. The module is based on CTC-ask [7]. The distinct differences being that it is written in python, automated and includes patient support structures. Media selection rules are predefined by the user and can be differentiated for various structure types. Also handles the motion input and writes the vector field in the correct format for further use in the simulations.

III
Initiates treatment specific BEAMnrc simulation starting from a previously generated phase space scored above collimating devices.

IV
Concatenates phase spaces files (if parallel simulation). Computes number of histories required in order to achieve a fixed level of uncertainty. Initiates 4DdefDOSXYZnrc simulations. V Deletes auxiliary files (e.g. phase spaces) VI Converts to absolute dose. Writes DICOM RT objects using the exported files as templates.
One of the aims of the proposed workflow is that no simulation parameters should be hardcoded. Instead, the workflow uses initial phase space files together with templates, where only treatment specific parameters are overwritten. The workflow is controlled by extracting information from the provided DICOM RP files together with data from a global and a machine specific configuration file written in plain text. This makes the workflow flexible and independent of vendor, energy and fluence mode. Sending a treatment plan through this workflow results in a set of DICOM RT objects (plan and dose), which are written using the TPS exported files as templates. This enables direct import to any TPS with automatic connection to the correct study.

Example with an in-house developed moving thorax phantom
A time-resolved plastic scintillator detector (PSD) dosimetry system was combined with a dynamic thorax phantom (both in-house developed), containing a PMMA sphere (tumor, ø = 5 cm) embedded in a balsa wood insert (lung) and laterally position in a hollow cylinder [8]. During irradiations, the cylinder containing the tumor was set in a controlled respiratory-like sinusoidal motion with a frequency of 0.25 Hz and peak-to-peak amplitude of 20 mm (corresponding to a clinically relevant motion with 15 breaths per minute). PSD measurements were performed in the center of the tumor for two half-arc 6 MV RapidArc plans (plan 1 and 2 optimized to give mean tumor doses of 1 Gy and 2 Gy, respectively) on a Varian TrueBeam linac. Trajectory log files and phantom motion profiles were obtained during the measurements and thereafter used for generating 4D MC input files. Deformation vectors corresponding to the phantom cylinder motion during treatments were manually generated and applied to the voxel grid at a reference phase. Monte Carlo simulations in the deformed anatomy were carried out, according to the workflow described above, with a calculation time of less than 24 hours on a standard CPU based cluster for a statistical uncertainty below 0.2 %. 4D MC input files were based on both the treatment plan beam configurations as planned in the TPS as well as the actually delivered dynamic beam configuration as extracted from the linac log files. A comparison between planned and delivered dose was conducted. The time-resolved PSD measurements resulted in average accumulated doses (relative standard deviation of ~1 %; n = 6 per plan) deviating from corresponding TPS isocenter doses with -1.6 % and -2.8 % for plan 1 and 2, respectively (figure 1A). The hypothesis was that the deviations between measured and TPS calculated doses were true deviations as a result of the tumor motion and the difficulties for the TPS to accurately account for the lack of charged particle equilibrium (CPE). This