## 1. Introduction

Polisomnography (PSG) is the standard technique used to study the sleep dynamic and to identify sleep disorders. In order to obtain an integrated knowledge of different corporal functions during sleep, a PSG study must perform the acquisition of several biological signals during one or more nights in a sleep laboratory. The signals usually acquired in a PSG study include the electroencephalogram (EEG), the electrocardiogram (ECG), the electromiogram (EMG), the electro oculogram (EOG), the abdominal and thoracic breathings, the blood pressure, the oxygen saturation, the oro-nasal airflow and others biomedical records (Collop et. al., 2007).

Particularly, the EEG is usually analyzed by physicians in order to detect neural rhythms during sleep. However, it is generally contaminated with different noise sources and mixed with other biological signals. Their common artifacts sources are the power line interference (50 or 60 Hz), the ECG and EOG signals. Figure 1 shows an example of real EEG ECG and EOG signals recorded simultaneously in a PSG study. It can be seen that EEG signal is contaminated by the QRS cardiac complexes which appear as spikes at the same time in ECG record. Likewise, the low frequencies present in the contaminated EEG correspond to the opening, closing or movements of the eyes recorded in EOG signal. These noise sources increase the difficulty in analyzing the EEG and obtaining clinical information.

To correct, or remove the artifacts from the EEG signal, many techniques have been developed in both, time and frequency domains (Delorme et. al., 2007; Sadasivan & Narayana, 1995). More recently, component-based techniques, such as principal component analysis (PCA) and independent component analysis (ICA); (Akhtar et. al., 2010; Astolfi et. al., 2010; Jung et. al., 2000), have also been proposed to remove the ocular artifacts from the EEG. The use of Blind Source Separation (BSS) (De Clercq et. al., 2005) and Parallel Factor Analysis (PFA) methods to remove artifacts from the EEG have been used in this area too (Cichocki & Amari, 2002; Makeig et. al., 2004). Wavelet Transform (WT) (Senthil Kumar et. al., 2009), WT combined with ICA (Ghandeharion et. al., 2009) and Autoregressive Moving Average Exogenous (ARMAX) (Hass et. al., 2003; Park et. al., 1998), have been applied too, to remove artifacts from EEG.

In this chapter, it is described a cascade of three adaptive filters based on a Least Mean Squares (LMS) algorithm to remove the common noise components present in the EEG signal recorded in polysomnographic studies.

Adaptive filters method has been used, among other applications, in external electroenterogram records (Mejia-García et. al., 2003) and in impedance cardiography (Pandey et. al., 2005). Other applications of this filtering technique in biomedical signals include, for example, removal of maternal ECG in fetal ECG records (Soria et. al., 1999) detection of ventricular fibrillation and tachycardia (Tompkins, 1993), cancellation of heart sound interference in tracheal sounds (Cortés, 2006), for pulse wave filter (Shen et. al., 2010), for tumor motion prediction (Huang et. al., 2010), detection of single sweep event related potential in EEG records (Decostre et. al., 2005), detection of SSVEP in EEG signals (Diez et. al., 2011) and for motor imagery (Jeyabalan et. al., 2007).

In the particular case of artifacts removal in EEG records, He et. al. (2007) studied the accuracy of adaptive filtering method quantitatively using simulated data and compared it with the accuracy of the domain regression for filtering ocular artifacts from EEG records. Their results show that the adaptive filtering method is more accurate in recovering the true EEG signals. Kumar et. al. (2009) shows that adaptive filtering can be applied to remove ocular artifacts from EEG with good results. Adaptive filters have been used to remove biological artifacts from EEG by others authors (Chan et. al., 1998; Karjalainen et. al., 1999; Kong et. al., 2001).

In order to improve the signal to noise ratio of EEG signals in PSG studies, we had proposed in a previous work a cascade of three adaptive filters based on a LMS algorithm (Garcés et. al., 2007). The first filter in the cascade eliminates line interference, the second adaptive filter removes the ECG complexes and the last one cancels EOG artifacts. Each stage uses a Finite Impulse Response (FIR) filter, which adjusts its coefficients to produce an output similar to the artifacts present in the EEG. In this chapter, we explain in detail the operation of the cascade of adaptive filters including novel tests to determinate the optimal order of FIR filter for each stage. Finally, we describe the results of the proposed filtering scheme in 18 real EEG records acquired in PSG studies.

