Open access peer-reviewed chapter

Wavelets for EEG Analysis

By Nikesh Bajaj

Submitted: July 5th 2020Reviewed: October 8th 2020Published: November 12th 2020

DOI: 10.5772/intechopen.94398

Downloaded: 213

Abstract

This chapter introduces the applications of wavelet for Electroencephalogram (EEG) signal analysis. First, the overview of EEG signal is discussed to the recording of raw EEG and widely used frequency bands in EEG studies. The chapter then progresses to discuss the common artefacts that contaminate EEG signal while recording. With a short overview of wavelet analysis techniques, namely; Continues Wavelet Transform (CWT), Discrete Wavelet Transform (DWT), and Wavelet Packet Decomposition (WPD), the chapter demonstrates the richness of CWT over conventional time-frequency analysis technique e.g. Short-Time Fourier Transform. Lastly, artefact removal algorithms based on Independent Component Analysis (ICA) and wavelet are discussed and a comparative analysis is demonstrated. The techniques covered in this chapter show that wavelet analysis is well-suited for EEG signals for describing time-localised event. Due to similar nature, wavelet analysis is also suitable for other biomedical signals such as Electrocardiogram and Electromyogram.

Keywords

  • EEG
  • artefacts
  • wavelet analysis
  • CWT
  • DWT
  • WPD
  • artefact removal algorithms
  • time-frequency analysis

1. Introduction

Biomedical signals are electrical activities recorded by sensors from a part of the body, such as the brain, heart, muscles, etc. They can be recorded as images e.g. functional Magnetic resonance Image (fMRI) from brain or a temporal signal e.g. Electrocardiogram (ECG), Electroencephalogram (EEG), Electromyogram (EMG), Galvanic Skin Response (GSR), etc. These signals contain useful information to analyse and understand the underlying physiological response of the body, thus they are also referred to as physiological signals. Biomedical signals are extensively used in healthcare to diagnose deceases and monitor health. With recent advancements and ease of using the devices to record the biomedical signals have open a window to use it to analyse and understand the day-to-day activities, emotions, and, experiences [1, 2, 3]. While recording the physiological activities through sensors, the signals are usually contaminated by noise and various artefacts [4]. Corrupted signals mislead the analysis and understanding of the underlying physiology [5]. The characteristics of wavelet to identify the time-localised events makes it suitable for the biomedical signals to clean, process, feature extraction, and analyse for various applications. Recent studies have shown the promising results of using wavelet in biomedical signals [6].

In this chapter, first, we introduce one kind of biomedical signal - EEG. We will explain the conventional features used in EEG studies. We will introduce the artefacts that commonly contaminate EEG signals, which makes it harder to use. The chapter then will move towards a short description of Wavelet analysis techniques, namely Continues Wavelet Transform (CWT), Discrete Wavelet Transform (DWT), and Wavelet Packet Decomposition (WPD). We would, then, compare CWT and STFT for EEG signal. Then, we will discuss artefact removal algorithms, with more details on Wavelet-based algorithms. The chapter will show the comparative analysis of artefact removal algorithm. The approach and analysis shown in this chapter for EEG signals can easily be applied to other biological signals.

Advertisement

2. Electroencephogram - EEG

The brain processes any information by means of neurons that use electrical and chemical signals to communicate by releasing and receiving neurotransmitters. The neural activity in the human brain is an electrical change. The brain generates electrical signals throughout the day for various activities. Studying these electrical signals is vital to understanding the neurophysiological behaviour of the brain [4]. A number of techniques are used to study brain activities. Functional magnetic resonance imaging (fMRI), Functional Near-Infrared Spectroscopy (firs), and Electroencephalography (EEG) recordings widely used techniques. The fMRI measures brain activity by scanning the blood flow. The fNIRS measures brain activity by measuring hemodynamic response in the brain through detecting the temporal changes in infrared light source. The EEG measures the electrical activity of the brain by electrodes placed on the scalp. Comparing to the other two, EEG measures brain activity directly, with high temporal resolution and most accessible and portable for the research. The fMRI has a high spatial resolution but very expensive, therefore it is mostly limited to medical diagnosis and treatments.

