From brain signals to computer commands, part 2: processing brain signals

Younes Subhi
6 min readFeb 13, 2021
Image source: Forbes.com

An introduction to signal processing of neural recordings for Brain-Computer Interfaces

Without proper signal processing, recorded data from the electrical activity of the brain, won’t be of much use.

For the sake of simplicity, this article will mainly focus on signal processing for EEG recordings. (although much of it is transferrable)

EEG (and in general, other neural recording methods) give very small signals (low amplitude) and are often masked by other unwanted signals (artifacts). To extract signals representing brain activity, computational processing techniques can be utilized. This includes steps like signal scaling and applying different filters to the signal.

In short, signal processing is the computational manipulation of recorded signals to extract features that represent brain activity.

In detail, the purposes could be:

  • the removal of unwanted signal components that are corrupting the signal of interest
  • Dimensionality reduction
  • Extracting information (signal amplitude, frequency, or phase*)
    *Phase: the phase of wave signals is the relationship between two or more signals/waves that share the same frequency and amplitude, but are not aligned.
  • Producing alternative representations of the signal (in time or frequency domains)
Two signals with a phase difference

Signal processing is a necessity

Let’s recite key points up to now:

  • Neural recordings are sensitive to artifacts = the signals are very noisy (especially EEG)
  • Signal processing is a computational method of ‘cleaning’ the unwanted signal noise
  • By cleaning the unwanted noise, features in the signal can be extracted, and in turn, correlated with cognitive function (classification).
Components of a Brain-Computer Interface

That’s why signal processing is a necessity for obtaining EEG signals which are useful in Brain-Computer Interfaces (or in fact useful for anything!).

Types of signal processing methods

A wide range of different signal processing methods exist. Whole books are written on not only signal processing itself but literally hoards of books on each subtopic of biomedical signal processing.

I will shortly touch upon different signal processing methods that are relevant for analyzing EEG data.

  • Digital Signal Processing is the branch of signal processing concerned with systems that transform one signal to another (aka filters)
  • Linear Time-Invariant Systems (LTI) and spectral filters is another branch of signal processing, which are one of the most developed branches with optimally designed solutions
  • Probabilistic Signal Processing and adaptive filtering are among the more advanced areas (Kalman filters, Particle filters, Recursive Least Square filters, xDAWN, axDAWN, and more)
  • Finally, Sparse Signal Processing (such as sparse recovery and compressive sensing) is a relatively new branch of signal processing with applications to BCIs
A raw EEG signal that is filtered / undergone signal processing

Types of filters for EEG signals

There are several categories of filters. The major filter classes are:

  • Static filters
Signal squaring is a type of static filter. Squaring [b(t) = e²(t)] is a useful step in calculating the variance of the signal
  • Temporal filters

Temporal filters transform a multichannel signal, such that each channel depends only on a specific channel. Examples include time windowing (moving average), wavelet transformations (such as Fourier transformations, FT), and more.

A Fourier Transformation loses the time-information of the signal. Wavelet transformations represent signals as linear combinations of finite basis functions called wavelets. Each wavelet is a scaled and translated copy of a single main (sometimes ‘mother’) wavelet. This allows for multi-resolution analysis.

In special cases, spectral filters can be used. Spectral filters are temporal filters designed to modify the spectrum of the signal, such as a Fourier Analysis (expressing any signal as an infinite sum of sines and cosines) or a Finite Impulse Response filter (performs a convolution between the signal and the filter coefficients). Spectral filters include high-pass, low-pass, band-pass, notch filters, etc. Their main use in BCIs is to isolate oscillations of event-related potentials (EVPs) of interest.

Below, an example of a Moving Average (MA) filter is shown:

MA is effectively a smoothing operator (low-pass filter). It could be argued that it is a simple type of spectral filter.
  • Spatial filters

Spatial filters transform multichannel signal X such that each channel Y only depends on X. Most spatial filters are linear. I.e. X = M · Y for some matrix M.

The main function of linear spatial filters in BCIs is that they can remap channel signals to approximate source signals.

Types of spatial filters are: Re-referencing, Laplacian Filtering, Bipolar Filtering, Independent Component Analysis’ (ICA), Principal Component Analysis’ (PCA) ❤️️️❤️️️, Common Spatial Filters (CSPs) ❤️️️❤️️️❤️️️. (I must admit that I’m partially biased and in love with the latter three, which are all dimensionality reducing filters)

Types of spatial filters.

Principal Component Analysis (PCA): converts high-dimensional input data into a smaller set of linear “features”, by projecting data onto a lower-dimensional linear space. Such as 2D to 1D (for EEGs, 256 EEG channels into 10 features). Features are determined by directions in the data with maximal variance. Data can be reconstructed, with some error margins, by the linear combination of these features.

PCA applied to EEG signals

Independent Component Analysis (ICA): ICA can be used to recover the ‘independent’ sources of mixed EEG signals. This is mainly used for artifact removal in EEG signals, e.g. identifying and removing EMG and ECG signals.

Common Spatial Pattern filters (CSP): CSP are spatial filters designed to recover source activity, such as the motor cortex source activity in relation to a motor or motor imagery task. CSPs are proper spatial filters that provide signals which are easy to classify. The goal is to design spatial filters that lead to optimal variances for the discrimination of populations of EEG related to cognitive activity. This filter can significantly enhance the discrimination ability between the classes by maximizing the variance for one class while minimizing it for the other class.

I would love to do deep dives into the math behind CSPs and go into details of sub-CSP type filters (e.g. common spatio-spectral pattern CSSPs, CSSSP, SBCSP). Let me know if this is of interest in the comment section!

Comparison of PCA vs CSP feature extraction in 2D plots

Alright.. my love for CSPs might have taken overhand.. To summarize, CSP filters are effective methods of feature extraction for EEG measurements where the goal is the classification of cognitive signal sources.

The next posts in the series will be on signal acquisition in non-invasive (primarily EEG) based BCIs.
In the same series:
* From brain signals to computer commands, part 1: acquiring signals
* A short introduction to Neural engineering, Neurotechnology & Brain-Computer Interfaces

That’ll be it for this post. Let me know what topic to cover next in the comments below. Feedback is likewise highly appreciated 🙌

--

--

Younes Subhi

Neural-engineer 🧑🏻‍💻 soon to be MD 🩺 Neuro-curious 🧠 everything brains, neurotechnology, transhumanism, psychiatry and philosophy.