|
| 1 | +%% Example: VHEE Treatment Plan |
| 2 | +% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
| 3 | +% |
| 4 | +% Copyright 2017 the matRad development team. |
| 5 | +% |
| 6 | +% This file is part of the matRad project. It is subject to the license |
| 7 | +% terms in the LICENSE file found in the top-level directory of this |
| 8 | +% distribution and at https://github.com/e0404/matRad/LICENSE.md. No part |
| 9 | +% of the matRad project, including this file, may be copied, modified, |
| 10 | +% propagated, or distributed except according to the terms contained in the |
| 11 | +% LICENSE file. |
| 12 | +% |
| 13 | +% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
| 14 | +%% this example contributors |
| 15 | +% Authors : F. D'Andrea ; A. Bennan ; L. Ermeneux ; N. Wahl |
| 16 | +% |
| 17 | +% Based on implementation proposed by M. Sitarz et al. (doi:10.1002/mp.17392) |
| 18 | +% Generic machine using FermiEyges model based on work of M.G. Ronga et al. (doi:10.1002/mp.16697) |
| 19 | +% Applied matRad for a VHEE study as described by F. D'andrea et al. (doi:10.1016/j.phro.2025.100732) |
| 20 | +% Focused machine based on work of L. Whitmore et al. (doi:10.1038/s41598-021-93276-8) |
| 21 | +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
| 22 | + |
| 23 | +%% In this example we will show |
| 24 | +% (i) how to load patient data into matRad |
| 25 | +% (ii) how to setup a VHEE dose calculation |
| 26 | +% (iii) how to inversely optimize the pencil beam intensities directly from |
| 27 | +% command window in MATLAB. |
| 28 | + |
| 29 | +%% set matRad runtime configuration |
| 30 | +matRad_rc; %If this throws an error, run it from the parent directory first to set the paths |
| 31 | + |
| 32 | +%% Patient Data Import |
| 33 | +% Let's begin with a clear Matlab environment and import the prostate |
| 34 | +% patient into your workspace |
| 35 | +load('PROSTATE.mat'); |
| 36 | + |
| 37 | +%% Treatment Plan |
| 38 | +% Here, we would like to use VHEE for treatment planning. Next, we need to |
| 39 | +% define a treatment machine to correctly load the corresponding base data. |
| 40 | +% matRad features two base data for VHEE, a divergent beam |
| 41 | +% (VHEE_Generic.mat) based on a FermiEyges model that has to be called |
| 42 | +% through 'Generic' and a Focused beam (VHEE_Focused.mat), to be called by |
| 43 | +% 'Focused'. |
| 44 | +pln.radiationMode = 'VHEE'; % either photons / protons / helium / carbon / brachy / VHEE |
| 45 | +pln.machine = 'Generic'; % Generic / Focused VHEE - (Focused still in development) |
| 46 | +pln.bioModel = 'none'; % 'none' for VHEE |
| 47 | + |
| 48 | +%% plan parameters |
| 49 | +% Now we have to set the remaining plan parameters. |
| 50 | +% beam geometry settings |
| 51 | +pln.numOfFractions = 30; |
| 52 | +pln.propStf.energy = 200; % set VHEE beam energy in MeV [100,150 or 200 MeV] |
| 53 | +pln.propStf.bixelWidth = 5; % [mm] / also corresponds to lateral spot spacing for particles |
| 54 | +pln.propStf.gantryAngles = [35, 110, 180, 250, 325]; % [°] ; |
| 55 | +pln.propStf.couchAngles = [0 0 0 0 0]; % [°] ; |
| 56 | +pln.propStf.numOfBeams = numel(pln.propStf.gantryAngles); |
| 57 | +pln.propStf.isoCenter = ones(pln.propStf.numOfBeams,1) * matRad_getIsoCenter(cst,ct,0); |
| 58 | + |
| 59 | +% dose calculation settings |
| 60 | +pln.propDoseCalc.doseGrid.resolution.x = 3; % [mm] |
| 61 | +pln.propDoseCalc.doseGrid.resolution.y = 3; % [mm] |
| 62 | +pln.propDoseCalc.doseGrid.resolution.z = 3; % [mm] |
| 63 | +pln.propDoseCalc.engine = 'HongPB'; |
| 64 | + |
| 65 | +% optimization settings |
| 66 | +pln.propOpt.quantityOpt = 'physicalDose'; % Quantity to optimizer (could also be RBExDose, BED, effect) |
| 67 | +pln.propOpt.optimizer = 'IPOPT'; % We can also utilize 'fmincon' from Matlab's optimization toolbox |
| 68 | +pln.propOpt.runDAO = false; % 1/true: run DAO, 0/false: don't / will be ignored for particles |
| 69 | +pln.propSeq.runSequencing = false; % true: run sequencing, false: don't / will be ignored for particles and also triggered by runDAO below |
| 70 | + |
| 71 | +%% generate steering file |
| 72 | +stf = matRad_generateStf(ct,cst,pln); |
| 73 | + |
| 74 | +%% dose calculation |
| 75 | +dij = matRad_calcDoseInfluence(ct, cst, stf, pln); |
| 76 | + |
| 77 | +%% inverse planning for imrt |
| 78 | +resultGUI = matRad_fluenceOptimization(dij,cst,pln); % Future work - remove low weighted spots to aid MC |
| 79 | + |
| 80 | +%% use the GUI widgets directly to visualize the result |
| 81 | +viewer = matRad_ViewingWidget(); |
| 82 | +viewer.doseOpacity = 0.35; %lets change the doseOpacity |
| 83 | + |
| 84 | +dvhwidget = matRad_DVHStatsWidget(); |
| 85 | +dvhwidget.selectedDisplayOption = 'physicalDose'; |
| 86 | + |
| 87 | +%% Export parameter files for a TOPAS recalculation |
| 88 | +% set number of histories lower than default for this example (default: 1e8) |
| 89 | +pln.propDoseCalc.numHistoriesDirect = 5e6; |
| 90 | +pln.propDoseCalc.engine = 'TOPAS'; |
| 91 | +pln.propDoseCalc.externalCalculation = 'write'; |
| 92 | +resultGUI_MC = matRad_calcDoseForward(ct,cst,stf,pln,resultGUI.w); |
| 93 | + |
0 commit comments