2.1 The EEG measure

The EEG signal is measured by placing multiple electrodes on the scalp that measure the current flow from neurons. A setup for EEG recording is shown in Figure 1. Each neuron (brain cell), when activated, it produced an electrical and magnetic field around the scalp. Since there are 100 billion neurons in the brain, when an electrode is placed on the scalp, it measures the accumulative activity of many neurons together. The complex structure of the brain attenuates the electrical signals, therefore an electrode can record the brain activity, only when a large number of neurons generate enough potential. The EEG devices amplify the recorded signal to store and process it [4].

Figure 1.

EEG recording setup: (a) a wireless device Emotiv Epoch mounted on a subject, transmitting EEG signal to a computer. (b) Electrode positions as 10–20 system, source:https://www.emotiv.com/.

The placement of electrodes has been standardised with the specific anatomical landmarks with a distance between electrodes as 10% or 20% of total length. This placement is called the 10–20 system, as shown in Figure 1b. The number of electrodes used for EEG recording varies, depending on the device. One of the low spatial resolutions can be of a 14-channel EEG device and high spatial resolution with 128 or 256 channels. The name of the electrode position is labelled as character followed by a number to identify the part of the brain. The characters are Fopfor pre-frontal, Ffor frontal, Pfor parietal, Tfor temporal, Ofor occipital, and Cfor central lobe of the brain. A few in between two landmarks are named with two characters, such as AF, between Fpand Fand FC, between Fand C[4]. An example of 14-channel is shown in Figure 1b.

The raw recording of EEG signal in the time-domain is complex to interpret. Similar to many other signals, frequency domain analysis has been widely used. The decades of work on EEG studies have identified five major frequency bands for EEG signals and established the correlation between behaviour and neural activity of a certain part of the brain. The frequency bands widely used are; Delta (0.14Hz or 0.54Hz), Theta (48Hz), Alpha (814Hz), Beta (1430Hz), Gamma (3063Hz). A raw EEG signal from a channel and corresponding signal in different bands are shown in Figure 2. It can be observed that low frequency, Delta activity, is the dominating wave in raw EEG and high-frequency Gamma is almost noise like with a little amplitude [4].

Figure 2.

The signal channel raw EEG signal and corresponding frequency bands: Delta (0.14Hz), theta (48Hz), alpha (814Hz), Beta (1430Hz), gamma (3063Hz).

Due to multichannel signals, it is usually viewed as topographical brain activity (heatmap over an image of head) under different frequency bands. An example of 5 seconds EEG recording with a 14-channel device is shown in Figure 3. The first second of all the channels are used to compute the energy distribution over brain regions. In Figure 3, the top left shows the raw EEG signal and corresponding brain activity, which shows a high activity in the frontal lobe of the brain. However, under different frequency bands, the different part of the brain shows higher activity.

Figure 3.

Topographical view of brain activity: Energy distribution of EEG recording over different brain regions under five frequency bands and raw signal.

The frequency bands; Delta, Theta, Alpha, Beta, and Gamma, are also called brain rhythms. Brain rhythms have been investigated over decades and a few characteristic behaviour of these brain rhythms have been established [4].

  • Delta: Delta waves were first introduced by Walter in 1936, it ranges from 0.1 (or 0.5) to 4 Hz in frequency. Delta waves are usually observed in deep sleep. Since delta wave is the low-frequency wave, it is easily confused by the movement artefact, due to similar nature. Delta waves have also been linked to continuous attention tasks.

  • Theta: Theta waves were introduced by Dovey and Wolter, ranges from 4 to 8 Hz in frequency. Theta waves are linked to drowsiness and deep meditation state.

  • Alpha: Alpha waves, perhaps are the most widely investigated waves in EEG studies. Alpha waves were introduced by Berger in 1929. They lie in a range from 8 to 14 Hz. Alpha waves usually appear on the occipital lobe of the brain. Alpha waves are the most common indication of a relaxing state of mind and are also linked to closing eyes. Any sign of anxiety or attention reduces the alpha waves.

  • Beta: Beta waves lie in the range of 14–30 Hz of frequency. Beta waves have been associated with active thinking, anxious, high alert, and focus of the brain.

  • Gamma: Gamma waves are the higher frequency waves, ranges from 30 to onwards. Gamma wave is considered to play a complex role in brain functionality, such as combining information from two different sensory inputs. It is also used to confirm certain brain diseases.

