BrainAccess Connect C/C++ API Reference

SSVEP classifier

This section describes functions available for accessing the SSVEP classifier algorithm.

The steady-state visual evoked potential (SSVEP) is a repetitive evoked potential that is produces when viewing flashing stimuli. Activity at the same frequency as the visual stimulation can be detected in the occipital areas of the brain.

SSVEP classifier can recognize steady-state visual evoked potentials (SSVEP). Meaning that given a visual stimulus flickering at a constant frequency, SSVEP classifier can determine if the user is currently looking at it. This can be used as motionless control, where the user chooses an option by looking at the corresponding visual stimulus.

The workflow of using SSVEP classifier is as follows:

  1. Acquisition Setup. We recommend using 2-6 electrodes in the ocipital region (O1, O2, P3, P4, Oz, Pz) with reference at Fp1 and bias at Fp2.

  2. Initialize classifier with desired frequency combinations, prediction time interval and EEG sampling rate.

  3. Get predictions on input data

See all function descriptions for more information.

Functions

BA_BCICONNECT_DLL_EXPORT size_t ba_bci_connect_ssvep_classify (const double *x, size_t n_time_steps, size_t n_chans, double sampling_rate, const double *freqs, size_t n_classes, double *score) NOEXCEPT

Classifies EEG SSVEP (steady state visually evoked potentials).

Classifies EEG SSVEP (steady state visually evoked potentials) into a given set of class frequencies.

Parameters:
  • x – a pointer to an array containing EEG signals from different channels, channel n data should statrt at position x[n_chans*n_time_steps], total length of x array should be n_chans*n_time_steps

  • n_time_steps – number of time samples in each channel recording

  • n_chans – number of recording channels

  • sampling_rate – sampling rate in hertz.

  • freqs – a pointer to frequency class array.

  • n_classes – a number of frequency classes.

  • score – address where classification score will be stored.

Returns:

Best matching class, selected from given frequency class array.

Visual P300 classifier

This section describes functions available for accessing the Visual P300 classifier algorithm.

The P300 (P3) wave is an event-related potential (ERP) component elicited in the process of decision making. The P300 is thought to reflect processes involved in stimulus evaluation or categorization. It is usually elicited using the oddball paradigm, in which low-probability target items are mixed with high-probability non-target (or “standard”) items. When recorded by electroencephalography (EEG), it surfaces as a positive deflection in voltage with a latency (delay between stimulus and response) of roughly 250 to 500 ms. The signal is typically measured most strongly by the electrodes covering the parietal lobe [1] . This can be used as lie detector [2], speller [3] etc.

The workflow of using Visual P300 classifier is as follows:

  1. Acquisition Setup. 8 electrode setup (F3, F4, C3, C4, P3, P4, O1, O2) with reference at Fp1 and bias at Fp2 is required.

  2. Initialize classifier with future use number of repetitions (responses to the same stimulus, 1 or 3 trials)

  3. Get predictions on input data sampled at 250 Hz

See all function descriptions for more information.

Functions

BA_BCICONNECT_DLL_EXPORT ba_bci_connect_error ba_bci_connect_p300_init (void **p, uint8_t repetitions) NOEXCEPT

Initializes neural network model for P300.

This function initializes the P300 model with the number of repetitions specified. Number of repetitions can be either 1 or 3, where 3 repetitions mean a stimuli being observed three times at different time points and three of these signals are collected and concatenated together.

Parameters:
  • p – Pointer to P300 model instance

  • repetitions – number of repetitions to observe for calculating the score for P300 signal.

Returns:

Error code

BA_BCICONNECT_DLL_EXPORT ba_bci_connect_error ba_bci_connect_p300_predict (void *p, const double *measurements, float *result) NOEXCEPT

Predicts the score of singal being classified as a P300 wave.

This function predicts the score of singal being classified as a P300 wave. The signal should be of lenght 176 times number of repetitions selected.

Parameters:
  • measurements – a pointer to an array containing EEG signals with dimensions [8, 176 * repetitions] where 8 is the number of channels and 176 * repetitions is 176 signal time steps multiplied by number of repetitions selected at model initialisation.

  • result – Result out parameter

Returns:

Error code

BA_BCICONNECT_DLL_EXPORT void ba_bci_connect_p300_free (void *p) NOEXCEPT

Deletes a P300 instance.

Call exactly once to avoid undefined behavior and memory leaks

Parameters:

p – P300 instance to destroy