forked from eric11210/matRad
-
Notifications
You must be signed in to change notification settings - Fork 0
/
matRad.m
91 lines (77 loc) · 3.14 KB
/
matRad.m
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% matRad script
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
% Copyright 2015, Mark Bangert, on behalf of the matRad development team
%
%
% This file is part of matRad.
%
% matrad is free software: you can redistribute it and/or modify it under
% the terms of the GNU General Public License as published by the Free
% Software Foundation, either version 3 of the License, or (at your option)
% any later version.
%
% matRad is distributed in the hope that it will be useful, but WITHOUT ANY
% WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
% FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
% details.
%
% You should have received a copy of the GNU General Public License in the
% file license.txt along with matRad. If not, see
% <http://www.gnu.org/licenses/>.
%
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
clear
close all
clc
% load patient data, i.e. ct, voi, cst
%load HEAD_AND_NECK
%load TG119.mat
load PROSTATE.mat
%load LIVER.mat
%load BOXPHANTOM.mat
% meta information for treatment plan
pln.SAD = 1000; %[mm]
pln.isoCenter = matRad_getIsoCenter(cst,ct,0);
pln.bixelWidth = 5; % [mm] / also corresponds to lateral spot spacing for particles
pln.gantryAngles = [0:72:359]; % [°]
pln.couchAngles = [0 0 0 0 0]; % [°]
pln.numOfBeams = numel(pln.gantryAngles);
pln.numOfVoxels = numel(ct.cube);
pln.voxelDimensions = size(ct.cube);
pln.radiationMode = 'photons'; % either photons / protons / carbon
pln.bioOptimization = 'none'; % none: physical optimization; effect: effect-based optimization; RBExD: optimization of RBE-weighted dose
pln.numOfFractions = 1;
pln.runSequencing = true; % 1/true: run sequencing, 0/false: don't / will be ignored for particles and also triggered by runDAO below
pln.runDAO = true; % 1/true: run DAO, 0/false: don't / will be ignored for particles
%% initial visualization and change objective function settings if desired
matRadGUI
%% generate steering file
stf = matRad_generateStf(ct,cst,pln);
%% dose calculation
if strcmp(pln.radiationMode,'photons')
dij = matRad_calcPhotonDose(ct,stf,pln,cst);
elseif strcmp(pln.radiationMode,'protons') || strcmp(pln.radiationMode,'carbon')
dij = matRad_calcParticleDose(ct,stf,pln,cst);
end
%% inverse planning for imrt
resultGUI = matRad_fluenceOptimization(dij,cst,pln);
%% sequencing
if strcmp(pln.radiationMode,'photons') && (pln.runSequencing || pln.runDAO)
%resultGUI = matRad_xiaLeafSequencing(resultGUI,stf,dij,5);
resultGUI = matRad_engelLeafSequencing(resultGUI,stf,dij,5);
end
%% DAO
if strcmp(pln.radiationMode,'photons') && pln.runDAO
resultGUI = matRad_directApertureOptimization(dij,cst,resultGUI.apertureInfo,resultGUI);
matRad_visApertureInfo(resultGUI.apertureInfo);
end
%% start gui for visualization of result
matRadGUI
%% dvh
matRad_calcDVH(resultGUI,cst)
%% quality indicators
resultGUI = matRad_calcQualityIndicators(resultGUI,cst);