## 2. Materials

Eighteen PSG records belonging to sixteen subjects were selected from the MIT-BIH Polysomnographic Database. All subjects are aged 44 +/- 12 years. This database contains

over 80 hours of four-, six-, and seven-channel PSG recordings. All of them contain EEG, ECG and Blood Pressure (BP) signals, some of them have Nasal or Plethysmograph Respiratory signals, five of them have O_{2} Saturation signal, EOG and EMG signals. All the subjects have ECG signals annotated beat-by-beat, and EEG and respiration signals annotated by an expert with respect to sleep stages and apnea (Goldberger et. al., 2000). In this work were used only the EEG, ECG and EOG signals, all of them were sampled at 250 Hz.

## 3. Common artifacts in EEG records

By artifacts it is understood all signals that appear in the EEG record which don't come from the brain. The most common artifacts in the EEG signal appear during the acquisition due to different causes, like as bad electrodes location, not clean hairy leather, electrodes impedance, etc. There is also a finding of physiological artifacts, that is, bioelectrical signals from other parts of the body (heart and muscle activity, eye blink and eyeball movement) that are registered in the EEG (Sörnmo & Laguna, 2005).

The problem of those artifacts is that they can made a mistake in the analysis of a EEG record, either in automatic method or in visual inspection by specialist (Wang et. al., 2008).

### 3.1. Power line interference

Biological records, especially EEG signals, are often contaminated with the 50 or 60 Hz line frequency interference from wires, light fluorescents and other equipments which are captured by the electrodes and acquisition system. The ignition of light of fluorescents usually causes artificial spikes in the EEG. They are distributed in several channels of EEG and can made a mistake in the analysis of the record (Sanei & Chambers, 2007)

### 3.2. Ocular artifacts

The human eye generates an electrical dipole caused by a positive cornea and negative retina. Eye movements and blinks change the dipole causing an electrical signal known as an EOG. The shape of the EOG waveform depends on factors such as the direction of eye movements. A fraction of the EOG spreads across the scalp and it is superimposed on the EEG (Vigon et. al., 2000).

Two kinds of ocular artifacts can be observed in EEG records, eye blinks and eye movements. Eye blinks are represented by a low frequency signal (< 4 Hz) with high amplitude. It is a symmetrical activity mainly located on the front electrodes (FP1, FP2) with low propagation. Eye movements are also represented by a low frequency signal (< 4 Hz) but with higher propagation, (Crespel et. al., 2006). In order for the EEG to be interpreted for clinical use, those artifacts need to be removed or filtered from the EEG.

### 3.3. Cardiac artifacts

Cardiac activity may have pronounced effects on the electroencephalogram (EEG) because of its relatively high electrical energy, especially upon the no-cephalic reference recordings of EEG. The QRS complexes appear in the EEG signal like regular spikes (Sörnmo & Laguna, 2005). In figure 1 it can be observed the QRS complex present in a segment of EEG record. The QRS amplitudes in the ECG are of the order of mV, but in the external EEG they have been reduced. These artifacts in the EEG records could be clinically misleading.

### 3.4. Other artifacts

The muscle disturbances are introduced in the EEG by involuntary muscle contractions of the patient, thus generating an electromyogram (EMG) signal present in the EEG record. The EMG and other biological artifacts have not been analyzing in the present work.

## 4. Methodology

Herein, we propose the use of adaptive filters to remove artifacts from EEG signal acquired in PSG studies. Usually, biological signals (ECG, EOG and others) have overlaped spectra with the EEG signal. For that, conventional filtering (band-pass, lower-pass or high-pass filters) cannot be applied to eliminate or attenuate the artifacts without losing significant frequency components of EEG signal.

Due to this reason, it is necessary to design specific filters to attenuate artifacts of EEG signals in PSG studies. The adaptive interference cancellation scheme is a very efficient method to solve the problem when signals and interferences have overlapping spectra.

Since the PSG recordings usually contain the ECG, EOG and EEG signals it is very convenient to apply this method to filter this kind of records.

### 4.1. Adaptive filter

