Jump to content

Contributions:CortecADC

From BCI2000 Wiki
CorTec Brain Interchange Implant

CortecADC is a source module that allows for intra-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

  • Nicholas Luczak (luczak@neurotechcenter.org)
  • William Engelhardt (engelhardt@neurotechcenter.org)
  • Alexander Belsten (belsten@neurotechcenter.org)
  • Markus Adamek (adamek@neurotechcenter.org)
  • Christian Stolle (christian.stolle@cortec-neuro.com)

Source Code Revisions

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

BCI2000 Version History

Date Revision Note Contributor
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) Belsten
01/01/2023 R7133 Updated API to version 1.0.200. Engelhardt
03/08/2023 R7251 Stimulation functionality added Engelhardt
05/19/2023 R7367 Impedance measurement enabled Engelhardt
10/26/2023 R7679 Stimulation latency vastly improved Engelhardt
02/20/2024 R7847 Version 1.0.230 added. Can change between versions in CMakeLists.txt file Stolle
08/09/2024 R8313 Version 1.0.238 added Stolle
01/17/2025 R7679 Interpolation filter added to interpolate lost samples Engelhardt
06/25/2025 R8915 All listener states were changed to events Engelhardt
04/13/2026 R9351 Refactored stimulation to be more in line with Cortec and BCI2000 standards. Nicholas Luczak

Cortec API Version History

Cortec is continually updating their devices with new API versions. In BCI2000, we currently support versions 1.0.200, 1.0.230, and 1.0.238. Each Brain Interchange Communication unit (BIC) is only compatible with one API version. To find your compatible version, connect the USB drive that comes with your BIC. Look under:

  1. Software folder: Each executable has the API version. E.g., Bicapi_setup_1.0.200-bicapi-setup-1.0.200-rev35926.exe
  2. Manuals foder: Appendix1_BIC_Application_Software_Short_Manual.pdf. On page 3, in Table 1, the third row contains the compatible version.

Here are some differences between the versions. As the device is always improving, the newest version will have the most features.

Features 1.0.200 1.0.230 1.0.238 1.0.260
Matlab API
C/C++ API
Stimulation modes
ASIC Noise Detection Mode
Monopolar stimulation (Ch → GND)
Measure GND impedances
Self-tests
Low noise recording

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.

Installation

  1. Install BCI2000
  2. Insert the Cortec USB drive that comes with the Brain Interchange (BIC) device. Under Software, run the Bicapi_setup... executable
  3. Run a batch file with CortecADC as your Signal Source!
  4. If you receive an error, and it states your API version is incorrect, you need to change it. Locate the CMakeLists.txt under BCI2000/src/private/SignalSource/Cortec. You must change Line 12, where it states set(BICAPI_VERSION 200). Change 200 to 230 or 238, depending on your device (see details above).

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.

LogCortecBinaryFiles

Enable or disable binary logging of raw CorTec communication data. When enabled, a binary log file is written to the BCI2000 session directory with the name: YYYYMMDD_HHMMSS_CortecAdcLog.bin This file contains raw communication packets between the Brain Interchange Communication unit and the implant and is primarily useful for low-level debugging and support from CorTec. Default value: 1 (enabled) Disable this parameter if binary logs are not needed or disk space usage is a concern.

LogStimulationEvents

Enable logging of stimulation configuration and execution events to the Operator Log. When enabled, detailed information about stimulation functions, trigger evaluation, and stimulation execution will be printed using bciout messages. This is useful for debugging stimulation timing and verifying correct parameter interpretation. Default value: 0 (disabled)

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

The figure below summarizes the BCI2000 stimulation paradigm used by CortecADC. A BCI2000 expression (typically based on StimulusCode) acts as a Stimulation Trigger. When a trigger evaluates true, one or more Stimulation Commands are executed. Each Stimulation Command is composed of one or more Stimulation Functions (with optional bursts, pauses, and repetitions), and every Stimulation Function is defined by a Stimulation Pulse with pulse amplitude, pulse duration, and dead-zone parameters. Use this figure as a mental model for interpreting the StimulationPulses and StimulationTriggers parameters described below.

