Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
118 commits
Select commit Hold shift + click to select a range
7f207c0
Test
eric11210 Oct 27, 2016
88708ae
another test
eric11210 Oct 27, 2016
9b10669
another
eric11210 Oct 27, 2016
951d101
Added lots of old stuff, some new
eric11210 Oct 27, 2016
a3e4443
Modifying leaf spread
eric11210 Oct 28, 2016
78b0d07
VMAT DAO
eric11210 Nov 3, 2016
d6746b1
Leaf speed fix
eric11210 Dec 8, 2016
3ca258f
Merge remote-tracking branch 'refs/remotes/e0404/dev' into eric
eric11210 Dec 8, 2016
7085692
Merge remote-tracking branch 'refs/remotes/e0404/dev' into eric
eric11210 Dec 12, 2016
3fe0406
Update from dev
eric11210 Dec 12, 2016
db26593
Revert Test
eric11210 Dec 12, 2016
5d24f17
Revert "Update from dev"
eric11210 Dec 12, 2016
a278043
Changed MU Conversion
eric11210 Jan 4, 2017
50b79ff
Cleaning up DAO
eric11210 Jan 4, 2017
79f1fa9
Revert to old
eric11210 Jan 4, 2017
79e5632
Again
eric11210 Jan 4, 2017
bc71c7d
Revert "Again"
eric11210 Jan 4, 2017
a794fb1
Up to date
eric11210 Jan 4, 2017
9c13746
Cleanup
eric11210 Jan 5, 2017
2f443a7
VMAT Ready?
eric11210 Feb 27, 2017
b322dca
Had to
eric11210 Feb 27, 2017
79ee967
Had to
eric11210 Feb 27, 2017
ce545ed
VMAT - new time variable
eric11210 Apr 13, 2017
1406582
Tweaks
eric11210 Apr 13, 2017
56d3073
Split daoVec2ApertureInfo
eric11210 Jun 22, 2017
e50abad
Dynamic fluence optimization
eric11210 Aug 3, 2017
c896b4e
Jacobi Scaling
eric11210 Sep 14, 2017
de9682f
4D Dose Calc
eric11210 Feb 5, 2018
3148472
Revert "4D Dose Calc"
eric11210 Feb 5, 2018
40fa6e8
More
eric11210 Feb 5, 2018
4d4c687
Revert "Revert "4D Dose Calc""
eric11210 Feb 5, 2018
34efd97
Merge remote-tracking branch 'refs/remotes/e0404/dev' into eric
eric11210 Feb 5, 2018
9a32682
Update gitignore
eric11210 Feb 5, 2018
9b09676
Merge remote-tracking branch 'refs/remotes/origin/eric' into to_e404_dev
eric11210 Feb 5, 2018
600f407
Deletions
eric11210 Feb 6, 2018
791bf8b
Ready for DKFZ?
eric11210 Feb 6, 2018
63a947d
gitignore
eric11210 Feb 6, 2018
df3f0d3
Final commit before DKFZ
eric11210 Feb 6, 2018
99b2774
Clean up files
eric11210 Feb 8, 2018
2ba96a6
Changed apInfo2Vec
eric11210 Feb 8, 2018
8ba1b9f
Example Doc
eric11210 Feb 13, 2018
d5cbd30
+++no stable commit+++ frist draft / brainstorming
markbangert Feb 14, 2018
66704fb
Move delivery constraints
eric11210 Feb 14, 2018
186fc80
Merge pull request #244 from eric11210/to_e404_dev
markbangert Feb 14, 2018
4fec934
Refactor pln in seq, DAO
eric11210 Feb 14, 2018
aeecde9
Delete .asv
eric11210 Feb 14, 2018
bd38ccb
Changes to seq
eric11210 Feb 14, 2018
64a1248
Merge remote-tracking branch 'upstream/dev' into to_e404_dev
eric11210 Feb 15, 2018
8c62a0f
New sequencing functions
eric11210 Feb 15, 2018
37dd3e4
Preconditioning
eric11210 Feb 15, 2018
4dd2230
Update example file
eric11210 Feb 16, 2018
c9cf6c5
Refactor stf for VMAT
eric11210 Feb 19, 2018
7a56e12
Revert default dose and ipopt settings
eric11210 Feb 19, 2018
7c84c86
Merge branch 'to_e404_dev' of https://github.com/eric11210/matRad int…
markbangert Feb 19, 2018
043d6f0
Change VMATGantryAngles
eric11210 Feb 19, 2018
da32dda
revert changes of patient data
markbangert Feb 20, 2018
9b66c14
Reverse unnecessary changes
markbangert Feb 20, 2018
367cac7
Renaming init, opt
eric11210 Feb 20, 2018
d970b0f
Merge branch 'to_e404_dev' into dev_VMAT
eric11210 Feb 20, 2018
2fb70d5
stf post-processing for VMAT
eric11210 Feb 20, 2018
e92debd
Merge of callback functions
eric11210 Feb 20, 2018
d59106b
Bugfix in non-VMAT sequencer.
eric11210 Feb 20, 2018
1f4c3c6
rearrange calcCubes function, make non VMAT example in matrad.m work
markbangert Feb 20, 2018
9020298
include dij.scaleFactor in calcParticleDose
markbangert Feb 20, 2018
7d3682b
reverse changes in calcQualityIndicators
markbangert Feb 20, 2018
a6ce43e
get rid of params.json file
markbangert Feb 20, 2018
dd76774
get rid of funny *.m.rej file
markbangert Feb 20, 2018
d86a8de
revert changes? in colormapTemplate.txt
markbangert Feb 20, 2018
75cdf8c
revert changes in ipoptOptions and isoCenterCalc
markbangert Feb 20, 2018
e1ac502
reverse changes in jacobFuncWrapper
markbangert Feb 20, 2018
11c11a0
clear up gradFuncWrapper
markbangert Feb 20, 2018
1caa697
Delete _VMAT, _IMRT
eric11210 Feb 20, 2018
24a5fae
Merge branch 'dev_VMAT' of https://github.com/e0404/matRad into dev_VMAT
eric11210 Feb 20, 2018
c889719
clear up backProjection and gradFuncWrapper
markbangert Feb 20, 2018
d9cf871
Merge branch 'dev_VMAT' of https://github.com/e0404/matRad into dev_VMAT
markbangert Feb 20, 2018
1c66005
Dosimetric constraints in VMAT
eric11210 Feb 22, 2018
765293f
Merge branch 'dev_VMAT' of https://github.com/e0404/matRad into dev_VMAT
eric11210 Feb 22, 2018
023720b
Merge of daoVec2ApertureInfo
eric11210 Feb 22, 2018
fb309fe
Faster Jacobian calc
eric11210 Feb 23, 2018
444610d
Added helper function for memorySaver
eric11210 Feb 23, 2018
09f21ab
refactoring
becker89 Feb 26, 2018
fdd79bc
Added leaf touching function
eric11210 Feb 26, 2018
cec8cdb
Edits
eric11210 Feb 26, 2018
08615d9
refactoring second part
becker89 Feb 27, 2018
cd550a0
Merge branch 'dev_VMAT' of https://github.com/e0404/matRad into dev_V…
becker89 Feb 27, 2018
047dfdf
refactoring leaf sequencing
becker89 Feb 27, 2018
ccdf4fa
refactoring 3
becker89 Feb 27, 2018
493ff56
minor update
becker89 Feb 27, 2018
6b6d649
Merge pull request #248 from becker89/dev_VMAT_HP
markbangert Feb 28, 2018
2446bf8
Remove memory saver
eric11210 Feb 28, 2018
1206d1b
Fixing optBixel
eric11210 Feb 28, 2018
0cc79ab
Add continuous aperture code
eric11210 Oct 26, 2018
c50893b
Bug fixes for continuous aperture code
eric11210 Nov 1, 2018
035bcd5
Merge pull request #305 from eric11210/dev_VMAT
markbangert Nov 28, 2018
6db9ea2
Merge branch 'dev_VMAT' of https://github.com/e0404/matRad into dev_V…
wahln Sep 20, 2019
886ca00
fix mistake in VMAT detection in DAO
wahln Sep 27, 2019
aee9ffe
make sure no NaN's are in the gradient
wahln Sep 27, 2019
525cc14
Fix display at the end of VMAT example
wahln Sep 27, 2019
c46df5c
fix display of apertures - please check
wahln Sep 27, 2019
446d163
readd stf to fluence optimization call... should be removed from ther…
wahln Sep 27, 2019
2e9b977
Merge branch 'dev' of https://github.com/e0404/matRad into dev_VMAT_m…
wahln Dec 3, 2020
e3d3c1e
fix basedata
wahln Dec 4, 2020
3c1a3c0
Merge branch 'hotfixes/daoWithConstraints' of https://github.com/e040…
wahln May 3, 2021
9a59db3
Fix correct sequence of precondition factors and dose cube computation
wahln May 3, 2021
58e3067
Merge branch 'hotfixes/daoWithConstraints' of https://github.com/e040…
wahln May 3, 2021
a789828
fix some issues, mainly with the jacobian in VMAT
wahln May 6, 2021
bcb0a59
adding the scale factor to the DoseProjection
wahln May 8, 2021
2b79fb7
Making sure the right aperturevector conversion is used
wahln May 8, 2021
a879d71
fix the bixelWeight vector usage in DAO constraint jacobian
wahln May 9, 2021
165a017
correct gradient for jacobiScale in DAO
wahln May 10, 2021
98bafb6
fix issue with assigning isocenter for VMAT plans in dicom import
wahln Mar 16, 2022
ef7cbd8
fix error in example script
wahln Jan 24, 2023
e398da2
Merge branch 'dev' of https://github.com/e0404/matRad into dev_VMAT_m…
wahln Jan 24, 2023
463ca2a
turn off diagnostics for fmincon because of error in R2022b
wahln Jan 25, 2023
2b4490d
Merge branch 'dev' into dev_VMAT_merge
wahln Feb 14, 2025
21233f2
Fix for last update to new version
eric11210 Feb 21, 2025
e61674f
updates to use propSeq with numLevels as level property
wahln Feb 28, 2025
54c40ca
Merge branch 'dev' into dev_VMAT_merge
wahln Sep 8, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
125 changes: 125 additions & 0 deletions examples/matRad_example8_photonsVMAT.m
Original file line number Diff line number Diff line change
@@ -0,0 +1,125 @@
%% Example Photon Treatment Plan with VMAT direct aperture optimization
%
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
% Copyright 2017 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/LICENSES.txt. 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.
%
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

