Subscribe
Join us and keep tuned to what's hot in Neuroscience! From EEG basics to EEG applications and transcranial Current Stimulation (tCS) and transcranial Direct Current Stimulation (tDCS).

Your email:

Search

Follow Me

Neuroscience, tCS and EEG blog

Current Articles | RSS Feed RSS Feed

EEG Signal Processing for Dummies

 

As promised in my previous post about Event-Related Potentials, I will explain the basics and standard steps commonly used in the analysis of EEG signals. There is a lot of literature and many concepts are involved in the field of EEG signal processing, and some of them can get very technical and difficult. That is why my aim in this post is to try to give a general overview of the different concepts without getting into too much detail.

Steps in EEG Data Analysis

Figure 1: Basic steps applied in EEG data analysis

1. Preprocessing

As we can see from figure 1, the first thing we need is some raw EEG data to process. This data is usually not clean so some preprocessing steps are needed. These often include the application of filters, such as a high-pass filter to remove the DC components of the signals and also the drifts (usually a frequency cut-off of 1 Hz is enough). A low pass filter can also be applied to remove the high frequency components. In EEG we currently rarely study frequencies above 90 Hz which correspond to the Gamma range. There are many other preprocessing techniques such as Electrooculogram (EOG) artefact correction, which might be necessary to apply if the subject under recording is keeping his/her eyes open. The reason is that blinks and eye movements generate strong electrical fields that affect our EEG recordings. Once our signals are clean, i.e. preprocessed, it is quite common to cut them in epochs of a few seconds and then extract features out of each one of these. This allows us to have a large number of features from a single EEG recording, which is always good when performing statistics or when applying classifiers.

2. Feature Extraction

The next step could be considered the most important one: feature extraction. EEG signals are complex, making  it very hard to extract information out of them using only the naked eye. Nowadays, thanks to computers, we can apply complex automatic processing algorithms that allow us to extract 'hidden' information from EEG signals. There are several techniques such as time domain features (mean, standard deviation, entropy, …), frequency domain features (Fourier transform, wavelets, …) and finally synchronisity features, which looks to the relationship between 2 or more EEG channels (coherence, correlation, mutual information, ….), just to mention a few.

There are other feature extraction methods that are worth mentioning, such as EEG tomography, that allows us to compute the regions inside the brain that are active (applying the so-called inverse-problem approach). This in turn usually needs a high number of electrodes (at least 32, although even better with 64 or more) in order to achieve a decent spatial resolution.

EEG Signal ProcessingFigure 2: Example of a graph. Each node would represent an EEG electrode. If two nodes are connected, it means that the corresponding EEG signals are similar enough.

We can also apply more advanced methods such as converting our EEG recording into a graph in which each node represents an electrode and the connections of these nodes depend on the similarity of the EEG signals of each electrode. Once we have our graph we can then analyse its properties using standard complex network analysis techniques.

3. Feature selection

The next step, called feature selection, is optional and  is used in the case in which we have a large number of features and we want to study the ones that are more relevant for our study. Imagine that we want to look for possible differences in the EEG in two different conditions: relaxed versus stressed. We can apply feature selection techniques to find out among our large number of features the ones that are more discriminative between these 2 conditions. We can apply statistical methods such as principal component analysis (PCA) or more complex techniques such as genetic algorithms.

4. Classification

Once we have our (selected) features we can plot them, or apply some statistics to them, close our research and write a potentially nice paper, or even go one step further applying the classification step. Using machine learning techniques, we can train a classifier to recognise from among our features which ones belong to one class (or condition, i.e. relaxed,) or to another (i.e. stressed condition). This is a very powerful technique and it is extensively used in EEG data analysis. For instance, all brain-computer interface systems follow this common scheme, in which the classification step is performed in order to decide what the user is thinking.

Well, that's all for now. I hope this post gives a helpful overview. You can dive deeper into EEG signal processing concepts by clicking on the hyperlinks provided in the text above, and you can also leave any comments or doubts below, and they will be answered as soon as possible.

Figure 2 credit: ilamont.com via photopin cc

New Call-to-action

Comments

