You are on page 1of 48

Nonlinear Analysis of ECG: a

Noninvasive Way of Medical Diagnosis

Problems of Discussion
Detection of ECG Characteristic Points
(Noise corrupted data)
Detection of Abnormality

Different Types of Beats

Normal Beat

Left Bundle Branch Block (LBBB) Beat

Right Bundle Branch Block (RBBB) Beat

LBBB & Premature Ventrcular Contraction Beat

RBBB & Atrial Premature (APC) Beat

Paced Beat

QRS Complex

Reflects ventricular contraction


Provides more information about the current state of heart
Characteristic shape different from other waves in ECG
QRS detection provides fundamentals for ECG analysis algorithms

Algorithmic Structure

ECG

Linear
Filtering

Nonlinear
Filtering

Preprocessing Stage

Peak
Detection
Logic

Decision

Decision Stage

ECG Detection Algorithms


Derivative based algorithms
First derivative
Amplitude and first derivative
Second derivative
Algorithms based on digital filters
FIR Filter
IIR Filter
Wavelet Transform based algorithms
Filter Banks methods

Algorithms

based on neural network


Time lagged feedforward neural network
Linear vector quantization network
Adaptive filters
Matched filers
Neural network- fuzzy hybrid method
Genetic algorithms
Hilbert transform
Maximum a posteriori estimation
Length and energy transforms

Problem Description
The wide variation in the morphologies of ECG waveforms, not
only of different patients or patient groups but also within the
same patient.

The ECG signal is contaminated by noise of various origins.

Many of the presented algorithms were not tested against


standard database or any database at all and tested with small
data.

Objectives

Only a comparable and reproducible evaluation on a standard


database with reasonable size may show the progress achieved by
a novel method.

The overall goal of this research is to quantify the relative


noise susceptibility of different recent and formerly proposed
QRS detection schemes against a standard database and ECG
contaminated by different types of noise at different levels.

Typical Noises in ECG


Disturbances

of physiological origin

Baseline Shift

Muscle Noise

Disturbances of technical origin

Power Line Noise

Electrode Contact Noise

Motion Artifacts

Noise Generated by Electronic Devices Used


in Signal Processing

Electrosurgical Noise

Baseline Shift
Slow-moving, non-deterministic wave
Due to respiration

Typical parameters:
Amplitude Variation 15 % of peak to peak ECG amplitude
Baseline Variation 15 % peak to peak ECG amplitude variation at 0.15 to 0.30 Hz

Muscle Noise

Electromyogram (EMG) interference


Caused by the random firing of muscle fibers

Typical parameters:
Standard Deviation 10 percent of peak to peak ECG amplitude
Duration 50 msec
Frequency Content dc to 10000 Hz

Power Line Noise


Picked up by the electrode leads from neighboring equipments
Almost periodic (50Hz 2% in Bangladesh)

Typical parameters:
Frequency content 50 Hz fundamental with harmonics
Amplitude up to 50 percent of pick-to-pick ECG Amplitude

Motion Artifacts
Baseline changes caused by changes in the electrode skin
impedance with electrode motion
Motion artifacts are transient but not in step

Typical parameters:
Duration 100 500 msec.
Amplitude 500 percent of peak-to-peak ECG amplitude

Electrode Contact Noise


Randomly occurring rapid base line transition (step)
Caused by loss of contact between the electrode and skin
Typical parameters:

Duration 1 second
Amplitude maximum recorder output
Frequency 60 Hz
Time constant about 1 second

Electrosurgical Noise

Alias version of this noise would remain in digitized ECG

Typical parameters:
Amplitude 200 percent of peak to peak ECG amplitude
Frequency Content Aliased 100 kHz to 1 MHz
Duration 1 to 10 seconds

Description of the Database


MIT-BIH Arrhythmia Database was used to evaluate the
performance of different QRS detection algorithms.

Contains 48 half hour, 2 channel recordings of annotated ECG


with 116,000 normal and abnormal beats.

Sampling rate 360 Hz, each record consists 6,48,000 samples.

11-bit resolution over a 10 mV range.

This study: Lead II ECG of 15 data sets tested; 33,774 beats


