util

General utility functions used throughout matRad.

matRad_appendResultGUI(resultGUI, resultGUItoAppend, boolOverwrite, Identifier)

function to merge two seperate resultGUI structs into one for visualisation

call

resultGUI = matRad_mergeResultGUIs(resultGUI,resultGUIrob)

Input:
  • resultGUI – matRads resultGUI struct

  • resultGUItoAppend – resultGUI struct which will be appendet

  • boolOverwrite – if true existing fields be overwritten in case they already exist

Output:

resultGUI – matRads resultGUI struct


Copyright 2018-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.


matRad_assignPropertiesFromStruct(obj, propertiesStruct, overwrite, fieldChangedWarningMessage)

matRad helper function to configure object from structure

call

obj = matRad_assignPropertiesFromStruct(obj,propertiesStruct,overwrite,fieldChangedWarningMessage) obj = matRad_assignPropertiesFromStruct(obj,propertiesStruct,overwrite) obj = matRad_assignPropertiesFromStruct(obj,propertiesStruct)

Input:
  • obj – Object to be configured

  • propertiesStruct – Structure containing properties to be assigned

  • overwrite – (optional) Boolean flag to overwrite existing properties (default: true)

  • fieldChangedWarningMessage – (optional) Custom warning message for changed fields

Output:
  • resultGUI – struct containing optimized fluence vector, dose, and (for biological optimization) RBE-weighted dose etc.

  • optimizer – Used Optimizer Object

References

Copyright 2016-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.


matRad_weightedQuantile(values, percentiles, weight, isSorted, extraPolMethod)

matRad uncertainty analysis report generaator function

call

matRad_weightedQuantile(values, percentiles, weight, isSorted, extraPol)

Input:
  • values – random variable vector

  • percentiles – percentiles to be calculated

  • weight – (optional) weight vector (same length as values)

  • isSorted – (optional) bool: are the values sorted alreay?


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.


matRad_compareDijStf(dij, stf)

matRad_compareDijStf compares the matRad dij struct with the matRad stf struct to check for consistency.

call

matching = matRad_compareDijStf(stf,dij)

Input:
  • dij – matRad dij struct

  • stf – matRad steering information struct

Output:
  • allMatch – flag is true if they all match

  • matching – message to display


Copyright 2019-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_SpotRemovalDij(dij, w)

Bases: handle

matRad_SpotRemovalDij class definition

References


Copyright 2019-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
removalMode = 'relative'

‘relative’ is the only mode for now

propSpotRemoval
dij
cst
pln
stf
weights
newSpots
newWeights
numOfRemovedSpots
Method Summary
reset()

Set all default properties for spot removal

setDefaultProperties()
reoptimize(cst, pln)
calcNewSpots()
getStf(stf)
getDij()
getWeights()
getLogical()
matRad_getAlphaBetaCurves(machine, varargin)

matRad alpha beta curve calculation tool

call

machine = matRad_getAlphaBetaCurves(machine) machine = matRad_getAlphaBetaCurves(machine,cst,modelName,overrideAB)

Example full call for protons:

machine = matRad_getAlphaBetaCurves(machine,pln,cst,’MCN’,’override’)

Input:
  • machine – matRad machine file to change

  • varargin (optional) – cst: matRad cst struct (for custom alpha/beta, otherwise default is alpha=0.1, beta=0.05) modelName: specify RBE modelName overrideAB: calculate new alpha beta even if available and override

Output:

machine – updated machine file with alpha/beta curves


Copyright 2021-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.


matRad_convertOldCstToNewCstObjectives(cst)

matRad function to convert cst format Converts a cst with struct array objectives / constraints to the new cst format using a cell array of objects.

call

newCst = matRad_convertOldCstToNewCstObjectives(cst)

Input:

cst a cst cell array that contains the old obectives as struct – array

output
newCst copy of the input cst with all old objectives struct arrays

replaced by cell arrays of Objective objects

References

matRad_calcCubes(w, dij, scenNum)

matRad computation of all cubes for the resultGUI struct which is used as result container and for visualization in matRad’s GUI

call

resultGUI = matRad_calcCubes(w,dij) resultGUI = matRad_calcCubes(w,dij,scenNum)

Input:
  • w – bixel weight vector

  • dij – dose influence matrix

  • scenNum – optional: number of scenario to calculated (default 1)

Output:

resultGUI – matRad result struct

References

Copyright 2024-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.


matRad_addMUdataFromMachine(machine, stf, dij)

helper function to add MU data included in machine file to dij and stf computed with earlier versions of matRad

call

[stf, dij] = matRad_addMUdataFromMachine(machine, stf, dij) stf = matRad_addMUdataFromMachine(machine, stf)

Input:
  • machine – machine struct as stored in basedata file

  • stf – matRad steering information struct

  • dij – matRad dose influence matrix struct

Output:
  • stf – matRad steering information struct with MUdata

  • dij – matRad dose influence matrix struct with MUdata

References


Copyright 2012-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.


matRad_plotSlice(ct, varargin)

matRad tool function to directly plot a complete slice of a ct with dose optionally including contours and isolines

call: [] = matRad_plotSlice(ct, dose, varargin)

input (required)

ct matRad ct struct

input (optional/empty) to be called as Name-value pair arguments:

dose dose cube axesHandle handle to axes the slice should be displayed in cst matRad cst struct cubeIdx Index of the desired cube in the ct struct plane plane view (coronal=1,sagittal=2,axial=3) slice slice in the selected plane of the 3D cube thresh threshold for display of dose values alpha alpha value for the dose overlay contourColorMap colormap for the VOI contours doseColorMap colormap for the dose doseWindow dose value window doseIsoLevels levels defining the isodose contours voiSelection logicals defining the current selection of contours that should be plotted. Can be set to [] to plot all non-ignored contours. colorBarLabel string defining the yLabel of the colorBar boolPlotLegend boolean if legend should be plottet or not showCt boolean if CT slice should be displayed or not varargin Additional MATLAB Line or Text Properties (e.g. ‘LineWidth’, ‘FontSize’, etc.)

References

Copyright 2025-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.


matRad_resampleCTtoGrid(ct, dij)

function to resample the ct grid for example for faster MC computation

call

[ctR] = matRad_resampleGrid(ct)

Input:
  • ct – Path to folder where TOPAS files are in (as string)

  • cst – matRad segmentation struct

Output:
  • ctR – resampled CT

  • cst – updated ct struct (due to calcDoseInit)


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.


matRad_plotParticleBaseDataEntry(machine, index, hFigure)

MATRAD_PLOTPARTICLEBASEDATAENTRY Summary of this function goes here Detailed explanation goes here

matRad_interp3(xi, yi, zi, x, xq, yq, zq, mode, extrapVal)

interpolates 3-D data (table lookup)

call

y = matRad_interp3(xi,yi,zi,x,xq,yq,zy) y = matRad_interp3(xi,yi,zi,x,xq,yq,zy,mode) y = matRad_interp3(xi,yi,zi,x,xq,yq,zy,mode,extrapVal)

Input:
  • xi,yi,zi – grid vectors

  • x – data

  • xq,yq,zq – coordinates of quer points as a grid

  • mode – optional interpolation mode (default linear)

  • extrapVal – (optional) value for extrapolation

Output:
  • y – interpolated data

  • References –


Copyright 2019-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.


matRad_fitBaseData(doseCube, resolution, energy, mcData, initSigma0, onAxis)

fit analytical data to pencil beam stored in doseCube, pencil beam in positive y direction, target per default in center of plane

call

fitData = matRad_fitBaseData(doseCube, resolution, energy, initSigma0)

Input:
  • doseCube – dose cube as an M x N x O array

  • resolution – resolution of the cubes [mm/voxel]

  • energy – energy of ray

  • initSigma0 – initial sigma of beam, measured at entrance into doseCube

  • onAxis – y and z coordinates of beam

output
fitData: struct containing fit, structured in the same way as data

in machine.data


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.


matRad_calcIntEnergy(dose, ct, pln)

matRad function to compute the integral energy in MeV for a dose cube

call

intDose = matRad_calcIntEnergy(dose,ct,pln)

Input:
  • dose – 3D matlab array with dose e.g. resultGUI.physicalDose

  • ct – matRad ct struct

  • pln – matRad pln struct

Output:

intDose – integral dose in MeV

References

Copyright 2019-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.


matRad_readCsvData(csvFile, cubeDim)

matRad read TOPAS csv data

call

dataOut = matRad_readCsvData(csvFile,cubeDim)

Input:
  • csvFile – TOPAS csv scoring file

  • cubeDim – size of cube

