Contributions:SWSignalProcessing

From BCI2000 Wiki
Jump to: navigation, search

Synopsis

A signal processing module for slow wave feedback.

Location

http://www.bci2000.org/svn/trunk/src/contrib/SignalProcessing/SW

Versioning

Authors

Dr. Thilo Hinterberger, Jürgen Mellinger, University of Tübingen.

Source Code Revisions

  • Initial development: 45
  • Tested under: 946
  • Known to compile under: 1528
  • Broken since: --

Description

The calculation of the Slow-Wave feedback signal is subdivided into three modules: The SW-Filter, which is realized as an efficient boxcar-filter, the SetBaseline module, which subtracts a defined baseline from the signal and an artifact correction module, which contains two different artifact correction modes.

Temporal SW-Filter

Parameters

The SW-Filter uses the following parameters:

SWFilter int SWAvgSpan= 0.5 0.5 0 10 
         // Averaging window in s
SWFilter intlist SWInChList= 3 0 1 2 0 0 63 
         // Channel index of input signal (include artifact channel!)
SWFilter intlist SWOutChList= 3 0 1 2 0 0 63 
         // Channel index of output signal (include artifact channel!)
SWFilter floatlist ThresholdAmp= 3 100 100 400 200 -2000 2000 
         // Threshold for invalid Trial in uV
SWFilter float Tc= 0 16 0 1024 
         // Time constant filter settings in s
Visualize int VisualizeSWFiltering= 1 0 0 1  
          // visualize SW filtered signals (0=no 1=yes)

SWAvgSpan defines the time window of the boxcar-filter. SWInChList defines, which channels from Signal B are filtered. They are sorted to the channels in Signal C which are selected in SWOutChList. In the Standard setting, three channels are filtered. The ThresholdAmp is an artifact control parameter. In between one trial (from one BeginOfTrial to the next), the amplitude is not allowed to vary more than the in ThresholdAmp defined size in muV. Otherwise the trial should be neglected and set as invalid in the application module (state Artifact is set to one).

A time constant (Tc) correction function simulates a real DC-behaviour, even if the amplifier has no DC-option. This can be done by the knowledge of the amplifiers' time constant, which is set as the parameter Tc. To avoid that the signal will drift towards very high positive or negative values, the correction signal is set to zero each time, when BeginOfTrial is one. Tc=0 will switch off the Tc-correction. Note: The Tc-correction will only work properly, when the A/D-converter and the amplifier puts out 0 when the input is 0 muV and there is no electrode polarization! If you are not sure, switch off this correction.

States

Following states are used: Artifact (bool) is set to 1 when the signal changes exceed the threshold values defined in ThresholdAmp (see below). BeginOfTrial is checked to trigger the start of the trial and reset the internal counter.

Baseline Setting

Parameters

The SW-Filter uses the following parameters:

BLFilter float BaseBegin= 0.9 1.9 0 60 
         // Begin of Baseline in s
BLFilter float BaseEnd= 1.0 2.0 0 60 
         // End of Baseline in s
BLFilter intlist BaseChList= 3 1 1 1 1 0 1 
         // 1 to mark that BL is subtracted
Visualize int VisualizeBaselineFiltering= 1 0 0 1  
          // visualize baseline filtered signals (0=no 1=yes)

The baseline is set each trial at the time point BaseEnd seconds after BeginOfTrial was set to one. The baseline amplitude is the average amplitude in the time interval between BaseBegin and BaseEnd. The baseline is subtracted of all channels marked with 1 in the BaseChList. As default, baseline subtraction is applied on all three channels.

This version still uses the parameters BIPts and FIPts, which define the duration of the baseline-interval and the feedback-interval in seconds. These parameters are used for the buffer, which needs the duration of a trial. They will be no longer used in the next version.

States

Following states are used: Baseline (bool) is set to 1 during the baseline period between BaseBegin and BaseEnd. Otherwise it is zero. BeginOfTrial is checked to trigger the start of the trial and reset the internal counter.

Artifact Correction

Parameters

The SW-Filter uses the following parameters:

ArteFilter intlist ArteChList= 3 2 2 -1 2 -1 63
  // Assignment of artefact channels, -1: no artifact channel
ArteFilter floatlist ArteFactorList= 7 0.15 0.15 0 0 0 0 0 0 -1 1
  // Influence of artefact channel on input channel,
     -1: no artifact channel
ArteFilter int ArteMode= 0 1 0 3
  // Artefact correction mode, 0 off, 1 continuous, 2 conditioned
Visualize int VisualizeFBArteCorFiltering= 1 0 0 1 
  // visualize FBArte corrected signals (0=no 1=yes)

Artifacts are corrected on all channels which are not marked with -1 in the ArteChList. For the correction, the channel number at the position of the channel in the ArteChList is used as artifact channel. For example, the standard setting corrects the channels 0 and 1 by using channel 2 for the correction. The correction factor is the factor set in ArteFactorList, 0.15 in the standard setting.

For the ArteMode parameter, the following values are possible:

  • ArteMode 0 switches this filter off.
  • ArteMode 1 will subtract the artifact channel multiplied with a constant factor.
  • ArteMode 2 will correct the signal according to Koutchoubey, 1997: If the artifact signal has the same sign as the control signal, a correction is applied by subtracting the artifact signal; otherwise, no correction is performed. If the artifact crosses a threshold value, feedback is suppressed.
  • ArteMode 3 is working identically to ArteMode 2 but sets the Artifact state to 1 when the feedback is set to zero.

States

Following states are used: Artifact (bool) is set to 1 only in ArteMode=3 when the feedback signal is set to zero due to the EOG artifact BeginOfTrial is checked to trigger the start of the trial and reset the internal counter.

See also

User Reference:Filters, Contributions:SignalProcessing