| 
24 | 24 | % (vii) how to visually and quantitatively evaluate the result  | 
25 | 25 | 
 
  | 
26 | 26 | %% 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  | 
29 | 29 | matRad_rc  | 
30 | 30 | 
 
  | 
31 |  | -load('HEAD_AND_NECK.mat');  | 
 | 31 | +load TG119.mat  | 
32 | 32 | 
 
  | 
33 | 33 | %% Treatment Plan  | 
34 | 34 | % The next step is to define your treatment plan labeled as 'pln'. This   | 
35 | 35 | % structure requires input from the treatment planner and defines   | 
36 | 36 | % the most important cornerstones of your treatment plan.  | 
37 | 37 | 
 
  | 
38 |  | -pln.radiationMode   = 'photons';   % either photons / protons / carbon  | 
39 |  | -pln.machine         = 'Generic';  | 
40 |  | - | 
 | 38 | +% meta information for treatment plan  | 
41 | 39 | 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  | 
42 | 42 | 
 
  | 
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  | 
45 | 46 | 
 
  | 
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'           | 
63 | 48 | 
 
  | 
 | 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  | 
64 | 62 | pln.propDoseCalc.doseGrid.resolution.x = 5; % [mm]  | 
65 | 63 | pln.propDoseCalc.doseGrid.resolution.y = 5; % [mm]  | 
66 | 64 | pln.propDoseCalc.doseGrid.resolution.z = 5; % [mm]  | 
67 | 65 | 
 
  | 
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;  | 
75 | 70 | 
 
  | 
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;  | 
79 | 77 | 
 
  | 
80 |  | -pln = matRad_VMATGantryAngles(pln,cst,ct);  | 
 | 78 | +%pln.propOpt.VMAToptions.machineConstraintFile = [pln.radiationMode '_' pln.machine];  | 
81 | 79 | 
 
  | 
82 | 80 | %% Generate Beam Geometry STF  | 
83 | 81 | stf = matRad_generateStf(ct,cst,pln);  | 
 | 
86 | 84 | % Lets generate dosimetric information by pre-computing dose influence   | 
87 | 85 | % matrices for unit beamlet intensities. Having dose influences available   | 
88 | 86 | % allows for subsequent inverse optimization.  | 
89 |  | -dij = matRad_calcPhotonDose(ct,stf,pln,cst);  | 
 | 87 | +dij = matRad_calcDoseInfluence(ct, cst, stf, pln);  | 
90 | 88 | 
 
  | 
91 | 89 | %% Inverse Planning for IMRT  | 
92 | 90 | % The goal of the fluence optimization is to find a set of beamlet weights   | 
93 | 91 | % which yield the best possible dose distribution according to the   | 
94 | 92 | % predefined clinical objectives and constraints underlying the radiation   | 
95 | 93 | % 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  | 
97 | 95 | % visualize the optimized dose cubes.  | 
98 | 96 | resultGUI = matRad_fluenceOptimization(dij,cst,pln,stf);  | 
99 | 97 | matRadGUI;  | 
 | 
105 | 103 | % aperture shapes. The fluence map at each angle in the initGantryAngles  | 
106 | 104 | % set is sequenced, with the resulting apertures spread to neighbouring  | 
107 | 105 | % angles from the optGantryAngles set.  | 
108 |  | -resultGUI = matRad_siochiLeafSequencing(resultGUI,stf,dij,pln,0);  | 
 | 106 | +resultGUI = matRad_sequencing(resultGUI,stf,dij,pln);  | 
109 | 107 | 
 
  | 
110 | 108 | %% DAO - Direct Aperture Optimization  | 
111 | 109 | % The Direct Aperture Optimization is an optimization approach where we   | 
 | 
119 | 117 | matRad_visApertureInfo(resultGUI.apertureInfo);  | 
120 | 118 | 
 
  | 
121 | 119 | %% 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);  | 
124 | 125 | 
 
  | 
0 commit comments