matRad_example3_photonsDAO

Purpose ^

% Example: Photon Treatment Plan with Direct aperture optimization

Synopsis ^

This is a script file.

Description ^

% Example: Photon Treatment Plan with 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.

 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

Cross-reference information ^

This function calls: This function is called by:

Source code ^

0001 %% Example: Photon Treatment Plan with Direct aperture optimization
0002 %
0003 % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
0004 %
0005 % Copyright 2017 the matRad development team.
0006 %
0007 % This file is part of the matRad project. It is subject to the license
0008 % terms in the LICENSE file found in the top-level directory of this
0009 % distribution and at https://github.com/e0404/matRad/LICENSES.txt. No part
0010 % of the matRad project, including this file, may be copied, modified,
0011 % propagated, or distributed except according to the terms contained in the
0012 % LICENSE file.
0013 %
0014 % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
0015 
0016 %%
0017 % In this example we will show
0018 % (i) how to load patient data into matRad
0019 % (ii) how to setup a photon dose calculation and
0020 % (iii) how to inversely optimize directly from command window in MatLab.
0021 % (iv) how to apply a sequencing algorithm
0022 % (v) how to run a direct aperture optimization
0023 % (iv) how to visually and quantitatively evaluate the result
0024 
0025 %% Patient Data Import
0026 % Let's begin with a clear Matlab environment and import the head &
0027 % neck patient into your workspace.
0028 
0029 matRad_rc; %If this throws an error, run it from the parent directory first to set the paths
0030 
0031 load('HEAD_AND_NECK.mat');
0032 
0033 %% Treatment Plan
0034 % The next step is to define your treatment plan labeled as 'pln'. This
0035 % structure requires input from the treatment planner and defines
0036 % the most important cornerstones of your treatment plan.
0037 
0038 pln.radiationMode   = 'photons';   % either photons / protons / carbon
0039 pln.machine         = 'Generic';
0040 pln.numOfFractions  = 30;
0041 
0042 pln.propOpt.bioOptimization = 'none';    
0043 pln.propStf.gantryAngles    = [0:72:359];
0044 pln.propStf.couchAngles     = [0 0 0 0 0];
0045 pln.propStf.bixelWidth      = 5;
0046 pln.propStf.numOfBeams      = numel(pln.propStf.gantryAngles);
0047 pln.propStf.isoCenter       = ones(pln.propStf.numOfBeams,1) * matRad_getIsoCenter(cst,ct,0);
0048 
0049 % dose calculation settings
0050 pln.propDoseCalc.doseGrid.resolution.x = 3; % [mm]
0051 pln.propDoseCalc.doseGrid.resolution.y = 3; % [mm]
0052 pln.propDoseCalc.doseGrid.resolution.z = 3; % [mm]
0053 
0054 % We can also use other solver for optimization than IPOPT. matRad
0055 % currently supports fmincon from the MATLAB Optimization Toolbox. First we
0056 % check if the fmincon-Solver is available, and if it es, we set in in the
0057 % pln.propOpt.optimizer vairable. Otherwise wie set to the default
0058 % optimizer 'IPOPT'
0059 if matRad_OptimizerFmincon.IsAvailable()
0060     pln.propOpt.optimizer = 'fmincon';   
0061 else
0062     pln.propOpt.optimizer = 'IPOPT';
0063 end
0064 
0065 %%
0066 % Enable sequencing and direct aperture optimization (DAO).
0067 pln.propOpt.runSequencing = 1;
0068 pln.propOpt.runDAO        = 1;
0069 
0070 %% Generate Beam Geometry STF
0071 stf = matRad_generateStf(ct,cst,pln);
0072 
0073 %% Dose Calculation
0074 % Lets generate dosimetric information by pre-computing dose influence
0075 % matrices for unit beamlet intensities. Having dose influences available
0076 % allows for subsequent inverse optimization.
0077 dij = matRad_calcPhotonDose(ct,stf,pln,cst);
0078 
0079 %% Inverse Planning for IMRT
0080 % The goal of the fluence optimization is to find a set of beamlet weights
0081 % which yield the best possible dose distribution according to the
0082 % predefined clinical objectives and constraints underlying the radiation
0083 % treatment. Once the optimization has finished, trigger once the GUI to
0084 % visualize the optimized dose cubes.
0085 resultGUI = matRad_fluenceOptimization(dij,cst,pln);
0086 matRadGUI;
0087 
0088 %% Sequencing
0089 % This is a multileaf collimator leaf sequencing algorithm that is used in
0090 % order to modulate the intensity of the beams with multiple static
0091 % segments, so that translates each intensity map into a set of deliverable
0092 % aperture shapes.
0093 resultGUI = matRad_siochiLeafSequencing(resultGUI,stf,dij,5);
0094 
0095 %% DAO - Direct Aperture Optimization
0096 % The Direct Aperture Optimization is an optimization approach where we
0097 % directly optimize aperture shapes and weights.
0098 resultGUI = matRad_directApertureOptimization(dij,cst,resultGUI.apertureInfo,resultGUI,pln);
0099 
0100 %% Aperture visualization
0101 % Use a matrad function to visualize the resulting aperture shapes
0102 matRad_visApertureInfo(resultGUI.apertureInfo);
0103 
0104 %% Indicator Calculation and display of DVH and QI
0105 [dvh,qi] = matRad_indicatorWrapper(cst,pln,resultGUI);

| Generated by m2html © 2005