Output:

dataOut – cube of size cubeDim containing scored values

References

Copyright 2024-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.


matRad_visSpotWeights(stf, weights)

visualise spot weights per energy slice (or fluence map for photons resp.) for single beams

call

matRad_visSpotWeights(stf,weights)

Input:
  • stf – matRad stf struct

  • weights – spot weights for bixels (resultGUI.w)

matRad_visPhotonFieldShapes(pln)

matRad function to visualize imported field shapes from a dicom RTPLAN data. Note that this only works with pln structures that were generated with matRad’s dicom import tool and feature the appropriate field shape information

call

matRad_visPhotonFieldShapes(pln)

Input:

pln – matRad plan struct

Output:

-

References

Copyright 2020-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.


matRad_getEnvironment()

matRad function to get the software environment matRad is running on

call

[env, versionString] = matRad_getEnvironment()

Input:

-

Output:
  • env – outputs either ‘MATLAB’ or ‘OCTAVE’ as string

  • versionString – returns the version number as string

References

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.


matRad_recursiveFieldAssignment(assignTo, reference, overwrite, fieldChangedWarningMessage, fieldname)

matRad recursive field assignment tool This function recursively assigns fields from one structure to another. If both ‘assignTo’ and ‘reference’ are structures, it will recurse into their fields. If a field in ‘assignTo’ is a structure and its corresponding field in ‘reference’ is not, or vice versa, a warning message is displayed. The function also handles the case where ‘assignTo’ or ‘reference’ are not structures, directly assigning the values. Custom warning messages can be specified for overwriting fields.

call

assigned = matRad_recursiveFieldAssignment(assignTo,reference,fieldChangedWarningMessage,fieldname)

Input:
  • assignTo – The initial structure to which the fields are to be assigned.

  • reference – The structure containing the fields and values to be assigned to ‘assignTo’.

  • overwrite – Boolean flag that determines if the field value should be overwritten ( by defaults ) or preserved

  • fieldChangedWarningMessage – Optional. A message to display if a field is overwritten. If not provided, no message is displayed.

  • fieldname – Optional. The name of the current field being processed. Used for generating specific warning messages.

Output:

assigned – The structure ‘assignTo’ after assigning the fields from ‘reference’.


Copyright 2024-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.


matRad_visApertureInfo(apertureInfo, mode, varargin)

matRad function to visualize aperture shapes stored as struct

call

matRad_visApertureInfo(apertureInfo) matRad_visApertureInfo(apertureInfo,mode) matRad_visApertureInfo(apertureInfo,mode,Name,Value,…)

Input:
  • apertureInfo – aperture weight and shape info struct

  • mode – view to show, either a single name or a cell array of names, default ‘auto’:

    'auto'       - 'perBeam' for static (IMRT/DAO) plans,
                   'grid' + 'trajectory' + 'metrics' for VMAT
    'perBeam'    - one figure with one tab per beam, one
                   subplot per shape of that beam. Suited to
                   static delivery, where a beam carries many
                   segments
    'grid'       - one (paginated) figure, one subplot per
                   control point. Suited to VMAT, where every
                   control point carries a single aperture
    'animate'    - single-aperture player, started playing:
                   steps through all apertures in delivery
                   order, each shown for a time proportional
                   to its delivery time (VMAT) or weight. For
                   VMAT the leaves and the gantry angle are
                   interpolated between control points, so
                   the aperture moves the way it is
                   delivered. Playback holds the command
                   line until it reaches the end of the
                   plan, is paused, or the figure is closed
    'interactive'- the same player, started paused, so that
                   the control point / shape sliders can be
                   scrubbed by hand. Pausing an 'animate'
                   figure leaves exactly this behind
    'trajectory' - leaf position vs gantry angle (VMAT only)
    'metrics'    - MU rate, gantry rotation speed and leaf
                   speed vs gantry angle, against the machine
                   delivery constraints (VMAT only)
    
  • Name-value pairs:: –

    ‘leafCoordinate’ how to place the leaf pairs on the vertical axis of

    the aperture plots, ‘leafNum’ (default) to label them by leaf pair index, or ‘physical’ to draw them at their physical coordinates

Output:

-

References

Copyright 2015-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.


matRad_interp1(xi, yi, x, extrapolation)