I have an eeg signal. my prject is to monitor the cognitive status from the eeg signal.i have to use PIC micro controller to process data. how should i read the recorded data and how should the filtering techniques be applied to separate alpha beta gamma waves.
Posted @ Friday, December 14, 2012 8:22 AM by Archana
Dear Archana, 
 
What EEG sensor do you plan to use? Why do you need to use a PIC microcontroler? I am not sure you will be able to extract relevant features with it. Maybe a FPGA would be more suited for your project. 
Regarding the filtering techniques, you can use several band pass filters and compute the spectral power for each relevant frequency band. That should not be very complex.  
Good luck, kind regards and let me know if I can be of further help!
Posted @ Friday, December 14, 2012 9:01 AM by Alejandro Riera
Great post for beginners! How do EEG signals effect from other signals? For example, would using wireless room to room communicator near by the EEG receiver effect the EEG signals? If so, how can we solve this issue? Thanks!
Posted @ Monday, January 07, 2013 1:11 AM by fay
Dear Fay.  
Thank you for your comment. I am not an expert in that field, but I guess the answer is that it depends on the EEG amplifier you are using and how well it is shielded to interferences. In the case of the wireless ENOBIO EEG sensor, which I have extensively used, the wireless communication is done via Bluetooth and I have never noticed interferences with wifi. Also ENOBIO is quite robust to 50/60 Hz line noise interferences, but even if some residual 50/60 Hz shows in the signal, you can always apply a notch filter to remove it. I am not sure if I have answer your question. If not, please let me know your doubts with more detail. Kind regards!
Posted @ Friday, January 11, 2013 2:33 PM by Alejandro Riera
Terrific post, Alejandro! I'm curious about the applications of the Genetic Algorithm to BCI - do you happen to know (I know it was a casual mention - so it's fine if you don't) of a particular attempt at applying GA to EEG data? It doesn't seem like a natural fit to the problem, so I'm curious as to how it was applied.
Posted @ Saturday, January 12, 2013 8:55 AM by Chuck
Dear Chuck, 
 
Thank you for your comment! As you know genetic algorithms (GA) are often used for optimization problems. If in your EEG analysis you apply a classification step (to try to differentiate between 2 different EEG data sets for instance), you can use the classification rate as the fitness function of your GA. Your population would be your feature space. In other words, you can use a GA to select the EEG features that maximize your classification rate. You can find an example of this in my PhD thesis Computational Intelligence Techniques applied to Electrophysiological Data Analysis. In the second research I present, I seek for the best features that maximize the classification rate between psychotic patients and controls. It is important to be careful with the well known over-fitting problem! You might end up with a set of features that work very well for your particular dataset, but they may behave poorly for new data sets, i.e. the generalization might not be guaranteed. This issue and how to avoid it is explained in the PhD. Kind regards 
 
Alejandro
Posted @ Sunday, January 13, 2013 11:23 PM by Alejandro Riera
sir i want know how to decide eeg signals inpaired or normal how?????
Posted @ Tuesday, April 30, 2013 6:02 AM by kumar
Dear Kumar, 
 
You mean how to know the quality of your EEG signals? Usually a visual inspection of the signal should be enough to see if there is something wrong with some of your EEG channel. On the other hand some amplifiers offer some quality check measures based on the impedance, on the offset (BIOSEMI for instance) and on other parameters such as ENOBIO. I hope this helps!
Posted @ Tuesday, May 07, 2013 8:09 AM by alejandro
Dear Alejandro 
Thank you so much for the excellent post! 
It is very helpful for me. I am very interested in this filed.  
I was wondering what kind of software you are using for EEG signal processing, and do you have any suggest where I can find an EEG database.  
 
Best Regards 
 
Jim
Posted @ Friday, June 07, 2013 3:31 PM by Jim
Dear Jim, 
 
Thank you for your nice comment. For EEG data analysis I mostly use Matlab. For BCI applications I have used LabView, and also BCI2000, which is an interesting open source application. 
 
Regarding available databases, you can have a look at this post, written by my colleague Anton. 
 
I hops that helps! 
 
Kind regards 
Posted @ Saturday, June 08, 2013 11:18 PM by Alejandro
Thank you for your reply. Alejandro. I appreciate. 
 
