Skip to content

Commit 205cfac

Browse files
authored
Merge pull request #781 from SimonaFa/dev
Cutoff method
2 parents a1df21c + eba1075 commit 205cfac

File tree

2 files changed

+11
-4
lines changed

2 files changed

+11
-4
lines changed

matRad/doseCalc/+DoseEngines/matRad_ParticleHongPencilBeamEngine.m

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,10 @@
7474
matRad_cfg.dispError('Invalid Lateral Model');
7575
end
7676

77-
bixel.physicalDose = bixel.baseData.LatCutOff.CompFac * L .* kernels.Z;
77+
if length(bixel.baseData.LatCutOff.CompFac) > 1
78+
bixel.baseData.LatCutOff.CompFac = matRad_interp1(bixel.baseData.LatCutOff.depths', bixel.baseData.LatCutOff.CompFac', bixel.radDepths);
79+
end
80+
bixel.physicalDose = bixel.baseData.LatCutOff.CompFac .* L .* kernels.Z;
7881

7982
% check if we have valid dose values
8083
if any(isnan(bixel.physicalDose)) || any(bixel.physicalDose<0)

matRad/doseCalc/+DoseEngines/matRad_ParticlePencilBeamEngineAbstract.m

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -714,14 +714,15 @@ function calcLateralParticleCutOff(this,cutOffLevel,stfElement)
714714

715715
% Find radius at which integrated dose becomes
716716
% bigger than cutoff * IDD
717+
717718
switch this.cutOffMethod
718719
case 'integral'
719720
IX = find(cumArea >= idd(j) * cutOffLevel,1, 'first');
720721
this.machine.data(energyIx).LatCutOff.CompFac = cutOffLevel^-1;
721722
case 'relative'
722723
IX = find(dose_r <= (1-cutOffLevel) * max(dose_r), 1, 'first');
723724
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+
this.machine.data(energyIx).LatCutOff.CompFac(j) = relFac^-1;
725726
otherwise
726727
matRad_cfg.dispError('LateralParticleCutOff: Invalid Cutoff Method. Must be ''integral'' or ''relative''!');
727728
end
@@ -872,14 +873,17 @@ function calcLateralParticleCutOff(this,cutOffLevel,stfElement)
872873
else
873874
idd = this.machine.data(energyIx).Z;
874875
end
876+
if length(TmpCompFac)>1
877+
TmpCompFac = matRad_interp1(depthValues, TmpCompFac', radDepths);
878+
end
875879
subplot(312),plot(this.machine.data(energyIx).depths,idd*conversionFactor,'k','LineWidth',2),grid on,hold on
876880
plot(radDepths - this.machine.data(energyIx).offset,vDoseInt,'r--','LineWidth',2),hold on,
877-
plot(radDepths - this.machine.data(energyIx).offset,vDoseInt * TmpCompFac,'bx','LineWidth',1),hold on,
881+
plot(radDepths - this.machine.data(energyIx).offset,vDoseInt .* TmpCompFac,'bx','LineWidth',1),hold on,
878882
legend({'original IDD',['cut off IDD at ' num2str(cutOffLevel) '%'],'cut off IDD with compensation'},'Location','northwest'),
879883
xlabel('z [mm]'),ylabel('[MeV cm^2 /(g * primary)]'),set(gca,'FontSize',12)
880884

881885
totEnergy = trapz(this.machine.data(energyIx).depths,idd*conversionFactor) ;
882-
totEnergyCutOff = trapz(radDepths,vDoseInt * TmpCompFac) ;
886+
totEnergyCutOff = trapz(radDepths,vDoseInt .* TmpCompFac) ;
883887
relDiff = ((totEnergy/totEnergyCutOff)-1)*100;
884888
title(['rel diff of integral dose ' num2str(relDiff) '%']);
885889
baseData.LatCutOff.CompFac = TmpCompFac;

0 commit comments

Comments
 (0)