matRad_constraintFunctions

Purpose ^

matRad IPOPT callback: constraint function for inverse planning

Synopsis ^

function c = matRad_constraintFunctions(optiProb,w,dij,cst)

Description ^

 matRad IPOPT callback: constraint function for inverse planning 
 supporting max dose constraint, min dose constraint, min mean dose constraint, 
 max mean dose constraint, min EUD constraint, max EUD constraint, 
 max DVH constraint, min DVH constraint 
 
 call
   c = matRad_constraintFunctions(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
   c:          value of constraints

 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.

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

Cross-reference information ^

This function calls: This function is called by:

Source code ^

0001 function c = matRad_constraintFunctions(optiProb,w,dij,cst)
0002 % matRad IPOPT callback: constraint function for inverse planning
0003 % supporting max dose constraint, min dose constraint, min mean dose constraint,
0004 % max mean dose constraint, min EUD constraint, max EUD constraint,
0005 % max DVH constraint, min DVH constraint
0006 %
0007 % call
0008 %   c = matRad_constraintFunctions(optiProb,w,dij,cst)
0009 %
0010 % input
0011 %   optiProb:   option struct defining the type of optimization
0012 %   w:          bixel weight vector
0013 %   dij:        dose influence matrix
0014 %   cst:        matRad cst struct
0015 %
0016 % output
0017 %   c:          value of constraints
0018 %
0019 % References
0020 %   -
0021 %
0022 % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
0023 %
0024 % Copyright 2016 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 
0036 % get current dose / effect / RBExDose vector
0037 %d = matRad_backProjection(w,dij,optiProb);
0038 optiProb.BP = optiProb.BP.compute(dij,w);
0039 d = optiProb.BP.GetResult();
0040 
0041 % Initializes constraints
0042 c = [];
0043 
0044 % compute objective function for every VOI.
0045 for  i = 1:size(cst,1)
0046 
0047     % Only take OAR or target VOI.
0048     if ~isempty(cst{i,4}{1}) && ( isequal(cst{i,3},'OAR') || isequal(cst{i,3},'TARGET') )
0049 
0050         % loop over the number of constraints for the current VOI
0051         for j = 1:numel(cst{i,6})
0052             
0053             obj = cst{i,6}{j};
0054             
0055             % only perform computations for constraints
0056             % if ~isempty(strfind(obj.type,'constraint'))
0057             if isa(obj,'DoseConstraints.matRad_DoseConstraint')
0058                 
0059                 % if we have effect optimization, temporarily replace doses with effect
0060                 % Maybe we should put some switch into the classes for that
0061                 if (~isequal(obj.name, 'max dose constraint')      && ~isequal(obj.name, 'min dose constraint')      &&...
0062                     ~isequal(obj.name, 'max mean dose constraint') && ~isequal(obj.name, 'min mean dose constraint') && ...
0063                     ~isequal(obj.name, 'min EUD constraint')       && ~isequal(obj.name, 'max EUD constraint'))     && ...
0064                     (isa(optiProb.BP,'matRad_EffectProjection') && ~isa(optiProb.BP,'matRad_VariableRBEProjection'))
0065                     
0066                     doses = obj.getDoseParameters();
0067                     
0068                     effect = cst{i,5}.alphaX*doses + cst{i,5}.betaX*doses.^2;
0069                     
0070                     obj = obj.setDoseParameters(effect);
0071                 end
0072 
0073                 % if conventional opt: just add constraints of nominal dose
0074                 %if strcmp(cst{i,6}(j).robustness,'none')
0075 
0076                     d_i = d{1}(cst{i,4}{1});
0077 
0078                     %c = [c; matRad_constFunc(d_i,cst{i,6}(j),d_ref)];
0079                     c = [c; obj.computeDoseConstraintFunction(d_i)];
0080                     
0081                 %else
0082                     
0083                     %error('Invalid robustness setting.');
0084 
0085                 %end % if we are in the nominal sceario or rob opt
0086             
0087             end % if we are a constraint
0088 
0089         end % over all defined constraints & objectives
0090 
0091     end % if structure not empty and oar or target
0092 
0093 end % over all structures

| Generated by m2html © 2005