Projects:2016s1-131 ECG Enhancement with Advanced Signal Processing

From Projects
Revision as of 13:30, 26 October 2016 by A1655515 (talk | contribs)
Jump to: navigation, search

Topic

ECG Enhancement with Advanced Signal Processing


Supervisors

Dr. Brian Ng

Prof. Mathias Baumert

Team Members

Yang Lin

Yingtong Guo

Introduction

The electrocardiogram (ECG) recording plays an important role in medical applications. However, it is easily affected by sources [2]. In this project, we are intend to enhance ECG signals by using recent advances in digital signal processing which is based on the sparsity –based signal processing. Three ECG databases and one optional database are used to implement the approach. Generally, the desired ECG recordings are gained from websites and then according to different ECG signals, the sparsity-based method is used with different parameters. After that, the performance of the method is evaluated by comparing the accuracy of the RR interval measurements, obtained from the Pan Tompkins QRS detection algorithm.

Motivation

The ECG signals are measured from the body surface so it is easy to be contaminated by body and instruments. It is essential for doctors to diagnose the diseases accurately by analysis of ECG signals and actually, all the waves of ECG signals have a certain pattern which have a predictable time duration, a range of acceptable amplitudes and a typical morphology which means that any deviation from the normal pattern is potentially not healthy [1]. Therefore, the noise or artefacts in the ECG signals can influence the doctors’ diagnosis and that noise in the ECG ideally should be removed before doctors’ diagnosis. That is the reason why we need ECG signal processing. In this project, the noise in the ECG signals will be removed or reduced and ECG will be enhanced with digital signal processing techniques so the doctor can analyze the real signal which should make the diagnosis more accurate, stable and reliable.

Previous Studies

This project is not a follow-up project but it is based on the work of Ning and Selesnick [2]. In their paper, some detailed denosing problem and proposed algorithm has been discussed. The most important thing is that the sparsity-based method has been introduced which make it possible to implement in ECG signals [2]. In addition to that, the QRS detection algorithm is named Pan Tompkins [3] which is reliable to detect the QRS complexes. It has a good result for the standard 24h MIT/BIH arrhythmia database so it can be used to test our project’s result. In this project, three databases and one optional database are chosen from physionet website to verify the sparsity-based method in the work of Ning and Selesnick and use Pan Tompkins QRS detection algorithm to check the result.

Objectives

The aim of this project is to improve the ECG signals in three databases and one optional database. The objectives are: • Reduce the influence of noise which mainly focus on motion artefacts on ECG signal in the chosen database to provide better result for doctors. • Investigate sparsity-based separation methods for QRS detection and compare the result to previous research. • For the optional database, separate desired clean ECG signal from mixed ECG recording.

Background

ECG Basics

ECG is an approach that measures and records the electrical activity of the heart. It can be sensed by monitoring electrodes which are placed on the body surface. The basic information can be measured from the ECG signals is the heart rate and heart rhythm. For example, a normal person’s heart rate is from 60 to 100 beats per minute [1]. Therefore, the clinicians can diagnose the patients through the heart rate and rhythm. Actually, each electrical activity of heart has a distinctive waveform. Figure shows that a normal ECG signal consists of P wave, QRS complex and T wave [1]. The first one is called P wave which represents the depolarization of atria from the SA node to the AV node. Depolarization is the change in the cell’s membrane potential to a positive value. It is this change that generates the electrical impulse that starts the heart’s contraction so the P wave can be related with the contraction of the atria [1]. The QRS wave which looks like a small dip followed by a large spike and another dip represents the depolarization of the ventricles which can be also think as the contraction of the ventricles [1]. One thing noticed is that the P wave is smaller than the QRS complex. That is because the ventricles are the muscle pumps of the heart compared to the atria. After the QRS complex, there is the T wave which represents the repolarization of the ventricles [16]. Repolarization is the opposite of the depolarization which returns the membrane back to a negative state [1].

Noise and Artifacts

