Skip to content

Commit b25659d

Browse files
authored
Merge pull request #762 from SimonaFa/dev
Bug fixed in MonteCarloEngineAbstract for forward dose calculation
2 parents 321ca7c + 6adf377 commit b25659d

File tree

6 files changed

+126
-145
lines changed

6 files changed

+126
-145
lines changed

AUTHORS.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
* Remo Cristoforetti
1414
* Marios Dallas
1515
* Edgardo Doerner
16+
* Simona Facchiano
1617
* Hubert Gabrys
1718
* Josefine Handrack
1819
* Jennifer Hardt

matRad/doseCalc/+DoseEngines/@matRad_DoseEngineBase/matRad_DoseEngineBase.m

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,7 @@
6464
properties (Access = protected)
6565
lastProgressUpdate;
6666
calcDoseDirect = false; % switch for direct cube / dij calculation
67+
directWeights = [];
6768
end
6869

6970
properties (Constant)
@@ -192,7 +193,7 @@ function assignPropertiesFromPln(this,pln,warnWhenPropertyChanged)
192193

193194
% copy bixel weight vector into stf struct
194195
if nargin == 5
195-
if sum([stf.totalNumOfBixels]) ~= numel(w)
196+
if sum([stf.totalNumOfBixels]) ~= numel(w) && ~isfield([stf.ray],'shapes')
196197
matRad_cfg.dispError('weighting does not match steering information');
197198
end
198199
counter = 0;
@@ -218,6 +219,7 @@ function assignPropertiesFromPln(this,pln,warnWhenPropertyChanged)
218219
end
219220

220221
%Set direct dose calculation and compute "dij"
222+
this.directWeights = w;
221223
this.calcDoseDirect = true;
222224
dij = this.calcDose(ct,cst,stf);
223225

matRad/doseCalc/+DoseEngines/matRad_MonteCarloEngineAbstract.m

Lines changed: 0 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -51,56 +51,6 @@ function setDefaults(this)
5151

5252
this.relativeDosimetricCutOff = matRad_cfg.defaults.propDoseCalc.dosimetricLateralCutOff;
5353
end
54-
55-
function resultGUI = calcDoseForward(this,ct,cst,stf,w)
56-
57-
matRad_cfg = MatRad_Config.instance();
58-
if nargin < 5 && ~isfield([stf.ray],'weight')
59-
matRad_cfg.dispError('No weight vector available. Please provide w or add info to stf')
60-
end
61-
62-
% copy bixel weight vector into stf struct
63-
if nargin == 5
64-
if sum([stf.totalNumOfBixels]) ~= numel(w) && ~isfield([stf.ray],'shapes')
65-
matRad_cfg.dispError('weighting does not match steering information')
66-
end
67-
counter = 0;
68-
for i = 1:size(stf,2)
69-
for j = 1:stf(i).numOfRays
70-
for k = 1:stf(i).numOfBixelsPerRay(j)
71-
counter = counter + 1;
72-
stf(i).ray(j).weight(k) = w(counter);
73-
end
74-
end
75-
end
76-
else % weights need to be in stf!
77-
w = NaN*ones(sum([stf.totalNumOfBixels]),1);
78-
counter = 0;
79-
for i = 1:size(stf,2)
80-
for j = 1:stf(i).numOfRays
81-
for k = 1:stf(i).numOfBixelsPerRay(j)
82-
counter = counter + 1;
83-
w(counter) = stf(i).ray(j).weight(k);
84-
end
85-
end
86-
end
87-
end
88-
89-
%Set direct dose calculation and compute "dij"
90-
this.calcDoseDirect = true;
91-
dij = this.calcDose(ct,cst,stf);
92-
93-
% hack dij struct
94-
dij.numOfBeams = 1;
95-
dij.beamNum = 1;
96-
97-
% calculate cubes; use uniform weights here, weighting with actual fluence
98-
% already performed in dij construction
99-
resultGUI = matRad_calcCubes(sum(w),dij);
100-
101-
% remember original fluence weights
102-
resultGUI.w = w;
103-
end
10454
end
10555

10656

0 commit comments

Comments
 (0)