Solutio in silico

Planner 2D Algorithm

The Planner 2D web application is designed to teach basic concepts about external beam radiation therapy (EBRT) treatment planning, by providing a simple, adjustable test case. To help further understand how EBRT treatment planning works, this article describes how the app takes user input and calculates the corresponding dose distribution. The first section describes the system geometry and input variables, with the second section describing the dose calculation itself in more detail.

I. System Geometry & User Input

The system geometry is defined using a two-dimensional coordinate system. The x-axis and y-axis are horizontal and vertical, respectively, with the origin (0, 0) located at the center of the image. All distance units are given as centimeters (cm). The beams rotate around the isocenter, located at the origin. In addition to the external/target/OAR design, the user also inputs the number of beams N_b along with their gantry angles and field sizes.

II. Dose Calculation

The Planner 2D web app calculates the dose from external beam radiation therapy using a corrections-based method, based on the AAPM TG-71 formalism. Using this formalism, the dose D from a beam can be calculated at any point defined by a depth d and an off-axis distance o using the following formula:

D(d, o) = MU \times k \times S_c(r_c) \times S_p(r_d) \times TPR(d, r_d) \times ISF \times OAR(d, o)

where:

d: distance from surface to calculation point, along beam's central axis
o: shortest distance from calculation point to beam's central axis
MU: Machine monitor units
k: Calibration dose rate, in cGy/MU
S_c(r_c): Collimator scatter factor
S_p(r_d): Patient scatter factor
TPR(d, r_d): Tissue phantom ratio
ISF: Inverse square factor
OAR(d, o): Off-axis ratio

Please refer to the AAPM TG-71 reports for further explanation of these terms. The monitor units for each field are set as constant in the web app, with a value of 100 MU. The dose calculation equation is implemented by the CBDose code, which automatically calculates the dose for a given external beam provided the MU, d, and o. Please refer to the source code for more information on CBDose calculation. Therefore the remaining task for the app is to provide values of d and o, and then the dose from a single beam at that point can be calculated.

2D Dose Calculation

For the 2D dose can be calculated, first a 2D dose grid needs to be defined. The dose grid for this app has dimensions of 200 \times 200 pixels (N_x = N_y = 200), with each pixel having dimensions calculated from the external radius r_{ext}: p_x = p_y = 2r_{ext} / 200. This dose grid is centered at the origin. For the m_{th} row and n_{th} column, the Cartesian coordinates x and y of a pixel's center can be calculated accordingly:

x_n = -N_x / 2 + p_x / 2 + np_x
y_m = -N_y / 2 + p_y / 2 + mp_y

Using a bit of vector geometry, the relationship between the dose pixel coordinates and d and o can be derived. Let \vec{S}(i) and \vec{D}(i) be the vectors defining the EBRT source position and beam axis direction, respectively, for the i^{th} beam. For a calculation point defined by the vector \vec{P}_{mn} = (x_n, y_m, 0), o can be calculated as:

o_{mn}(i) = \big| \vec{D}(i) \times [\vec{P}_{mn} - \vec{S}(i)] \big|

The depth d depends on the intersection of the beam's central axis with the external surface (in this case a circle). The point along the central axis \vec{I}_{mn}(i) that is at the same depth as the point \vec{P}_{mn} is defined as:

\vec{I}_{mn}(i) = \big| \vec{S}(i) + [\vec{D}(i) \cdot (\vec{P}_{mn} - \vec{S}(i))] \vec{D}(i) \big|

The direction vector from the source to \vec{I}_{mn}(i) is therefore:

\vec{V}_{mn}(i) = \vec{S}(i) - \vec{I}_{mn}(i)

Solving for the intersection of the external with \vec{V}_{mn}(i) yields the point \vec{E}_{mn}(i), and the distance between this and the projection point is the depth:

d_{mn}(i) = \big| \vec{E}_{mn}(i) - \vec{I}_{mn}(i) \big|

The values d_{mn}(i) and o_{mn}(i) can be used directly in the TG-71 dose calculation equation, and adding the dose rates at a point from all beamss results in the total dose:

D(d_{mn}, o_{mn}) = \sum^{N_b}_{i=1} D_i(d_{mn}(i), o_{mn}(i))

This process is repeated for each point to produce the 2D dose grid.