matRad_BackProjection

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_BackProjection
0002 % matRad_BackProjection superclass for all backprojection algorithms
0003 % used within matRad optimzation processes
0004 %
0005 % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
0006 %
0007 % Copyright 2019 the matRad development team.
0008 %
0009 % This file is part of the matRad project. It is subject to the license
0010 % terms in the LICENSE file found in the top-level directory of this
0011 % distribution and at https://github.com/e0404/matRad/LICENSES.txt. No part
0012 % of the matRad project, including this file, may be copied, modified,
0013 % propagated, or distributed except according to the terms contained in the
0014 % LICENSE file.
0015 %
0016 % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
0017    
0018     properties (Access = protected)
0019         wCache
0020         wGradCache  %different cache for optimal performance (if multiple evaluations of objective but not gradient are required)
0021         d
0022         wGrad
0023     end
0024     
0025     properties 
0026         dij          %reference to matRad dij struct (to enable local changes)
0027     end
0028 
0029     
0030     methods
0031         function obj = matRad_BackProjection()
0032             obj.wCache = [];
0033             obj.wGradCache = [];
0034             obj.d = []; 
0035             obj.wGrad = [];
0036         end
0037         
0038         function obj = compute(obj,dij,w)
0039             if ~isequal(obj.wCache,w)
0040                 obj.d = obj.computeResult(dij,w);
0041                 obj.wCache = w;
0042             end
0043         end
0044         
0045         function obj = computeGradient(obj,dij,doseGrad,w)
0046             if ~isequal(obj.wGradCache,w)
0047                 obj.wGrad = obj.projectGradient(dij,doseGrad,w);
0048                 obj.wGradCache = w;
0049             end
0050         end
0051         
0052         function d = GetResult(obj)
0053             d = obj.d;
0054         end
0055         
0056         function wGrad = GetGradient(obj)
0057             wGrad = obj.wGrad;
0058         end
0059         
0060         function d = computeResult(obj,dij,w)
0061             d = cell(size(dij.physicalDose));
0062             d = arrayfun(@(scen) computeSingleScenario(obj,dij,scen,w),ones(size(dij.physicalDose)),'UniformOutput',false);
0063         end
0064         
0065         function wGrad = projectGradient(obj,dij,doseGrad,w)
0066             wGrad = cell(size(dij.physicalDose));
0067             wGrad = arrayfun(@(scen) projectSingleScenarioGradient(obj,dij,doseGrad,scen,w),ones(size(dij.physicalDose)),'UniformOutput',false);
0068         end
0069     end
0070     
0071     %These should be abstract methods, however Octave can't parse them. As soon
0072     %as Octave is able to do this, they should be made abstract again
0073     methods %(Abstract)
0074         function d = computeSingleScenario(obj,dij,scen,w)
0075             error('Function needs to be implemented');
0076         end
0077         
0078         function wGrad = projectSingleScenarioGradient(obj,dij,doseGrad,scen,w)
0079             error('Function needs to be implemented');
0080         end
0081     end
0082 end
0083

| Generated by m2html © 2005