scenarios

Copntains the scenario models used in matRad.


matRad_multScen(ct, scenarioModel)

This function replaces the deprecated matRad_multScen class. It creates the respective matRad_ScenarioModel instance for the specific scenario model chosen with standard parameters.

call

pln.multScen = matRad_multScen(ct,scenarioModel);

e.g. pln.multScen = matRad_multScen(ct,’nomScen’);

Input:
  • ct – ct cube

  • scenarioModel – string to denote a scenario creation method ‘nomScen’ create only the nominal scenario ‘wcScen’ create worst case scenarios ‘impScen’ create important/grid scenarios ‘rndScen’ create random scenarios


Copyright 2022-2026 the matRad development team.

This file is part of the matRad project. It is subject to the license terms in the LICENSE file found in the top-level directory of this distribution and at https://github.com/e0404/matRad/LICENSE.md. No part of the matRad project, including this file, may be copied, modified, propagated, or distributed except according to the terms contained in the LICENSE file.


class matRad_ScenarioModel(ct)

Bases: handle

matRad_ScenarioModel

This is an abstract interface class to define Scenario Models for use in robust treatment planning and uncertainty analysis. Subclasses should at least implement the update() function to generate their own scenarios.

constructor (Abstract)

matRad_ScenarioModel() matRad_ScenarioModel(ct)

Input:

ct – ct cube


Copyright 2022-2026 the matRad development team.

This file is part of the matRad project. It is subject to the license terms in the LICENSE file found in the top-level directory of this distribution and at https://github.com/e0404/matRad/LICENSE.md. No part of the matRad project, including this file, may be copied, modified, propagated, or distributed except according to the terms contained in the LICENSE file.


Property Summary
rangeRelSD = 3.5

We use AbortSet = true here to avoid updates when Uncertainty model

rangeAbsSD = 1

given in [mm]

shiftSD = [2.252.252.25]

given in [mm]

wcSigma = 1

Multiplier to compute the worst case / maximum shifts

ctScenProb = [11]

Scenario Index. Right column: Scenario Probability

Type:

Ct Scenarios to be included in the model. Left column

name
shortName
wcFactor
numOfCtScen

total number of CT scenarios used

numOfAvailableCtScen

total number of CT scenarios existing in ct structure

ctScenIx

map of all ct scenario indices per scenario

isoShift

these parameters will be filled according to the choosen scenario type

relRangeShift
absRangeShift
maxAbsRangeShift
maxRelRangeShift
totNumShiftScen

total number of shift scenarios in x,y and z direction

totNumRangeScen

total number of range and absolute range scenarios

totNumScen

total number of samples

scenForProb

matrix for probability calculation - each row denotes one scenario, whereas columns denotes the realization value

scenProb

probability of each scenario stored in a vector (according to uncertainty model)

scenWeight

weight of scenario relative to the underlying uncertainty model (depends on how scenarios are chosen / sampled)

scenMask
linearMask
Method Summary
listAllScenarios(this)
updateScenarios(this)

This function will always update the scenarios given the current property settings

extractSingleScenario(this, scenNum)
sub2scenIx(this, ctScen, shiftScen, rangeShiftScen)

Returns linear index in the scenario cell array from scenario subscript indices

scenNum(this, fullScenIx)

gets number of scneario from full scenario index in scenMask

extractSingleNomScen(this, ~, scenIdx)
TYPE(this)
static getAvailableModels()
static create(modelMetadata, ct)
class matRad_RandomScenarios(ct)

Bases: matRad_ScenarioModel

matRad_RandomScenarios

Implements randomly sampled scenarios

constructor

matRad_RandomScenarios() matRad_RandomScenarios(ct)

Input:

ct – ct cube


Copyright 2022-2026 the matRad development team.

This file is part of the matRad project. It is subject to the license terms in the LICENSE file found in the top-level directory of this distribution and at https://github.com/e0404/matRad/LICENSE.md. No part of the matRad project, including this file, may be copied, modified, propagated, or distributed except according to the terms contained in the LICENSE file.


Property Summary
includeNominalScenario = false

Forces inclusion of the nominal scenario

nSamples = 10

Standard number of random samples

