matRad_MeanDose

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_MeanDose < DoseObjectives.matRad_DoseObjective
0002 % matRad_MeanDose Implements a penalized MeanDose 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 = 'Mean Dose';
0023         parameterNames = {'d^{ref}'};
0024         parameterTypes = {'dose'};
0025         %parameterNames = {};
0026         %parameterIsDose = [];
0027     end
0028     
0029     properties
0030         parameters = {0};        
0031         penalty = 1;
0032     end
0033     
0034     methods 
0035         function obj = matRad_MeanDose(penalty,dMeanRef)
0036            
0037             % if we have a struct in first argument
0038             if nargin == 1 && isstruct(penalty)
0039                 inputStruct = penalty;
0040                 initFromStruct = true;
0041             else
0042                 initFromStruct = false;
0043                 inputStruct = [];
0044             end
0045             
0046             %Call Superclass Constructor (for struct initialization)
0047             obj@DoseObjectives.matRad_DoseObjective(inputStruct);
0048             
0049             if ~initFromStruct
0050                 if nargin == 2 && isscalar(dMeanRef)
0051                     obj.parameters{1} = dMeanRef;
0052                 end
0053 
0054                 if nargin >= 1 && isscalar(s)
0055                     obj.penalty = penalty;
0056                 end
0057             end
0058             
0059         end       
0060         
0061         %% Calculates the Objective Function value
0062         function fDose = computeDoseObjectiveFunction(obj,dose)
0063             %fDose = obj.penalty * abs(mean(dose(:)) - obj.parameters{1});
0064             fDose = obj.penalty * (mean(dose(:)) - obj.parameters{1})^2;
0065         end
0066         
0067         %% Calculates the Objective Function gradient
0068         function fDoseGrad   = computeDoseObjectiveGradient(obj,dose)
0069             %fDoseGrad = (obj.penalty/numel(dose))*sign(dose(:)-obj.parameters{1});
0070             fDoseGrad = obj.penalty*2*(mean(dose(:))-obj.parameters{1}) * ones(size(dose(:)))/numel(dose);
0071         end
0072     end
0073     
0074 end
0075

| Generated by m2html © 2005