Adaptive filters are based on the optimization theory and they have the capability of modifying their properties according to selected features of the signals being analyzed (Haykin, 2005). Figure 2 illustrates the structure of an adaptive filter. There is a primary signal *d(n)* and a secondary signal *x(n).* The linear filter *H(z)* produces an output *y(n),* which is subtracted from *d(n)* to compute an error *e(n)*.

The objective of an adaptive filter is to change (adapt) the coefficients of the linear filter, and hence its frequency response, to generate a signal similar to the noise present in the signal to be filtered. The adaptive process involves minimization of a cost function, which is used to determine the filter coefficients. Initially, the adaptive filter adjusts its coefficients to minimize the squared error between its output and a primary signal. In stationary conditions, the filter should converge to the Wiener solution. Conversely, in non-stationary circumstances, the coefficients will change with time, according to the signal variation, thus converging to an optimum filter (Decostre & Arslan, 2005).

In an adaptive filter, there are basically two processes:

A filtering process, in which an output signal is the response of a digital filter. Usually, FIR filters are used in this process because they are linear, simple and stable.

An adaptive process, in which the transfer function

*H(z)*is adjusted according to an optimizing algorithm. The adaptation is directed by the error signal between the primary signal and the filter output. The most used optimizing criterion is the Least Mean Square (LMS) algorithm.

The structure of the FIR can be represented as,

where *L* is the order of the filter, *x(n)* is the secondary input signal, *w*_{k} are the filter coefficients and *y(n)* is the filter output.

The error signal *e(n)* is defined as the difference between the primary signal *d(n)* and the filter output *y(n),* that is,

where,

The squared error is,

The squared error expectation for *N* samples is given by

where *r*_{dx}*(n)* and *r*_{xx}*(n)* are, respectively, the cross-correlation function between the primary and secondary input signals, and the autocorrelation function of the secondary input, that is

The objective of the adaptation process is to minimize the squared error, which describes a performance surface. To get this goal there are different optimization techniques. In this work, we used the method of steepest descent (Semmlow, 2004). With this, it is possible to calculate the filter coefficient vector for each iteration *k* having information about the previous coefficients and gradient, multiplied by a constant, that is,

where *µ* is a coefficient that controls the rate of adaptation.

The gradient is defined as,

Substituting (10) in (9) leads to,

Deriving with respect to *w*_{k} and replacing leads to,

Since *d(n)* and *x(n)* are independent with respect to *w*_{k}*,* then,

Equation (14) is the final description of the algorithm to compute the filter coefficients as function of the signal error *e(n)* and the reference input signal *x(n).* The coefficient µ is a constant that must be chosen for quick adaptation without losing stability. The filter is stable if *µ* satisfies the following condition, (Sanei & Chambers, 2007).

where *L* is the filter order and *P*_{xx} is the total power of the input signal.

### 4.2. Artifacts removal from EEG

As it is mentioned above, the adaptive interference cancellation is a very efficient method to solve the problem when signals and interferences have overlap spectra.

The adaptive noise canceller scheme is arranged on the basic structure showed in Figure 2, where the primary and secondary inputs are called as ”corrupted signal” and “reference signal”, respectively.

In this scheme, it is assumed that the corrupted signal *d(n)* is composed of the desired *s(n)* and noise *n*_{0}*(n),* which is additive and not correlated with *s(n).* Likewise, it is supposed that the reference *x(n)* is uncorrelated with *s(n)* and correlated with *n*_{0}*(n).* The reference *x(n)* feeds the filter to produce an output *y(n)* that is a close estimate of *n*_{0}*(n)* (Tompkins, 1993).