%%
% In this example we will show
% (i) how to load patient data into matRad
% (ii) how to input necessary parameters in the pln structure
% (iii) how to setup a photon dose calculation
% (iv) how to inversely optimize fluence directly from command window in MatLab.
% (v) how to apply a sequencing algorithm
% (vi) how to run a VMAT direct aperture optimization
% (vii) how to visually and quantitatively evaluate the result

%% Patient Data Import
% Let's begin with a clear Matlab environment and import the TG119 patient
% into your workspace
matRad_rc

load TG119.mat

%% Treatment Plan
% The next step is to define your treatment plan labeled as 'pln'. This
% structure requires input from the treatment planner and defines
% the most important cornerstones of your treatment plan.

% meta information for treatment plan
pln.numOfFractions = 30;
pln.radiationMode = 'photons'; % either photons / protons / helium / carbon / brachy
pln.machine = 'Generic'; % generic for RT / LDR or HDR for BT

pln.bioModel = 'none'; % none: for photons, protons, carbon, brachy % constRBE: constant RBE for photons and protons
% MCN: McNamara-variable RBE model for protons % WED: Wedenberg-variable RBE model for protons
% LEM: Local Effect Model for carbon ions % HEL: data-driven RBE parametrization for helium

pln.multScen = 'nomScen'; % scenario creation type 'nomScen' 'wcScen' 'impScen' 'rndScen'

