Skip to content

Commit 21233f2

Browse files
eric11210wahln
authored andcommitted
Fix for last update to new version
1 parent 2b4490d commit 21233f2

37 files changed

+228
-173
lines changed

examples/matRad_example8_photonsVMAT.m

Lines changed: 42 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -24,60 +24,58 @@
2424
% (vii) how to visually and quantitatively evaluate the result
2525

2626
%% Patient Data Import
27-
% Let's begin with a clear Matlab environment and import the head &
28-
% neck patient into your workspace.
27+
% Let's begin with a clear Matlab environment and import the TG119 patient
28+
% into your workspace
2929
matRad_rc
3030

31-
load('HEAD_AND_NECK.mat');
31+
load TG119.mat
3232

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

38-
pln.radiationMode = 'photons'; % either photons / protons / carbon
39-
pln.machine = 'Generic';
40-
38+
% meta information for treatment plan
4139
pln.numOfFractions = 30;
40+
pln.radiationMode = 'photons'; % either photons / protons / helium / carbon / brachy
41+
pln.machine = 'Generic'; % generic for RT / LDR or HDR for BT
4242

43-
% beam geometry settings
44-
pln.propStf.bixelWidth = 5;
43+
pln.bioModel = 'none'; % none: for photons, protons, carbon, brachy % constRBE: constant RBE for photons and protons
44+
% MCN: McNamara-variable RBE model for protons % WED: Wedenberg-variable RBE model for protons
45+
% LEM: Local Effect Model for carbon ions % HEL: data-driven RBE parametrization for helium
4546

46-
% optimization settings
47-
pln.propOpt.bioOptimization = 'none';
48-
pln.propOpt.runVMAT = true;
49-
pln.propOpt.runDAO = true;
50-
pln.propOpt.runSequencing = true;
51-
pln.propOpt.preconditioner = true;
52-
pln.propOpt.numLevels = 7;
53-
54-
pln.propOpt.VMAToptions.machineConstraintFile = [pln.radiationMode '_' pln.machine];
55-
56-
pln.propOpt.VMAToptions.maxGantryAngleSpacing = 2; % Max gantry angle spacing for dose calculation
57-
pln.propOpt.VMAToptions.maxDAOGantryAngleSpacing = 4; % Max gantry angle spacing for DAO
58-
pln.propOpt.VMAToptions.maxFMOGantryAngleSpacing = 28; % Max gantry angle spacing for FMO
59-
60-
pln.propOpt.VMAToptions.startingAngle = 0;
61-
pln.propOpt.VMAToptions.finishingAngle = 359;
62-
pln.propOpt.VMAToptions.continuousAperture = 0;
47+
pln.multScen = 'nomScen'; % scenario creation type 'nomScen' 'wcScen' 'impScen' 'rndScen'
6348

49+
% beam geometry settings
50+
pln.propStf.bixelWidth = 5; % [mm] / also corresponds to lateral spot spacing for particles
51+
pln.propStf.maxGantryAngleSpacing = 30; % [°] / max gantry angle spacing for dose calculation
52+
pln.propStf.maxDAOGantryAngleSpacing = 60; % [°] / max gantry angle spacing for DAO
53+
pln.propStf.maxFMOGantryAngleSpacing = 180; % [°] / max gantry angle spacing for FMO
54+
pln.propStf.startingAngle = -180; % [°] / starting angle for VMAT
55+
pln.propStf.finishingAngle = 180; % [°] / finishing angle for VMAT
56+
pln.propStf.couchAngle = 0; % [°]
57+
pln.propStf.isoCenter = matRad_getIsoCenter(cst,ct,0);
58+
pln.propStf.generator = 'PhotonVMAT';
59+
pln.propStf.continuousAperture = false;
60+
61+
% dose calculation settings
6462
pln.propDoseCalc.doseGrid.resolution.x = 5; % [mm]
6563
pln.propDoseCalc.doseGrid.resolution.y = 5; % [mm]
6664
pln.propDoseCalc.doseGrid.resolution.z = 5; % [mm]
6765

68-
%%
69-
% Generate dose calculation, DAO, and FMO angles from the parameters input
70-
% above. FMO is performed only on the initGantryAngles set. In the DAO
71-
% step, weights and leaf positions are optimized at the angles in the
72-
% optGantryAngles set. Weights and leaf positions are interpolated at the
73-
% angles in the gantryAngles set to increase the accuracy of the dose
74-
% calculation (each iteration).
66+
% sequencing settings
67+
pln.propSeq.runSequencing = true; % true: run sequencing, false: don't / will be ignored for particles and also triggered by runDAO below
68+
pln.propSeq.sequencer = 'siochi';
69+
pln.propSeq.numLevels = 7;
7570