To remove the main artifacts of the EEG signal, we propose a cascade of three adaptive filters (see Figure 3). The input *d*_{1}*(n)* in the first stage is the EEG corrupted with artifacts (EEG + line-frequency + ECG + EOG). The reference *x*_{1}*(n)* in the first stage is an artificial sine function generated with 50 Hz (or 60 Hz, depends on line frequency). The output of *H*_{1}*(z)* is *y*_{1}*(n),* which is an estimation of the line artifacts present in the EEG. This signal *y*_{1}*(n)* is subtracted from the corrupted *d*_{1}*(n)* to produce the error *e*_{1}*(n),* which is the EEG without line-interference. The *e*_{1}*(n)* error is forwarded as the corrupted input signal *d*_{2}*(n)* to the second stage. The reference input *x*_{2}*(n)* of the second stage can be either a real or artificial ECG. The output of *H*_{2}*(z)* is *y*_{2}*(n),* representing a good estimate of the ECG artifacts present in the EEG record. Signal *y*_{2}*(n)* is subtracted from *d*_{2}*(n);* its result produces error *e*_{2}*(n).* Thus, we have obtained the EEG without line and ECG artifacts. Then, *e*_{2}*(n)* enters into the third stage as the signal *d*_{3}*(n).* The reference input *x*_{3}*(n)* of filter *H*_{3}*(z)* is also a real or artificial EOG and its output is *y*_{3}*(n),* which is a replica of the EOG artifacts present in the EEG record. Such *y*_{3}*(n),* subtracted from *d*_{3}*(n),* gives error *e*_{3}*(n).* It is the final output of the cascade filter, that is, the clean EEG without artifacts.

The reference signals ECG and EOG and the corrupted EEG were acquired simultaneously in polysomnographic studies. EEG, ECG and EOG records belonged to adult patients and were downloaded from the MIT-BIH Polysomnographic Databas-Physiobank (Goldberger et. al., 2000).

In section 4.3 there are present the tests that were carried out to determine the optimum order of *H*_{1}*(z), H*_{2}*(z)* and *H*_{3}*(z).*

### 4.3. Optimal order of FIR filters

To determine the optimum values of the orders *L*_{1}*, L*_{2} and *L*_{3} of *H*_{1}*(z), H*_{2}*(z)* and *H*_{3}*(z)* filters the EEG signal were artificially contaminated with different coloured noises. The test to determinate the optimum values of the orders *L*_{1}*, L*_{2} and *L*_{3} was done with a coefficient convergence rates *μ* fixed in 0.001. As soon as the optimum value of the *L* of each stage was obtained the coefficient convergence rates *μ* of each stage was recalculated with Eq. (15) to assure an adequate adaptation. If *μ* is too big, the filter becomes unstable, and if it is too small, the adaptation may turn out too slow.

The tests were done using one stage of adaptive filter per time without using the cascade of three filters.

#### 4.3.1. Optimal estimation of order *L*_{1} for filter *H*_{1}*(z)*.

The first stage filter attenuates the line frequency and was used to determinate the optimum value *L*_{1} of *H*_{1}*(z).* To determinate *L*_{1}, the EEG was artificially contaminated with a sinusoidal signal of 50 Hz which amplitude is adjusted in 30%, 50%, 80% and 100% of the Root Mean Square (RMS) value of original EEG signal. Then, the filter order *L*_{1} was adjusted with different values of 8, 16, 32, 64 and 128.

In order to study the filter performance, we estimated the Power Spectral Density (PSD) of the original real EEG signal, the contaminated EEG and the different filtered versions of the EEG signal. PSD was computed using the Burg method with a model order equal to 12. Those graphics for one patient are presented in Figure 4 as an example.

Then, we estimated the normalized area below the frequency coherence function and the maximum of temporal cross-correlation normalized function between the filtered EEG signals and the contaminated EEG. If the signals are identical these parameters must be equal to 1. This test was done for each patient.

Table 1 show the averaged values of two parameters for all EEG records of the database.

Figure 4 is an example of PSD graphics for a EEG recording (corresponding to Patient 48) but all records of the database have a similar behaviour in the test. In this figure it could be observed that as *L*_{1} increases, the attenuation of the 50 Hz interference is more significant. However, if *L*_{1} is higher than 32, it can be seen than other frequencies of spectrum are modified.

For this reason, there is a tradeoff between the 50 Hz interference attenuation and the modification of the main frequency components of EEG signal.

In table 1 it can be observed that the best option between *L*_{1}=8, *L*_{1}=16 and *L*_{1}=32 is *L*_{1}=16, because it have the minimum area of coherence and similar values of maximum in cross- correlation with *L*_{1}=32. Chosen this value of the order *L*_{1} there is a loss of information of original signal and there is not a modification in the rest of the spectrum.