Jim
Posted @ Sunday, June 09, 2013 5:01 PM by Jim Cui
Thank you for the great post! I am using Emotiv TestBench and although I can see eeg data, I was confused in how to go about in analyzing what I am seeing. I was wondering which program you would recommend for preprocessing and filtering?
Posted @ Saturday, June 22, 2013 10:20 AM by Tooba
Dear Tooba, 
 
Thank you for your nice comment. In my particular case I have been using Matlab which has a nice Signal Processing tool box. The drawback is that it is a proprietary SW. You can also try Octave which is similar (and open source), but I have not use it much.
Posted @ Tuesday, July 02, 2013 10:43 AM by Alejandro Riera
Mr. Riera, 
Really a nice and useful blog, Thanks for it. Signal acquired from a 14 channel, 128Hz sampling frequency Emotiv device. After ICA analysis of raw EEG data, how to process the data using wavelet? Say a matrix of(14x2560) has been got. Reshaping it to (1x35840)for wavelet decomposition. Whether my reshaping is correct? If wrong how to derive wavelet coefficients for classification? Thanks in advance.
Posted @ Friday, July 19, 2013 2:20 AM by Sivashankar
Dear Sivashankar, 
 
Thank you for your comment. I am not an expert in Wavelet analysis, but I think what you should do is to treat your channels separately and extract the wavelet coefficients for every channel, i.e. no need to do a reshaping. Good luck and let me know if you need further help. Regards
Posted @ Saturday, July 27, 2013 9:37 AM by Alejandro Riera
thanks alot that really helped me and gave me an idea how to start my final year project
Posted @ Sunday, September 08, 2013 9:26 AM by Saba Ahmed
I am using Emotiv EPOC to capture the EEG data. I read your post and it was seriously very helpful. What I do not understand is how can each step be done?
Posted @ Wednesday, October 16, 2013 5:58 AM by John Demetriou
dear John, Thanks for your comment. EEG signal processing can get quite complex. In this post I meant to provide an general overview. In order to perform each step, first thing you need is a Signal Processing SW (such as Octave, EEGLAB, MATLAB) from where you can use their inbuilt routines to save you a lot of time. In any case, if you can be more specific I can try to get deeper in my explanations. Thanks!
Posted @ Sunday, October 20, 2013 11:42 PM by Alejandro Riera
Dear Alejandro, thanks for your reply. I have MATLAB installed on my pc. How do I perform the low pass and high pass filters on my EEG data. Plus the data are recorded using EMOTIV Epoc if that helps and they are saved in a CSV file. I think my data must be in alpha, beta, delta and theta bands. How do I do it?
Posted @ Wednesday, October 23, 2013 3:11 PM by John Demetriou
Please reply to this comment as I did not subscribe to the last one, so I will not get an email when you reply. Thanks again for your help
Posted @ Wednesday, October 23, 2013 3:13 PM by John Demetriou
My task is to load the EEG signal and extract a band of 0-40Hz . Find the mean and standard deviation.If i'm not wrong extraction of a particular bandwidth is done by filters. my question is how to load the eeg signal and what is the scope of finding mean and standard deviation?
Posted @ Tuesday, October 29, 2013 10:52 PM by amulya
dear alejandro, 
i want to ask sommething about the brain signal.my task is, i need to make a final year project using brain signal to control the wheelchair.so, how can i get the analyse the signal to give the correct direction of the wheelchair? sorry if my question was not in your field
Posted @ Tuesday, January 07, 2014 6:06 AM by hanz
Dear John, 
 
There are many Matlab functions to perform filter in the Signal Processing toolbox. You can check the tutorials of this toolbox. In your case, if you want specific bands, you should use band pass filters (i.e. alpha is between 8Hz and 12Hz).  
Also, if you want to compute the power of each band, waht you should do is to compute the power spectrum of your signal for each band. You can find a lot of information about this in Matlab tutorials as well. 
Hope this helps!
Posted @ Tuesday, January 07, 2014 8:26 AM by Alejandro Riera
Dear Amulya,  
 