interpolates 1-D data (table lookup) and utilizes griddedInterpolant if availabe in the used MATLAB version

call

y = matRad_interp1(xi,yi,x) y = matRad_interp1(xi,yi,x,extrapolation)

Input:
  • xi – sample points

  • yi – corresponding data to sample points

  • x – query points for interpolation

  • extrapolation – (optional) strategy for extrapolation. Similar to interp1. NaN is the default extrapolation value

Output:

y – interpolated data

Note that all input data has to be given as column vectors for a correct interpolation. yi can be a matrix consisting out of several 1-D datasets in each column, which will all be interpolated for the given query points.

Reference

Copyright 2020-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.


matRad_generateBodyContour(ct, cst, thresholdHU)

function to create a BODY contour for imported patient cases that do not have one

call

cst = matRad_generateBodyContour(ct,cst,thresholdHU)

Input:
  • ct – matrad ct structure

  • cst – matrad cst structure

  • thresholdHU – HU thresholding value (optional) default = -500 HU

Output:

cst – matRads cst struct with inserted BODY contour


Copyright 2024-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.


matRad_comparePlnStf(pln, stf)

matRad_comparePlnStf compares the matRad pln struct with the matRad stf struct for matching parameterization.

call

matching = matRad_comparePlnStf(pln,stf)

Input:
  • pln – matRad plan meta information struct

  • stf – matRad steering information struct

  • pln – matRad plan meta information struct

Output:
  • allMatch – flag is true if they all match

  • matching – message to display


Copyright 2019-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.


matRad_checkMexFileExists(filename, linkOctave)

Checks if a matching mex file exists, and can create a link if a matching custom, system specific precompiled octave mex file is found

call

matRad_checkMexFileExists(filename) matRad_checkMexFileExists(filename,linkOctave)

Input:
  • filename – name of the mex file (without extension)

  • linkOctave – (optional: default true) If set to true, the function will check for a custom build mex file for octave with our custom extension mexoct<version><system>. From Octave 10 on, <version> is the major version only (e.g. mexoct10w64) because mex files link against the stable liboctmex library and are compatible across major versions; the newest file at or below the running major version is used. Before Octave 10 the exact full version is used (e.g. mexoct920w64). If such a file exists, it will create a link to the file as filename.mex since octave does not use system- specific extensions by default. If false, the function will only check for an existing .mex file for octave.

Output:

fileExists – true if the mex file exists (or can be linked), and false otherwise

References

Copyright 2020-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.


matRad_upgradeApertureInfo(apertureInfo)
matRad_upgradeApertureInfo Migrates a legacy apertureInfo struct to the

current field naming, so that aperture info saved by an older matRad version (e.g. loaded from a .mat alongside a resultGUI) keeps working.

Renamed fields are moved to their current name and the legacy field is removed, so downstream code only ever sees the current names. A deprecation warning is issued once per renamed field. Structs that are already up to date are returned unchanged and silently.

call

apertureInfo = matRad_upgradeApertureInfo(apertureInfo)

Input:

apertureInfo – aperture weight and shape info struct, possibly using legacy field names

Output:

apertureInfo – the same struct using the current field names


Copyright 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.


matRad_checkEnvImageProcessingRequirements(env)

matRad function to check if image processing functionality is available, i.e., the Image Processing Toolbox (MATLAB) or the image package (Octave)

call

available = matRad_checkEnvImageProcessingRequirements() available = matRad_checkEnvImageProcessingRequirements(env)

Input:

env – (optional) environment string ‘MATLAB’ or ‘OCTAVE’

Output:

available – true if the image processing functionality is available

References

Copyright 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.


matRad_getFieldOrDefault(s, fieldName, defaultVal, warningMessage, deprecation)
matRad_getFieldOrDefault Reads s.(fieldName), falling back to a default

if the struct or the field doesn’t exist, optionally displaying a warning (or deprecation warning) when the fallback is used.

call

val = matRad_getFieldOrDefault(s, fieldName, defaultVal) val = matRad_getFieldOrDefault(s, fieldName, defaultVal, warningMessage) val = matRad_getFieldOrDefault(s, fieldName, defaultVal, warningMessage, deprecation)