It is concluded that the optimum value of *L*_{1} for the first filter is *L*_{1}=16 (for a sampling frequency of 250 Hz). For this order, the optimum value of the coefficient convergence rates *μ* calculated with Eq. (15) must be positive and lower than 0.047

#### 4.3.2. Optimal estimation of order *L*_{2} for filter *H*_{2}*(z).*

The second stage filter attenuates ECG artifacts (mainly QRS complexes) present in EEG signal, and was used to determinate the optimum value of the order *L*_{2} of *H*_{2}*(z).* To determinate *L*_{2}, the EEG was artificially contaminated with a coloured noise, with a -3dB bandwidth between 5 Hz and 40 Hz. This bandwidth was selected considering that QRS complexes have almost their total energy in this frequency band (Thakor, 1984). Then, the filter order *L*_{2} was adjusted with the different values of 16, 32, 64, 128, 256 and 512.

As a similar way to optimum value estimation of *L*_{1}, we estimated the PSD of the original real EEG signal, the contaminated EEG and the different filtered versions of the EEG signal.

Figure 5 shows the PSD graphics for an EEG recording before and after the second adaptive filter. In this figure it could be observed that the possible optimum values of *L*_{2} to filter the cardiac frequencies between 5Hz and 40Hz are *L*_{2}=16, *L*_{2}=32 or *L*_{2}=64, because the rest of the values of *L*_{2} modify the frequencies of the entire spectrum.

Table 2 shows the average of the normalized area below the frequency coherence function and the maximum of temporal cross-correlation normalized function (between the filtered EEG signals and the contaminated EEG) for all recordings analyzed and for different values of *L*_{2}.

L2 | Coherence | Cross-correlation |

16 | 0.2588 | 0.5686 |

32 | 0.2596 | 0.5595 |

64 | 0.2927 | 0.5406 |

128 | 0.2641 | 0.5087 |

256 | 0.1756 | 0.4576 |

512 | 0.1579 | 0.3463 |

In table 2 it can be observed that the best option between *L*_{2}=16, *L*_{2}=32 or *L*_{2}=64 is *L*_{2}=32, because it have the minimum value of the normalized area below the frequency coherence function and the lower values of maximum of cross- correlation normalized function without losing information and not modifying the spectrum of the original EEG signal.

It is concluded that the optimum value of *L*_{2} for second filter is *L*_{2}=32. For this order, the optimum value of the coefficient convergence rates *μ* calculated with (15) must be positive and lower than 0.02367.

#### 4.3.3. Optimal estimation of order *L*_{3} for filter *H*_{3}*(z)*.

As it is mentioned above, the third and last stage filter attenuates EOG artifacts present in EEG. In this section, we determinate the optimum value of the order *L*_{3} of *H*_{3}*(z).* To determinate it, the EEG was artificially contaminated with a coloured noise with a -3dB bandwidth between 0.5 Hz and 10 Hz. This bandwidth includes the main frequency components of EOG artifacts. Then, we evaluated the filter performance with different *L3* values (4, 8, 16 and 32).

As a similar way to optimum value estimation of *L*_{1} and *L*_{2}, we estimated the PSD of the original real EEG signal, the contaminated EEG and the different filtered versions of the EEG signal.

Figures 6 and 7 show the PSD graphics for an EEG recording before and after the third adaptive filter. It can be observed that all the values of the order *L*_{3} chosen have good result to filter the frequencies lower than 10 Hz (see Figure 6). No one introduce interferences in other frequencies. But with values bigger than 256 it could be observed a distortion in high frequencies and a loss of information of the original signal in low frequencies (see Figure 7). The modification of the high frequencies and the losing of information in low frequencies are shown in figure 7, where there have been filtered the contaminated EEG with values of *L*_{3}=256 and *L*_{3}=512

Table 3 shows the averaged values of the normalized area below the frequency coherence function and temporal cross-correlation normalized function (between the filtered EEG signals and the contaminated EEG) for all recordings analyzed and for different values of *L*_{3}.

In Table 3 it can be observed that the best option of the value of the order *L*_{3} for the third filter is *L*_{3}=16, because it have the minimum value of the normalized area below the frequency coherence function and the lower values of maximum of cross- correlation normalized function without losing information of original signal and not modifying the spectrum of the original EEG. The results of the test using values of *L*_{3} bigger than *L*_{3=}256 have not been included in Table 3.

