Research Article

SSVEP Enhancement Using Moving Average Filter Controlled by Phase Features

Algorithm 1

Specify the appropriate threshold value.
Input:  PhaseSig,         ▷ instantaneous phase signal
   BestBreakpointsAmount,          ▷appropriate percentage of breakpoints
   Errormin, Errormax,     ▷minimum and maximum error values tolerated between lines and the signal
   EEG_Length          ▷number of samples in the input EEG signal
Output: BestThreshold        ▷ appropriate threshold value
If BestBreakpointsAmount ≥ 100 then:
   BestThreshold⟵ Errormin
   return BestThreshold
Else
   (VectErrors, NbBreakpoints, …)  ⟵  PLS(PhaseSig, Errormin)
              ▷PLS(signal, threshold): segment the signal using PLR with respect to the
              threshold value
              ▷VectErrors: vector of error values sorted in increasing order
              ▷NbBreakpoints: number of breakpoints
      
   (Errormax closest value to Errormax from VectErrors
   ((VectErrors, NbBreakpoints, …)  ⟵  PLS(PhaseSig, Errormax)
   (
   (If BestBreakpointsAmount ≤ ActualBreakpointsAmount then:
     (BestThreshold ⟵  Errormax
     return BestThreshold
   Else
     
     
     While BestThreshold has not been assigned a value do:
     
     (VectErrors, NbBreakpoints, …)  ⟵  PLS(PhaseSig, StepError)
     Recalculate ActualBreakpointsAmount
       If BestBreakpointsAmount > ActualBreakpointsAmount then:
         While BestThreshold has not been assigned a value do:
            (VectErrors, NbBreakpoints, …)  ⟵  PLS(PhaseSig, ThStep)
            Recalculate ActualBreakpointsAmount
            If BestBreakpointsAmount > ActualBreakpointsAmount then:
               BestThreshold ⟵  threshold that gives the closet ActualBreakpointsAmount to BestBreakpointsAmount
               return BestThreshold
            End if
            Recalculate THStep
         End while
            End if
     End while
   End if
End if