In signal processing, noise is an unwanted component that a signal may suffer during transmission, processing and conversion. Basically, there are mainly 4 kinds of noises which possibly interfere the ECG signals: • Power line interference is the most common noise. It comes from patients’ cables and can be easily found since the interfering voltage in the ECG signal will have frequency 60 Hz [18]. What is more, it can be regarded as sinusoids and combination of sinusoids [4]. Despite the fact that hardware system can remove part of the signal interference, the 60Hz of power line interference still exists [17]. • Muscle contractions (EMG) is caused by the contraction of other muscles besides the heart [2]. That contraction can also produce depolarization and repolarization which can influence the ECG signals. Moreover, it can be reasonably modelled as Gaussian distribution function. However, the variance is dependent on the environmental variables [4]. • Electrode contact noise is caused by the loss contact between the electrode and skin which can be permanent [4]. Figure 39 in Appendix shows it can cause sudden changes in amplitude of the signal. • Motion artefacts which due to vibrations or movement of the subject, resulting in a change to the skin voltage [4].

Sparsity-based method for removing noise

To remove the noise in ECG, actually there are many methods such as wavelet transform and adaptive filtering [7]. The wavelet transform is a time-scale transformation to optimize signal composition structure [6] and it will be described in detail in the next section. For Adaptive filtering method, a widely used one is the least mean squares (LMS) adaptive algorithm. As shown in figure 41 in Appendix, the basic idea of LMS filter is to keep a gradient based iterative solution [19]. The idea of noise reduction is to use the adaptive filter to estimate the effect of the secondary input on the primary signal (the filter output Yk) and subtract this from the primary signal [19]. For example, the problem of fetal heart beat measurement. The heartbeats of the fetal are often corrupted by the effect of mother’s heart [23]. In that case, the effect of the mother’s heart on the fetal will be estimated and subtract this from the primary signal, leaving an enhanced signal Ek which consists primarily of the fetal heartbeat signal.

BP and BPD

However, all those ways are not flexible enough and some important information may miss due to the noise is non-stationary and the overlap of signal and noise bandwidths. In Ning and Selesnick’s work, many algorithms based on sparsity-method for noise reduction have been introduced. If it is known that the signal which will be estimated has sparse Fourier coefficient, then sparsity-method can be used for denoising [5]. The basic idea about sparsity-method is to consider a system with the equation Y=Ax where A is an M x N matrix, y and x are length-M and length-N vectors respectively, where N>M. As the unknowns in the system are more than equations, the equation Y=Ax has infinitely many solutions. An l1-norm is used which is defined by: E1.jpg (1)

An approach to solve Y=Ax is to minimize the sum of absolute value of x: E2.jpg (2)

Where ||x||1 is the defined l1-norm. This problem is known as the basis pursuit (BP) problem which cannot be expressed in explicit form. One way to tackle the problem is to use an iterative numerical algorithm [5]. What is more, in real world y is usually noisy, the solution to the Y=Ax can be changed to minimize the cost function: E3.jpg (3)

This is the basis pursuit denoising (BPD) problem and similar to BP, the BPD problem can be solved by using an iterative numerical algorithm. In addition, note that ||x||1 is not differentiable since it is defined as the sum of absolute values [5]. The absolution value function is not differentiable at zero. That make the calculation difficult for large-scale problems. However, the BP and BPD problems are convex optimization so that some practical algorithms from optimization theory can be used such as iterative shrinkage (ISTA), fast ISTA (FISTA) and split variable augmented lagrangian shrinkage algorithm (SALSA) [5].

Signal component separation using BP

It is useful to split up the signal into its components when a signal contains components with distinct properties. What is more, when the signal components have overlap in frequency, the sparse representation can be used to signal separation problems. The use of sparsity to separate components of a signal is known as ‘morphological component analysis’ which means the components should have different shape. Consider a known signal y, which can be regarded as the sum of two components, E4.jpg (5) Where y1 and y2 should be distinct form each other. In addtion, it assumes that each of those two components is described by transforms A1 and A2 and the aim is to find the respective coefficients c1 and c2. E5.jpg (6) Thus, instead of finding y1 and y2, find c1 and c2 are the appropriate way. The equation is similar to the equation in the BP. The only difference is there are two sets of coefficients to be found so that problem is equivalent to basis pursuit. E6.jpg (7) Likewise, the solution for the above equation is the same as the BP solution so that problem is also known as dual BP. Therefore, the signal can be divided into two components according to their different characteristics. For ECG signals, they are sparse in frequency while the noise or other interference is not. In addition, the shape and period of R waves are regular which can be used to distinguish from the undesired component.