2.2 Artefacts in EEG

While recording, EEG signals are frequently contaminated with various artefacts. The most common types of artefacts are motion, muscular, ocular, and cardiac artefacts [4], which are shown in Figure 4. The motion artefacts are caused by the physical movement of the person’s body. As shown in Figure 4a, motion artefacts produce a sudden high valued spike in all the channels of EEG recording. The muscular artefacts, shown in Figure 4b are caused by any muscular contraction such as grinding the teeth. It produces high-frequency bursts in EEG recording as circled in the Figure 4b. The cardiac artefacts, shown in Figure 4c, are caused by the electrical activities of the heart. They appear as a weak form of QRS wave of heart and most likely to be appeared in the channels near to ears (temporal lobe), though it can be sometimes present in channels from the frontal lobe [7]. The ocular artefacts are slow oscillating waves appear on the frontal lobe, caused by the eye movements or closed eyes, as circled in the Figure 4d. The higher magnitude of the artefacts corrupts the EEG recording and leads to misinterpretations of the results and analysis [5]. Even though there are many algorithms to remove the artefacts, but there is always a possibility of losing the cerebral information while removing the artefacts.

Figure 4.

Common type of artefacts in EEG. Corresponding artefacts are circled in the figure.

3. Wavelet analysis

Most of the real-life signals are non-stationary in behaviour, which means their properties change over time. To localise the events of interest, time-frequency analysis is widely used. The conventional way of time-frequency analysis is the Short-Time Fourier Transform (STFT), where Fourier transform of the signal is taken over short-windows, resulting spectrogram plot. STFT has limitations on resolutions, due to Heisenberg’s uncertainty principle, e.g. improvement in time resolution results in poorer frequency resolution and vice-versa. The alternative to STFT is wavelet transform, which exploits the property of low-frequency signals being widespread over time and high-frequency bursts occurring on short intervals. Wavelet transform uses the variable size of windows with a wavelet function.

Wavelet analysis is usually applied in two ways, Continuous Wavelet Transform (CWT) and Discrete Wavelet Transform (DWT). CWT uses a wavelet function ψtand produces a scalogram, similar to a spectrogram for time-frequency analysis. However, DWT decomposes a signal into two (1) average or lowpass signal, using scaling function and (2) difference or highpass signal using wavelet function. The conventional DWT recursively decomposes lowpass signal with the same scaling and wavelet functions to the desired level of decomposition. A decomposition tree for DWT is shown in Figure 5a. For some applications, it is useful to decompose highpass signal at each level too, this is called Wavelet Packet Decomposition (WPD). A tree for WPD is shown in Figure 5b.

Figure 5.

4-level decomposition tree for (a) discrete wavelet transform (DWT), (b) wavelet packet decomposition (WPD).

As shown in Figure 5, block LP is a lowpass filter hnand block HP is a highpass filter gn, both followed by downsampler (2). The coefficients of lowpass filter are corresponds to scalling function ϕnand coefficients of highpass filter are corresponds to wavelet funciton ψn. A N-level DWT decomposes a signal xninto set of signals: [XLN,XHN,XHN1,,XH1], each with different dimensions. However, a N-level WPD decomposes a signal xninto set of packets: [XN1,XN2,,XN2N], each with same dimensions.

4. Time-frequency analysis of EEG using CWT

As discussed, a conventional way to time-frequency analysis is STFT, however, using CWT with different wavelet functions can enrich the analysis with more details. In this section, we will show, how a continuous wavelet function (ψt), can be applied to a discrete EEG signal xn, and compare the spectrogram with scalogram of different wavelet functions.