Figure 2. Summary of the BCI2000 stimulation paradigm. A BCI2000 trigger expression (top, based on StimulusCode) launches a Stimulation Command (red, left), which is built from repeating Stimulation Functions, optional bursts, and pauses. Each Stimulation Function is defined by a Stimulation Pulse (blue, right), parameterized by Pulse Amplitude, Pulse Duration, Dead Zone 0, and Dead Zone 1.

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, allowing stimulation commands to be defined with virtually no size constraints. However, the stimulation configuration must be uploaded immediately before execution, which introduces additional latency. Furthermore, the configuration is cleared after each command, resulting in increased latency for repeated executions. This mode is best suited for iterating across multiple stimulation configurations and designing complex stimulation paradigms.
Figure 3. Figure demonstrating volatile command functionality
  1. Persistent Command: This preloading mode enables uploading up to 16 stimulation functions to the device and executing them in a predefined order (the list of FunctionID(s) in StimulationTriggers must be the same). The stimulation command remains in memory after execution and can be repeated, making it best suited for delivering continuous or continuously repeated stimulation.
  2. Persistent Functions: This preloading mode enables uploading up to 16 stimulation functions to the device and executing them individually by calling the stimulation function ID. The device executes only one stimulation function (the indexed one) without repetition. This mode is best suited for rapidly iterating over subsets of stimulation pulses in single-pulse stimulation settings.
Figure 4. Figure demonstrating Persistant Function functionality

There cannot be any train settings (Train frequency and Train repetitions), so the StimulationTriggers must not have those rows. Also, StimulationTriggers must not have more than 16 columns, as that is the highest number of configurations that can be stored on the device. 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 stimulation functions. Each column defines a stimulation waveform and electrode configuration. Each function consists of:

  • Pulse waveform parameters
  • Electrode mapping
  • Repetition behavior

Rows are defined as follows:

FunctionID

Integer identifier for this stimulation function. This ID is referenced in the StimulationTriggers parameter.

Pulse Amplitude

Amplitude of the stimulation pulse in µA. Valid range: 0 to 6120 µA

Pulse Duration

Duration of the main pulse in µs. Valid range: 10 to 2550 µs

Dead Zone 0

Pause between main pulse and counter pulse.

Dead Zone 1

Pause after pulse delivery.

Anode(s)

Embedded list specifying source electrodes. Example: { list 1 18 19 }

Cathode(s)

Embedded list specifying return electrodes. Use 0 to reference ground.

Pulse Repetition

Number of times the pulse is repeated within a function. Range: 1 to 255

Burst Repetition

Number of times the function is repeated. Range: 1 to 255

StimulationTriggers

Defines when stimulation functions are executed. Each column contains:

Trigger

A valid BCI2000 expression. When this expression evaluates to true, the associated stimulation function(s) are executed.

FunctionID(s)

List of FunctionIDs that should execute when the trigger evaluates true. Example: StimulusCode==1 { list 1 3 } This means: Execute FunctionID 1 followed by FunctionID 3 whenever the trigger becomes true. Note: Electrode configuration and repetition settings are defined in StimulationPulses, not here.

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.

PauseStimulation

Binary state that pauses stimulation execution without stopping data recording. When this state is set to 1, trigger expressions are ignored and no stimulation will be delivered. When set to 0, stimulation resumes normally. This allows temporary suspension of stimulation during a recording session without restarting the system.

Stimulation Logging

When LogStimulationEvents is enabled, stimulation activity will be written to the Operator Log. Logged information includes:

  • Stimulation mode
  • Function definitions
  • Trigger matches
  • Stimulation execution events

This information is useful for:

  • Debugging stimulation timing
  • Verifying correct function configuration
  • Investigating unexpected stimulation behavior

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.

Template Parameter Files

The following .prm files are stimulation parameter fragments — they contain only the Stimulation section (EnableStimulation, StimulationMode, MeasureImpedance, LogStimulationEvents=1, StimulationPulses, StimulationTriggers). Load one on top of an existing CortecADC configuration in the BCI2000 config window to swap in a stimulation paradigm without overwriting your source/storage/visualization settings.