(Normal 21,061; abnormal 12,713), includes both male and
female aged 23-89 years old.

Noise simulation
Different representative noise sources for simulation are:
1. Electromyographic Interference because of its random
properties and high frequency content,
2. Powerline Interference because it is ubiquitous,
3. Base line drift due to respiration because of its low
frequency properties,
4. Abrupt shift in the base line due to its large first derivative,
5. A composite of all of the above.
Electrosurgical and instrumental noise behaves similarly as
random model for EMG, hence these were not specifically
modeled.

Power Line Noise


50Hz sine wave was generated having the peak amplitude as 1.

Generated sine wave is scaled with max peak-to-peak amplitude of


0.333mV. It is then scaled further by the percent noise to be added.

Raw ECG Signal

25% Power Line Noise

50% Power Line Noise

75% Power Line Noise

100% Power Line Noise

Electromyographic (EMG) Noise


EMG noise was simulated using a random number generator.
Array of random numbers was created consisting of values of +/- 0.50. Then

these random numbers were multiplied the max ECG amplitude value and
scaled by the percent noise that is to be added.

Raw ECG Signal

25% EMG Noise

75% EMG Noise

50% EMG Noise

100% EMG Noise

Baseline Drift Noise


Baseline drift noise was simulated by adding a 0.333 Hz and 1 mV sinusoid

to the ECG signal.


It is then scaled further by the percent noise to be added.

Raw ECG Signal

25% Baseline Drift Noise

75% Baseline Drift Noise

50% Baseline Drift Noise

100% Baseline Drift Noise

Abrupt Baseline Shift Noise


Random numbers (within 0.5 mV) were generated, but the same random

number was taken for 500 ms duration cycle.


After completing one cycle, another random number was generated and it
was taken as the one for that cycle.

Raw ECG Signal

25% Abrupt Baseline Shift Noise

50% Abrupt Baseline Shift Noise

75% Abrupt Baseline Shift Noise

100% Abrupt Baseline Shift Noise

Composite Noise
The maximum noise level of this type was constructed by reducing the

maximum noise levels for each of the previous described noise types to
50% and then summing them.

Raw ECG Signal

25% Composite Noise

50% Composite Noise

75% Composite Noise

100% Composite Noise

QRS Detection Algorithms


Each algorithm used in this study is based on a specific
scheme.

Seven basic types of algorithms included in this study. These


include Amplitude and First Derivative (AFD), First Derivative
(FD), First and Second Derivative (FSD), FIR Digital Filter
(DFF), IIR Digital Filter (DGI), Neural Network (NN) and
Wavelet Transform (WT).

A tuning procedure was carried out in order to determine


the value for threshold and constants, which would give the
best results for the composite noise corrupted data.

Simple thresholding techniques used to provide similar


platform for comparison.

Algorithm Based on Amplitude and First Derivative


Amplitude Threshold = 0.3max[x(n)]
First derivative transfer function:
H(z)=z-z-1;

A QRS candidate occurs when,


y(i), y(i+1), y(i+2) > 0.1
and

y(j), y(j+1) < -0.1

where

(i+2) < j < (i+25)

and x(i),x(i+1),,x(j+1) Amplitude Threshold

Algorithm Based on First Derivative


First derivative is a five point parabolic filter:
H(z)=-2z-2 -z-1 + z + 2z2 ;

The slope threshold is calculated as:


Slope threshold = 0.25max[y(n)] ;
A QRS candidate occurs when,
y(i) > slope threshold

Algorithm Based on First and Second Derivative


Rectified first derivative:
y0 (n)=abs[x(n+1)-x(n-1)];
Then smoothed by a three point moving average filter:
y1(n)=[y0(n-1)+2y0(n)+y0(n+1)]/4;

Response for Moving Average Filter

The rectified second derivative :


y2(n)=abs[x(n+2)-2x(n)+x(n-2)];
The rectified and smoothed first derivative is added to the rectified
second derivative:
y3(n)=y1(n)+y2(n);

Algorithm Based on First and Second Derivative


Maximum value scaled to serve as primary and secondary thresholds:
Primary threshold = 0.4max[y3(n)] ;
Secondary threshold = 0.05max[y3(n)] ;
a) ECG Signal
b) Rectified first
derivative signal
c) Output of Moving
Average Filter
d) Rectified second
derivative signal
e) Sum of (c) and (d).

