Skip to content

Commit a311bba

Browse files
committed
small improvement of code readability and quality
1 parent 1ec96af commit a311bba

File tree

2 files changed

+18
-14
lines changed

2 files changed

+18
-14
lines changed

matRad/doseCalc/+DoseEngines/matRad_ParticleAnalyticalBortfeldEngine.m

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -326,9 +326,14 @@ function calcLateralParticleCutOff(this,cutOffLevel,~)
326326
calcRange = true;
327327
end
328328

329+
if ~any(strcmp(this.cutOffMethod,{'integral','relative'}))
330+
matRad_cfg = MatRad_Config.instance();
331+
matRad_cfg.dispError('LateralParticleCutOff: Invalid Cutoff Method. Must be ''integral'' or ''relative''!');
332+
end
333+
329334
for i = 1:numel(this.machine.data)
330335
this.machine.data(i).LatCutOff.CompFac = 1/cutOffLevel;
331-
this.machine.data(i).LatCutOff.numSig = sqrt(-2*log(1-cutOffLevel)); %For a 2D symmetric gaussian we need the inverse of the incomplete Gamma function for defining the CutOff
336+
this.machine.data(i).LatCutOff.numSig = sqrt(-2*log(1-cutOffLevel));
332337
this.machine.data(i).LatCutOff.maxSigmaIni = max([this.machine.data(i).initFocus(:).SisFWHMAtIso]) ./ 2.3548;
333338
if calcRange
334339
this.machine.data(i).range = 10 * this.alpha*this.machine.data(i).energy.^this.p;

matRad/doseCalc/+DoseEngines/matRad_ParticlePencilBeamEngineAbstract.m

Lines changed: 12 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
airOffsetCorrection = true; % Corrects WEPL for SSD difference to kernel database
2727
lateralModel = 'auto'; % Lateral Model used. 'auto' uses the most accurate model available (i.e. multiple Gaussians). 'single','double','multi' try to force a singleGaussian or doubleGaussian model, if available
2828

29-
cutOffMethod = 'integral'; % or 'relative'
29+
cutOffMethod = 'integral'; % or 'relative' - describes how to calculate the lateral dosimetric cutoff
3030

3131
visBoolLateralCutOff = false; % Boolean switch for visualization during+ LeteralCutOff calculation
3232
end
@@ -714,27 +714,26 @@ function calcLateralParticleCutOff(this,cutOffLevel,stfElement)
714714

715715
% Find radius at which integrated dose becomes
716716
% bigger than cutoff * IDD
717-
if strcmp(this.cutOffMethod, 'integral')
718-
IX = find(cumArea >= idd(j) * cutOffLevel,1, 'first');
719-
this.machine.data(energyIx).LatCutOff.CompFac = cutOffLevel^-1;
720-
elseif strcmp(this.cutOffMethod, 'relative')
721-
IX = find(dose_r <= (1-cutOffLevel) * max(dose_r), 1, 'first');
722-
relFac = cumArea(IX)./cumArea(end); % (or idd(j)) to find the appropriate integral of dose
723-
this.machine.data(energyIx).LatCutOff.CompFac = relFac^-1;
724-
else
725-
matRad_cfg = MatRad_Config.instance();
726-
matRad_cfg.dispError('Invalid Cutoff Method');
717+
switch this.cutOffMethod
718+
case 'integral'
719+
IX = find(cumArea >= idd(j) * cutOffLevel,1, 'first');
720+
this.machine.data(energyIx).LatCutOff.CompFac = cutOffLevel^-1;
721+
case 'relative'
722+
IX = find(dose_r <= (1-cutOffLevel) * max(dose_r), 1, 'first');
723+
relFac = cumArea(IX)./cumArea(end); % (or idd(j)) to find the appropriate integral of dose
724+
this.machine.data(energyIx).LatCutOff.CompFac = relFac^-1;
725+
otherwise
726+
matRad_cfg.dispError('LateralParticleCutOff: Invalid Cutoff Method. Must be ''integral'' or ''relative''!');
727727
end
728728

729729
if isempty(IX)
730730
depthDoseCutOff = Inf;
731-
matRad_cfg.dispWarning('LateralParticleCutOff: Couldnt find lateral cut off !')
731+
matRad_cfg.dispWarning('LateralParticleCutOff: Couldnt find lateral cut off!')
732732
elseif isnumeric(IX)
733733
depthDoseCutOff = r_mid(IX);
734734
end
735735

736736
this.machine.data(energyIx).LatCutOff.CutOff(j) = depthDoseCutOff;
737-
738737
end
739738
end
740739
end

0 commit comments

Comments
 (0)