76-
% FMO: optimize fluence on coarse subset of gantry angles
77-
% Sequencing: select subset of apertures and spread to finer angles
78-
% DAO: constrain for leaf speed, gantry rotation speed and MU rate
71+
% optimization settings
72+
pln.propOpt.quantityOpt = 'physicalDose'; % Quantity to optimizer (could also be RBExDose, BED, effect)
73+
pln.propOpt.optimizer = 'IPOPT'; % We can also utilize 'fmincon' from Matlab's optimization toolbox
74+
pln.propOpt.runDAO = true; % 1/true: run DAO, 0/false: don't / will be ignored for particles
75+
pln.propOpt.runVMAT = true;
76+
pln.propOpt.preconditioner = true;
7977

80-
pln = matRad_VMATGantryAngles(pln,cst,ct);
78+
%pln.propOpt.VMAToptions.machineConstraintFile = [pln.radiationMode '_' pln.machine];
8179

8280
%% Generate Beam Geometry STF
8381
stf = matRad_generateStf(ct,cst,pln);
@@ -86,14 +84,14 @@
8684
% Lets generate dosimetric information by pre-computing dose influence
8785
% matrices for unit beamlet intensities. Having dose influences available
8886
% allows for subsequent inverse optimization.
89-
dij = matRad_calcPhotonDose(ct,stf,pln,cst);
87+
dij = matRad_calcDoseInfluence(ct, cst, stf, pln);
9088

9189
%% Inverse Planning for IMRT
9290
% The goal of the fluence optimization is to find a set of beamlet weights
9391
% which yield the best possible dose distribution according to the
9492
% predefined clinical objectives and constraints underlying the radiation
9593
% treatment. In VMAT, FMO is done only at the angles in the
96-
% initGantryAngles set. Once the optimization has finished, trigger once the GUI to
94+
% FMOGantryAngles set. Once the optimization has finished, trigger once the GUI to
9795
% visualize the optimized dose cubes.
9896
resultGUI = matRad_fluenceOptimization(dij,cst,pln,stf);
9997
matRadGUI;
@@ -105,7 +103,7 @@
105103
% aperture shapes. The fluence map at each angle in the initGantryAngles
106104
% set is sequenced, with the resulting apertures spread to neighbouring
107105
% angles from the optGantryAngles set.
108-
resultGUI = matRad_siochiLeafSequencing(resultGUI,stf,dij,pln,0);
106+
resultGUI = matRad_sequencing(resultGUI,stf,dij,pln);
109107

110108
%% DAO - Direct Aperture Optimization
111109
% The Direct Aperture Optimization is an optimization approach where we
@@ -119,6 +117,9 @@
119117
matRad_visApertureInfo(resultGUI.apertureInfo);
120118

121119
%% Indicator Calculation and display of DVH and QI
122-
[dvh,qi] = matRad_indicatorWrapper(cst,pln,resultGUI);
123-
matRad_showDVH(dvh,cst,pln);
120+
resultGUI = matRad_planAnalysis(resultGUI,ct,cst,stf,pln);
121+
122+
%% Calculate delivery metrics
123+
124+
resultGUI = matRad_calcDeliveryMetrics(resultGUI,pln,stf);
124125

matRad/MatRad_Config.m

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -321,12 +321,12 @@ function setDefaultGUIProperties(obj)
321321
if ispc
322322
light = logical(winqueryreg('HKEY_CURRENT_USER','Software\\Microsoft\\Windows\\CurrentVersion\\Themes\\Personalize','AppsUseLightTheme'));
323323
elseif ismac
324-
out = system('defaults read -g AppleInterfaceStyle');
325-
if ~strcmp(out,'Dark')
324+
[~,out] = system('defaults read -g AppleInterfaceStyle');
325+
if ~strcmp(out(1:end-1),'Dark')
326326
light = true;
327327
end
328328
else
329-
out = system('gsettings get org.gnome.desktop.interface color-scheme');
329+
[~,out] = system('gsettings get org.gnome.desktop.interface color-scheme');
330330
if strcmp(out,'prefer-light')
331331
light = true;
332332
end

matRad/doseCalc/+DoseEngines/matRad_PhotonPencilBeamSVDEngine.m

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -159,6 +159,17 @@ function setDefaults(this)
159159
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);
160160
this.kernelCutOff = this.geometricLateralCutOff;
161161
end
162+
163+
% TODO: calculate and add weightToMU for the generic photon
164+
% machine. Typical calibration: 100 cGy/100 MU in a 10x10 cm^2
165+
% field, 100 cm SSD, depth of dose maximum for the given beam
166+
% quality.
167+
if isfield(this.machine.data,'weightToMU')
168+
dij.weightToMU = this.machine.data.weightToMU;
169+
else
170+
dij.weightToMU = 100;
171+
matRad_cfg.dispWarning('photon machine file does not contain weight to MU scaling factor. Assuming %.1f.',dij.weightToMU);
172+
end
162173

163174
%% kernel convolution
164175
% set up convolution grid
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

0 commit comments

Comments
 (0)