A QRS candidate occurs when,


y3 (i)>= primary threshold ;
y3(i+1), y3(i+2),., y3(i+6)> secondary threshold

Algorithm Based on Digital Filter (FIR)


First stage smoothes the ECG using a three point MA filter:
y0(n)=[x(n-1)+2x(n)+x(n+1)]/4 ;
The output of the moving point averaging filter is passes through a
low pass filter:
nm

y0 (l ) ;
y1(n)=[1/(2m+1)] l
nm
Response for Low Pass Filter

The difference between the input and output of the low pass filter,
which is act as a band-pass filter is then squared:
y2(n)=(y0(n)-y1(n))2 ;
The squared difference is filtered to enhanced the QRS complex:
n m

y3(n)=y2(n){

y (l ) }2 ;

l nm

Algorithm Based on Digital Filter (FIR)


A fourth array is form to discard peaks due to abrupt baseline shift, using
the following formula :
y4(n)=y3(n) if [y0(n)-y0(n-m)][ y0(n)-y0(n+m)]>0
y4(n)=0 otherwise
Threshold = 0.125max[y4(n)] ;

A QRS candidate occurs when,


y4(n) > threshold

The value of m was set to six in


order to give good performance.

Algorithm Based on Digital Filter (IIR)


The ECG signal passed through a band pass filter composed of
cascaded low pass and high-pass, differentiation, squaring and
moving average filter.
The low pass filter is:
y1[n]=2y1[n-1]-y1[n-2]+x[n]-2x[n-6]+x[n-12]
High pass filter is:
y2[n]=-y2[n-1]-y1[n]+32y1[n-16]+ y1[n-32]
The signal then differentiated through a five point differentiator:
y3[n]=(2y2[n+1]+y2[n+2]-2y2[n-1]-y2[n-2])/8
Squaring operation makes all data positive; it emphasizes the higher
frequency component nonlinearly:
y4[n] = y3[n]2

IIR (Continued)
A moving average filter is now acts as a smoother and performs a
moving window integrator over 150ms:
y5[n] = (y4[n-(N-1)]+ y4[n-(N-2)]+. + y4[n])/N

Response of Low Pass Filter

Response of High Pass Filter

Thresholds are set up to detect QRS complexes in the output of


the moving average filter.

Algorithm based on Neural Network


A Time Lagged Feed forward Network (TLFN) is used to model
the background noise process.
The TLFN is applied to predict lower frequency content in
ECG.

The occurrence of higher frequency QRS suddenly increase


prediction error, indicate the presence of a QRS.

o
Backpropagation
algorithm
o Forward pass
o Back-propagation pass
A 6-5-1 MLP configuration with hyperbolic tangent hidden layer
neuron and linear output neuron was trained with different sets of
noisy signal using Back- propagation algorithm.

Training was stopped at 500 iterations with an Mean Squared


Error (mse) of 0.0206. This TLFN used for simulation process.

After smoothing the output of TLFN, a matched filter is


applied to improve the SNR.

Error (mse) curve during training

The output of the matched filter is then propagated further to the


adaptive threshold function to detect the QRS complex.

Algorithm based on Wavelet Transform


Wavelet has zero net area that offers the potential to capture the
QRS spikes which normally occur in a short period of time.

Discrete wavelet transform is equivalent to an octave filter bank.


This Multi-Resolution Analysis (MRA) decomposes a signal into
scales with different time and frequency resolution helps to
discriminate the QRS spikes with other noises.

Originalsignal
m=0

G
H

m=1

m=2

Scaledsignals

WaveletTransform/Detailsignal

A five level wavelet decomposition of the noisy signal using


Coif2 wavelet functions with soft and fixed thresholding applied
for denoising.

The wavelet used for QRS detection is Biorthogonal spline


wavelet (bior6.8) for which symmetry and exact reconstruction are
possible.

When a local peak


exceeds the threshold
successive search in
vicinity is performed
for higher peaks as
QRS candidate.

Results of QRS Detection


The performance criterion is percentage error rate:
Error Rate,

