This is a script file.
0001 classdef matRad_BackProjection
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016
0017
0018 properties (Access = protected)
0019 wCache
0020 wGradCache
0021 d
0022 wGrad
0023 end
0024
0025 properties
0026 dij
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
0072
0073 methods
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