Volatile Commands (StimulationMode = 0)

  • complex_stim.prmComplex multi-function stimulation paradigm. 20-function StimulationPulses matrix mixing pause and stim functions, monopolar (cathode=0/ground) and multi-electrode anode/cathode lists, amplitudes 50–300µA, durations 50–500µs, and reps up to 255 × 100. Two triggers: StimulusCode==1 runs functions [1, 2] with CommandRepetition=5; StimulusCode==2 runs functions [3…20] once. Useful for exercising the volatile-mode flexibility on a long, structured command.
  • stim_100Hz_1min.prm1-minute 100 Hz volatile stim train, three electrode targets. Three "100Hz" stimulation functions (FunctionID 1/2/3) all 250–150µA, 200µs, 100 pulses × 60 bursts (≈1 min at 100 Hz each). Triggers labeled ANT, HPC, and Cortical1 map StimulusCode==1/2/3 to those functions, so the same 100 Hz / 1 min train can be steered to anterior thalamus, hippocampus, or cortical electrodes.

Persistent Command (StimulationMode = 1)

  • persistant_100Hz_1function.prmSingle-function 100 Hz preloaded persistent command. One stimulation function "100Hz" (250µA, 200µs, anode 1 / cathode 2, 200 pulses × 30 bursts ≈ 1 min of 100 Hz). One trigger "Sequence1" on StimulusCode==1, CommandRepetition=1. Demonstrates the simplest persistent-command setup: preload once, fire on cue.
  • stim_1Hz_1min.prm1 Hz × 1 min persistent-command train. Two functions, "1Hz" and "pause": a 250µA / 250µs single pulse (anode 1 / cathode 2) and a ~990 ms pause (IsPause=1, duration 990,000µs). One trigger "1Hz" on StimulusCode==1 runs [1Hz, pause] with CommandRepetition=60 → 60 pulses spaced ~1 s apart = 1 Hz for 1 minute.
  • stim_5Hz_1min.prm5 Hz × 1 min persistent-command train. Same structure as the 1 Hz file but with a ~190 ms pause (190,000µs); trigger on StimulusCode==1 with CommandRepetition=300 → 300 pulses at ~200 ms spacing = 5 Hz for 1 minute.

Persistent Functions (StimulationMode = 2)

  • persistant_function_single_pulse.prmFour indexed single-pulse persistent functions. Functions SinglePulse1–4 vary independently in amplitude (250 / 375 / 250 / 125 µA), pulse duration (250 / 250 / 200 / 500 µs), and electrode pair (10/11, 1/2, 3/5, 7/8). Triggers map StimulusCode==1…4 directly to FunctionID 1…4 so each StimulusCode value fires a different preloaded single pulse — ideal for rapid iteration over a small set of distinct pulses.
  • singlePulse.prm16 indexed single-pulse persistent functions, one per bipolar pair. 16-function StimulationPulses matrix of 250µA / 250µs single pulses across electrode pairs 1/2 … 15/16, plus an 8-vs-8 final function. Triggers map StimulusCode==1…16 1:1 onto FunctionID 1…16 (CommandRepetition=1) so each StimulusCode value fires a single pulse on its corresponding pair.

Matrix Parameter Files (.bmt)

.bmt files are BCI2000 matrix parameter exports. Load one into a matrix parameter (e.g., StimulationPulses). These templates only populate the corresponding matrix; everything else in the configuration (StimulationMode, triggers, ReferenceCh, etc.) is unaffected, so they can be reused across any stimulation mode.

  • SinglePulse_withPause.bmt — StimulationPulses matrix with four functions in sequence: a 1 s leading pause, a 250µA / 250µs single pulse on anode 1 / cathode 2, a 250µA / 250µs single pulse on anode 3 / cathode 5, and a 2.5 s inter-stimulation pause. Demonstrates how to interleave pause functions with stimulation in a single command.
  • 100Hz.bmt — StimulationPulses matrix with three functions: a 250µA / 200µs 100 Hz train (anode 1 / cathode 2, 100 pulses × 60 bursts), a 1 s pause (amplitude 0, dead zone 1 = 1,000,000µs), and a second 150µA / 200µs 100 Hz train (anodes 3,4 / cathodes 5,6, 100 pulses × 60 bursts). Use for two-train protocols separated by a fixed pause.

µZeus

In order to use the new µZeus headpiece simply change the BICVERSION number on line 12 of the CMakeList.txt located in the project folder to use version 274 of the API. ie., set(BICAPI_VERSION 274)

See also

User Reference:Filters, Contributions:ADCs