Jump to content

Contributions:CortecADC

From BCI2000 Wiki
Revision as of 21:06, 18 February 2025 by Wengelhardt (talk | contribs)
CorTec Brain Interchange Implant

CortecADC is a source module that allows for inter-cranial recording and stimulating over 32 channels via a fully implantable device. It is intended for long-term measurement of neural activity and electrical stimulation of brain tissue. See the CorTec site for more information.

See the CortecExperience page for user tutorials and a broad overview! After viewing the CortecExperience page, refer to this page for detailed instructions.


Versioning

Authors

  • Alexander Belsten (belsten@neurotechcenter.org)
  • Markus Adamek (adamek@neurotechcenter.org)
  • William Engelhardt (engelhardt@neurotechcenter.org)

Version History

  • 11/29/2018 - R5829 - Initial untested version (Adamek)
  • 04/19/2021 - R6271 - First working version (Belsten)
  • 07/22/2021 - R6339 - Changed ImplantLostSample from a BCI2000 state to a stream, so it can record individual sample loss (instead of over the whole block). This change is untested. (Belsten)
  • 01/01/2023 - R7133 - Updated API to version 1.0.200. (Engelhardt)

Source Code Revisions

  • Initial development: 6266
  • Tested under: 6271
  • Known to compile under: 6271
  • Broken since: --

Known Issues

  • Lost samples - The ImplantLostSamples state records what samples are lost, and their locations. Lost samples are replaced with the previous valid sample for all channels. In offline analysis, be sure to remove these samples and replace them with interpolates.
  • The Brain Interchange Communication Unit has been seen to work with certain USB inputs, and not with others. If you are experiencing connection issues, try using a different USB port.

Source Parameters

These parameters can be found in the "Source" tab of the BCI2000 config window.

Figure 1. The default source parameters for the CortecADC

SourceCh

The total number of digitized and stored channels. In the current implementation, this parameter cannot be edited, and will default to how many channels are available from the implant.

SampleBlockSize

Samples per channel per digitized block. Together with the sampling rate, this parameter determines how often per second data are collected, processed, and feedback is updated. For example, at 1000 Hz sampling and a SampleBlockSize of 20, the system (e.g., source signal display, signal processing, and stimulus presentation) will be updated 50 times per second.

SamplingRate

The sample rate of the system. This parameter cannot be edited, and will default to the sampling rate available from the implant. In case you are experiencing problems by higher sampling rates (e.g., data loss, jerky display, etc.), increase the SampleBlockSize so that you are updating the system less frequently (usually, updating the system 20-30 times per second is sufficient for most applications), and increase Visualize->VisualizeSourceDecimation. This parameter will decrease the number of samples per second that are actually drawn in the Source display.

SourceChOffset

Offset for each channel.

SourceChGain

Gain for each channel.

ChannelNames

Names of each channel.

ReferenceCh

This list defines what channels will be used as reference. This list is uploaded to the device and set in hardware, effecting the raw bio-signal data that is recorded by BCI2000. If you do not want to effect the raw bio-signal data that is recorded, you can use the spatial filter. If this parameter is set to auto, no reference channels are used. It is strongly recommended to use at least one reference channel.

AmplificationFactor

Amplification factor that is applied to the recorded data on the implant. The choices are 39.5, 45.5, 51.5, 57.5 db.

UseGround

Enable to use the ground electrode while measuring. This setting can be overwritten during stimulation, depending if the ground electrode is being used or not. For example, if you have enabled this parameter but don't have 0 in your Destination ch list in the StimulationTriggers parameter, when you are stimulating you will not be using the ground electrode. Once stimulation is done, this parameter's settings are used again.

SaveInfoFile

Enable to save a text file, named the same as the data file run. It will contain the timestamp, amplification factor used in the run, and reference channels used. If the Impedance is measured, the impedance values will be saved to this file regardless of if this parameter is enabled.

LogPacketErrors

Enable to save the packet loss errors to the System Log. Helpful for debugging, however can get overwhelming if there are a lot of lost samples. The System Log can be programmatically saved by appending --SystemLogFile=SOME_FILE.TXT to the Startup system localhost line in your batch file.


Stimulation Parameters