A spectrogram is obtained using STFT, which is Fourier Transform computed for a short windows. STFT Xstftτωof signal xtas given as Eq. (1), where wtis a window function. On the other hand, CWT Xcwtabof a signal xtis given by Eq. (2), where ψa,btis a complex conjugate of scaled and shifted version of mother wavelet ψt, ais scaling parameter and bis shifting parameter.

Xstftτω=xtwτtejωtdtE1
Xcwtab=xtψa,btdt.E2

CWT operation from Eq. (2) can be seen as convolution of input signal xtwith scaled version of wavelet function ψt.

Xcwta=xtψatE3
Xcwtf=XfψafE4

where Xfis Fourier transform of xt, and the same for others. For computations with discrete signal xn, both equations; 3 and 4 can be used with discrete operations, e.g. convolution and multiplication and discrete wavelet function ψn, while for Fourier Transform, Fast Fourier Transform (FFT) is used. For computational efficiency, however, Eq. (4) is widely used, by multiplying FFT of xnand FFT of scaled and discrete version ψn. Even though, for discrete signal xn, discrete wavelet function ψnis used, however, the conventional definitions of wavelet functions for CWT are defined in continues time-domain. A set time-domain and frequency-domain equations for six complex wavelet functions are defined below. Figure 6 shows all the six wavelet functions, with their real and imaginary part. All six functions are similar, in terms of smoothness and being derived from exponential and sinusoidal functions, however, they have different parameters to control the oscillation and frequency band to be captured.

Figure 6.

Continues wavelet functions.

Gaussian Wavelet:A time-domain wavelet it derived from a Gaussian function centered at t0and modulated by a complex exponential function with frequency f0[8].

ψt=eatt02e2πjf0tt0E5
ψf=π/ae2πjft0eπ2ff02/aE6

where a=f0Q2.

Gabor Wavelet:Gabor wavelet is perhaps the most widely used function for various applications. It is essentially the same as Gaussian wavelet function, with simplified equations, as follow [8, 9];

ψt=ett02/a2ejf0tt0E7
ψf=eff0a2ejt0ff0E8

where ais oscillation rate and f0is center frequency, t0is centred time.

Morlet Wavelet:Morlet is considered very similar to Gabor wavelet and Gabor filters. The oscillation of Morlet wavelet is controlled by σ. A higher value of σresults in higher oscillation [10].

ψt=Cσπ0.25e0.5t2ejσtKσE9
ψw=Cσπ0.25e0.5σw2Kσe0.5w2E10

where Cσ=1+eσ22e34σ20.5, Kσ=e0.5σ2, and w=2πf.

Poisson Wavelet:Poisson wavelet is defined by positive integers (n), unlike other, and associated with Poisson probability distribution [11, 12].

ψt=12π1jtn+1E11
ψw=1Γn+1wnewuwE12

where w=2πfand uwis a unit step function, e.g. uw=1if w>=0, 0else.

Complex Mexican hat wavelet:Complex Mexican hat wavelet is derived from the conventional Mexican hat wavelet. It is a low-oscillation wavelet which is modulated by a complex exponential function with frequency f0[13].

ψt=23π14π1t2e12t22jt+πerfj2t1t2e12t2e2πjf0tE13
ψw=223π1/4ww02e12ww02ifw0,0elseE14

where w=2πfand w0=2πf0.

Complex Shannon wavelet:Complex Shannon wavelet is the most simplified wavelet function, exploiting Sinc function by modulating with sinusoidal, which results in an ideal bandpass filter. Real Shannon wavelet is modulated by only a cos function [14].

ψt=Sinct/2e2f0tE15
ψw=ww0πE16

where x=1if x0.5, 0 else and w=2πfand w0=2πf0.

An example of using the above six wavelet functions for a small single-channel EEG segment is shown in Figure 7, along with spectrogram. It can be observed, spectrogram highlights a few events in signal (sharp peaks and lowpass wave), however, using CWT with different Wavelet functions, much richer information can be observed. Since, we observed that in the formulation of wavelet functions that they are similar to the underlying principle, we could also observe the similarities across different scalograms. Specifically, spectrogram using Complex Shannon and Complex Mexican hat wavelet are much similar. Interestingly, Morlate and Poisson wavelet functions are able to produce a better resolution towards lower frequencies.

