matRad IPOPT callback: jacobian structure 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 jacobStruct = matRad_getJacobStruct(optiProb,w,dij,cst) input optiProb: matRad optimization problem w: beamlet/ pencil beam weight vector dij: dose influence matrix cst: matRad cst struct output jacobStruct: jacobian of constraint function 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. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% Initializes constraints
0001 function jacobStruct = matRad_getJacobianStructure(optiProb,w,dij,cst) 0002 % matRad IPOPT callback: jacobian structure 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, max DVH 0005 % constraint, min DVH constraint 0006 % 0007 % call 0008 % jacobStruct = matRad_getJacobStruct(optiProb,w,dij,cst) 0009 % 0010 % input 0011 % optiProb: matRad optimization problem 0012 % w: beamlet/ pencil beam weight vector 0013 % dij: dose influence matrix 0014 % cst: matRad cst struct 0015 % 0016 % output 0017 % jacobStruct: jacobian of constraint function 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 % Initializes constraints 0035 jacobStruct = sparse([]); 0036 % compute objective function for every VOI. 0037 for i = 1:size(cst,1) 0038 % Only take OAR or target VOI. 0039 if ~isempty(cst{i,4}{1}) && ( isequal(cst{i,3},'OAR') || isequal(cst{i,3},'TARGET') ) 0040 % loop over the number of constraints for the current VOI 0041 for j = 1:numel(cst{i,6}) 0042 0043 obj = cst{i,6}{j}; 0044 0045 % only perform computations for constraints 0046 if isa(obj,'DoseConstraints.matRad_DoseConstraint') 0047 0048 % get the jacobian structure depending on dose 0049 jacobDoseStruct = obj.getDoseConstraintJacobianStructure(numel(cst{i,4}{1})); 0050 nRows = size(jacobDoseStruct,2); 0051 jacobStruct = [jacobStruct; repmat(spones(mean(dij.physicalDose{1}(cst{i,4}{1},:))),nRows,1)]; 0052 0053 end 0054 end 0055 end 0056 end