It is concluded that the optimum value of *L*_{3} for the third filter is *L*_{3}=32. For this value, the optimum value of the coefficient convergence rates μ calculated with (15) must be positive and lower than 0.02367.

## 5. Results

Eighteen real EEG records acquired in PSG studies were processed with the cascade of adaptive filters. According to the previous tests, the values of the orders *L*_{1,}
*L*_{2} and *L*_{3} were adjusted as *L*_{1}= 16*, L*_{2}= 32 and *L*_{3}= 32.

As it was mentioned in section 2, only five subjects from the entire database have EOG signals. So, the EEG signals of these five patients have been filtered with the entire cascade shown in Figure 3. The others thirteen EEG (belonging to the rest of the patients) have not been filtered with the last third stage.

The input *d*_{1}*(n)* in the first stage is the EEG corrupted with artifacts (EEG + line-frequency + ECG + EOG). The reference *x*_{1}*(n)* in the first stage is an artificial sine function generated with 50 Hz with the same RMS of the EEG signal. The *e*_{1}*(n),* which is the EEG without line-interference, is forwarded as the corrupted input signal *d*_{2}*(n)* to the second stage. The reference input *x*_{2}*(n)* of the second stage is the real ECG. The error *e*_{2}*(n)* is the EEG without line and ECG artifacts and enters into the third stage as the signal *d*_{3}*(n).* The reference input *x*_{3}*(n)* of filter *H*_{3}*(z)* is a real EOG. The error *e*_{3}*(n)* is the final output of the cascade filter, that is, the clean EEG without artifacts.

In order to study the filter performance we estimated the normalized area below the frequency coherence function and the maximum of temporal cross-correlation normalized function between the filtered EEG signals of each stage and the original EEG for the entire data base.

Table 4 shows the results obtained for each record of the database processed by the first stage of the propose filter. In this table, it is presented the values of the normalized area of frequency coherence function and the normalized maximum of temporal cross-correlation between the contaminated signal *d*_{1}*(n)* and the error signal *e*_{1}*(n)*. Those values show that the first stage attenuates the line interference.

Figure 8 illustrates a temporal segment of 10s of the original EEG record (corresponding to Patient 41) and its filtered version after the first stage of adaptive filter. In this figure it can be observed that the 50 Hz power line component is significantly filtered.

Figure 9 shows the PSD function of the same original and filtered EEG signals shown in Figure 8. The PSD of the filtered signal shows that the first stage attenuates the line-frequency artifacts. The *H*_{1}*(z)* filter adapts the amplitude and the phase of the artificial sinusoidal signal *x*_{1}*(n)* (50Hz) in order to have as output a replica, *y*_{1}*(n)*, of the line-frequency artifacts present in the EEG.

After 50 Hz filtering, the EEG is forwarded to the second stage in order to remove ECG artifacts (see Figure 3).

Table 5 shows the results obtained for each record of the database processed by the second stage. In this table, it is presented the values of the normalized area of frequency coherence function and the normalized maximum of temporal cross-correlation between the contaminated signal *d*_{2}*(n)* and the error signal *e*_{2}*(n).* Those values show that the second stage attenuates QRS complexes artifacts introduced by ECG signal.

Figure 10 shows an example of 10s of EEG signal (corresponding to patient 41) processed by the second filter. The contaminated signal *d*_{2}*(n)* is shown in red. It could be observed the presence and morphology similarity of QRS complexes of the ECG (in green) in the EEG record. The output signal *y*_{2}*(n)* of *H*_{2}*(z)* is drawn in black colour, this signal is an estimation of the ECG artifacts present in the EEG. The *H*_{2}*(z)* filter adapts the amplitude and the phase of the reference signal *x*_{2}*(n)* (ECG signal) in order to have as output a replica of the artifacts present in the EEG

After 50 Hz and ECG filtering, the EEG is forwarded to the third stage in order to remove EOG artifacts.

