@@ -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