% beam geometry settings
pln.propStf.bixelWidth = 5; % [mm] / also corresponds to lateral spot spacing for particles
pln.propStf.maxGantryAngleSpacing = 30; % [°] / max gantry angle spacing for dose calculation
pln.propStf.maxDAOGantryAngleSpacing = 60; % [°] / max gantry angle spacing for DAO
pln.propStf.maxFMOGantryAngleSpacing = 180; % [°] / max gantry angle spacing for FMO
pln.propStf.startingAngle = -180; % [°] / starting angle for VMAT
pln.propStf.finishingAngle = 180; % [°] / finishing angle for VMAT
pln.propStf.couchAngle = 0; % [°]
pln.propStf.isoCenter = matRad_getIsoCenter(cst,ct,0);
pln.propStf.generator = 'PhotonVMAT';
pln.propStf.continuousAperture = false;

% dose calculation settings
pln.propDoseCalc.doseGrid.resolution.x = 5; % [mm]
pln.propDoseCalc.doseGrid.resolution.y = 5; % [mm]
pln.propDoseCalc.doseGrid.resolution.z = 5; % [mm]

% sequencing settings
pln.propSeq.runSequencing = true; % true: run sequencing, false: don't / will be ignored for particles and also triggered by runDAO below
pln.propSeq.sequencer = 'siochi';
pln.propSeq.numLevels = 7;