ER

FP FN
*100
Total no. of QRS complex

Performance (% Error Rate) for Raw ECG Signal (15 data sets, 33,774 beats, 21,061 N+12,713 Ab)

Total
( ER is in
Mean

Standard
Deviation)

Total
Beats

Beats Description

Algorithms

33,774

Normal
21061
APC
650
PVC
589
Paced
2078
LBBB
2492
RBBB
6776
Fusion PVC
8
Blocked APC
10
Blocked PVC
2
Junctional Premature 79
Junctional Escape 5
Unclassible
5
Aberrated APC 19

AFD

Error Rate
(%)
5.2811.75

FD

4.06 12.6

FSD

2.02 3.22

DF_FIR

3.98 8.77

DF_IIR

2.67 7.34

NN

1.77 1.88

WT

1.29 1.74

Percentage error rate for Power Line Noise Corrupted ECG Signal
NL

Algorithms

(%)

AFD

FD

FSD

DFF

DFI

NN

WT

25

0.54
0.55

1.01
0.69

2.39
4.37

0.86
0.59

0.94
0.92

1.64
2.17

1.13
1.84

0.86
1.13

1.51
1.47

6.03
16.73

0.79
0.53

0.94
0.9

1.64
2.13

1.14
1.77

75

1.95
3.02

3.21
4.89

4.94
14.92

0.79
0.51

0.94
0.89

1.63
2.11

1.16
1.81

100

3.63
5.67

20.8
65.51

8.04
22.12

0.8
0.49

0.94
0.89

1.63
2.1

1.16
1.78

50

Percentage error rate(Mean SD) for Baseline Drifted ECG Signal


Algorithms

NL
(%)

25

AFD

FD

FSD

DF_FIR

DF_IIR

NN

WT

0.48
0.26

0.85
0.51

1.64
2.36

1.04
0.73

0.94
0.92

1.63
2.06

1.14
1.87

0.94
0.9

1.6
2.05

1.14
1.83

50
0.51
0.25

0.85
0.5

1.64
2.32

1.04
0.72

75

0.51
0.22

0.85
0.5

1.64
2.31

1.04
0.71

0.94
0.89

1.61
1.95

1.16
1.81

100

0.50
0.23

0.85
0.50

1.64
2.3

1.04
0.71

0.94
0.89

1.69
2.06

1.15
1.8

Percentage error rate(Mean SD) for Abrupt Baseline Shifted ECG Signal
NL

Algorithms

(%)

25

AFD

FD

FSD

DF_FIR

DF_IIR

NN

WT

5.51
11.84

4.6
12.32

2.86
4.12

3.1
6.38

2.92
8.27

1.9
2.09

1.28

1.73

50

1.34

1.66

5.72
12.11

6.77
12.33

8.33
12.57

3.58
6.35

3.43
8.74

2.21
2.79

75

6.27
12.51

8.03
11.16

15.1
27.74

5.41
10.81

4.51
9.44

2.05
2.52

1.55

2.12

100

7.39
12.87

9.64
11.16

23.29
34.29

8.26
15.51

5.77
10.3

2.55
3.73

1.89
2.8
3

Percentage error rate(Mean SD) for EMG Noise Corrupted ECG Signal
NL

Algorithms

(%)

25

AFD

FD

FSD

DF_FIR

DF_IIR

NN

WT

92.07
12.13

91.59
131.6

139.7
188.8

8.66
7.02

6.9
20.31

2.01
2.55

1.51
2.14

183.8
168.1

215.3
223.4

22.34
12.65

38.77
25.32

6.85
3.53

11.03
5.09

228.3
203.4

272.9
219.9

25.64
53.73

41.52
47.46

9.3
17.67

10.43
19.21

269.6
208.3

304.6
218.1

38.25
74.05

51.93
49.48

17.53
26.76

16.06
19.21

50

75

100

89.32
14.22
81.56
21.13

74.5
27.04

Percentage error rate(Mean SD) for Composite Noise Corrupted ECG Signal
NL

Algorithms

(%)

25

AFD

FD

FSD

DF_FIR

DF_IIR

NN

WT

7.32
13.93

17.98
45.77

53.27
123.9