Yes, you are right, in your case you need to apply a low pass filter (to kill all the frequencies above 40Hz). In any case, it is a good practice to also remove the low frequencies to kill the drifts of your signals (i.e. apply a band pass filter between 1 and 40 Hz), but that depends on what you want to do. 
 
To load EEG signal depends on what format and what SW you use. It should be quite straightforward.  
 
The mean does not make much sense to me. Actually, if you remove the baseline (a common practice in EEG signal analysis), your mean would be zero. 
 
The standard deviation is related with the energy of your signal, i.e. a std = 0 means a low energy signal, a high std means an energetic signal. 
 
Hope that helps.
Posted @ Tuesday, January 07, 2014 8:51 AM by Alejandro Riera
Dear Hanz, 
 
What you want to do is a Brain Computer Interface (BCI) to control a wheel chair. You can use several approaches depending on your requirements. If you only need to code 2 commands (left and right) I would go for a motor imagery BCI approach. If you need to code more commands (move, stop, left and right), you might consider a P300 approach. You can find nice tutorials in the BCI2000 website: 
http://www.bci2000.org/wiki/index.php/User_Tutorial:Mu_Rhythm_BCI_Tutorial for motor imagery. 
http://www.bci2000.org/wiki/index.php/User_Tutorial:P300_BCI_Tutorial for P300. 
 
Regards
Posted @ Tuesday, January 07, 2014 8:58 AM by Alejandro Riera
I am very new to acquisition system. I am interested in designing an acquisition system for EEG. Could you please give insight about the reference electrode and how to view the signal in the DSO. 
 
Thanks & Regards. 
Pradeep Kumar Govindaiah
Posted @ Tuesday, January 21, 2014 10:59 PM by Pradeep Kumar Govindaiah
Deer Pradeep, 
I am not sure what you mean with DSO. What EEG system are you using? Regarding reference, a common practice is to place it in the mastoid or the earlobe (either left or right or an average reference of both) or in the tip of the nose. Where are you from? I have been living in Kerala for a while :) 
regards 
Posted @ Wednesday, January 22, 2014 6:05 AM by Alejandro Riera
Great post..!!  
My query is regarding ones cognitive ability. 
What sort of an input can EEG data give pertaining to the subjects cognitive abilities. Quite certain that it can be straight forward. But in terms of measurement of ones cognitive skills cant EEG data be of any use?
Posted @ Monday, March 24, 2014 12:20 AM by Roshan
Thank you Roshan! Your comment is indeed quite interesting and this has been explored since the very beginning of EEG. And the answer is yes! You can find in this link a paper that addresses your very comment. http://www.ncbi.nlm.nih.gov/pubmed/16043403 
Kind regards and thanks for reading!
Posted @ Thursday, March 27, 2014 4:51 AM by Alejandro
Thank you for the great info... 
May I know what is the real different between ERP and EEG can we say that ERP is part of EEG? and in term of studying the mental lexicon of morphology in a natural language, from my reading all researchers are using ERP to analyze the data, but someone told we can use EEG as well. so I was wondering is ERP another type of analysis or it is a part of EEG which we can use in some specific domains such as analyzing the word decomposition in NLP? 
 