% optimization settings
pln.propOpt.quantityOpt = 'physicalDose'; % Quantity to optimizer (could also be RBExDose, BED, effect)
pln.propOpt.optimizer = 'IPOPT'; % We can also utilize 'fmincon' from Matlab's optimization toolbox
pln.propOpt.runDAO = true; % 1/true: run DAO, 0/false: don't / will be ignored for particles
pln.propOpt.runVMAT = true;
pln.propOpt.preconditioner = true;

%pln.propOpt.VMAToptions.machineConstraintFile = [pln.radiationMode '_' pln.machine];

%% Generate Beam Geometry STF
stf = matRad_generateStf(ct,cst,pln);

%% Dose Calculation
% Lets generate dosimetric information by pre-computing dose influence
% matrices for unit beamlet intensities. Having dose influences available
% allows for subsequent inverse optimization.
dij = matRad_calcDoseInfluence(ct, cst, stf, pln);

%% Inverse Planning for IMRT
% The goal of the fluence optimization is to find a set of beamlet weights
% which yield the best possible dose distribution according to the
% predefined clinical objectives and constraints underlying the radiation
% treatment. In VMAT, FMO is done only at the angles in the
% FMOGantryAngles set. Once the optimization has finished, trigger once the GUI to
% visualize the optimized dose cubes.
resultGUI = matRad_fluenceOptimization(dij,cst,pln,stf);
matRadGUI;

%% Sequencing
% This is a multileaf collimator leaf sequencing algorithm that is used in
% order to modulate the intensity of the beams with multiple static
% segments, so that translates each intensity map into a set of deliverable
% aperture shapes. The fluence map at each angle in the initGantryAngles
% set is sequenced, with the resulting apertures spread to neighbouring
% angles from the optGantryAngles set.
resultGUI = matRad_sequencing(resultGUI,stf,dij,pln);

