matRad_objectiveGradient

Purpose ^

matRad IPOPT callback: gradient function for inverse planning

Synopsis ^

function weightGradient = matRad_objectiveGradient(optiProb,w,dij,cst)

Description ^

 matRad IPOPT callback: gradient function for inverse planning 
 supporting mean dose objectives, EUD objectives, squared overdosage, 
 squared underdosage, squared deviation and DVH objectives
 
 call
   g = matRad_gradFuncWrapper(optiProb,w,dij,cst)

 input
   optiProb: option struct defining the type of optimization
   w:       bixel weight vector
   dij:     dose influence matrix
   cst:     matRad cst struct

 output
   g: gradient of objective function

 References
   [1] http://www.sciencedirect.com/science/article/pii/S0958394701000577
   [2] http://www.sciencedirect.com/science/article/pii/S0360301601025858

 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

Cross-reference information ^

This function calls: This function is called by:

Source code ^

0001 function weightGradient = matRad_objectiveGradient(optiProb,w,dij,cst)
0002 % matRad IPOPT callback: gradient function for inverse planning
0003 % supporting mean dose objectives, EUD objectives, squared overdosage,
0004 % squared underdosage, squared deviation and DVH objectives
0005 %
0006 % call
0007 %   g = matRad_gradFuncWrapper(optiProb,w,dij,cst)
0008 %
0009 % input
0010 %   optiProb: option struct defining the type of optimization
0011 %   w:       bixel weight vector
0012 %   dij:     dose influence matrix
0013 %   cst:     matRad cst struct
0014 %
0015 % output
0016 %   g: gradient of objective function
0017 %
0018 % References
0019 %   [1] http://www.sciencedirect.com/science/article/pii/S0958394701000577
0020 %   [2] http://www.sciencedirect.com/science/article/pii/S0360301601025858
0021 %
0022 % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
0023 
0024 % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
0025 %
0026 % Copyright 2016 the matRad development team.
0027 %
0028 % This file is part of the matRad project. It is subject to the license
0029 % terms in the LICENSE file found in the top-level directory of this
0030 % distribution and at https://github.com/e0404/matRad/LICENSES.txt. No part
0031 % of the matRad project, including this file, may be copied, modified,
0032 % propagated, or distributed except according to the terms contained in the
0033 % LICENSE file.
0034 %
0035 % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
0036 
0037 % get current dose / effect / RBExDose vector
0038 %d = matRad_backProjection(w,dij,optiProb);
0039 optiProb.BP = optiProb.BP.compute(dij,w);
0040 d = optiProb.BP.GetResult();
0041 
0042 % Initializes dose gradient
0043 doseGradient{1} = zeros(dij.doseGrid.numOfVoxels,1);
0044 
0045 % compute objective function for every VOI.
0046 for  i = 1:size(cst,1)    
0047    
0048     % Only take OAR or target VOI.
0049     if ~isempty(cst{i,4}{1}) && ( isequal(cst{i,3},'OAR') || isequal(cst{i,3},'TARGET') )
0050 
0051         % loop over the number of constraints and objectives for the current VOI
0052         for j = 1:numel(cst{i,6})
0053             
0054             %Get current optimization function
0055             objective = cst{i,6}{j};
0056             
0057             % only perform gradient computations for objectives
0058             if isa(objective,'DoseObjectives.matRad_DoseObjective')
0059                 % if we have effect optimization, temporarily replace doses with effect
0060                 if (~isequal(objective.name, 'Mean Dose') && ~isequal(objective.name, 'EUD')) &&...
0061                     (isa(optiProb.BP,'matRad_EffectProjection') && ~isa(optiProb.BP,'matRad_VariableRBEProjection')) 
0062                     
0063                     doses = objective.getDoseParameters();
0064                 
0065                     effect = cst{i,5}.alphaX*doses + cst{i,5}.betaX*doses.^2;
0066                     
0067                     objective = objective.setDoseParameters(effect);
0068                 end
0069                 
0070                 %dose in VOI
0071                 d_i = d{1}(cst{i,4}{1});
0072                 
0073                 %add to dose gradient
0074                 doseGradient{1}(cst{i,4}{1}) = doseGradient{1}(cst{i,4}{1}) + objective.computeDoseObjectiveGradient(d_i);                
0075             end       
0076         end           
0077     end    
0078 end
0079   
0080 %project to weight gradient
0081 optiProb.BP = optiProb.BP.computeGradient(dij,doseGradient,w);
0082 g = optiProb.BP.GetGradient();
0083 weightGradient = g{1};
0084 
0085 end

| Generated by m2html © 2005