matRad IPOPT objective function wrapper call f = matRad_objectiveFuncWrapper(optiProb,w,dij,cst) input optiProb: matRad optimization problem w: beamlet/ pencil beam weight vector dij: matRad dose influence struct cst: matRad cst struct output f: objective function value References - %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 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 f = matRad_objectiveFunction(optiProb,w,dij,cst) 0002 % matRad IPOPT objective function wrapper 0003 % 0004 % call 0005 % f = matRad_objectiveFuncWrapper(optiProb,w,dij,cst) 0006 % 0007 % input 0008 % optiProb: matRad optimization problem 0009 % w: beamlet/ pencil beam weight vector 0010 % dij: matRad dose influence struct 0011 % cst: matRad cst struct 0012 % 0013 % output 0014 % f: objective function value 0015 % 0016 % References 0017 % - 0018 % 0019 % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 0020 % 0021 % Copyright 2016 the matRad development team. 0022 % 0023 % This file is part of the matRad project. It is subject to the license 0024 % terms in the LICENSE file found in the top-level directory of this 0025 % distribution and at https://github.com/e0404/matRad/LICENSES.txt. No part 0026 % of the matRad project, including this file, may be copied, modified, 0027 % propagated, or distributed except according to the terms contained in the 0028 % LICENSE file. 0029 % 0030 % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 0031 0032 % get current dose / effect / RBExDose vector 0033 %d = optiProb.matRad_backProjection(w,dij); 0034 optiProb.BP = optiProb.BP.compute(dij,w); 0035 d = optiProb.BP.GetResult(); 0036 0037 0038 % Initialize f 0039 f = 0; 0040 0041 % compute objectiveective function for every VOI. 0042 for i = 1:size(cst,1) 0043 0044 % Only take OAR or target VOI. 0045 if ~isempty(cst{i,4}{1}) && ( isequal(cst{i,3},'OAR') || isequal(cst{i,3},'TARGET') ) 0046 0047 % loop over the number of constraints for the current VOI 0048 for j = 1:numel(cst{i,6}) 0049 0050 objective = cst{i,6}{j}; 0051 0052 % only perform gradient computations for objectiveectives 0053 %if isempty(strfind(objective.type,'constraint')) 0054 if isa(objective,'DoseObjectives.matRad_DoseObjective') 0055 0056 % if we have effect optimization, temporarily replace doses with effect 0057 if (~isequal(objective.name, 'Mean Dose') && ~isequal(objective.name, 'EUD')) &&... 0058 (isa(optiProb.BP,'matRad_EffectProjection') && ~isa(optiProb.BP,'matRad_VariableRBEProjection')) 0059 0060 doses = objective.getDoseParameters(); 0061 0062 effect = cst{i,5}.alphaX*doses + cst{i,5}.betaX*doses.^2; 0063 0064 objective = objective.setDoseParameters(effect); 0065 end 0066 0067 % if conventional opt: just sum objectiveectives of nominal dose 0068 %if strcmp(cst{i,6}{j}.robustness,'none') 0069 0070 d_i = d{1}(cst{i,4}{1}); 0071 0072 f = f + objective.computeDoseObjectiveFunction(d_i); 0073 0074 %end 0075 0076 end 0077 0078 end 0079 0080 end 0081 0082 end