Discrete Wavelet Transform

The wavelet transform is based on small wavelets with limited duration which provides the time-frequency representation. Basically, the main idea of the discrete wavelet transform is that the signal is passed through various high pass and low pass filters [15]. Those filters can remove either high frequency or low frequency portions of the signal. This procedure is repeated so every time some portion of the signal corresponding to some frequencies being removed from the signal. The DWT analyzes the signal at different bands by decomposing the signal into an approximation and detail information. The decomposition of the signal into different frequency bands is simply obtained by successive high pass and low pass filtering of the signal. As shown in figure 42 in the Appendix, the original signal is first passed through a half-band high pass filter and a low pass filter. After that, half the frequencies of the signal have now been removed and half the samples can be discarded according to Nyquist’s rule [15]. The filter outputs are then subsampled by 2. downsampling a signal corresponds to reduce the sample rate or remove some of the samples of the signal. For instance, downsampling by two refers to drop every other sample of the signal. downsampling by a factor n reduces the number of samples in the signal n times. The DWT is mostly used in image compression and images analysis [25]. One application is in JPEG 2000. People break the image into the DWT components, then construct trees of the coefficients generated by the DWT to determine which components can be omitted before saving the image to eliminate extraneous information. For this project, we want to use DWT to make ECG signal into sub-bands and analysis them to find which part is what we need so that the unwanted sub-bands can be reduced.

QRS Detection

In order to verify the approach in this project is feasible, a QRS detection is used to check the results. In this project, Pan Tompkins algorithm is chosen which is an old-fashion but widely used so it can make the result more convincing. The algorithm has several steps [3]. Figure 43 (a) in Appendix is the original signal. To reduce noise and false detection, a band-pass filter is used and (b) shows the output of the filter. After that, the filtered signal is differential followed by squaring which (c) and (d) shows the results respectively. The square process increases the slope of the frequency response curve and will make false positives under control. Next, as shown in (e) moving window integration which generate a signal that contains information about both the slope and the width of the QRS waves. (f) is the signal that produced by delaying the original one by the total processing time of the algorithm and (g) shows the final output after using the adaptive thresholds. In this algorithm, two thresholds are used [3]. One is to threshold the filtered ECG and another is to threshold the signal produced by moving window integration. In that way, detection sensitivity can be increased and missed beats can be found.

R Wave Detection

As mentioned, the R wave, which represents early ventricular depolarization, is the first upward deflection after the P wave even sometimes the Q wave is missing. It is the easiest waveform to recognize on the ECG as it is the tallest among other waves. The abnormalities of the R wave may represent some diseases in heart. In ECG, R waves are always detected because the P wave and T wave’s amplitude is low. The RR interval is the same as the distance between two beats which should be from 0.6s to 1.2s [20]. From the RR interval, we can tell the beats are evenly spaced or not so the instantaneous heart rate can be calculated and the rhythm can be judged as well. Moreover, RR interval is applied to analyse heart rate variability which is a physiology phenomenon of variation in the time interval between heartbeats [21]. In addition, the measurements of RR intervals are essential because not only doctors are able to tell heart rate and rhythm from them but also they are often used to compare performances of various algorithms about ECG. Actually, the measurements for the long-time RR intervals suffer from non-stationary noise, such as baseline drift and the presence of ectopic beats which cause the statistical information inaccuracy [22]. Thus, some pre-processing methods are often used, such as nonlinear filter and wavelet technique [21]. In this project, the R waves will be detected and the RR interval will be calculated. Compare the RR intervals from the signal after processing to the reference ECG signal to evaluate the performance of the sparsity-based method. Since the RR intervals may vary from beat to beat, the mean, maximum, minimum and variance of RR intervals will be calculated to make the evaluation reasonably.



Annotation.png

Flow direction Flowchart.png