matRad dose calculation wrapper bypassing dij calculation call resultGUI = matRad_calcDoseDirect(ct,stf,pln,cst) resultGUI = matRad_calcDoseDirect(ct,stf,pln,cst,w) input ct: ct cube stf: matRad steering information struct pln: matRad plan meta information struct cst: matRad cst struct w: optional (if no weights available in stf): bixel weight vector output resultGUI: matRad result struct 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. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
0001 function resultGUI = matRad_calcDoseDirect(ct,stf,pln,cst,w) 0002 % matRad dose calculation wrapper bypassing dij calculation 0003 % 0004 % call 0005 % resultGUI = matRad_calcDoseDirect(ct,stf,pln,cst) 0006 % resultGUI = matRad_calcDoseDirect(ct,stf,pln,cst,w) 0007 % 0008 % input 0009 % ct: ct cube 0010 % stf: matRad steering information struct 0011 % pln: matRad plan meta information struct 0012 % cst: matRad cst struct 0013 % w: optional (if no weights available in stf): bixel weight 0014 % vector 0015 % 0016 % output 0017 % resultGUI: matRad result struct 0018 % 0019 % References 0020 % - 0021 % 0022 % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 0023 % 0024 % Copyright 2015 the matRad development team. 0025 % 0026 % This file is part of the matRad project. It is subject to the license 0027 % terms in the LICENSE file found in the top-level directory of this 0028 % distribution and at https://github.com/e0404/matRad/LICENSES.txt. No part 0029 % of the matRad project, including this file, may be copied, modified, 0030 % propagated, or distributed except according to the terms contained in the 0031 % LICENSE file. 0032 % 0033 % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 0034 0035 calcDoseDirect = true; 0036 0037 % check if weight vector is available, either in function call or in stf - otherwise dose calculation not possible 0038 if ~exist('w','var') && ~isfield([stf.ray],'weight') 0039 error('No weight vector available. Please provide w or add info to stf') 0040 end 0041 0042 % copy bixel weight vector into stf struct 0043 if exist('w','var') 0044 if sum([stf.totalNumOfBixels]) ~= numel(w) 0045 error('weighting does not match steering information') 0046 end 0047 counter = 0; 0048 for i = 1:size(stf,2) 0049 for j = 1:stf(i).numOfRays 0050 for k = 1:stf(i).numOfBixelsPerRay(j) 0051 counter = counter + 1; 0052 stf(i).ray(j).weight(k) = w(counter); 0053 end 0054 end 0055 end 0056 else % weights need to be in stf! 0057 w = NaN*ones(sum([stf.totalNumOfBixels]),1); 0058 counter = 0; 0059 for i = 1:size(stf,2) 0060 for j = 1:stf(i).numOfRays 0061 for k = 1:stf(i).numOfBixelsPerRay(j) 0062 counter = counter + 1; 0063 w(counter) = stf(i).ray(j).weight(k); 0064 end 0065 end 0066 end 0067 end 0068 0069 % dose calculation 0070 if strcmp(pln.radiationMode,'photons') 0071 dij = matRad_calcPhotonDose(ct,stf,pln,cst,calcDoseDirect); 0072 %dij = matRad_calcPhotonDoseVmc(ct,stf,pln,cst,5000,4,calcDoseDirect); 0073 elseif strcmp(pln.radiationMode,'protons') || strcmp(pln.radiationMode,'carbon') 0074 dij = matRad_calcParticleDose(ct,stf,pln,cst,calcDoseDirect); 0075 end 0076 0077 % calculate cubes; use uniform weights here, weighting with actual fluence 0078 % already performed in dij construction 0079 resultGUI = matRad_calcCubes(ones(pln.propStf.numOfBeams,1),dij); 0080 0081 % remember original fluence weights 0082 resultGUI.w = w; 0083 0084 0085 0086