@@ -673,14 +673,15 @@ function calcLateralParticleCutOff(this,cutOffLevel,stfElement)
673673
674674                        %  Find radius at which integrated dose becomes
675675                        %  bigger than cutoff * IDD
676+ 
676677                        switch  this .cutOffMethod 
677678                            case  ' integral' 
678679                                IX =  find(cumArea  >=  idd(j ) *  cutOffLevel ,1 , ' first'  );
679680                                this .machine .data(energyIx ).LatCutOff.CompFac =  cutOffLevel ^-1 ;
680681                            case  ' relative' 
681682                                IX =  find(dose_r  <=  (1 - cutOffLevel ) *  max(dose_r ), 1 , ' first'  );
682683                                relFac =  cumArea(IX )./cumArea(end ); %  (or idd(j)) to find the appropriate integral of dose
683-                                 this .machine .data(energyIx ).LatCutOff.CompFac =  relFac ^-1 ;
684+                                 this .machine .data(energyIx ).LatCutOff.CompFac( j )  =  relFac ^-1 ;
684685                            otherwise 
685686                                matRad_cfg .dispError(' LateralParticleCutOff: Invalid Cutoff Method. Must be '' integral''  or '' relative'' !'  );
686687                        end 
@@ -831,14 +832,17 @@ function calcLateralParticleCutOff(this,cutOffLevel,stfElement)
831832                else 
832833                    idd =  this .machine .data(energyIx ).Z;
833834                end 
835+                 if  length(TmpCompFac )>1
836+                     TmpCompFac =  matRad_interp1(depthValues , TmpCompFac ' , radDepths );
837+                 end 
834838                subplot(312 ),plot(this .machine .data(energyIx ).depths,idd * conversionFactor ,' k'  ,' LineWidth'  ,2 ),grid  on,hold on 
835839                plot(radDepths  -  this .machine .data(energyIx ).offset,vDoseInt ,' r--'  ,' LineWidth'  ,2 ),hold  on, 
836-                 plot(radDepths  -  this .machine .data(energyIx ).offset,vDoseInt  *  TmpCompFac ,' bx'  ,' LineWidth'  ,1 ),hold  on, 
840+                 plot(radDepths  -  this .machine .data(energyIx ).offset,vDoseInt  . *  TmpCompFac ,' bx'  ,' LineWidth'  ,1 ),hold  on, 
837841                legend({' original IDD'  ,[' cut off IDD at '   num2str(cutOffLevel ) ' %'  ],' cut off IDD with compensation'  },' Location'  ,' northwest'  ),
838842                xlabel(' z [mm]'  ),ylabel(' [MeV cm^2 /(g * primary)]'  ),set(gca ,' FontSize'  ,12 )
839843
840844                totEnergy        =  trapz(this .machine .data(energyIx ).depths,idd * conversionFactor ) ;
841-                 totEnergyCutOff  =  trapz(radDepths ,vDoseInt  *  TmpCompFac ) ;
845+                 totEnergyCutOff  =  trapz(radDepths ,vDoseInt  . *  TmpCompFac ) ;
842846                relDiff          =   ((totEnergy / totEnergyCutOff )-1 )*100 ;
843847                title([' rel diff of integral dose '   num2str(relDiff ) ' %'  ]);
844848                baseData.LatCutOff.CompFac =  TmpCompFac ;
0 commit comments