Best regards..
Posted @ Thursday, April 03, 2014 3:25 AM by Saba
Dear Saba. Thank you for your interesting question. Event-Related Potential (ERP's) are our Brain Response To External Stimuli, recorded via EEG. So ERP are recorded using EEG but you have to present stimuli to the subject and then analyze your data with especial methods. First of all, you need to synchronize (i.e. timestamp) your stimuli with your EEG recording. You can find more on that on my related post:  
 
http://blog.neuroelectrics.com/blog/bid/237205/Event-Related-Potential-Our-Brain-Response-To-External-Stimuli 
 
And indeed ERP have largely been used for linguistic studies. You can also find some of that here:  
 
http://blog.neuroelectrics.com/blog/bid/318938/14-Event-Related-Potentials-Components-and-Modalities 
 
Kind regards
Posted @ Saturday, April 05, 2014 11:49 PM by Alejandro
Thank you very much for your clear response that really help... 
Best regards
Posted @ Monday, April 07, 2014 10:54 AM by Saba
Hello all, 
I read all the comments and all are very use full. What exactly i want to know that i have EMOTIVE neuro EEG Headset, I want to analyze the EEG signals on MATLAB. I have implement FFT algorithm and got some results, but I want to detect some of the facial expression using matlab, like eye blink detection. 
Kindly reply ASAP, i really need help for this.
Posted @ Saturday, April 19, 2014 3:24 AM by Dipanshu Payasi
Dear Dipanshu, 
 
I am not familiarized with EMOTIVE EEG Headset, but I guess it should be easy to detect both eye movements and blinks (i.e. EOG) and muscular movements (i.e. EMG). Regarding EOG, the electrodes close to the eyes should clearly record the blinks and other eye movements and those should be easy to detect since their amplitude and shape is quite characteristic. Similarly, EMG generated by closing your jaws should also be easily recorded since amplitude of the EMG is quite high (compared to EEG) and its frequency is also quite high. Good luck!
Posted @ Wednesday, April 23, 2014 3:17 AM by Alejandro
Hello, 
For an eeg signal sampled at Fs=256 Hz, with 32 channels, how frequencies band (Delta Theta Alpha and Beta) are arranged is there by channel for example channel 1 Delta, ch 2 Theta and so on, or may be different frequencies band can be found in each channel. 
My second question is how can I extract these different frequency band from that raw eeg data. 
Thank you all. 
Posted @ Friday, June 06, 2014 10:21 PM by Brahim
Hi again; 
 
I am a computer science student going to graduate soon. and I can say I have some knowledge in EEG analysis, now I am applying for my Master degree and looking for some topics in EEG, Could you please suggest me some possible and current research areas under EEG? 
 
Thank you  
Regards 
Saba  
 
Posted @ Tuesday, June 10, 2014 1:27 AM by Saba
Dear Brahim, 
 
Every channel will have a spectrum, and this spectrum is divided in frequency bands (alpha for instance is between 8-12Hz). So in fact a single channel can present different frequencies and those will change with time.  
 
To extract these frequency bands you need to compute the spectrum by performing a Fourier Transform. You can find a lot of information on how to do that online. 
 
Kind regards 
 
Alejandro
Posted @ Thursday, June 12, 2014 10:10 AM by Alejandro Riera
Dear Saba,  
 
There are a lot of interesting topics regarding EEG research, and most of them have been commented in this blog. A quick list of ideas:  
 
-Emotion detection based on EEG 
-Diagnosis based on EEG or EEG characteristics in different conditions (Schizophrenia, Depression, Autism, ADDH ...) 
-BCI  
-Combination of EEG with fMRI 
-Combination of EEG with neurostimulation (tCS and TMS)  
 
I hope this helps!  
 
Kind regards  
 
Alejandro
Posted @ Thursday, June 12, 2014 10:38 AM by Alejandro Riera
Sure it does, thank you very much for your valuable tips and comments.
Posted @ Thursday, June 12, 2014 11:13 PM by Saba
Hi, 
I'd like to ask if you think it's possible to wirelessly transmit data directly from the EEG electrode (via bluetooth or RF), to a station where amplification/filtering/digitization can be carried out. 
 
Current 'wireless' EEG equipment only transmits the wireless signal after it's been amplified/filtered. And of course that means wires connected to the electrodes. 
 
Sorry if I've asked this in the wrong place!
Posted @ Friday, June 20, 2014 2:24 PM by Vineet
Dear Vineet, 
 
Sure I think it is possible, or at least it will be possible soon. As time has proven, each time electronics components are getting smaller, so I would not be surprised to see soon EEG solutions as the one you describe. 
 
Moreover, you could use active electrodes that do the AD conversion and amplification on site and then transmit the data to a computer were you will receive the EEG raw data (already amplified). The challenge is to put all these electronic components in a small component that would be attached to you head for EEG recording.  
 
I think this is the future for EEG and BCI systems. People would be more willing to use such technologies if the EEG hardware is "invisible" or at least not too noticeable. 
 
Kind regards and thank you for your comment. 
 
Alejandro
Posted @ Monday, June 23, 2014 9:11 AM by Alejandro Riera
Post Comment
Name
 *
Email
 *
Website (optional)
Comment
 *

Allowed tags: <a> link, <b> bold, <i> italics