5.63
12.12

4.66
16.5

2.08

2.6

1.53
2.07

2.37

3.1

50

10.57
18.62

70.98
110.6

136.1
176.7

8.26
15.57

7.88
21.2

3.23
6.37

75

14.23
24.66

132.3
152.1

195
192.1

10.98
19.62

13.11
26.52

2.58

3.23

4.27
7.34

100

18.78
31.36

182.2
173.3

237.1
196.7

16.47
27.27

21.35
32.6

4.28

7.78

5.74
9.6

Comparison of Performance for NN and WT


NL
(%)

Algorithms
NN

WT

1.771.88

1.291.84

25

2.122.72

1.732.79

50

3.656.56

6.5511.57

75

9.5517.83

9.8418.46

100

17.6727.29

14.7024.27

ANOVA test: No significant difference between methods, difference


due to noise type for noise levels of 50% and above. Interaction is
insignificant.

Findings
AFD perform well for noiseless and low frequency base line
drifted ECG signal but shows decreasing performance as the
power line noise increases.

Differentiation worsens at high frequency noise because the


amplitude of the derivative of a signal is proportional to the
frequency.

Transient shifts produce spikes in the derivative, which are


detected as QRS candidate.

Algorithm based on first and second derivative (AFD) exhibits


worst performance.

Despite its simplicity, differentiation should be avoided with


noisy data.

Both digital filter (FIR and IIR) perform well for noiseless,
power line noisy and baseline drifted ECG signal, while IIR DF
shows slightly better performance than FIR DF.

For abrupt base line shift, performance of digital filters


decreases slightly as the noise level increases.

The band pass filter cannot filter EMG noise effectively.

Algorithms based on NN and WT outperforms the others


specially for abrupt base line shift and EMG noise corrupted
ECG signal. Their performances are statistically similar.

Despite its computational burden the use of a NN for QRS


detection (Nonlinear Prediction) is applicable.

WTs are fairly novel approaches for processing of nonstationary signals.

Abnormality Detection (PVC)


PVC events result from irritated ectopic foci in the ventricular
area of the heart which cause premature contractions of the
ventricles independent of atrial depolarization.

V o lta g e / m V

ECG signal
1
0.8

(a)

0.6
0.4
0.2
0
-0.2
-0.4
-0.6
-0.8

0.5

1.5

2.5

3.5

3.5

V o lta g e / m V

Time / s

ECG signal with PVC

2
1.5

(b)

1
0.5
0
-0.5
-1

0.5

1.5

2.5

Time / s

(c)

(d)

12

16

20

24

28

32

36

Frequency (Hz)

Performance Evaluation
Detection statistics: true positives (TP), true negatives
negatives (FN) and false positives (FP):

(TN), false

TP: classifies PVC as PVC


FP: classifies normal as PVC
TN: classifies normal as normal
FN: classifies PVC as normal
Classifier Parameters:
Sensitivity: SE = 100TP/(TP+FN)
fraction of real events correctly detected among all real events
oSpecificity:
ofraction

oCorrect

SP = 100TN/(TN+FP)

of nonevents correctly rejected

classification: CC=100(TP+TN)/(TN+TP+FN+FP)

oclassification

rate

Performance Evaluation
MITBIH #

Detected beats by Classifier performance


detector
Normal PVC

TP

FP

TN

FN

116

2256

108

97

141

2115

11

119

1543

409

409

1542

208

1573

874

871

85

1488

213

2626

134

132

23

2603

215

3071

160

138

3071

22

221

2027

385

384

121

1906

Total

13096

2070

2031

371

12725

39

Performance Evaluation
Classifier Performance:
MIT-BIH
Record
Number

Classifier Performance
(%)
SE

SP

CC

116

89.81

93.75

93.57

119

100.00

99.93

99.95

208

99.66

94.60

96.40

213

98.51

99.12

99.09

215

86.25

100.00

99.32

221

99.74

94.03

94.94

Average

95.66

96.91

97.21

What in Future?
The results of this study will help in the development of a
more robust ECG detector by making signal processing more
effective.

Abnormality detection algorithm should be compared with


other nonlinear techniques (WT, Fractal, Chaos, and so on)

You might also like