Calculation of single field uniform dose (SFUD) optimization If provided the dij matrix is used for optimisation, otherwise single beam dijs are calculated (memory saving). call [resultGUI] = matRad_SFUDoptimization(pln, cst, dij) or [resultGUI] = matRad_SFUDoptimization(pln, cst, [], ct, stf) input pln: matRad pln struct cst: matRad cst struct dij: matRad dij struct (optional) ct: matRad ct struct (optional, only needed if no dij provided) stf: matRad stf struct (optional, only if needed no dij provided) output resultGUI: struct containing optimized fluence vector, dose, and (for biological optimization) RBE-weighted dose etc. (info: struct containing information about optimization) References [1] https://ro-journal.biomedcentral.com/articles/10.1186/s13014-016-0705-8 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 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_SFUDoptimization(pln, cst, dij, ct, stf) 0002 % Calculation of single field uniform dose (SFUD) optimization 0003 % If provided the dij matrix is used for optimisation, otherwise single 0004 % beam dijs are calculated (memory saving). 0005 % 0006 % call 0007 % [resultGUI] = matRad_SFUDoptimization(pln, cst, dij) 0008 % or 0009 % [resultGUI] = matRad_SFUDoptimization(pln, cst, [], ct, stf) 0010 % 0011 % 0012 % input 0013 % pln: matRad pln struct 0014 % cst: matRad cst struct 0015 % dij: matRad dij struct (optional) 0016 % 0017 % ct: matRad ct struct (optional, only needed if no dij provided) 0018 % stf: matRad stf struct (optional, only if needed no dij provided) 0019 % 0020 % output 0021 % resultGUI: struct containing optimized fluence vector, dose, and (for 0022 % biological optimization) RBE-weighted dose etc. 0023 % (info: struct containing information about optimization) 0024 % 0025 % References 0026 % [1] https://ro-journal.biomedcentral.com/articles/10.1186/s13014-016-0705-8 0027 % 0028 % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 0029 % 0030 % Copyright 2015 the matRad development team. 0031 % 0032 % This file is part of the matRad project. It is subject to the license 0033 % terms in the LICENSE file found in the top-level directory of this 0034 % distribution and at https://github.com/e0404/matRad/LICENSES.txt. No part 0035 % of the matRad project, including this file, may be copied, modified, 0036 % propagated, or distributed except according to the terms contained in the 0037 % LICENSE file. 0038 % 0039 % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 0040 0041 % adjust cst for single beams 0042 sb_cst = cst; 0043 for i=1:size(sb_cst,1) 0044 for j = 1:size(sb_cst{i,6},1) 0045 % biological dose splitting for carbon 0046 if strcmp(pln.bioOptimization, 'LEMIV_effect') || ... 0047 strcmp(pln.bioOptimization, 'LEMIV_RBExD') 0048 ab = sb_cst{i,5}.alphaX / sb_cst{i,5}.betaX; 0049 % dose per fraction 0050 fx_dose = sb_cst{i,6}(j).dose / pln.numOfFractions; 0051 % calculate dose per beam per fraction according to [1] 0052 fx_dose = -0.5*ab +sqrt( 0.25*ab^2 + ... 0053 fx_dose/pln.numOfBeams *(fx_dose + ab)); 0054 % calculate pseudo total Dose per Beam 0055 sb_cst{i,6}(j).dose = fx_dose * pln.numOfFractions; 0056 0057 % physical dose splitting 0058 else 0059 sb_cst{i,6}(j).dose = sb_cst{i,6}(j).dose/pln.numOfBeams; 0060 end 0061 end 0062 end 0063 0064 if ~isempty(dij) 0065 % calculate dij with total dij being present 0066 0067 % initialise total weight vector 0068 wTot = zeros(dij.totalNumOfBixels,1); 0069 0070 for i = 1:pln.numOfBeams 0071 % columns in total dij for single beam 0072 sb_col = find(dij.beamNum == i); 0073 % construct dij for single beam 0074 sb_dij.numOfBeams = 1; 0075 sb_dij.doseGrid = dij.doseGrid; 0076 sb_dij.ctGrid = dij.ctGrid; 0077 sb_dij.numOfRaysPerBeam = dij.numOfRaysPerBeam(i); 0078 sb_dij.totalNumOfRays = sb_dij.numOfRaysPerBeam; 0079 sb_dij.totalNumOfBixels = size(sb_col, 1); 0080 sb_dij.numOfScenarios = dij.numOfScenarios; 0081 sb_dij.bixelNum = dij.bixelNum(sb_col); 0082 sb_dij.rayNum = dij.rayNum(sb_col); 0083 sb_dij.beamNum = dij.beamNum(sb_col); 0084 sb_dij.physicalDose{1} = dij.physicalDose{1}(:, sb_col); 0085 if isfield(dij, 'RBE') 0086 sb_dij.RBE = dij.RBE; 0087 end 0088 if isfield(dij, 'mLETDose') 0089 sb_dij.mLETDose = dij.mLETDose(:, sb_col); 0090 end 0091 if isfield(dij,'mAlphaDose') && isfield(dij,'mSqrtBetaDose') 0092 sb_dij.mAlphaDose{1} = dij.mAlphaDose{1}(:, sb_col); 0093 sb_dij.mSqrtBetaDose{1} = dij.mSqrtBetaDose{1}(:, sb_col); 0094 end 0095 0096 % adjust pln to one beam only 0097 sb_pln = pln; 0098 sb_pln.gantryAngles = pln.gantryAngles(i); 0099 sb_pln.couchAngles = pln.couchAngles(i); 0100 sb_pln.numOfBeams = 1; 0101 sb_pln.isoCenter = pln.isoCenter(i,:); 0102 0103 % optimize single beam 0104 sb_resultGUI = matRad_fluenceOptimization(sb_dij,sb_cst,sb_pln); 0105 0106 % merge single beam weights into total weight vector 0107 wTot(sb_col) = sb_resultGUI.w; 0108 end 0109 0110 % calculate dose 0111 resultGUI = matRad_calcCubes(wTot,dij,cst,1); 0112 0113 else 0114 % calculate SFUD without total dij 0115 0116 % initialise total weight vector 0117 wTot = []; 0118 0119 for i = 1:pln.numOfBeams 0120 fprintf(['optimizing beam ' num2str(i) '...\n']); 0121 % single beam stf 0122 sb_stf = stf(i); 0123 0124 % adjust pln to one beam only 0125 sb_pln = pln; 0126 sb_pln.isoCenter = pln.isoCenter(i,:); 0127 sb_pln.numOfBeams = 1; 0128 sb_pln.gantryAngles = pln.gantryAngles(i); 0129 sb_pln.couchAngles = pln.couchAngles(i); 0130 0131 % calculate single beam dij 0132 sb_dij = matRad_calcParticleDose(ct,sb_stf,sb_pln,sb_cst,false); 0133 0134 % optimize single beam 0135 sb_resultGUI = matRad_fluenceOptimization(sb_dij,sb_cst,sb_pln); 0136 0137 % merge single beam weights into total weight vector 0138 wTot = cat(1,wTot,sb_resultGUI.w); 0139 0140 end 0141 0142 fprintf('Calculate total dose...\n'); 0143 % calculate dose 0144 resultGUI = matRad_calcDoseDirect(ct,stf,pln,cst,wTot); 0145 resultGUI.w = wTot; 0146 end 0147 0148 end %eof 0149