matRad dvh calculation call dvh = matRad_calcDVH(cst,doseCube) dvh = matRad_calcDVH(cst,doseCube,dvhType) dvh = matRad_calcDVH(cst,doseCube,doseGrid) dvh = matRad_calcDVH(cst,doseCube,dvhType,doseGrid) input cst: matRad cst struct doseCube: arbitrary doseCube (e.g. physicalDose) dvhType: (optional) string, 'cum' for cumulative, 'diff' for differential dvh doseGrid: (optional) use predefined evaluation points. Useful when comparing multiple realizations output dose volume histogram References van't Riet et. al., IJROBP, 1997 Feb 1;37(3):731-6. Kataria et. al., J Med Phys. 2012 Oct-Dec; 37(4): 207�213. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% Copyright 2016 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. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
0001 function dvh = matRad_calcDVH(cst,doseCube,dvhType,doseGrid) 0002 % matRad dvh calculation 0003 % 0004 % call 0005 % dvh = matRad_calcDVH(cst,doseCube) 0006 % dvh = matRad_calcDVH(cst,doseCube,dvhType) 0007 % dvh = matRad_calcDVH(cst,doseCube,doseGrid) 0008 % dvh = matRad_calcDVH(cst,doseCube,dvhType,doseGrid) 0009 % 0010 % input 0011 % cst: matRad cst struct 0012 % doseCube: arbitrary doseCube (e.g. physicalDose) 0013 % dvhType: (optional) string, 'cum' for cumulative, 'diff' for differential 0014 % dvh 0015 % doseGrid: (optional) use predefined evaluation points. Useful when 0016 % comparing multiple realizations 0017 % 0018 % output 0019 % dose volume histogram 0020 % 0021 % References 0022 % van't Riet et. al., IJROBP, 1997 Feb 1;37(3):731-6. 0023 % Kataria et. al., J Med Phys. 2012 Oct-Dec; 37(4): 207�213. 0024 % 0025 % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 0026 % 0027 % Copyright 2016 the matRad development team. 0028 % 0029 % This file is part of the matRad project. It is subject to the license 0030 % terms in the LICENSE file found in the top-level directory of this 0031 % distribution and at https://github.com/e0404/matRad/LICENSES.txt. No part 0032 % of the matRad project, including this file, may be copied, modified, 0033 % propagated, or distributed except according to the terms contained in the 0034 % LICENSE file. 0035 % 0036 % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 0037 0038 if ~exist('dvhType','var') || isempty(dvhType) 0039 dvhType = 'cum'; 0040 end 0041 0042 if ~exist('doseGrid', 'var') || isempty(doseGrid) 0043 maxDose = max(doseCube(:)); 0044 minDose = min(doseCube(:)); 0045 0046 % get dvhPoints for every structure and every scenario the same 0047 n = 1000; 0048 if strcmp(dvhType, 'cum') 0049 doseGrid = linspace(0,maxDose*1.05,n); 0050 elseif strcmp(dvhType, 'diff') 0051 doseGrid = linspace(0.95*minDose,maxDose*1.05,n); 0052 end 0053 end 0054 0055 numOfVois = size(cst,1); 0056 dvh = struct; 0057 for i = 1:numOfVois 0058 dvh(i).doseGrid = doseGrid; 0059 dvh(i).volumePoints = getDVHPoints(cst, i, doseCube, doseGrid, dvhType); 0060 dvh(i).name = cst{i,2}; 0061 end 0062 0063 end %eof 0064 0065 function dvh = getDVHPoints(cst, sIx, doseCube, dvhPoints, dvhType) 0066 n = numel(dvhPoints); 0067 dvh = NaN * ones(1,n); 0068 indices = cst{sIx,4}{1}; 0069 numOfVoxels = numel(indices); 0070 0071 doseInVoi = doseCube(indices); 0072 0073 switch dvhType 0074 case 'cum' % cummulative DVH 0075 for j = 1:n 0076 dvh(j) = sum(doseInVoi >= dvhPoints(j)); 0077 end 0078 0079 case 'diff' % differential DVH 0080 binning = (dvhPoints(2) - dvhPoints(1))/2; 0081 for j = 1:n % differential DVH 0082 dvh(j) = sum(dvhPoints(j) + binning > doseInVoi & doseInVoi > dvhPoints(j) - binning); 0083 end 0084 0085 end 0086 dvh = dvh ./ numOfVoxels * 100; 0087 end %eof getDVHPoints 0088