forked from e0404/matRad
-
Notifications
You must be signed in to change notification settings - Fork 0
/
matRad_showDVH.m
101 lines (86 loc) · 2.94 KB
/
matRad_showDVH.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
92
93
94
95
96
97
98
99
100
101
function matRad_showDVH(dvh,cst,pln,lineStyleIndicator)
% matRad dvh visualizaion
%
% call
% matRad_showDVH(dvh,cst,pln,lineStyleIndicator)
%
% input
% result: result struct from fluence optimization/sequencing
% cst: matRad cst struct
% pln: matRad pln struct,
% now optional, standard uses Dose [Gy]
% lineStyleIndicator: integer (1,2,3,4) to indicate the current linestyle
% (hint: use different lineStyles to overlay
% different dvhs)
%
% output
% graphical display of DVH
%
% References
% -
%
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
% Copyright 2015 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.
%
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
if ~exist('lineStyleIndicator','var') || isempty(lineStyleIndicator)
lineStyleIndicator = 1;
end
% create new figure and set default line style indicator if not explictly
% specified
hold on;
%reduce cst
visibleIx = cellfun(@(c) c.Visible == 1,cst(:,5));
cstNames = cst(visibleIx,2);
cstInfo = cst(visibleIx,5);
dvh = dvh(visibleIx);
numOfVois = numel(cstNames);
%% print the dvh
%try to get colors from cst
try
colorMx = cellfun(@(c) c.visibleColor,cstInfo,'UniformOutput',false);
colorMx = cell2mat(colorMx);
catch
colorMx = colorcube;
colorMx = colorMx(1:floor(64/numOfVois):64,:);
end
lineStyles = {'-',':','--','-.'};
maxDVHvol = 0;
maxDVHdose = 0;
for i = 1:numOfVois
% cut off at the first zero value where there is no more signal
% behind
ix = max([1 find(dvh(i).volumePoints>0,1,'last')]);
currDvh = [dvh(i).doseGrid(1:ix);dvh(i).volumePoints(1:ix)];
plot(currDvh(1,:),currDvh(2,:),'LineWidth',4,'Color',colorMx(i,:), ...
'LineStyle',lineStyles{lineStyleIndicator},'DisplayName',cstNames{i})
maxDVHvol = max(maxDVHvol,max(currDvh(2,:)));
maxDVHdose = max(maxDVHdose,max(currDvh(1,:)));
end
fontSizeValue = 14;
myLegend = legend('show','location','NorthEast');
set(myLegend,'FontSize',10,'Interpreter','none');
legend boxoff
ylim([0 1.1*maxDVHvol]);
xlim([0 1.2*maxDVHdose]);
grid on,grid minor
box(gca,'on');
set(gca,'LineWidth',1.5,'FontSize',fontSizeValue);
ylabel('Volume [%]','FontSize',fontSizeValue)
if exist('pln','var') && ~isempty(pln)
if strcmp(pln.propOpt.bioOptimization,'none')
xlabel('Dose [Gy]','FontSize',fontSizeValue);
else
xlabel('RBE x Dose [Gy(RBE)]','FontSize',fontSizeValue);
end
else
xlabel('Dose [Gy]','FontSize',fontSizeValue);
end