Skip to content

Commit

Permalink
Update matRad_TopasConfig.m
Browse files Browse the repository at this point in the history
  • Loading branch information
JenHardt committed Feb 28, 2024
1 parent cc42adf commit c2c293d
Showing 1 changed file with 4 additions and 6 deletions.
10 changes: 4 additions & 6 deletions topas/matRad_TopasConfig.m
Original file line number Diff line number Diff line change
Expand Up @@ -692,8 +692,6 @@ function writeAllFiles(obj,ct,cst,pln,stf,machine,w)
% Allocate possible scored quantities
processedQuantities = {'','_std','_batchStd'};
topasCubesTallies = unique(erase(topasCubesTallies,processedQuantities(2:end)));

normFac = sum(w);


% Loop through 4D scenarios
Expand All @@ -711,7 +709,7 @@ function writeAllFiles(obj,ct,cst,pln,stf,machine,w)
% Check if current quantity is available and write to dij
if isfield(topasCubes,[topasCubesTallies{j} '_ray' num2str(dij.rayNum(d)) '_bixel' num2str(dij.bixelNum(d)) processedQuantities{p} '_beam' num2str(dij.beamNum(d))]) ...
&& iscell(topasCubes.([topasCubesTallies{j} '_ray' num2str(dij.rayNum(d)) '_bixel' num2str(dij.bixelNum(d)) processedQuantities{p} '_beam' num2str(dij.beamNum(d))]))
dij.([topasCubesTallies{j} processedQuantities{p}]){ctScen,1}(:,d) = normFac*reshape(topasCubes.([topasCubesTallies{j} '_ray' num2str(dij.rayNum(d)) '_bixel' num2str(dij.bixelNum(d)) processedQuantities{p} '_beam' num2str(dij.beamNum(d))]){ctScen},[],1);
dij.([topasCubesTallies{j} processedQuantities{p}]){ctScen,1}(:,d) = sum(w)*reshape(topasCubes.([topasCubesTallies{j} '_ray' num2str(dij.rayNum(d)) '_bixel' num2str(dij.bixelNum(d)) processedQuantities{p} '_beam' num2str(dij.beamNum(d))]){ctScen},[],1);
end
end
end
Expand All @@ -724,7 +722,7 @@ function writeAllFiles(obj,ct,cst,pln,stf,machine,w)
for p = 1:length(processedQuantities)
% Check if current quantity is available and write to dij
if isfield(topasCubes,[topasCubesTallies{j} processedQuantities{p} '_beam' num2str(d)]) && iscell(topasCubes.([topasCubesTallies{j} processedQuantities{p} '_beam' num2str(d)]))
dij.([topasCubesTallies{j} processedQuantities{p}]){ctScen}(:,d) = normFac*reshape(topasCubes.([topasCubesTallies{j} processedQuantities{p} '_beam',num2str(d)]){ctScen},[],1);
dij.([topasCubesTallies{j} processedQuantities{p}]){ctScen}(:,d) = sum(w)*reshape(topasCubes.([topasCubesTallies{j} processedQuantities{p} '_beam',num2str(d)]){ctScen},[],1);
end
end
end
Expand All @@ -745,7 +743,7 @@ function writeAllFiles(obj,ct,cst,pln,stf,machine,w)
% Check if current quantity is available and write to dij
if isfield(topasCubes,[topasCubesTallies{j} '_ray' num2str(dij.rayNum(d)) '_bixel' num2str(dij.bixelNum(d)) processedQuantities{p} '_beam' num2str(dij.beamNum(d))]) ...
&& iscell(topasCubes.([topasCubesTallies{j} '_ray' num2str(dij.rayNum(d)) '_bixel' num2str(dij.bixelNum(d)) processedQuantities{p} '_beam' num2str(dij.beamNum(d))]))
dij.([topasCubesTallies{j} processedQuantities{p}]){ctScen,1}(:,d) = normFac*reshape(topasCubes.([topasCubesTallies{j} '_ray' num2str(dij.rayNum(d)) '_bixel' num2str(dij.bixelNum(d)) processedQuantities{p} '_beam' num2str(dij.beamNum(d))]){ctScen},[],1);
dij.([topasCubesTallies{j} processedQuantities{p}]){ctScen,1}(:,d) = sum(w)*reshape(topasCubes.([topasCubesTallies{j} '_ray' num2str(dij.rayNum(d)) '_bixel' num2str(dij.bixelNum(d)) processedQuantities{p} '_beam' num2str(dij.beamNum(d))]){ctScen},[],1);
end
end
% Handle RBE-related quantities (not multiplied by sum(w)!)
Expand Down Expand Up @@ -782,7 +780,7 @@ function writeAllFiles(obj,ct,cst,pln,stf,machine,w)
for p = 1:length(processedQuantities)
% Check if current quantity is available and write to dij
if isfield(topasCubes,[topasCubesTallies{j} processedQuantities{p} '_beam' num2str(d)]) && iscell(topasCubes.([topasCubesTallies{j} processedQuantities{p} '_beam' num2str(d)]))
dij.([topasCubesTallies{j} processedQuantities{p}]){ctScen}(:,d) = normFac*reshape(topasCubes.([topasCubesTallies{j} processedQuantities{p} '_beam',num2str(d)]){ctScen},[],1);
dij.([topasCubesTallies{j} processedQuantities{p}]){ctScen}(:,d) = sum(w)*reshape(topasCubes.([topasCubesTallies{j} processedQuantities{p} '_beam',num2str(d)]){ctScen},[],1);
end
end
% Handle RBE-related quantities (not multiplied by sum(w)!)
Expand Down

0 comments on commit c2c293d

Please sign in to comment.