Figure 7.

Scalogram and spectrogram of a segment of signal channel EEG signal with six wavelet functions and STFT. Figure obtained using spkit python library -https://spkit.github.iohttps://spkit.github.io

5. Artefact removal algorithms using DWT and WPD

Artefacts in EEG recording is a primary obstacle that all researchers have to deal with. There are decades of research work in literature to remove these artefacts [15, 16]. A range of methods have been proposed to remove the artefacts, starts with a statistical with interpolation method [17] and regression method [18]. The most commonly used approaches are based on Blind Source Separation (BSS) using Independent Component Analysis (ICA) [19, 20]. ICA based approach have been widely explored with statistical measures [21, 22, 23, 24], and variant of ICA as FastICA, InfoMax, and Extended InfoMax [25, 26, 27]. Wavelet-based approaches are well suited for time-localised short events, as opposed to ICA. This property has been exploited to remove artefacts from single-channel EEG. In contrast to a single channel, wavelet has also been used for multi-channel EEG [28] and in combination with ICA [29, 30, 31, 32, 33, 34], in which identified artifactual component is cleaned with wavelet rather than removed. The ICA-based approaches can only be applied to multi-channel EEG and need an expert to select artifactual component, which has been automated with heuristics [21, 35, 36]. In contrast, most wavelet-based algorithms remove artefacts from each channel individually.

The key idea of wavelet-based artefact removal algorithms is to apply DWT on single-channel EEG signal xnand remove (set to zero) wavelet coefficients that fall above some statistical threshold and reconstruct signal back using inverse-DWT (IDWT) x̂n[37, 38, 39]. With linear property of electrical activities, recorded EEG signal is considered as xn=sn+vn, where snis source signal of brain activity and vnis artifactual components. The two most widely used threshold formulations are used with wavelet.

Global Threshold:Also known as the optimal threshold for removing white-gaussian noise from any signal [40] using DWT. Global Threshold (TG) is defined as;

TG=σ̂2logNforσ̂=medianw0.6745E17

where Nis the length of signal and for wavelet coefficients w, σ̂is the estimate of noise variance. To denoise a signal, wavelet coefficients with magnitude below the threshold TGare set to zero and reconstruct the signal back. However, for recorded EEG signal xn, source signal snis considered to be zero mean and normally distributed, i.g. snN0σ[4]. For which any wavelet coefficients with a magnitude above the threshold TGis considered to be artifactual and removed (set to zero).

Standard Deviation (STD) Threshold:As name suggests, STD threshold is based on Standard Deviation (STD) of wavelet coefficients [39].

TSTD=1.5×STDwE18

ATAR algorithm:A recent study has shown that approaches based on above thresholds are very aggressive, since, statistically, a few wavelet coefficients of any signal will always fall above these thresholds [14]. In contrast, an Automatic and Tunable Artefact Removal (ATAR) Algorithm based on WPD was proposed [41], which provides three different wavelet filtering modes and a tunable parameter. As shown a block diagram of ATAR algorithm in Figure 8, a single channel EEG signal xnis first split into smaller windows xwn, apply L-level WPD to get wavelet coefficients w=XLk=WPDxwn, then wavelet coefficients are filtered using wavelet filtering ŵ=λwto reconstruct signal x̂nfrom corrected windows x̂wn. The three filtering modes in ATAR algorithm are namely; Elimination λe, Linear attenuation λa, and soft thresholding λs, which are defined below;

Figure 8.

A block diagram of ATAR algorithm [41].

λew=wifwθα0elseE19
λaw=wifwθαsgnwθα1wθαθβθαifθα<wθβ0elseE20
λsw=wifw<θγ1eαw1+eαwθαotherwisewhereα=1θγlogθαθγθα+θγE21