Table 6 shows the results obtained for five records of the database processed by the third stage. In this table, it is presented the values of the normalized area of frequency coherence function and the normalized maximum of temporal cross-correlation between the contaminated signal *d*_{3}*(n)* and the error signal *e*_{3}*(n),* which is the final output of the proposed filter. As it has been mentioned before only five patients have been filtered with the third stage, the rest of them do not have the reference signal *x*_{3}*(n).* Those values show that this last stage attenuates artifacts introduced by the EOG.

Patient | Coherence | Cross-correlation |

32 | 0.9985 | 0.9907 |

37 | 0.9912 | 0.7949 |

41 | 0.9859 | 0.6052 |

45 | 0.9990 | 0.9500 |

48 | 0.9527 | 0.7943 |

average | 0.9855 | 0.8270 |

Figure 11 shows the same 10s of temporal EEG signal of patient 41. There it can be observed all signals of third stage*.* The contaminated signal *d*_{3}*(n)* is drawn in red colour. It can be observed the presence and morphology similarity of the EOG signal in the EEG record. The output signal *y*_{3}*(n)* of *H*_{2}*(z)* is in black colour in the figure, this signal is an estimation of the EOG signal present in the EEG. The *H*_{3}*(z)* filter adapts the amplitude and the phase of the reference signal *x*_{3}*(n)* (EOG signal) in order to have as output a replica of the EOG artifacts present in the EEG.

Figure 12 show the PSD of the contaminated EEG of third stage, *d*_{3}*(n)*, of the reference signal *x*_{3}*(n),*EOG, and of the filtered EEG signals illustrated in Fig. 11. Note that the low frequencies of the EOG present in the contaminated EEG are attenuated in the filtered EEG signal.

Figure 13 is shown temporal temporal segments of 10s of EEG. In this figure it could be observed the attenuation of line frequency and biological artifacts without losing important information of the EEG signal. Results show that the proposed adaptive filter cancels correctly the line frequency interference and attenuate very well the biological artifacts introduced by the ECG and the EOG.

## 6. Discussion and conclusion

In this chapter, a novel filtering method based on three adaptive filters in cascade has been proposed to cancel common artifacts (line interference, ECG and EOG) present in EEG signals recorded in PSG studies.

Other methods (like PCA, ICA, BSS or WT) have been described in the bibliography to cancel these artifacts in the EEG signals. However, those methods have some restrictions. For example, the properties of WT make it has an advantage in processing short-time instantaneous signal, but it needs that the frequency range of the EEG signal was not overlap with the bandwidth of noise sources and in this case the frequencies bands of the ECG and EOG signal are overlap with the frequencies of the EEG. ICA is a developed method for transforming an observed multidimensional vector into components that are statistically as independent from each other as possible. This method needs that the dimension of the signals were larger than that of original signals, and every original signal must be non-Gaussian. With more observed signals ICA will get better filtering result, which limits the application of this technique in few channels EEG recordings.

The main advantages of the proposed adaptive filtering method can be summarized as:

The method does not have restrictions about the signal to be filtered.

The implementation of adaptive filtering is very simple and fast and the results can be obtained without complex calculations.

The filter coefficients can be adapted to variations in heart frequency, abrupt changes in the line frequency (caused, say, by ignition of electric devices) or modifications due to eye movements.

At each stage output, the error signals

*e*_{i}*(n),*EEG with one of the three attenuated artifacts are present; such separation (by artifacts) may be useful in some applications where such output might be enough.The filters have a linear phase response so no phase distortion is made. This is particularly important for the analysis of neurological rhythms in EEG signals

As soon as the optimal orders of the three filters were determinate, the method was tested in 18 real EEG records acquired in PSG studies. Figure 13 is a good example of an EEG record corrupted by three types of artifacts and its corresponding filtered version. It can be seen that all artifacts have been eliminated or attenuated, improving the quality of EEG record. The remaining records analyzed in the work had obtained similar results and their filtered EEGs don’t have large artifacts.

It has been concluded that proposed adaptive filtering scheme with the appropriate values of order *L _{i}*, attenuate correctly ECG, EOG and line interference without removing significant information embedded in EEG signals registered in PSG studies. Due to the fact that the these studies usually have the ECG, EOG and EEG signals, the proposed cascade of adaptive filters is very useful and appropriate for the analysis of PSG recordings in sleep laboratories. The cascade could be used in others biomedical applications and in BCI applications.