Jump to content

Contributions:CCEPFilter: Difference between revisions

From BCI2000 Wiki
No edit summary
No edit summary
Line 1: Line 1:
[[Image:CCEP gif.gif |616px|right|thumb|frame| An example video showing one channel of the CCEP filter.]]
 
[[Image:CCEP gif.gif|thumb|1300px| An demo video of the CCEP Filter with VisualizeBCI2000. ]]
 
==Introduction==
==Introduction==
Cortico-cortical evoked potentials (CCEPs) are generated as a response to stimulation within the cortical zone. To best view this response, the CCEP filter time locks the signal to the stimulation and allows the user to view the CCEPS from every recording electrode. There are many adaptable parameters to include flexibility for a variety of experiments.
Cortico-cortical evoked potentials (CCEPs) are generated as a response to stimulation within the cortical zone. To best view this response, the CCEP filter time locks the signal to the stimulation and allows the user to view the CCEPS from every recording electrode. There are many adaptable parameters to include flexibility for a variety of experiments.
Line 22: Line 24:
See [[Python Visualizations#Installation|the Installation section on the Python Visualization page]] to see how to install the necessary packages and how to run demo files! Once that is all set up, you can return to this page to understand the specific parameters for the CCEPs.
See [[Python Visualizations#Installation|the Installation section on the Python Visualization page]] to see how to install the necessary packages and how to run demo files! Once that is all set up, you can return to this page to understand the specific parameters for the CCEPs.


==Settings==
==Processing Details==
The CCEP filter has two parts - a C++ filter in the Signal Processing pipeline, and the Python filter outside of the BCI2000 chain.
# BCI2000 filter
#* The filter receives the raw data from the Source module, then time-locks the data based on the user-defined CCEP parameters.
#* When all the data is collected, the state CCEPTriggered will pulse to let the Python filter know data is ready to be visualized.
# Python filter
#* Data is received through the [[User Reference:SignalSharing|SignalSharing]] feature. Specifically, the parameter ShareCCEPFilter is set to a valid port to share the data.
#* When CCEPTriggered is true, the incoming data is further processed and plotted. The only processing this filter does is to calculate the area under the curve (AUC), then determine which channels have a significant response based on the threshold standard deviation set by the user. The raw values are given in the table, and the top most significant channels are visually shown.
#* If ''Sort Channels'' is enabled, all the significant channels will be at the top. They are then organized based on their original order, to maintain electrode grouping. If they were sorted purely on highest to lowest AUC, it would be very difficult to tell which general areas are responding.
 
==Python Settings==
===Threshold (STD)===
This defines the threshold to determine a CCEP response. This value should be adjusted to maximize the number of significant channels shown, while not going over. If the value is too low, there will be more significant channels than visualized windows. This would only show you the electrodes which were originally at the top of the list, which might lead you to disregard the bottom electrodes.
===Max Windows===
===Max Windows===
The maximum amount of windows displayed. If you desire all the transmitted channels to be shown, set this max value to the number of channels or greater.
The maximum amount of windows displayed. If you desire all the transmitted channels to be shown, set this max value to the number of channels or greater.
Line 34: Line 48:
Disable to keep the order of the channels unchanged. If there are more transmitted channels than windows shown, the shown windows will simply be the first in the list.
Disable to keep the order of the channels unchanged. If there are more transmitted channels than windows shown, the shown windows will simply be the first in the list.
===Save figures on refresh===
===Save figures on refresh===
Enable to make sure the visualizations are never lost, as every time the plots are cleared they would first be saved. This can get cumbersome with many saved files.
''Currently broken''. Enable to make sure the visualizations are never lost, as every time the plots are cleared they would first be saved. This can get cumbersome with many saved files.
===Onset Period===
===Onset Period===
This number minus one is the number of plots to skip when visualizing. For example, if a stimulation burst causes the OnsetExpression to be true 10 times during a single burst, set this to 10 (it will skip the 9 pulses after the first pulse).  
This number minus one is the number of plots to skip when visualizing. For example, if a stimulation burst causes the OnsetExpression to be true 10 times during a single burst, set this to 10 (it will skip the 9 pulses after the first pulse).  


==BCI2000 Parameters==
===OnsetExpression===
Expression that defines the stimulus onset. Ideally, this should be a hardware trigger to have the most precise time-locking. This expression should be true when the stimulation is triggered. See the [[User Reference:Expression Syntax | Expression syntax page]] for more information.


==Parameters==
===Duration settings===
===<u>''General Configuration''</u>===
These parameters all should have units of time (e.g. milliseconds), or auto.


====OnsetExpression====
====''BaselineEpochLength''====
Expression that defines the stimulus onset. See the [[User Reference:Expression Syntax | Expression syntax page]] for more information. This expression should be true when the stimulation is triggered.
 
===<u>''Duration settings''</u>===
These parameters all should have units of time (e.g. milliseconds), or auto.
<gallery mode="packed" widths=250px heights=450px>
File:CCEPTimingVisualization.png|The three timing sections of the CCEP filter visualization.
</gallery>
====BaselineEpochLength====
The duration of desired baseline data. This baseline data is helpful for visualizing the data before the stimulation, and is also used to calculate the average signal value from which the threshold is calculated.
The duration of desired baseline data. This baseline data is helpful for visualizing the data before the stimulation, and is also used to calculate the average signal value from which the threshold is calculated.
====CCEPEpochLength====
====''CCEPEpochLength''====
Duration of time after the baseline and latency. Essentially the amount of time that is needed to view the CCEP.
Duration of time after the baseline and latency. Essentially the amount of time that is needed to view the CCEP.


===<u>''Counting settings''</u>===
===Counting settings===
<gallery mode="packed" widths=250px heights=450px>
These parameters must be integers as they specify a quantity to count.  
File:CCEPCountingVisualization.png|The three counting parameters of the CCEP filter visualization. The yellow circles represent counting every third OnsetExpression, then the pink arrows display averaging every 5th number. The original plot is then held because HoldPlots is greater than 1.
====''EpochsToAverage''====
</gallery>
Average this number of CCEPs before sending it to Python to visualize. This is helpful if the OnsetExpression is frequently true within a short period of time, to lower the load on Python updating.  
These parameters must be integers, they specify a quantity to count.  
====''OnsetPeriod''====
====EpochsToAverage====
Skip one less than this number of CCEPs. This is helpful if you want to visualize a time range in which the OnsetExpression is met multiple times. For example, for high-frequency stimulation, the OnsetExpression might be true 50 times in 1 second. Therefore, you would want to set this number to 50. If you are also averaging the plots, it will only average the signals specified by this period.
Number of times the OnsetExpression is met to average together. The resulting average will then be displayed once the number is met. This is helpful if the OnsetExpression is frequently true within a short period of time.
====OnsetPeriod====
Count every number of times the OnsetExpression is evaluated true. In other words, skip every OnsetPeriod - 1. This is helpful if you want to visualize a time range in which the OnsetExpression is met multiple times. If you are also averaging the plots, it will only average the signals specified by this period.


==See also==
==See also==

Revision as of 17:19, 24 April 2025

An demo video of the CCEP Filter with VisualizeBCI2000.

Introduction

Cortico-cortical evoked potentials (CCEPs) are generated as a response to stimulation within the cortical zone. To best view this response, the CCEP filter time locks the signal to the stimulation and allows the user to view the CCEPS from every recording electrode. There are many adaptable parameters to include flexibility for a variety of experiments.

Location

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

Versioning

Authors

  • Will Engelhardt (engelhardt@neurotechcenter.org)

Version History

  • 05/17/2023 - First working version

Source Code Revisions

  • Initial development: 7199
  • Tested under: 7303
  • Known to compile under: 7364
  • Broken since: --

Installation

See the Installation section on the Python Visualization page to see how to install the necessary packages and how to run demo files! Once that is all set up, you can return to this page to understand the specific parameters for the CCEPs.

Processing Details

The CCEP filter has two parts - a C++ filter in the Signal Processing pipeline, and the Python filter outside of the BCI2000 chain.

  1. BCI2000 filter
    • The filter receives the raw data from the Source module, then time-locks the data based on the user-defined CCEP parameters.
    • When all the data is collected, the state CCEPTriggered will pulse to let the Python filter know data is ready to be visualized.
  2. Python filter
    • Data is received through the SignalSharing feature. Specifically, the parameter ShareCCEPFilter is set to a valid port to share the data.
    • When CCEPTriggered is true, the incoming data is further processed and plotted. The only processing this filter does is to calculate the area under the curve (AUC), then determine which channels have a significant response based on the threshold standard deviation set by the user. The raw values are given in the table, and the top most significant channels are visually shown.
    • If Sort Channels is enabled, all the significant channels will be at the top. They are then organized based on their original order, to maintain electrode grouping. If they were sorted purely on highest to lowest AUC, it would be very difficult to tell which general areas are responding.

Python Settings

Threshold (STD)

This defines the threshold to determine a CCEP response. This value should be adjusted to maximize the number of significant channels shown, while not going over. If the value is too low, there will be more significant channels than visualized windows. This would only show you the electrodes which were originally at the top of the list, which might lead you to disregard the bottom electrodes.

Max Windows

The maximum amount of windows displayed. If you desire all the transmitted channels to be shown, set this max value to the number of channels or greater.

x0

The minimum shown value of the x-axis for all windows, in milliseconds. You can set this to a negative value to show baseline data before the CCEP.

Hold Plots

The number of plots to keep on a window. Set to 0 to hold all plots, until manually cleared with "Clear Figures".

Average CCEPs

Enable to display the average of the plots in addition to the single trials.

Sort Channels

Disable to keep the order of the channels unchanged. If there are more transmitted channels than windows shown, the shown windows will simply be the first in the list.

Save figures on refresh

Currently broken. Enable to make sure the visualizations are never lost, as every time the plots are cleared they would first be saved. This can get cumbersome with many saved files.

Onset Period

This number minus one is the number of plots to skip when visualizing. For example, if a stimulation burst causes the OnsetExpression to be true 10 times during a single burst, set this to 10 (it will skip the 9 pulses after the first pulse).

BCI2000 Parameters

OnsetExpression

Expression that defines the stimulus onset. Ideally, this should be a hardware trigger to have the most precise time-locking. This expression should be true when the stimulation is triggered. See the Expression syntax page for more information.

Duration settings

These parameters all should have units of time (e.g. milliseconds), or auto.

BaselineEpochLength

The duration of desired baseline data. This baseline data is helpful for visualizing the data before the stimulation, and is also used to calculate the average signal value from which the threshold is calculated.

CCEPEpochLength

Duration of time after the baseline and latency. Essentially the amount of time that is needed to view the CCEP.

Counting settings

These parameters must be integers as they specify a quantity to count.

EpochsToAverage

Average this number of CCEPs before sending it to Python to visualize. This is helpful if the OnsetExpression is frequently true within a short period of time, to lower the load on Python updating.

OnsetPeriod

Skip one less than this number of CCEPs. This is helpful if you want to visualize a time range in which the OnsetExpression is met multiple times. For example, for high-frequency stimulation, the OnsetExpression might be true 50 times in 1 second. Therefore, you would want to set this number to 50. If you are also averaging the plots, it will only average the signals specified by this period.

See also

User Reference:Filters, Contributions:SignalProcessing, Python Visualizations, Contributions:PAC