numOfShiftScen
numOfRangeShiftScen
name = 'Randomly sampled Scenarios'
shortName = 'rndScen'
Method Summary
updateScenarios(this)
class matRad_WorstCaseScenarios(ct)

Bases: matRad_GriddedScenariosAbstract

matRad_WorstCaseScenarios

Implements single worst-case shifts per dimension.%

constructor

matRad_WorstCaseScenarios() matRad_WorstCaseScenarios(ct)

Input:

ct – ct cube


Copyright 2022-2026 the matRad development team.

This file is part of the matRad project. It is subject to the license terms in the LICENSE file found in the top-level directory of this distribution and at https://github.com/e0404/matRad/LICENSE.md. No part of the matRad project, including this file, may be copied, modified, propagated, or distributed except according to the terms contained in the LICENSE file.


Property Summary
shortName = 'wcScen'
name = 'Worst Case Scenarios'
Method Summary
updateScenarios(this)

Use the static gridded shift function from ImportanceScenarios. We set inclusion of nominal scenarios to false and handle it automatically via the grid point number

matRad_calcScenProb(mu, sigma, samplePos, calcType, probDist)

matRad_calcScenProb provides different ways of calculating the probability of occurance of individual scenarios

call

scenProb = matRad_calcScenProb(mu,sigma,samplePos,calcType,probDist)

Input:
  • mu – mean of the distrubtion

  • sigma – standard deviation of the distribution

  • calcType – can be set to (i) probBins to calculate the accumulated occurance probability in a certain bin width (ii) pointwise to calculate the pointwise occurance probability

  • probDist – identifier for the underlying probability distribution (i) normDist

Output:

scenProb – occurance probability of the specified scenario


Copyright 2017-2026 the matRad development team.

This file is part of the matRad project. It is subject to the license terms in the LICENSE file found in the top-level directory of this distribution and at https://github.com/e0404/matRad/LICENSE.md. No part of the matRad project, including this file, may be copied, modified, propagated, or distributed except according to the terms contained in the LICENSE file.


class matRad_GriddedScenariosAbstract(ct)

Bases: matRad_ScenarioModel

UNTITLED Summary of this class goes here Detailed explanation goes here

Property Summary
combinations = 'none'

includeNominalScenario = true;

combineRange = true

Wether to treat absolute & relative range as one shift or as separate scenarios

numOfSetupGridPoints
numOfRangeGridPoints
validCombinationTypes = {'all','none','shift'}
Method Summary
updateScenarios(this)
static uniqueStableRowsCompat(values)

This is a compatability wrapper to call unique without sorting

class matRad_NominalScenario(ct)

Bases: matRad_ScenarioModel

matRad_RandomScenarios

Implements a single nominal planning scenario

constructor

matRad_NominalScenario() matRad_NominalScenario(ct)

Input:

ct – ct cube


Copyright 2022-2026 the matRad development team.

This file is part of the matRad project. It is subject to the license terms in the LICENSE file found in the top-level directory of this distribution and at https://github.com/e0404/matRad/LICENSE.md. No part of the matRad project, including this file, may be copied, modified, propagated, or distributed except according to the terms contained in the LICENSE file.


Property Summary
shortName = 'nomScen'
name = 'Nominal Scenario'
Method Summary
updateScenarios(this)
class matRad_ImportanceScenarios(ct)

Bases: matRad_GriddedScenariosAbstract

matRad_ImportanceScenarios

Implements gridded importance scenarios, i.e., weighted according to a probability distribution. It is not advised to create “combined” grids with a large number of grid-points as the curse of dimensionality will quickly break memory requirements when putting this in to dose influence matrix computation.

constructor

matRad_ImportanceScenarios() matRad_ImportanceScenarios(ct)

Input:

ct – ct cube


Copyright 2022-2026 the matRad development team.

This file is part of the matRad project. It is subject to the license terms in the LICENSE file found in the top-level directory of this distribution and at https://github.com/e0404/matRad/LICENSE.md. No part of the matRad project, including this file, may be copied, modified, propagated, or distributed except according to the terms contained in the LICENSE file.


Property Summary
numOfSetupGridPoints = 9
numOfRangeGridPoints = 9
shortName = 'impScen'
name = 'Gridded Scenarios with Importance Weights'