Skip to content
DosiPlot
EN
Download

Articles · AI and medicine

Machine learning for dose prediction

How machine learning is transforming dose prediction in radiotherapy: methods, models and clinical applications.

By Dr Yassine Oulhouq · · 9 min read

Introduction: dose calculation, a major computational problem

Calculating the dose distribution in the patient is a fundamental step in radiotherapy. Its accuracy directly determines the quality of the treatment: a dose error can lead either to undertreatment of the tumour or to excessive toxicity in healthy organs. Historically, dose calculation has relied on deterministic algorithms (Pencil Beam, Convolution/Superposition, AAA) or stochastic ones (Monte Carlo). Each of these approaches involves a trade-off between accuracy and calculation time.

Machine learning (ML) opens a third path: learning the relationship between the patient’s geometry, the beam parameters and the resulting dose distribution from training data. This approach promises near-instantaneous calculations with an accuracy approaching that of the reference methods.

Traditional dose calculation methods

Analytical algorithms

Analytical algorithms break the dose calculation problem down into primary and scattered components. The Pencil Beam (PB) algorithm models each elementary beam as a pre-calculated dose kernel in water, corrected for the electron density of the medium traversed.

D(x,y,z)=∫∫Φ(x′,y′)⋅K(x−x′,y−y′,zrad) dx′ dy′D(x, y, z) = \int \int \Phi(x', y') \cdot K(x - x', y - y', z_{rad}) \, dx' \, dy'

where Φ\Phi is the primary fluence, KK is the dose kernel calculated in water and zrad=∫0zρel(x,y,t) dtz_{rad} = \int_0^z \rho_{el}(x, y, t) \, dt is the radiological depth, that is, the depth weighted by the relative electron density ρel\rho_{el} of the medium traversed. The formula is simplified here. This approach is fast (a few seconds) but has limitations in heterogeneous media, particularly at tissue-air and tissue-bone interfaces.

The AAA (Anisotropic Analytical Algorithm) improves accuracy by using anisotropic dose kernels that take the direction of propagation into account, but it remains an approximation.

Convolution/superposition algorithm

The convolution/superposition (C/S) algorithm is more accurate because it explicitly calculates the transport of the energy deposited by secondary electrons:

D(r⃗)=∫T(r′⃗)⋅h(r⃗−r′⃗,ρ) d3r′⃗D(\vec{r}) = \int T(\vec{r'}) \cdot h(\vec{r} - \vec{r'}, \rho) \, d^3\vec{r'}

where TT is the TERMA (Total Energy Released per unit MAss), the total energy released per unit mass by the primary photons, and hh is the energy deposition kernel adapted to the local density. The calculation time is of the order of a few minutes.

Monte Carlo

Monte Carlo simulation, as we saw in a previous article, simulates the transport of each individual particle. It is considered the gold standard of dosimetric accuracy, but its calculation time (several hours for a complete plan with an uncertainty below 2%) limits its use in routine clinical practice.

Feature engineering for dose prediction

Representation of the input data

Dose prediction by ML requires a structured representation of the input data. The features typically used include:

Anatomical data:

  • CT image (electron densities or Hounsfield numbers) in 3D
  • Binary masks of the structures of interest (target volume, OARs)
  • Signed Distance Maps (SDM) to the boundary of each structure

Geometric data:

  • Distance to the radiation source
  • Gantry and collimator angles
  • MLC configuration (leaf opening)
  • Primary fluence map

Signed distance maps

Signed distance maps (SDM) have proved particularly useful as input features. For each voxel, the SDM gives the minimum distance to the surface of the structure concerned, with a positive sign inside and a negative sign outside:

SDM(r⃗)={+d(r⃗,∂S)if r⃗∈S−d(r⃗,∂S)if r⃗∉SSDM(\vec{r}) = \begin{cases} +d(\vec{r}, \partial S) & \text{if } \vec{r} \in S \\ -d(\vec{r}, \partial S) & \text{if } \vec{r} \notin S \end{cases}

where d(r⃗,∂S)d(\vec{r}, \partial S) is the minimum Euclidean distance to the contour ∂S\partial S of the structure SS. SDMs implicitly encode the spatial relationship between anatomical structures and the expected dose gradients, which makes learning easier.

Neural network architectures

3D CNN for voxel-by-voxel prediction

3D convolutional networks (3D-CNN) are the basic architecture for dose prediction. They process the 3D input volumes directly and produce a dose volume as output. The architecture typically consists of convolutional layers, batch normalisation and ReLU activation functions.

The main challenge is the size of medical volumes: a typical chest CT scan of 512 x 512 x 150 voxels does not fit in GPU memory in a full 3D network. Strategies to get around this limitation include splitting into patches, spatial subsampling and multi-resolution architectures.

3D U-Net

The 3D U-Net architecture is the most widely used for dose prediction. Its encoder-decoder structure with skip connections makes it possible to capture both the global contextual information (through the deep layers) and the fine spatial details (through the skip connections).

The encoder progressively reduces the spatial resolution while increasing the number of feature channels:

Encoder: (B,C,D,H,W)→conv + pool(B,2C,D/2,H/2,W/2)→⋯\text{Encoder: } (B, C, D, H, W) \xrightarrow{\text{conv + pool}} (B, 2C, D/2, H/2, W/2) \xrightarrow{} \cdots

The decoder performs the reverse operation, increasing the spatial resolution through deconvolution or upsampling operations. The skip connections concatenate the encoder features with the decoder features at each resolution level.

Architectures with attention

Attention mechanisms improve the performance of U-Nets by allowing the network to weight the relative importance of different spatial regions and different feature channels. Spatial attention guides the network towards anatomically relevant regions (tissue-tumour interfaces, areas of high dose gradient).

αi=exp⁡(si)∑jexp⁡(sj),x^i=αi⋅xi\alpha_i = \frac{\exp(s_i)}{\sum_j \exp(s_j)}, \quad \hat{x}_i = \alpha_i \cdot x_i

where sis_i is the attention score for voxel ii and αi\alpha_i is the attention weight normalised by softmax.

Generative adversarial networks (GAN)

GANs (Generative Adversarial Networks) have been applied to dose prediction to improve the realism of the predicted dose distributions. The generator produces the dose distribution from the anatomical inputs, while the discriminator learns to distinguish real distributions from predicted ones.

The GAN loss function combines the classical adversarial term with a reconstruction term:

LGAN=E[log⁡D(y)]+E[log⁡(1−D(G(x)))]+λ∥y−G(x)∥1\mathcal{L}_{GAN} = \mathbb{E}[\log D(y)] + \mathbb{E}[\log(1 - D(G(x)))] + \lambda \|y - G(x)\|_1

The advantage of the GAN is that it produces sharper dose distributions, with more realistic gradients, avoiding the smoothing effect typical of L1 or L2 loss functions alone.

Training data and preparation

Building the dataset

The quality of the prediction model depends directly on the quality and diversity of the training data. A typical dataset includes:

  • 100 to 500 patients for a specific anatomical site
  • For each patient: CT image, contours, beam parameters, reference dose distribution
  • The reference dose distribution can come from the clinical TPS, from a Monte Carlo calculation, or from a clinically accepted plan

Data augmentation

Data augmentation is critical in medical imaging. The transformations that can be applied include:

  • Rotations and reflections (respecting physical consistency)
  • Elastic deformations simulating inter-patient anatomical variations
  • Addition of Gaussian noise to the CT image
  • Variations in contrast and brightness

It is important to note that some augmentations must be applied simultaneously to the CT image, the contours and the dose distribution to maintain geometric consistency.

Validation methods

Evaluation metrics

Several metrics are used to evaluate the quality of dose predictions:

Voxel-by-voxel metrics:

MAE=1N∑i=1N∣Dpred,i−Dref,i∣MAE = \frac{1}{N} \sum_{i=1}^{N} |D_{pred,i} - D_{ref,i}|
RMSE=1N∑i=1N(Dpred,i−Dref,i)2RMSE = \sqrt{\frac{1}{N} \sum_{i=1}^{N} (D_{pred,i} - D_{ref,i})^2}

Clinical metrics:

  • Differences in DVH metrics (D95D_{95}, DmeanD_{mean}, DmaxD_{max} for the OARs)
  • 3D gamma analysis with 3%/3mm or 2%/2mm criteria
  • Conformality index and homogeneity index

Cross-validation and external testing

K-fold cross-validation (typically k = 5) is the norm for evaluating models with limited datasets. However, internal cross-validation is not enough to guarantee that the model generalises. External validation on data from a different centre, with different equipment and protocols, is strongly recommended.

Clinical applications

Adaptive planning

Fast dose prediction is particularly useful for adaptive radiotherapy, where the treatment plan must be re-evaluated at each session according to the anatomy of the day. An ML model can provide an estimate of the dose within a few seconds, making it possible to decide quickly whether replanning is necessary.

Planning optimisation

ML dose predictions can serve as dosimetric objectives for inverse optimisation. Rather than defining the dose constraints manually, the system uses the prediction as the target objective, which automates and standardises the planning process.

Pre-treatment verification

Prediction models can be used as an independent check of the TPS dose calculation. By comparing the ML prediction with the TPS calculation, potential planning errors can be detected.

Comparison with Monte Carlo

The following table summarises the characteristics of the different dose calculation approaches:

MethodAccuracyCalculation timeData required
Pencil Beam+/- 5-10% (heterogeneous)SecondsPhysical model
AAA / C/S+/- 2-3%MinutesPhysical model
Monte Carlo+/- 1-2%HoursCross sections
Deep Learning+/- 2-4%SecondsTraining data

The accuracy of deep learning is comparable to that of advanced analytical algorithms, with a calculation time close to that of Pencil Beam. However, the actual accuracy depends heavily on the quality and representativeness of the training data.

Challenges and outlook

Robustness and generalisability

The main challenge for dose prediction models remains their generalisability. A model trained on data from a specific accelerator (for example a Varian TrueBeam at 6 MV) may not be directly applicable to another machine (Elekta Versa HD) or to another energy. Transfer learning and federated learning are promising ways to improve generalisability.

Prediction uncertainty

Unlike Monte Carlo, which provides a statistical estimate of uncertainty, classical neural networks produce a deterministic prediction with no quantification of uncertainty. Bayesian approaches (MC Dropout, Deep Ensembles) make it possible to estimate the prediction uncertainty, which is essential for clinical application.

Integration into the clinical workflow

Integrating ML models into commercial treatment planning systems requires rigorous validation and regulatory certification. TPS manufacturers are starting to integrate AI components, but the road to a system based entirely on ML is still a long one.

FAQ

Can machine learning replace Monte Carlo calculation?

No, not with the current state of the technology. ML offers a fast approximation but does not reproduce the physical rigour of Monte Carlo. It is better suited to applications that need fast calculation (adaptive planning, verification), while Monte Carlo remains indispensable for reference dosimetry, for validating algorithms and for situations where absolute accuracy is critical.

How many patients are needed to train a dose prediction model?

The size of the dataset depends on the complexity of the task and the anatomical site. For a relatively standardised site such as the prostate, 100 to 200 patients may be enough. For more complex sites such as the head and neck, 300 to 500 patients are generally needed. Data augmentation and pre-training on similar sites can reduce these requirements.

How do you assess the reliability of a dose prediction model in the clinic?

The clinical evaluation should include a 3D gamma analysis with strict criteria (2%/2mm or 3%/3mm), a comparison of the clinically relevant DVH metrics, and validation on an external dataset from a different centre. It is also recommended to compare the model’s predictions with experimental measurements on a phantom and to have the results assessed by expert medical physicists.

Does DosiPlot use machine learning for its calculations?

DosiPlot does not use machine learning for its dose calculations. The data presented in DosiPlot are calculated by Monte Carlo simulation with the PRIMO code. However, understanding the ML concepts applied to dosimetry is essential for future medical physicists, and DosiPlot helps to develop the dosimetric intuition needed to assess the results of any calculation algorithm.