Input:
  • s – struct to read the field from (may be missing/empty/non-struct)

  • fieldName – name of the field to read

  • defaultVal – value returned if the field is not present

  • warningMessage – optional. If given (non-empty), displayed via matRad_cfg.dispWarning (or dispDeprecationWarning, see below) whenever the field is missing and defaultVal is used instead

  • deprecation – optional. If true, warningMessage is displayed via matRad_cfg.dispDeprecationWarning instead of dispWarning. Default: false

Output:

val – s.(fieldName) if present, otherwise defaultVal


Copyright 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.


matRad_plotSliceWrapper(axesHandle, ct, cst, cubeIdx, dose, plane, slice, thresh, alpha, contourColorMap, doseColorMap, doseWindow, doseIsoLevels, voiSelection, colorBarLabel, boolPlotLegend, varargin)

matRad tool function to directly plot a complete slice of a ct with dose including contours and isolines.

call: [hCMap,hDose,hCt,hContour,hIsoDose] = matRad_plotSliceWrapper(axesHandle,ct,cst,cubeIdx,dose,plane,slice) [hCMap,hDose,hCt,hContour,hIsoDose] = matRad_plotSliceWrapper(axesHandle,ct,cst,cubeIdx,dose,plane,slice,thresh) [hCMap,hDose,hCt,hContour,hIsoDose] = matRad_plotSliceWrapper(axesHandle,ct,cst,cubeIdx,dose,plane,slice,alpha) [hCMap,hDose,hCt,hContour,hIsoDose] = matRad_plotSliceWrapper(axesHandle,ct,cst,cubeIdx,dose,plane,slice,contourColorMap) [hCMap,hDose,hCt,hContour,hIsoDose] = matRad_plotSliceWrapper(axesHandle,ct,cst,cubeIdx,dose,plane,slice,doseColorMap) [hCMap,hDose,hCt,hContour,hIsoDose] = matRad_plotSliceWrapper(axesHandle,ct,cst,cubeIdx,dose,plane,slice,doseWindow) [hCMap,hDose,hCt,hContour,hIsoDose] = matRad_plotSliceWrapper(axesHandle,ct,cst,cubeIdx,dose,plane,slice,doseIsoLevels) … [hCMap,hDose,hCt,hContour,hIsoDose] = matRad_plotSliceWrapper(axesHandle,ct,cst,cubeIdx,dose,plane,slice,thresh,alpha,contourColorMap,doseColorMap,doseWindow,doseIsoLevels,voiSelection,colorBarLabel,boolPlotLegend,…)

input (required)

axesHandle handle to axes the slice should be displayed in ct matRad ct struct cst matRad cst struct cubeIdx Index of the desired cube in the ct struct dose dose cube plane plane view (coronal=1,sagittal=2,axial=3) slice slice in the selected plane of the 3D cube

input (optional / empty)

thresh threshold for display of dose values alpha alpha value for the dose overlay contourColorMap colormap for the VOI contours doseColorMap colormap for the dose doseWindow dose value window doseIsoLevels levels defining the isodose contours voiSelection logicals defining the current selection of contours that should be plotted. Can be set to [] to plot all non-ignored contours. colorBarLabel string defining the yLabel of the colorBar boolPlotLegend boolean if legend should be plottet or not varargin additional input parameters that are passed on to individual plotting functions (e.g. ‘LineWidth’,1.5)

Output:
  • hCMap handle to the colormap

  • hDose handle to the dose plot

  • hCt handle to the ct plot

  • hContour handle to the contour plot

  • hIsoDose handle to iso dose contours

References

Copyright 2015-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.


matRad_generateSingleBixelStf(ct, cst, pln)

call

stf = matRad_generateSingleBixelStf(ct,cst,pln,visMode)

Input:
  • ct – ct cube

  • cst – matRad cst struct

  • pln – matRad plan meta information struct

  • visMode – toggle on/off different visualizations by setting this value to 1,2,3 (optional)

Output:

stf – matRad steering information struct

References

Copyright 2015-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.


matRad_progress(currentIndex, totalNumberOfEvaluations, linereset)

matRad progress bar

call

matRad_progress(currentIndex, totalNumberOfEvaluations)

Input:
  • currentIndex – current iteration index

  • totalNumberOfEvaluations – maximum iteration index

  • linereset – (optional) reset output to new line

Output:
  • graphical display of progess. make sure there is no other output

  • written during the loop to prevent confusion

References

Copyright 2015-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.


matRad_info()

matRad function to get information message

call

message = matRad_info()

input:

Output:

message – An Information message about matRad

References

Copyright 2020-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.


matRad_findSubclasses(superClass, varargin)
matRad_findSubclasses: Helper function to find subclasses

This method can find subclasses to a class within package folders and normal folders. It is not very fast, but Matlab & Octave compatible, so it is advised to cache classes once scanned.

call

classList = matRad_findSubclasses(superClass); classList = matRad_findSubclasses(superClass,’package’,{packageNames}) classList = matRad_findSubclasses(superClass,’folders’,{folderNames}) classList = matRad_findSubclasses(superClass,’includeAbstract’,true/false)


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.


matRad_identifyClassesByConstantProperties(metaClasses, primaryPropertyName, varargin)
matRad_identifyClassesByProperty: Helper function to identify classes by property

This method identifies classes based on a primary property and optional additional properties.

call

classList = matRad_identifyClassesByProperty(metaClasses, primaryPropertyName) classList = matRad_identifyClassesByProperty(metaClasses, primaryPropertyName, ‘defaults’, {defaultClasses}) classList = matRad_identifyClassesByProperty(metaClasses, primaryPropertyName, ‘additionalPropertyNames’, {additionalProperties})

Input:
  • metaClasses – A cell array of meta.class objects representing the classes to be identified.

  • primaryPropertyName – The name of the primary property used for identification.

optional Parameter Inputs:

defaults: A cell array of default classes that should be listed first. additionalPropertyNames: A cell array of additional property names used for identification.

outputs:
classList: A structure array containing the identified classes with fields:
  • primaryPropertyName: The values of the primary property for each class.

  • additionalPropertyNames: The values of the additional properties for each class.

  • className: The names of the identified classes.

  • handle: The constructor handles of the identified classes.


Copyright 2024-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.


Octave Compatibility

Compatibility functions ensuring matRad runs correctly in GNU Octave in addition to MATLAB.

matRad_roundCompat(x, n)

matRad function mimicking Matlab’s round(x,n) for compatibility with Octave, whose round takes the value to be rounded only and errors with “Invalid call to round” as soon as a digit count is passed

call

y = matRad_roundCompat(x) y = matRad_roundCompat(x,n)

Input:
  • x value (s)

  • n number of decimal digits to keep. Positive n rounds to the right of – the decimal point, negative n to the left, n = 0 rounds to integers. Omitting n is the same as passing 0

Output:

y x rounded to n decimal digits

Note that the Octave branch below scales, rounds and scales back, which is not bit-identical to Matlab’s round(x,n) - the latter is more accurate for values whose scaled magnitude approaches the limit of exact integer representation in a double (2^53). Several hot paths in matRad therefore keep their own local variant of the scaling idiom instead of calling this function, so that they compute the same thing under both environments (see matRad_calcBixelWeightAndGradient or matRad_daoVec2ApertureInfo).

References

Copyright 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.


matRad_getPropsCompat(obj)

matRad function mimicking Matlab’s properties for compatibility with Octave 6 in classdef files (avoids a parse error in the file)

call

p = matRad_getPropsCompat(obj)

Input:

obj object (classdef)

Output:

p properties of the object

References

Copyright 2024-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.


matRad_gatherCompat(x)
matRad wrapper around Matlab’s gather function for Octave compatibility.

In Matlab, gather transfers a gpuArray from device to host memory. Octave has no GPU array support, so this function returns the input unchanged.

call

x = matRad_gatherCompat(x)

Input:

x array (gpuArray on Matlab, regular array on Octave)

Output:

x array in host memory

References

Copyright 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.


matRad_ispropCompat(obj, prop)

matRad function mimicking Matlab’s properties for compatibility with Octave 6 in classdef files (avoids a parse error in the file)

call

result = matRad_ispropCompat(obj)

Input:
  • obj object (classdef)

  • prop property to check for

Output:

result true if property exists, false otherwise

References

Copyright 2024-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.


matRad_underlyingTypeCompat(x)
matRad function to obtain the type of a numeric datatype.

Matlab has the function underlyingType to robustly determine the type of numerical data, since class might return, for example, “gpuArray” in case of data stored on the GPU compared to “single”, or “double” for standard arrays. This wraps the function for Octave compatibility.

call

utype = matRad_underlyingTypeCompat(x)

Input:

x object to check for datatype

Output:

utype datatype

References

Copyright 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.