Approximate time needed to complete the tutorial: 20 min.
In this tutorial you will learn how to remove bad channels or transient artifacts from your EEG recordings. This is crucial for the next tutorial where you will learn how to reject eye-blinks. Importantly, non-neuronal artifacts can spoil your final statistical analysis of EEG oscillations, because effects may appear significant solely because of an unfortunate bias of artifacts. Or, possibly worse, significant effects in the brain are not identified because of unnecessarily large noise-related variability in the EEG data.
To practice this tutorial you can use the 5 minute recording from an Eyes Closed Rest experiment called “TutorialSignal” which you need to download from Blackboard→Course Documents→NBT material. Unzip and save both files in a new folder in your Documents, we suggest to call this folder NBT_test_files. If you come directly from the “Getting started with EEG analysis in NBT”, then you already have the signal and you do not need to download it again.
With high-density EEG you often have some bad channels, e.g., channels with poor contact to the scalp and therefore a poor quality signal. In general these channels can be identified by the following parameters:
The mean of the channel's correlation coefficients with other channels. Most channels should correlate highly with neighboring channels. Therefore, a channel with contaminated data will likely have a low correlation with other channels.
The variance of the channel. Alternatively, a contaminated channel may correlate quite well with other channels, but have a higher variance (due to additive noise).
Since bad channels will spoil your analysis, you want to remove these channels.
Use the latest version of NBT. You can download NBT from Blackboard.
Step into the folder which contains the EEG signals. Note that the folder should only contain EEG recordings in NBT format. Make sure there are no sub-folders within this folder.
Type NBT on the Matlab command line
Load an NBT signal through NBT | File | Load NBT Signal
Open the NBT signal viewer through NBT | Pre-processing | Artifact removal | Mark transient artifacts for current NBT signal
The Specify parameters graphical user interface (GUI) will open up. In this GUI, it is possible to specify parameters for plotting the signal. Use default parameter settings:
Filter: Specify the frequency filter to filter out a range of frequencies of interest. Blackman, Butterworth or No filter. Default = Blackman
Frequency interval: Specify the range of frequencies of interest. Default for Blackman and Butterworth = 0.5-45Hz, Default for No filter = N/A
Filter order: Default for Blackman and Butterworth = automatic, Default for No filter = N/A
Select channels: specify channel indices or select 'All channels' to plot all channels. Default = 'All channels'
Select time interval: specify a time interval (in time samples: take into account signal length and sampling frequency). Default = 'all'
Colors: Using this option you can set the colors used for plotting different channels. Default = 'blue'
Steps performed automatically by NBT:
Signal is down-sampled to 200Hz (This is for speeding up the signal viewer only. The signal after viewing / cleaning is at the original sampling frequency)
Signal is filtered if this option was selected (either Blackman or Butterworth)
Automatic marking of filter effects
Filter artifacts occur at the beginning and end of a signal since there are less time points to use for the filtering algorithm. Therefore the first 1.5 seconds and last 1.5 seconds of the signal are automatically marked as artefacts.
Next, the signal viewer will open and will show the full signal:
First, judge if the full signal looks normal (like the above signal).
Manual detection of bad electrodes / channels
Using the zoom buttons you can zoom in on the signal and look for bad channels. There are several different zoom buttons. The first ones are the small magnifying glass buttons in the task bar, the one with the minus sign let's you zoom out, the one with the plus sign lets you zoom in (by clicking and dragging you can also select a specific area on which you want to zoom in). The Time zoom buttons let you zoom in on a certain time interval, which you can select on the screen (click and drag). Window 60 seconds will immediately zoom in on a time interval of 60 seconds, same goes for Window 10 seconds and Window 5 seconds. Scale up and Scale down enables you to change the distance between the channels, essentially decreasing or increasing the amplitude with which the signals are plotted.
Zoom-in on a 10-second window of the signal by clicking Window 10 Seconds.
Bad channels will often stand out very clearly with huge jumps, much high-frequency noise, or completely flat (note that in the demo signal channel 129 is the reference channel, it is supposed to be flat!). In the Figure below you can see an example of a bad channel (in black color):
Scroll through the entire signal in windows of 10 seconds
Mark very noisy channels / electrodes as bad electrodes by right-clicking the signal trace in the signal viewer and then click Set as noisy channel. You can mark a channel as good by right-clicking and clicking Unset as noisy channel
If you want to hide the noisy electrodes from the signal viewer, click Hide bad channels, you can show them again by clicking Show all channels
When you loaded your signal in the previous tutorial, you may have noticed that some or all channels had huge jumps at some points. These jumps are transient artifacts, most often coming from the subject moving, causing the electrodes to move. In general these artifacts can be identified by the following parameters:
The amplitude range of the epoch. The movement of electrodes on the scalp results in a change in impedance between the scalp and the electrodes, which affects the electrode voltage offsets. This offset change can be identified by its high amplitude.
The deviation from each channel's average value. The shifting of electrodes may be less extreme, but still contaminate an epoch. This may be reflected in a high deviation of that epoch's average value from the average values across all channels.
Since these artifacts will spoil your analysis, you need to remove them from your signal.
Go back to the window you left open after detecting bad channels, and look for transient artifacts. A transient artifact is characterized by a very sharp change in voltage. You should be careful not to remove eye artifacts which are more slow in their voltage change (see Figure below) and can be removed with better methods as explained in the next tutorial (ICA - Independent Component Analysis). Also do not remove transient artifacts which only appear in the bad channels.
Do not remove typical eye blinks:
Transient artifacts are best identified by scrolling through the data in segments of 10 seconds while viewing all of the channels (e.g., 129). Use the zoom button Window 10 seconds and scroll though the entire signal to the end.
Noisy intervals / transient artifacts can be marked by clicking on the button in the right-top of the signal viewer: click here to select noisy interval. Double-click or right-click 1 second before the noisy interval and then again double-click or right-click 1 second after the noisy interval. If done correctly, the noisy interval will be marked using a transparent gray color:
Scroll to the next transient artifact, and repeat point 3.
If you made a mistake, you can right click on the noisy interval and unset it.
When you are done, you can grade and save the signal by clicking on of the five buttons numbered 1-5. A signal that only contains noise would deserve a 1, and a signal with no transient artifacts or bad channels deserves a 5. Grading saves the signal automatically (and closes the signal).
Wait for confirmation that the signal has been saved. It will say NBT signal saved in the Matlab command window.