Jump to content

Contributions:g.EstimSwitchingUnit

From BCI2000 Wiki
Revision as of 17:27, 25 January 2021 by Abelsten (talk | contribs) (Added latency and states section. Populated latency section with a figure. Will add screenshots of BCI2000 to further demonstrate functionalities)

Versioning

g.tec g.Estim Switching Unit

Author

Alexander Belsten (belsten@neurotechcenter.org)

Version History

  • 2020/05/22: Initial release for the switching unit prototype

Source Code Revisions

  • Initial development: 6125
  • Known to compile under: 6177
  • Broken since: --

Functional Description

The purpose of this device and filter is to automate the process of switching channels from recording to stimulation during cortical stimulation experiments. Previously, channels had to be switched manually (unplugging electrodes from the amplifier and plugging them into a stimulator). With the switching unit and this filter, this process is automated.

Integration into BCI2000

Compile the filter by enabling BUILD_PRIVATE in your CMake configuration. Access to the private directory in the SVN is necessary.

Parameters

The g.EstimSwitchingUnit is configured in the filtering tab. The configurable parameters are:

ActivateSwitchingUnit

This parameter enables the switching unit.

DeviceID

Index of the device on the system. If one switching unit is plugged into the computer this value should be 0.

Trigger

There are two options for the trigger, a software trigger, and a digital trigger.

Software Trigger

Channel switching is triggered when the StimulusCode state meets the stimulus condition defined in the first row of the StimConfig parameter. Note: if only one state (one column) is defined in StimConfig, channel information configuration will not need to be re-uploaded to the device. This results in a dramatic decrease in latency of transition between recording to stimulating. See the latency section for more details.

Digital Trigger

Channel switching is triggered by digital input on the back of the device, allowing for the use of foot pedals or push buttons. Only one state (one column) can be defined in the StimConfig parameter to use the digital trigger. When the digital trigger occurs, the switching configuration for that one state will be applied.

StimConfig

This matrix configures channel routing. The StimConfig parameter is where expressions for the software trigger and electrode pairs are defined. Each column contains information for a specific switching configuration and the number of configurations must be configured in accordance with the trigger type. If the trigger type is set to digital, there must only be one configuration (one column) as shown in Image 1. There can also be multiple configurations if the software trigger is enabled (Image 2).

States

EstimSU

This binary state records when the switching unit is switched into the active state (1) and inactive state (0).

Latency

Figure 1: Latency changes greatly depending on if there is one electrode pair or multiple

The time between a SwitchExpression evaluating true and the channels actually switching varies based on the number of electrode pairs. The latency is much lower if there is only one electrode pair (one column) defined in StimConfig, as can be seen in Fig. 1. When more than one electrode pairs are defined, the latency increases. The large jump in latency from one electrode pair to multiple electrode pairs is due to the fact that the expression that evaluated true must now have its corresponding configuration uploaded to the device. In the case of one software configuration, the configuration does not need to be uploaded online because it is uploaded before the run. Checking which SwitchExpression evaluates true does not take very long so the latency does not vary substantially when there are 2 electrode pairs defined, or 20.

Knowing what to expect in terms of switching latency allows the experimentalist to design their stimulation montage such that the switching of channels occurs before the stimulation is applied and even add some additional time to allow the switching artifact introduced to other channels to subside.

See also