The Neurophysiological Biomarker Toolbox (NBT)



How to remove bad channels and transient artifacts

Version: June 2017

Approximate time needed to complete the tutorial: 20 min.

Aim
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 1 minute recording from an Eyes Closed Rest experiment called “Tutorial.Signal” which you need to download from Blackboard→Course Documents→NBT material. Unzip, extract and save both files in a new folder in your C:\Temp, 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.

How to deal with bad channels

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:

  1. 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.
  2. 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.

  1. Use the latest version of NBT. You can download NBT from Blackboard.
  2. 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.
  3. Type NBT on the Matlab command line
  4. Load an NBT signal through ​NBT | File | Load NBT Signal
  5. Open the NBT signal viewer through NBT | Pre-processing | Artifact removal | Mark transient artifacts for current NBT signal
  6. 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:
    1. Researcher ID: Fill in your initials.
    2. Timescale: Seconds / Minutes / Samples. Default = Seconds
    3. Filter: Specify the frequency filter to filter out a range of frequencies of interest. Blackman, Butterworth or No filter. Default = Blackman
    4. Frequency interval: Specify the range of frequencies of interest. Default for Blackman and Butterworth = 0.5-45Hz, Default for No filter = N/A
    5. Filter order: Default for Blackman and Butterworth = automatic, Default for No filter = N/A (note that the filter order depends on the sampling frequency of your data, and it updates automatically, it may be 550, 1100 or 5500)
    6. Select data
      1. Select channels: specify channel indices or select 'All channels' to plot all channels. Default = 'All channels'
      2. Select time interval: specify a time interval (in time samples: take into account signal length and sampling frequency). Default = 'all'
    7. Plot settings
      1. Colors: Using this option you can set the colors used for plotting different channels. Default = 'blue'
      2. Signal: Here, you should change the Signal field to 40
    8. Auto detect artefacts
      1. Bad Channels: Change this field to No
  7. Click Plot
  8. Steps performed automatically by NBT:
    1. Signal is down-sampled (This is for speeding up the signal viewer only. The signal after viewing / cleaning is at the original sampling frequency)
    2. Signal is filtered if this option was selected (either Blackman or Butterworth)
  1. Next, the signal viewer will open and will show the full signal:

First, judge if the full signal looks normal (like the above signal). If the signal does not look normal and the channels display completely flat signals, close the signal viewer and re-open the Specify parameters graphical user interface. Here, you can change the Signal field, which will correct the scaling (i.e., the signal distance). Try changing this number to 40 and select Plot again.

Manual detection of bad electrodes / channels

  1. 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.

In this tutorial we did not choose 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 if this function is selected. Since this is not the case, you should judge whether to manually remove the first 1.5 seconds and last 1.5 seconds of the signal

  1. Zoom-in on a 10-second window of the signal by clicking Window 10 Seconds.
  2. 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 examples of a bad channel automatically marked (in black color):
  3. Scroll through the entire signal in windows of 10 seconds
  4. 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
  5. 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

How to remove transient artifacts

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:

  1. 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.
  2. 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.

  1. 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.
    1. Do not remove typical eye artifacts:
  2. 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.
  3. 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:
  4. Scroll to the next transient artifact, and repeat point 3.
  5. If you made a mistake, you can right click on the noisy interval and unset it.
  6. 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).
  7. Wait for confirmation that the signal has been saved. It will say NBT signal saved in the Matlab command window.


Go to the next tutorial: Re-referencing data to common average electrode