These parameters can be found in the "Stimulation" tab of the BCI2000 config window.

EnableStimulation

This parameter enables/disables stimulation.

StimulationMode

The BIC has 3 stimulation modes. Each one has limitations. Here is a brief summary of how to use each one:

  1. Volatile Commands: The most flexible mode. The limitation is that the stimulation configuration is uploaded right before starting the stimulation, which increases the latency of the stimulation.
  2. Persistent Command: There can only be one stimulation configuration, which includes burst settings. There can still be multiple trigger expressions and electrodes.
  3. Persistent Functions: There cannot be any train settings (Train frequency and Train repetitions), so the StimulationTriggers must not have those rows.

Persistent Command and Functions modes have a lower latency because the stimulation is pre-uploaded. All modes are available to give you the highest amount of flexiblity with the BIC. See below for more details on latency.

MeasureImpedance

When enabled, the impedances of the used electrodes are printed when you set the configuration. All electrodes that are being recorded will conduct the impedance measurement. The impedances are shown to the user and also saved in the data directory.

StimulationPulses

This parameter defines the shape of the charge balanced stimulation pulses, as described in Fig 1. The pulses are defined in one column of this parameter matrix, and it is possible to define an arbitrary number of pulses, each of which are associated with a user defined integer called a PulseID. The rows are labeled and there are some limitations to the magnitudes and durations which are elaborated on in the subsequent section.

Figure 1. Pulse definition

PulseID

This must be an integer greater than or equal to zero. This ID will be used in the StimulationTriggers parameter.

Pulse Amplitude

The pulse amplitude defines the amplitude of the main pulse in units of µA. The counter pulse will have a negative amplitude that is one-quarter of the magnitude of the main pulse.

The valid values of this parameter are in the range 0 to 6120 µA. The granularity changes for smaller amplitudes as follows:

  • amplitude <= 3060 µA: step size of 12
  • amplitude > 3060 µA: step size of 24

This leads to a set of acceptable values that looks like: [0, 12, ..., 3048, 3060, 3084, ... 6096, 6120] You can define this parameter not to be one of the acceptable values in this range, but it will be rounded to the nearest valid value, and other parameters will be varied to maintain charge balance.

Pulse Duration

The pulse duration defines the duration of the main pulse in µs. The counter pulse will have a duration that is four times longer than the main pulse duration. Pulse duration values are set in steps of 10 µs. The acceptable range is between 10 and 2550 µs. Again, if the provided value is not a multiple of 10, it will be rounded to the nearest valid value, and other parameters will be modified to maintain charge balance.

Dead Zone 0

Holds the duration of the pause between main and counter pulse in µs. Values can be set in steps of 10 µs. The acceptable range is between 10 and 2550 µs. The same duration dead zone will also occur after the counter pulse.

Dead Zone 1

Holds the duration of the pause after the pulse was delivered. Values can be set in steps of 80 µs. The acceptable range goes from 10 to 20400 µs. Note that the steps are starting from 0 while the minimum value is 10 µs. This leads to a set of acceptable values that looks like: [10, 80, 160, 240, ... , 20400] µs.

StimulationTriggers

This parameter defines when stimulation is applied, what pulse is used, how many pulses are applied, and the source and destination locations of the stimulation. These parameters are defined in the rows of this matrix with labels

Trigger

This must be a BCI2000 expression. When this expression evaluates true during the run, the stimulation is applied.

PulseID

The second row should contain a valid PulseID that is to be used.

Source Ch

The third row is an embedded list that defines the source electrodes.

Destination Ch

The fourth row is also an embedded list that defines the destination electrodes. Specify 0 to include the ground electrode as the destination channel.

Pulse Repetition

The fifth row defines how many times that pulse is repeated. The max is 255. In between each repeated pulse there is a 10 µs delay.

Train Frequency (optional)

The sixth row defines the frequency of the train. This is implemented by determining the amount of downtime after the pulses are done, in a resolution of microseconds. So if your desired frequency produces a desired wait time with a resolution of less than a microsecond, this will be rounded to the nearest microsecond.

Train Repetition (optional)

The seventh row defines how many times the entire train is repeated, at the frequency set by the previous row.

Figure 1. Stimulation train definition