where wis a wavelet coefficient, sgnis the signum function, and θα>θγ. A default setting for θγand θβis; θγ=0.8θαand θβ=2θα. The characteristics of wavelet filtering mode are shown in Figure 9. From Figure 9, it can be seen that Elimination mode of filtering is the same as conventional filtering, however, Linear attenuation and soft-thresholding modes do not remove the wavelet coefficient, rather suppress them softly. Another distinction ATAR algorithm has over others is the threshold selection. The threshold θαis computed from Interquartile Range (IQR) of wavelet coefficients using Eq. (22), which is robust against outliers, as oppose to STD.

Figure 9.

Wavelet filtering modes for ATAR algorithm. Forθα=200,θγ=0.8θα=160,θβ=2θα=400[41].

θα=fβriffβrk1k1elsewherefβr=k2expβ100k2r2E22

where ris Interquartile Range (IQR) of coefficients i.e. r=IQRwand k1and k2are lower and upper bounds on filtering.

Figure 10 shows a visual comparative analysis of wavelet-based approaches (i.e. Global threshold, STD threshold, and ATAR algorithm) and ICA based approaches (FastICA, InfoMax, and Extended-InfoMax) to remove the artefacts. It is visually apparent that wavelet-based approaches are better than ICA-based approaches. Among wavelet-based approaches, using ATAR gives much control over Global and STD based threshold selection. Other quantitative analyses of the above-mentioned approaches are discussed in the article [41], which also demonstrate the effect of tuning parameter and filtering modes on different predictive tasks of EEG signal. The formulation of relationship, algorithmic implementation details, and comparative results are given in article [41].

Figure 10.

Comparison of artefact removal approaches from [41].

Advertisement

6. Conclusions

This chapter presents the overview of Wavelet for EEG analysis. The first chapter introduces EEG signal, commonly used features for predictive analysis, and artefacts that often contaminate EEG signal. Then chapter discusses the Wavelet analysis approaches, namely CWT, DWT, and WPD. The richness of CWT over STFT for time-frequency analysis using various wavelet functions is demonstrated. Finally, the artefact removal algorithms based on wavelet and ICA are discussed. The comparative analysis present in the chapter shows that the wavelet-based approach outperforms ICA based approach. Specifically, a recent algorithm (ATAR) allows controlling the removal or suppression of assumed artifactual components in the signal, which can be tuned to improve the performance of any predictive tasks. The techniques presented in this chapter show how wavelet can be used for EEG studies to extract rich information and removing the artefacts. The comparative analysis shows wavelet based approaches are well suited for EEG signal processing. Further, similar approaches can be used with other biomedical signals such as electrocardiogram (ECG or EKG), Electromyography (EMG) etc.

© 2020 The Author(s). Licensee IntechOpen. This chapter is distributed under the terms of the Creative Commons Attribution 3.0 License, which permits unrestricted use, distribution, and reproduction in any medium, provided the original work is properly cited.

How to cite and reference

Link to this chapter Copy to clipboard

Cite this chapter Copy to clipboard

Nikesh Bajaj (November 12th 2020). Wavelets for EEG Analysis, Wavelet Theory, Somayeh Mohammady, IntechOpen, DOI: 10.5772/intechopen.94398. Available from:

chapter statistics

213total chapter downloads

More statistics for editors and authors

Login to your personal dashboard for more detailed statistics on your publications.

Access personal reporting

Related Content

This Book

Next chapter

Ultra-High Performance and Low-Cost Architecture of Discrete Wavelet Transforms

By Mouhamad Chehaitly, Mohamed Tabaa, Fabrice Monteiro, Safa Saadaoui and Abbas Dandache

Related Book

First chapter

Introductory Chapter: Multiplexing History - How It Applies to Current Technologies

By Somayeh Mohammady and Pooria Varahram

We are IntechOpen, the world's leading publisher of Open Access books. Built by scientists, for scientists. Our readership spans scientists, professors, researchers, librarians, and students, as well as business professionals. We share our knowledge and peer-reveiwed research papers with libraries, scientific and engineering societies, and also work with corporate R&D departments and government entities.

More About Us