matRad_SquaredUnderdosing

Purpose ^

Synopsis ^

This is a script file.

Description ^

Cross-reference information ^

This function calls: This function is called by:

Subfunctions ^

Source code ^

0001 classdef matRad_SquaredUnderdosing < DoseObjectives.matRad_DoseObjective
0002 % matRad_SquaredUnderdosing Implements a penalized squared underdosing objective
0003 %   See matRad_DoseObjective for interface description
0004 %
0005 % References
0006 %   -
0007 %
0008 % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
0009 %
0010 % Copyright 2020 the matRad development team.
0011 %
0012 % This file is part of the matRad project. It is subject to the license
0013 % terms in the LICENSE file found in the top-level directory of this
0014 % distribution and at https://github.com/e0404/matRad/LICENSES.txt. No part
0015 % of the matRad project, including this file, may be copied, modified,
0016 % propagated, or distributed except according to the terms contained in the
0017 % LICENSE file.
0018 %
0019 % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
0020 
0021     properties (Constant)
0022         name = 'Squared Underdosing';
0023         parameterNames = {'d^{min}'};
0024         parameterTypes = {'dose'};
0025     end
0026     
0027     properties
0028         parameters = {60};
0029         penalty = 1;
0030     end
0031     
0032     methods
0033         function obj = matRad_SquaredUnderdosing(penalty,dMin)
0034             %If we have a struct in first argument
0035             if nargin == 1 && isstruct(penalty)
0036                 inputStruct = penalty;
0037                 initFromStruct = true;
0038             else
0039                 initFromStruct = false;
0040                 inputStruct = [];
0041             end
0042             
0043             %Call Superclass Constructor (for struct initialization)
0044             obj@DoseObjectives.matRad_DoseObjective(inputStruct);
0045             
0046             %now handle initialization from other parameters
0047             if ~initFromStruct
0048                 if nargin == 2 && isscalar(dMin)
0049                     obj.parameters{1} = dMin;
0050                 end
0051                 
0052                 if nargin >= 1 && isscalar(penalty)
0053                     obj.penalty = penalty;
0054                 end
0055             end
0056         end
0057         
0058         %% Calculates the Objective Function value
0059         function fDose = computeDoseObjectiveFunction(obj,dose)
0060             % overdose : dose minus prefered dose
0061             underdose = dose - obj.parameters{1};
0062             
0063             % apply positive operator
0064             underdose(underdose>0) = 0;
0065             
0066             % claculate objective function
0067             fDose = obj.penalty/numel(dose) * (underdose'*underdose);
0068         end
0069         
0070         %% Calculates the Objective Function gradient
0071         function fDoseGrad   = computeDoseObjectiveGradient(obj,dose)
0072             % overdose : dose minus prefered dose
0073             underdose = dose - obj.parameters{1};
0074             
0075             % apply positive operator
0076             underdose(underdose>0) = 0;
0077             
0078             % calculate delta
0079             fDoseGrad = 2 * obj.penalty/numel(dose) * underdose;
0080         end
0081     end
0082     
0083 end

| Generated by m2html © 2005