%% DAO - Direct Aperture Optimization
% The Direct Aperture Optimization is an optimization approach where we
% directly optimize aperture shapes and weights at the angles in the
% optGantryAngles set. The gantry angle speed, leaf speed, and MU rate are
% constrained by the min and max values specified by the user.
resultGUI = matRad_directApertureOptimization(dij,cst,resultGUI.apertureInfo,resultGUI,pln);

%% Aperture visualization
% Use a matrad function to visualize the resulting aperture shapes
matRad_visApertureInfo(resultGUI.apertureInfo);

%% Indicator Calculation and display of DVH and QI
resultGUI = matRad_planAnalysis(resultGUI,ct,cst,stf,pln);

%% Calculate delivery metrics

resultGUI = matRad_calcDeliveryMetrics(resultGUI,pln,stf);

7 changes: 4 additions & 3 deletions matRad/MatRad_Config.m
Original file line number Diff line number Diff line change
Expand Up @@ -249,6 +249,7 @@ function setDefaultProperties(obj)

%Sequencing Options
obj.defaults.propSeq.sequencer = 'siochi';
obj.defaults.propSeq.numLevels = 5;



Expand Down Expand Up @@ -324,12 +325,12 @@ function setDefaultGUIProperties(obj)
if ispc
light = logical(winqueryreg('HKEY_CURRENT_USER','Software\\Microsoft\\Windows\\CurrentVersion\\Themes\\Personalize','AppsUseLightTheme'));
elseif ismac
out = system('defaults read -g AppleInterfaceStyle');
if ~strcmp(out,'Dark')
[~,out] = system('defaults read -g AppleInterfaceStyle');
if ~strcmp(out(1:end-1),'Dark')
light = true;
end
else
out = system('gsettings get org.gnome.desktop.interface color-scheme');
[~,out] = system('gsettings get org.gnome.desktop.interface color-scheme');
if strcmp(out,'prefer-light')
light = true;
end
Expand Down
Binary file modified matRad/basedata/photons_Generic.mat
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,16 @@
% set necessary steering information
obj.stf(i).gantryAngle = UniqueComb(i,1);
obj.stf(i).couchAngle = UniqueComb(i,2);
obj.stf(i).isoCenter = obj.pln.propStf.isoCenter(i,:);

%Handle possibility of multiple isocenters
if size(obj.pln.propStf.isoCenter,1) == 1
obj.stf(i).isoCenter = obj.pln.propStf.isoCenter;
elseif size(pln.propStf.isoCenter,1) == obj.pln.propStf.numOfBeams
obj.stf(i).isoCenter = obj.pln.propStf.isoCenter(i,:);
else
matRad_cfg = MatRad_Config.instance();
matRad_cfg.dispError('Invalid number of isocenters - should either be one or as many as beams!');
end

% bixelWidth = 'field' as keyword for whole field dose calc
obj.stf(i).bixelWidth = 'field';
Expand Down
11 changes: 11 additions & 0 deletions matRad/doseCalc/+DoseEngines/matRad_PhotonPencilBeamSVDEngine.m
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,17 @@ function setDefaults(this)
matRad_cfg.dispWarning('Kernel Cut-Off ''%f mm'' cannot be smaller than geometric lateral cutoff ''%f mm''. Using ''%f mm''!',this.kernelCutOff,this.geometricLateralCutOff,this.geometricLateralCutOff);
this.kernelCutOff = this.geometricLateralCutOff;
end

% TODO: calculate and add weightToMU for the generic photon
% machine. Typical calibration: 100 cGy/100 MU in a 10x10 cm^2
% field, 100 cm SSD, depth of dose maximum for the given beam
% quality.
if isfield(this.machine.data,'weightToMU')
dij.weightToMU = this.machine.data.weightToMU;
else
dij.weightToMU = 100;
matRad_cfg.dispWarning('photon machine file does not contain weight to MU scaling factor. Assuming %.1f.',dij.weightToMU);
end

%% kernel convolution
% set up convolution grid
Expand Down
Loading
Loading