Note: If a train is not desired, you can either set Train Frequency and Repetition to 0, or delete those 2 rows.

Hardware limitations

Minimum Maximum
Pulse Amplitude (µA) 0 6,120
Pulse Duration (µs) 10 2,550
Dead Zone 0 (µs) 10 2,550
Dead Zone 1 (µs) 10 20,400
Pulse Repetitions 1 255
Train Repetitions 0 65,535
Pulse Frequency (Hz) 43.57 200
Train Frequency (Hz) ~0.02 Pulse Frequency
Compliance Voltage (V) -11 5

Device Parameters

DeviceInfo

This parameter cannot be edited and is automatically populated with information returned from the device, such as device type, device ID, and the firmware version.

StateInfo

This parameter cannot be edited and is automatically populated with information regarding state units and their multiplier. The device provides information such as humidity, temperature, control value, etc., which are recorded in BCI2000 states (see state information on this page for a complete enumeration of states). The device provides these values with floats, but BCI2000 states can only be integers. The multipliers defined in this parameter are used to increase the amount of precision in the state values. To approximately recover the original float values with the units defined in this parameter, divide each state by its corresponding multiplier.

States

The states encode auxiliary information returned from the Cortec implant. The device provides this data in floating point numbers, however BCI2000 can only record integers to it's states. To maintain some precision, these floats are multiplied by constants, then recorded to the states as integers. To approximately recover the original data, divide the state by its corresponding constant. Constants are shown in the following table.

State Constant
ImplantVoltage 1000
ImplantHumidity 100
ImplantControlValue 100
ImplantPrimaryCoilCurrent 1000
ImplantTemperature 100

ImplantLostSample

The communication protocol the device uses does not re-send lost data. This state annotates what samples were lost in the bio-signal data. Currently, lost samples are made up by duplicating the previous sample.

ImplantVoltage

16 bit state that changes when new supply voltage value is received from the implant. After dividing the integer state value by the the voltage multiplier defined in the StateInfo parameter, the units are in volts.

ImplantHumidity

16 bit state that changes when new humidity value is received from the implant. Units in %rh.

ImplantControlValue

16 bit state that changes when new current control value is received from the external unit. The power of the implant is controlled by the external unit. The control value provides a measure of how good the coupling between the two coils is and how much more power can be provided if necessary. The value is between 0.0 and 100.0 percent, where 0.0 translates to no power and 100.0 translates to maximum power applied.

ImplantPrimaryCoilCurrent

16 bit state that change when new primary coil current value is received from the external unit. The primary coil refers to the coil inside the head piece of the external unit. Units are mA.

ImplantTemperature

16 bit state that changes when new temperature value is received from the implant. Units are degrees Celsius.

ImplantStimulation

Binary state that changes when the device reports that it is stimulating.

ImplantStimulationBursts

Updates when the device reports that stimulation functions have finished. Should increment during a stimulation train.

ImplantRfQuality

8 bit state that reports the antenna quality as reported from the rf-link in dBm. To obtain the original value, subtract by 128 (2^8).

RequestedStimulation

Binary state that records when a stimulation trigger expression evaluates true. State remains true for the duration triggered stimulation. This is useful for determining the latency between when stimulation is requested and when it is actually applied. This is done by computing the difference in time between the rising edges of ImplantStimulation and RequestedStimulation states.

SCIT

To help out with creating the BCI2000 parameters, a GUI has been made which should make it easy to translate your stimulation specifications into BCI2000 parameter files. The GUI also visualizes the stimulation from three different perspectives, making it easy to tell if your parameters are really what you want. There is a Stimulation Configuration tool user reference which will further tell you how to use this tool.

Stimulation Latency

Tests were conducted for 100 pulses, with an ISI of 10 seconds.

Stimulation latency numbers:

  • Persistent functions: 13 ± 1 ms
  • Persistent commands: 11 ± 1 ms
  • Volatile commands: 60 ± 30 ms. Split into the 2 groups, the lower one is 48 ± 3 ms and the higher one is 174 ± 3 ms

As explained above, volatile commands are uploaded right before stimulation, which leads to the increased latency and jitter.

See also

User Reference:Filters, Contributions:ADCs