Citation
A New Quality Measure in Electrocardiogram Signal

Material Information

Title:
A New Quality Measure in Electrocardiogram Signal
Creator:
OH, SUNGHO ( Author, Primary )
Copyright Date:
2008

Subjects

Subjects / Keywords:
Conduction ( jstor )
Electrocardiography ( jstor )
Electrodes ( jstor )
High frequencies ( jstor )
Noise measurement ( jstor )
Noise reduction ( jstor )
Signal detection ( jstor )
Signals ( jstor )
Standard deviation ( jstor )
Supernova remnants ( jstor )

Record Information

Source Institution:
University of Florida
Holding Location:
University of Florida
Rights Management:
Copyright Sungho Oh. Permission granted to University of Florida to digitize and display this item for non-profit research and educational purposes. Any reuse of this item in excess of fair use or other copyright exemptions requires permission of the copyright holder.
Embargo Date:
12/18/2004
Resource Identifier:
57735035 ( OCLC )

Downloads

This item has the following downloads:


Full Text












A NEW QUALITY MEASURE IN ELECTROCARDIOGRAM SIGNAL


By

SUNGHO OH














A THESIS PRESENTED TO THE GRADUATE SCHOOL
OF THE UNIVERSITY OF FLORIDA IN PARTIAL FULFILLMENT
OF THE REQUIREMENTS FOR THE DEGREE OF
MASTER OF SCIENCE

UNIVERSITY OF FLORIDA


2004

































Copyright 2004

by

Sungho Oh

































Dedicated to my parents, Junyoung Oh and Eunsun Choi, for their blind love and support.















ACKNOWLEDGMENTS

I would like to express my gratitude to my advisor, Prof. Johannes H. van Oostrom,

for all his advice and patient support. Without him this thesis would not have been

possible. I also like to thank Kelly Spaulding, Dave Lizdas, and Jangyong Huh for being

there when I was emotionally unstable after failing driving license tests.

Most of all, I would like to thank my parents who supported my decisions without

an exception. Words can not express my appreciation.
















TABLE OF CONTENTS
Page

A C K N O W L E D G M EN T S ......... ......... .. ..................................................................... iv

L IST O F TA B LE S .................... .. ............................................. .... ...... ..... vii

LIST O F FIG U R E S .................... .. ................................... .... ........ ................ viii

ABSTRACT .............. ......................................... xi

1 IN TROD U CTION ................................... ..................... .... ..... ............... 1

2 TH E H EA R T A N D TH E E C G ......................................................................................4

Electrical Conduction System of the Heart .............. .............................................4
Electrical Basis of the Electrocardiogram ............................. .................................. 5
E C G P ap er ...................... ..................................... ................ .. 6
Com ponents of the Electrocardiogram ........................................... .......................... 7
E C G L ead s ............................................................ ..................................... . 7

3 N O ISE IN E C G .....................................................................................................11

Pow erline Interference ................................................. ....... .............. .. 11
R expiration N oise ................................................................................... 12
E M G N o ise .......................................................................................................1 3
M ov em ent A rtifact........... ...... .......................................................... .......... ....... 13
Electro-surgical N oise ...................................... .. ..... .............. 15
C om p o site N oise ............................................................................... 16

4 QR S DETECTION ........................................................... ............... 17

Coarse Limits Determination...........................................................19
Lowpass Filter ......................................... ................... .... ........ 19
D derivative F ilter .................................................................................. ......... ... 2 1
N on-linear Transform .............................................. ....... ....................... 22
T hreshold F unction ........... .................................................. ...... ..... .... .... .. 23
Rejection of the False Limits............................. ....... .. .......................23
Peaks and Notches Determination...... .......................... .....................24
Lowpass Filter ......................................... .................... ... ....... 24
D derivative Filter .....................................................................24
Peaks and Notches Determination.......................... ............... 24


v









L locating R Peaks ..................................................... ... .. ............ 25
D election of Other features ............................................................................ 27
E x p erim ent .................................................................................................... 2 7
Results and Discussion .................................... ...... .. ...... ............. 30

5 SIGNAL AVERAGING AND RESIDUE FILTERING................ ....... ...........32

Sign al A v raging .................................................... ................. 32
Aligning Each Epoch....... ........ ......... .... ......................... .......... 33
R esidu e F altering .............................. ......................... ... ...... .... ..... ...... 34
Experim ent and D discussion ............................................... ............................. 34

6 Q U A L ITY M E A SU R E S ..................................................................... ...................39

Current Parameters of Signal Quality................ .. ..... ........................39
Experiment (Synthetic Signal Case)......... .......... ... ......... ....................41
Experim ent (Random Signal Case) ........................................ ........................ 45

7 KARHUNEN-LOEVE TRANSFORM ................................................... ...............49

KL Representation of Random Process...... ..................... ...............50
K LT and Q quality of ECG Signal ........................................ .......................... 52
Input M atrix ......... ... ................................ ............... .. ...... ... 52
KL Basis Functions and KL Coefficients.................... .................... 53
Data Representation........ ........ ....... .... .... .. ......... .......54
Quality Measures ....... ...... ............ ............................. 54
E xperim ent ...................... ............... ....................................................... 54
F u tu re W o rk .......................................................................................................... 5 6

8 M O S T E S T .............................................................................5 8

M O S T e st............................ ....................................5 8
Comparative Study of Quality Measures................................ ... .........59
Linear R egression ...................... ...................... ..................................59
Strength of a R elation ...................... .......................... .... ............................60
M easuring A greem ent ................................................................................... 6 1
D isc u ssio n ...................... .. ............. .. ......................................................6 2

9 CONCLUSION AND FUTURE WORK ........................................ ............... 63

LIST OF REFERENCES ........................................... ..................66

B IO G R A PH IC A L SK E T C H ....................................................................................... 69
















LIST OF TABLES

Table page

8-1 Variances of vertical deviation from regression line ............................................60

8-2 Correlation coefficients between the MOS quality score and proposed measures ..61
















LIST OF FIGURES


Figure p

2-1 Electrical conduction system of the heart .............................................. ...........4

2-2 Electrical basis of the ECG ................................................................... ..5

2-3 ECG paper ................................. ................................. .......... 6

2-4 C om ponents of the E C G ............................................................................. ..... .7

2-5 The standard (bipolar) limb leads I, II, and III ............. ...........................................

2-6 The augmented (unipolar) leads aVR, aVL, and aVF..............................................9

2-7 Precordial (unipolar) leads ............................................................................. 9

3-1 Clean ECG signal (Fs = 125H z) ..................................................... ............. 11

3-2 ECG with powerline interference (18dB, 60Hz) .....................................................12

3-3 ECG with respiration noise (32dB, 0.3Hz) ................................... .................13

3-4 E C G w ith EM G noise (18dB ) ............................................................................ ..14

3-5 ECG with movement artifact (SNA=0.1, f=0.07Hz, d=0.50s)..............................14

3-6 ECG with movement artifact (SNA=1.0, f=6Hz, d=0.04s)................................15

3-7 ECG with Electro-surgical noise (-12dB, 900Hz) ........................ ............... 15

3-8 ECG with a composite noise ............ .................. ................. ......................... 16

4-1 The original ECG signal (Fs=125Hz) ........................................... ............... 19

4-2 Magnitude and phase response of the lowpass filter (fc=25Hz, Fs=125Hz) ...........20

4-3 Lowpass filter output (blue) and the original ECG (red) ......................................21

4-4 Magnitude and phase response of the derivative filter ............................................21

4-5 Moving average filter output (ymv) and the original ECG...................................22









4-6 Coarse limits of the QRS complex.......................................... ...............23

4-7 The first five seconds of d[n] .............................................................................24

4-8 Input/output EC G signals ........... ......... ...... ......... ......................... ............... 26

4-9 The exact locations of R wave peaks. ............. ......... ............... .. ............. 26

4-11 Locations of QRS onset and offset..............................................27

4-12 The result of the QRS detection for ECG3.dat signal................... ............... 28

4-13 The result of the QRS detection for ECG4.dat signal................... ............... 28

4-14 The result of the QRS detection for ECG5.dat signal...........................................29

4-15 The result of the QRS detection for ECG6.dat signal................... ............... 30

5-1 Magnitude spectrum of ECG............... .............................. 35

5-2 Signal average of the original ECG ............ ......... ...... .................... ............... 35

5-3 Characteristics of the residue signal....... ...................................... .................. 36

5-4 Residue filtering and signal average. ............................................ ............... 36

5-5 B andpass filtered residues .............................................. ............................. 38

5-6 True ECG signals ........................................ ......... .............. .. 38

6 1 T ru e E C G ........................................................................................................... 4 1

6-2 Quality m measures of the true ECG ..................... ............................. .............. 42

6-3 Quality measures of the ECG with powerline noise ..................... .................42

6-4 Quality measures of the ECG with baseline wander noise ............. ...............43

6-5 Quality measures of the ECG with EMG noise .................. ...............43

6-6 Quality measures of the ECG with sharp movement artifact..............................44

6-7 ECG3.dat and its quality measures in time sequence................................ 45

6-8 ECG4.dat and its quality measures in time sequence........ ........... ............. 46

6-9 ECG5.dat and its quality measures in time sequence................................ 47

6-10 ECG6.dat and quality measures in time sequence ................................................47










6-11 ECG5 and quality measures in time sequence ............................... ................ 48

7-1 KLT algorithm of the ECG ..........................................................................52

7-2 Five largest KL basis functions of ECG6.dat.......................................................53

7-3 K L T of E C G 6.dat......... ................................................................ .. .... ..... .. 55

7-4 K L T of E C G 4 .dat........... ............................................................ ...... .... ..... 55

7-4 K LT of EC G 5.dat w ith n=l ......... .................................................. ............... 56

7-5 K LT of ECG 5.dat w ith n=2........................................ ............... ............... 57

7-6 KLT of ECG 5.dat w ith n=3 ................................................... ... ............57

8-1 M O S test questionnaire .................................................. .............................. 58

8-2 Scatter plots of quality measures against MOS quality score ................................60

8-3 Difference against mean plots with 95% confidence interval lines of MOS quality
sc o re ............................................................................. 6 2















Abstract of Thesis Presented to the Graduate School
of the University of Florida in Partial Fulfillment of the
Requirements for the Degree of Master of Science

A NEW QUALITY MEASURE IN ELECTROCARDIOGRAM SIGNAL

By

Sungho Oh

December 2004

Chair: Johannes H. van Oostrom
Major Department: Electrical and Computer Engineering

In recent years quantifying signal quality has been significant in research as well as

in clinical practice. Poor quality signals have resulted in false alarms, poor patient

monitoring, imprecise measurement, and misleading analysis. In areas such as ECG

(electrocardiogram) monitoring, the assessment of the signal quality has been left to the

intuitive judgment of the ECG interpreter who has to decide if the noise levels will allow

for reliable interpretations.

As an attempt to provide for more reliable ECG analysis, we have developed a

study which will compare pre-existent quality measuring parameters and newly proposed

parameters to a MOS (mean opinion score) test. The pre-existent measures under our

investigation consist of four parameters; SD- R (standard deviation of the residue),

RMSSD- R (root mean square of successive differences of the residue), TP (turning

points), and Mobility Several studies have used the residue measures to assess the noise

level. Although these measures do indicate occasional instances of quality, our results









have led us to believe that they are insufficient in regards to quantifying signal quality.

Therefore, we have proposed two measures that are both promising and more precise.

The foundation in the development of our parameters is as follows: ECG diagnosis

mainly relies on the signal's morphology. The KLT (Karhunen-Loeve Transform) is

known to separate signal from noise and represent the optimal morphology of the signal.

T,, the percent ratio of the sum of n largest principal components (KL coefficients) and

the trace of the eigenvalue matrix, is a measure that is associated with KL representation

performance. Related to KL representation and its performance lT, RMS (Root Mean

Square) error en and residual error r, were proposed as new quality measures.

As a final baseline comparison between both the pre-existent parameters used in

other studies and our newly developed parameters, we used a MOS test as a subjective

measure. Fifty lead II ECG signal segments were selected from the European ST-T

database and their qualities were evaluated by a clinician.

When compared with the other measures, en and rm showed highest correlation and

agreement with the MOS test results (0.6607, 0.6884), and lowest deviation variance

from regression line (0.0205, 0.0220). This test showed that en and r are possibly

better measures than the pre-existent ones.

Among the preprocessing steps that we used to compute the measures, QRS

detection was the most fundamental task. Our QRS detector was tested with the second

one minute 48 ECG signals from the European ST-T database. Excluding the signals of

morphologies other than lead II ECG, the detection rate was 99.5517% among the total

5353 beats. The sensitivity and specificity were 99.57% and 99.98% respectively.














CHAPTER 1
INTRODUCTION

Patient monitoring provides information on the patient's physiological status. An

alarm goes off when the value of the monitored variable lies outside a preset threshold

range. In practice, seventy-five percent of the alarms by the standard monitors were

reported to be false alarms [1]. This high error rate has led attending personnel to disable

the alarm rather than to use it for information monitoring.

Efforts to increase the efficacy in patient monitoring were made by integrating

information from several monitors by using fuzzy logic [1]. While they improve the

reliability of an alarm, multiple sources of information are required. However, the

presence of noise still accounts for a high probability of misdiagnosis [1].

We have thus attempted to find a parameter that can estimate signal quality. From

an indicator of the signal quality we will benefit ourselves as follows:

* Alerting a clinician about a low quality signal.

* Storing quality measures with the signal in an automated record keeper.

* Passing the quality information onto further processing as a weight so that less
attention should be paid to the signals of low quality.

The majority of false alarms is caused by noise and artifact. Signal quality is in

reciprocal relationship with the amount of noise and artifact. Therefore, quantifying the

amount of noise and artifact was regarded to be the same as assessing the signal's quality.

In this thesis, we will focus on the lead II ECG.









Velislav Batchvarov et al. defined the residue, which is the difference between the

original signal and the aligned averaged signal, as the underlying noise in the ECG [2].

SD- R (standard deviation of the residue) and RMSSD- R (root mean square of

successive differences of the residue) were proposed as measures to compare the quality

performance of two ECG monitors. These measures have limitations where SD R

measures the low frequency mainly and RMSSD R reflects mostly the high frequency

components of the signal. TP (turning points) and Mobility will be tested along with the

above two measures. They represent the randomness and the mobility of the signal.

Their advantages lie in that preprocessing of the original signal is unnecessary.

The original ECG signal contains many local features that are insignificant. We

will investigate the KL representation of the ECG. The five largest KL coefficients are

known to represent the optimal morphology for both ST segment and QRS complex

[3,4]. Thus, KLT can be used to reduce the feature dimension while the output signal

still contains the optimal morphology of the original signal. We define a new residue to

be the difference between the original signal and the optimal morphology representation

of the original signal. Assuming the optimality, the new residue should also be the

optimal representation of noise. RMS error, e, and residual error, rm of the KL

representation are investigated in their relation with the signal's quality.

As a subjective quality measure, an MOS test was performed. A clinician marked

the quality of fifty different signal segments. Strength of a relation and agreement were

studied between different measures.









For achieving our main study goal, several requirements had to be achieved, which

include study on noise characteristics, QRS detection, signal average and residual

filtering, and KL representation of the ECG.

The structure of this work is as follows:

* Chapter 1 is this introduction that addresses signal quality problem. It also
describes the motivation and the purpose of this work.

* Chapter 2 describes the basics of the heart physiology and the ECG.

* Chapter 3 describes the common types of noise that are present in ECG signal. We
simulated five representative types of noise.

* Chapter 4 is about QRS detection, which is a required step for signal average,
residue processing, and KLT.

* Chapter 5 presents signal average of the ECG and filtering the residue.

* Chapter 6 reviews several present parameters that are proposed for assessing the
amount of noise in the ECG.

* Chapter 7 describes KLT that is used to represent signal morphology optimally.
Associated with the representation performance, root mean square error and
residual error were investigated in its relationship with the signal's quality
determined by a subjective MOS test, and are proposed as new quality measures.

* Chapter 8 is about the MOS test and comparative study of the quality measures.

* Chapter 9 contains result summary with conclusions, and discusses future work.
















CHAPTER 2
THE HEART AND THE ECG

Electrical Conduction System of the Heart

The heart consists of four hollow chambers. Its purpose is to circulate blood

through the circulatory system [5-7]. The heart pumps in a rhythmic sequence. To make

this possible, it is regulated by the electrical conduction system comprised of

* Sinoatrial (SA) node

* Intemodal atrial conduction tracts and the interatrial conduction tract (Bachmann's
bundle)

* Atrioventricular (AV) junction consisting of the atrioventricular (AV) node and
bundle of His

* Right bundle branch, left bundle branch, and left anterior and posterior fascicles

* Purkinje network

The major function of this electrical conduction system of the heart is to transmit

electrical impulses from the SA node to the atria and ventricles, causing them to contract.


-- suoatial (S A) node
ie rai al conduction tract
.(Bavhanmm's bundle)
Figur 2-1 Eletricradal actal costluctmontracth
atiioveiticulaa(AV) node
burkle ofHis
left bundle branch
left posterior fs cice
left arderiir fascicle






Figure 2-1. Electrical conduction system of the heart









Electrical Basis of the Electrocardiogram

The ECG is a graphic record of the electric current that is generated by the

depolarization and repolarization of the atria and ventricles. This electrical activity is

detected by electrodes attached to the skin.





-\ ATRIAL
DEPOLARIZATION
TaP wave

I" ?_"_ Tat\e __ ATRIAL
l \ REPOLARIZATION




\ VENTRICULAR
-. DEPOLARIZATION
QRS complex


I .^ VENTRICULAR
Si Tr REPOLARIZATION
T wave





P QRS T


Figure 2-2. Electrical basis of the ECG

The voltage generated by atrial depolarization is the P wave. Ventricular

depolarization is recorded as QRS complex. T waves correspond to the repolarization

process. However, the effect of the atrial repolarization (Ta wave) is buried in the QRS

complex because it normally occurs during ventricular depolarization.










ECG Paper

The paper used in recording electrocardiograms has a grid to show time

measurement in seconds along the horizontal lines and voltage amplitudes along the

vertical lines. Figure 2-4 illustrates how the box size corresponds to the measurements.

The grid consists of intersecting dark and light vertical and horizontal lines. When the

ECG is recorded at the standard paper speed of 25 mm/sec:

* The dark horizontal lines are 0.20 second (5 mm) apart and the light ones are 0.04
second (1 mm) apart.

* The dark vertical lines are 0.5 mV (5 mm) apart and the light ones are 0.1 mV (1
mm) apart.






J j : -.---- j ,






I u In n

ni' /






Figure 2-3. ECG paper

The sensitivity of the ECG machine is usually adjusted and calibrated so that 1 mV

electrical signal produces a 10 mm deflection on the ECG.









Components of the Electrocardiogram

After the electric current is detected by electrodes, is is amplified, displayed on an

oscilloscope, recorded on ECG paper, or stored in memory. In a normal cardiac cycle,

the P wave occurs first, followed by the QRS complex and the T wave.

QRS
complex



T vave
P wave


SIST' S
II i II

PR R-R inteval
interval

Figure 2-4. Components of the ECG

The sections of the ECG between the waves and complexes are called segments

and intervals: the PR segment, the ST segment, the TP segment, the PR interval, the QT

interval, and the R-R interval. Intervals include waves and complexes, while segments

do not. When electrical activity of the heart is not being detected, the ECG is a straight,

flat line, which is called isoelectric line or baseline.

ECG Leads

An ECG lead is a record of the electrical activity generated by the heart that is

sensed by either one of two ways: (1) two discrete electrodes of opposite polarity or (2)

one discrete positive electrode and a zero reference point. A lead composed of two

discrete electrodes of opposite polarity is called a bipolar lead; a lead composed of a

single discrete positive electrode and a zero reference point is a unipolar lead.









Depending on the ECG lead being recorded, the positive electrode may be attached

to the right or left arm, the left leg, or one of several locations on the anterior chest wall.

The negative electrode is usually attached to an opposite arm or leg or to a reference

point made by connecting the limb electrodes together.




i 1,


/ I ) K
A




Lad I Ltad II




I I




Lead II


Figure 2-5. The standard (bipolar) limb leads I, II, and III

For a detailed analysis of the heart's electrical activity, usually in the hospital

setting, an ECG recorded from 12 separate leads (the 12-lead ECG) is used. The 12-lead

ECG is also used in the prehospital phase of emergency care in certain advanced life

support services to diagnose acute myocardial infarction and to help in the identification

of certain arrhythmias. A 12-lead ECG consists of three standard (bipolar) limb leads

(leads I, II, and III), three augmented (unipolar) leads (leads aVR, aVL, and aVF) and six

precordial (unipolar) leads (Vi, V2, V3, V4, V5, V6).
























Lead aVL


Lead aVR


Led aVF


Figure 2-6. The augmented (unipolar) leads aVR, aVL, and aVF







AI
Lead V1




cir v-v d v 5
i' i/ \ / VV


Figure 2-7. Precordial (unipolar) leads






10


In this thesis, we will focus on lead II ECG. The single channel, limb lead II ECG

is commonly used in the prehospital phase of emergency care when monitoring the heart

for arrhythmias. The signal's diagnostic features are very noticeable in lead II ECG.

However, the precision can still be affected by patient's movement or other interference

easily because its millivolt range amplitude is relatively small.















CHAPTER 3
NOISE IN ECG

Noise is omnipresent. ECG signals also suffer from noise originating from various

sources. There are five major types of noise in ECG signal: powerline interference,

respiration noise, EMG noise, movement artifact, and electro-surgical noise [8-9]. Each

type of noise is studied and simulated here. These simulated signals will later be used to

evaluate measures of quality.

Figure 3-1 shows the clean ECG signal after signal averaging that has normal sinus

rhythm. Five different kinds of noises are added to simulate noisy signals.



















0 2 4 6 8 10 12
[se c]


Figure 3-1. Clean ECG signal (Fs = 125Hz)

Powerline Interference

Powerline interference is due to the environment of the experiment, where it is

filled with EM (Electro-Magnetic) waves. The 60Hz powerline interference is notorious










for corrupting the signal of interest. Simple EM shielding of cables and grounding of the

chassis of equipment can reduce EM and power-supply interference in most cases.

Powerline noise consists of the 60Hz tone with random initial phase. Generally, it is

consistent for a given measurement situation and once set, it will not change during

evaluation. We modeled this with a single sinusoid of period 60Hz. Typically the

amplitude can be up to 50 percent of the peak-to-peak ECG amplitude with SNR in the

order of 3dB [8]. The harmonic components are present but were not modeled here

because 60Hz component is dominant.



















S2 4 6 8 10 12
[sec]

Figure 3-2. ECG with powerline interference (18dB, 60Hz)

Respiration Noise

Respiration noise is represented by a sinusoidal drift of the baseline. The

frequency corresponds to the respiration rate of the subject. The amplitude variation is

about 15 percent of peak-to-peak ECG amplitude. It is simulated with a sinusoid of

0.3Hz frequency with typical 32dB SNR.





























I' i I I I A ___ I__ j A __
0 2 4 6 8 10 12
[sec]


Figure 3-3. ECG with respiration noise (32dB, 0.3Hz)

EMG Noise

If during an ECG acquisition procedure the subject coughs or squirms, the EMG

(Electromyogram) associated with such activity will pose interference. The EMG is

caused by muscular contraction, which generates microvolt-range electrical signal [9].

Such physiological interference may be minimized by strict instructions and self-control.

However, this may not be applicable to infants and children. EMG noise is assumed to

be zero mean Gaussian noise. The standard deviation determines the SNR, whose typical

value is in the order of 18dB

Movement Artifact

Movement artifact is simulated with exponential function that decays with time. It

contains two noise alternatives [8]. The first one is low-frequency artifact simulating

displacements between electrodes and skin due to subject's slow movement. This kind

typically shows 0.07Hz sinusoidal behavior with 0.16 second duration with random







initial phase. The amplitude can be nearly up to twice the peak-to-peak amplitude. The
second one is relatively high frequency artifact with 6Hz sinusoid of 0.04 second
duration. The amplitude can almost be the same as the QRS complex and the initial
phase is random. This kind of noise simulates the QRS complex. Therefore, it can cause
a difficulty in QRS detection process. The amplitude was decided by SNA (Signal and
Noise Amplitude ratio)


Figure 3-4. ECG with EMG noise (18dB)


Figure 3-5. ECG with movement artifact (SNA=0.1, f=0.07Hz, d=0.50s)


4m4OA


Aty' iThhhK


HOm+/(~)UlYIh


























0 4 6 9 10 "12


Figure 3-6. ECG with movement artifact (SNA=1.0, f=6Hz, d=0.04s)

Electro-surgical Noise

Electro-surgical noise is caused by the use of electro-surgery instrument. This

completely destroys the ECG. It is simulated with aliased signal with the frequency

higher than the sampling frequency. Typical SNR is -12dB, which is highly destructive.






.. ..J .. .. ... I .. .. .... ....


I I I I I II


I I I I I I I
0 2 4 l 8 10 1:
[s e

Figure 3-7. ECG with Electro-surgical noise (-12dB, 900Hz)










Composite Noise

Various examples of composite noise can be simulated by adding the noises created

as above. Figure 3-7 shows one example of powerline noise (18dB, 60Hz), EMG noise

(24dB), baseline wander noise (18dB, 0.3Hz), and movement artifact (SNA=0.4, 0.07Hz,

d=0.50s).



















0 2 4 0 8 10 12
[sec]


Figure 3-8. ECG with a composite noise














CHAPTER 4
QRS DETECTION

The detection of QRS complexes is a crucial task in ECG analysis. It is the basis of

ECG processing applications such as rhythm analysis, feature recognition (P, QRS, T)

and ECG compression. In our work, fiducial points in each beat needed to be determined

first, to carry out the signal averaging process. The peak locations of the R waves were

located and used as fiducial points.

We developed a real time algorithm for beat detection in signal channel ECG

signal. Some detectors operate on two ECG leads simultaneously. Although such an

attempt offers direct advantages, often times the detected beats do not coincide in time.

A single channel detector will be especially suitable for stand-alone monitors, telemetry

devices of limited bandwidth, event recorders for home use, defibrillators, pacemakers,

etc [10].

The main challenges in QRS detection lie in patterns with varying morphology,

large P and T waves, and different types of artifacts and noise. A general scheme for

QRS detector is composed of two stages. In the first stage, the digitized ECG data is

passed through a filtering step to eliminate noise, P and T waves. The output is processed

by non-linear transformations such as squaring function, to enhance the R waves.

Second, decision rules are applied to affirm the occurrence of R waves, where Tompkins'

algorithm used threshold with adjustment followed by adjustment of the average RR-

interval and rate limits and T-wave rejection [11].









Instead of Tompkins' algorithm, we chose to use Yaniv Zigel's algorithm with

some modifications [5]. It is composed of two stages as well, but is different in defining

refractory periods in the signal. In the first stage, the refractory periods are defined

where no QRS event can happen, thus coarse QRS complexes are obtained. The QRS

complex candidates are coarsely determined by lowpass filtering, derivative filtering,

moving average filtering, and applying threshold function to obtain coarse limits. False

coarse limits caused by T waves and artifact are rejected. Determining coarse limits is

important. We used a constant threshold function to determine coarse limits, but

especially when the signal is contaminated with high EMG noise or movement artifact, it

was not perfect. Making the threshold function adaptive is suggested as future work.

In the second stage, we define peaks and notches emphasis signal (pne ) whose

zero-crossings are candidates for R wave peak locations. The zero-crossings caused by

other limits or noise are rejected. Lastly errors are corrected by comparing amplitude of

the neighboring points. The pne signal is defined by threshold as well. Yaniv Zigel's

algorithm tends to fail when the signal contains large high frequency noise. This is

because the threshold depends on the derivative values of the signal. We made this

threshold as a function that varies over each epoch, and made it be a user defined

parameter.

After locating the R waves' peaks, the onset and offset of the QRS complex can be

also located from pne signal, if they exist. The rest of the features such as P and T waves

can be detected afterwards with additional work [12-13].

For all the processes, the output was compensated in its group delay to be aligned

with the input.










Coarse Limits Determination

The signal in Figure 4-1 shows a portion of an ECG with normal sinus rhythm. It

is a 125Hz sampled signal with 60 seconds duration.


















S 0.5 1 1.5 2 2.5 3 35 4 45 5
[sec]


Figure 4-1. The original ECG signal (Fs=125Hz)

Lowpass Filter

First, the ECG signal is passed through 25 Hz lowpass filter. Most of the energy in

the ECG lies between 1Hz and 45Hz range. The lowpass filter was designed targeting

the 250Hz sampled ECG signals, where the cutoff frequency will be 50Hz. It will

represent most of the energy in the signal while suppressing high frequency noise content

including 60Hz powerline noise. In some cases more aggressive filtering can be possibly

used to improve result, but the purpose of this stage is only to determine the limits of the

complexes coarsely. This process is not very dependent on the artifact caused by lowpass

filtering. Kaiser window filter of order 20 was used to ensure constant delay.









Lowpass filter
20


-n0
S20----------- ------ ------ --------------

-20 ------------- ------
S03 -
S- 0 ----- ----------- ----- ------- ------ ------
S- 4 0 - .- -- - .- - - --- - .---r ---- - --. - -- -- - -

O I I I I I I I I I-- -
0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1
Normalized Frequency (xx rad/sample)


S -100 -----i -----. ------------------ -------. I------I-------- ------- I.-----
CD,
S-300 ---- -

-400 -------------- ------- ------ --- ------ -----
-50--------------------- -------------------
-500 1 1 1 1
0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1
Normalized Frequency (xi rad/sample)

Figure 4-2. Magnitude and phase response of the lowpass filter (fc=25Hz, Fs=125Hz)

The filtered output signal was smoother and contains less noise than the original signal.

Figure 4-3 compares the first second of the filtered ECG signal with its lowpass filtered

output. It can be seen that the lowpass filter distorts the signal especially at the onset and

offset of the QRS complex. After the filtering, the limits became more notched. This can

interfere in the peak detection process since they may be included in the pne signal.

Yaniv Zigel used bandpass filter with lower cutoff frequency 1 Hz. This elimination of

the low frequency is for eliminating baseline wander. However, it is not as successful in

baseline wander noise as it distorts the limits. The original ECG signal is flat at the

limits. After bandpass filtering, onset became elevated in amplitude, and the offset

became noticeably notched. Even though this kind of distortion won't affect the goal of

this stage, it should be noted that some conventional filtering techniques might bias the







21


measurement, and resolution of the ECG systems, when they are used without proper

understanding.


















0 0.2 04 0.6 8 1 1.2
[se c]


Figure 4-3. Lowpass filter output (blue) and the original ECG (red)

Derivative Filter

Derivative filter
20
20 i---i------------------ ----- I -- I-------



eg / ^ "" ^--------~~------



-40
0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1
Normalized Frequency (xx rad/sample)



03
O -10 0 .----.------ ------------ -- I ----- --.-------I.------- I ----- -- I ---- .--


S-200 ------ ------- --..---------.I--- I------ -- .-------. -- ----.--.


-300 11 1 1
0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1
Normalized Frequency (xx rad/sample)


Figure 4-4. Magnitude and phase response of the derivative filter









The role of the derivative filter is to enhance R waves and diminish other events,

such as P and T waves and baseline noise. The equation we used for taking derivative of

the signal is d[n] = (x[n + 1] x[n -1]) / 2, where x[n] is the output of the lowpass filter.

Figure 4-4 shows characteristics of the derivative filter.

Non-linear Transform

The derivative filter reduces non-QRS event successfully. But it also exaggerates

high frequency noise that survived the lowpass filter. Thus, the signal is passed through

the moving average filter. The input is the absolute values of d[n], thus making this

process non-linear. This moving average reduces the contribution of the transient noise.

Filter size is taken to correspond to an approximate width of the QRS complex. In this

example, we used 21 samples (0.168sec) as the equation below.

ymfnn] = k2 d[n + k]

The result is shown in Figure 4-5.


[s ec]


Figure 4-5. Moving average filter output (ymv) and the original ECG









Threshold Function

To determine the coarse limits of the QRS complex, we threshold moving average

filter output.

Yaniv Zigel used an adaptive threshold function as follows [5]:
ymVy, (k) ymVmln (k)
thresh(k 1) + ymvmn (k) + ymv k) mmm k)
2.8
thresh(k) = 8
2

When the coarse limit detection fails, it is due to excessive amount of sporadic high

frequency noise or movement artifact. Most of the cases the sudden increase of ymv

didn't have influence on the previous epoch. In our test, sometimes 0.5 x max(ymv[n])

was generally a good threshold value. When there is a sudden increase in the ymv signal

that are larger than twice the rest peaks in amplitude, usually mean(ymv[n]) is a better

threshold function. Thus, the value thresh was determined heuristically:

thresh = ((0.5 x max(ymv[n]) + mean(ymv[n])) /2

However, an adaptive thresh[n] can be defined for improvement of the algorithm.

Rejection of the False Limits


Isec]


Figure 4-6. Coarse limits of the QRS complex









After the threshold, typical width of the coarsely determined QRS complex was

around 25 samples (0.2 seconds.) Therefore any coarse QRS complex detected that are

out of 20 to 60 samples range in duration were rejected. Figure 4-6 is the final result of

the coarse limit determination process. The coarse QRS regions are successfully

determined while the rest points are forced to zero.

Peaks and Notches Determination

Lowpass Filter

The same lowpass filter in the coarse limit determination process was used.

Derivative Filter

The same derivative filter in the coarse limit determination process was also used.

Peaks and Notches Determination

The original ECG signal often suffers from baseline wander noise. When the

derivative of the signal is taken, simple threshold functions become efficient. The output

will have constant baseline with exaggerated high frequency components. Thus, noise

level can be estimated by looking at the isoelectric part of the output signal.


Figure 4-7. The first five seconds of d[n]









The threshold process is done by defining dth for each epoch, which is calculated

with the following equation:

dmax = max {| d[n] }
QRSon QRSoff

dmin = max {| d[n] 1}
QRSoff n QRSon

dth = max {dmn, dmax /20}

dmax is searched over the coarse QRS complex region, and d, is searched over an

estimated isoelectric segment in order to determine the noise threshold. The dth function

values can be changed by user. In our algorithm the default threshold value was taken to

be dth. When there are missed beats because the dth value was too high, often caused

by large high frequency noise, we can reduce dth by multiplying decimals, and vice

versa.

Two thresholds are applied to d[n] for determining pne[n]: -dth and + dth. The

peaks and notches emphasizing signal, pne[n] is produced by the equation:

pne[n] = 1 if d[n] > +dth

pne[n] = 0 if -dth < d[n] < +dth

pne[n] = -1 if d[n] < -dth

Locating R Peaks

The locations of R wave peaks correspond to the zero crossings of the pne[n]

signal. The R wave locations were found based on the assumption that the R waves are

the most sharp amplitude change in the coarse QRS complex regions. To locate the exact

peak locations, errors were corrected by comparing amplitudes of the five neighboring

points and choosing the point of maximal amplitude among them. Figure 4-8 shows how












the zero crossing corresponds to the R peaks, and Figure 4-9 shows final results of the


QRS detection algorithm.











0 0.2 0.4 0.6 0.8 1 1.2 1.4 1.6 1.8




*I I




0 0.2 0.4 0.6 0.8 1 1.2 1.4 1.6 1.8









0 0.2 0.4 0.6 0.8 1 1.2 1.4 1.6 1.8
[see]



Figure 4-8. Input/output ECG signals (a) Original ECG. (b) d[n] (c) pne[n]


0 0.5 1 1 2 2.5 3 3 5 4 45


[s e


Figure 4-9. The exact locations of R wave peaks.










Detection of other features

From further investigation of the pne[n] signal, QRS onset and offset points can be

located if they exist. Figure 4-11 shows successful detection of QRS onsets and offsets.


0.0 0.5 1.0 1.5 2.0 2.5 3.0 3.5 4.0 4.5 5.0


0.0 0.5 1.0 1.5 2.0 2.5 3.0 3.5 4.0 4.5 5.0
[sec]


Figure 4-11. Locations of QRS onset and offset

Experiment

Our QRS detector was first tested with the five ECG signals from Rangaraj M.

Rangayyan's ftp site (ECG3.dat, ECG4.dat, ECG5.dat, ECG6.dat, and ECGPVC.dat).

[14-15] They are sampled at 200Hz. The first four signals are 20 seconds in duration and

ECGPVC.dat is 60 seconds.




















S 2 4 6 8 10 12 14 10 18 2(


Figure 4-12. The result of the QRS detection for ECG3.dat signal
The ECG3.dat signal has moderate amount of baseline wander noise that could
have been caused by patient's respiration. The QRS detection was successful as shown
in Figure 4-12. Peak locations are indicated with red vertical lines.


Figure 4-13. The result of the QRS detection for ECG4.dat signal


~ ~~~ ~ ~~ ~ ~ ~ ~ ~ ~ ~ ~ ~~ ~ ~ ~~~ ~ ~ ~~ ~ ~ ~


11 1'll 1 111 111 1 11 ll ll ,1~ 11 11 11 1 ,










The ECG4.dat signal is affected by the baseline change at the end. It seems to be

caused by patient's movement, and the high frequency noise that makes the line look

thicker.



















l 2 S 6 1D 12 1 16 1 20
[selc]


Figure 4-14. The result of the QRS detection for ECG5.dat signal

The ECG5.dat signal is corrupted with severe baseline changes. Also at around 7

seconds, a sharp movement artifact simulating QRS complex appears. This kind of

movement artifact makes the QRS detection difficult. Using our detector, dth value had

to be raised to 1.8 x dth to ensure no error.

The ECG6.dat signal has irregular rhythm with high frequency noise appearing

sporadically. It is also corrupted with a moderate amount of high frequency noise.

For four different cases of the ECG signals, the peak finding process could find all

the exact locations of R peaks. In ECGPVC.dat signal as well, where there are some

ectopic beats, all 398 peaks were successfully located.



























[sec]


Figure 4-15. The result of the QRS detection for ECG6.dat signal

Results and Discussion

Our QRS detector was trained with five ECG signals of Rangaraj M. Rangayyan's

ftp site and the European ST-T database. [15-16] The first four signals are 20 seconds in

duration and are contaminated with various kinds of noise (Fs = 200Hz, ). They were

regarded to be good for training the detector and for demonstration purpose as well.

PhysioBank has 48 ECG signals of European ST-T database available. Each record is

two hours in duration with two channels. The signals are sampled at 250Hz and have 12

bit resolution over a nominal 20 millivolt input range. Our single channel QRS detector

was run for each channel individually, thus for 96 signals in total. The first one minute of

all signals were used to train and the second minute to test the QRS detector.

16 signals among the 96 were of morphologies other than lead II ECG. For some

of them, R peaks were successfully located, but for others not. In this work, we excluded

those of different leads from our interest.









Among the total 5353 beats, only 23 beats were missed and 1 false beat was

located. It was regarded to be correct if the detector located local maxima. Sensitivity

and specificity were calculated by the following definition:

Se FN TP
Se= 1 =
TP + FN TP + FN

S FP TP
Sp = 1
TP + FP TP + FP

TP was calculated as the total number of correct peak locations. FP is the total

number of incorrect peak locations, and FN is the total number of missed beats. If there

was an error in locating the beat by even one sample point, FN is incremented [10,24].

Our QRS detector had 99.57% sensitivity and 99.98% specificity. The total detection

rate was calculated to be (5353-24)/5353 = 99.5517%.

Our algorithm successfully located the peaks of the ectopic beats as well.

However, coarse limit determination tends to fail when they were contaminated by high

EMG and movement noise, which caused 13 missed beats. Thus, instead of using

constant threshold function, an adaptive threshold function can improve the performance.

One ectopic beat was missed because of its wide complex, and the rest were missed

because the signal was contaminated with excessive amount of noise.














CHAPTER 5
SIGNAL AVERAGING AND RESIDUE FILTERING

An ECG signal is highly repetitive in its nature. Signal averaging is often used to

obtain the stationary portion of a signal by taking advantage of its repetitive nature. The

main problem in signal averaging lies in the small variations of each epoch's duration.

This problem is resolved by non-linear stretching that aligns each epoch to the same

length [17]. After signal averaging, only the stationary part of the original signal

remains. The residue signal, which is the difference between the original signal and the

signal averaged output, was used to estimate noise quantity in the ECG [2]. In this

chapter, we introduce a new signal average method involving residue filtering and

attempt to analyze the residue further in noise representation.

Signal Averaging

Let x[k] be the input data sequence composed of m beats of 1 < k < n. Assuming

that the signal is perfectly periodic with a period of r sample points, let n = mr and

k = it + j, where 0 < i < m -1 and 0 < j < We can model the signal as

x(ir + j) = f (j) + g(i + j) + n(i + j)

,where f is the underlying stationary periodic signal, g is the non-stationary part of the

signal, and n is a white Gaussian noise with zero mean and standard deviationo-. The

signal average of x is repetition of the signal s of size r computed as

1 ml
s(j) = x(ir+j)
M _O









The assumption behind signal averaging is that the noise at each sample times j,

j + r, j + 2-, ... is uncorrelated, while true signal at these times is highly correlated. By

definition, g(ir + j) = 0. If we average m points with the same f(j) and


uncorrelated noise, the average will become f(j) + 1/m '" n(ir + j). Based on the


central limit theorem, 1/m '"-n(ir + j) has a normal distribution with zero mean and

standard deviation c-/m In conclusion, the SNR improves by the factor of m as a

result of signal averaging. As long as r is not a multiple of the period of sinusoidal

noise, signal averaging will reduce those noises as well. Thus, n can be used to represent

all types of noise in the ECG.

Aligning Each Epoch

The durations of each epoch are not the same and have small variations. Therefore,

they should be aligned to the same length in order to be averaged. Consequently, the

maximal duration is found and all the epochs are stretched to it. This stretching is a

mapping transformation. Instead of using a simple linear mapping function, a function

that confines the stretching of low frequency region was used. The reason for this is that

the repolarization phase differs among beats more than the upstrokes do. Moreover,

regions of the upstrokes have higher frequency content and less vulnerable to non-

transient signal components. The following equation is the polynomial function that was

used for mapping [17]. This will confine the stretching of the low frequency region,

providing almost one-to-one mapping in the neighborhood of the upstrokes.

j = M, (j) = j + 3(r -max )(j, )2 2(rma ', )(j/jl )3









Residue Filtering

The residue is defined to be the difference between the original signal and its signal

averaged output. The averaged signal was shrunk back using the inverse of the stretching

transformation and subtracted from the original signal. However, the non-stationary

component of the signal g is not represented in the signal averaged output. It is still

contained in the residue. Thus, it is possible that the time-varying information which is

clinically significant is obtained from the residue.

Shahriar Iravanian et al. filtered the residue with conventional FIR bandpass filter

and added the result back to the signal averaged output, to increase SNR greatly while

suppressing high frequency noise successfully [17]. We analyzed the residue through

implementing this new signal averaging method. Because the frequency domain does not

allow perfect separation of the signal and the noise, further work is suggested in this area.

It would be ideal if we can separate the non-stationary part of the signal g, and noise n

to define the true ECG signal and the true noise in the ECG.

Experiment and Discussion

The effect of signal averaging was studied in frequency characteristics of the

signals. Figure 5-1 is a comparison of the magnitude spectrums of the original ECG (fs =

125Hz), 25Hz lowpass filtered output, and signal averaged ECG. While almost all the

high frequency components of the signal are suppressed by lowpass filtering, they are

well reserved in the averaged output signal with noise eliminated in time domain.

After alignment, the signals were averaged. In a real time application, the average

size of fifty epochs can be chosen. In our experiment, the size of the input ECG signal is

less than fifty. Therefore, averaging is performed across all the epochs.


















tr~iYJ


Figure 5-1. Magnitude spectrum ofECG (a) the original ECG. (b) the 25Hz lowpass
filtered output of the ECG. (c) the signal averaged output of the ECG.


[s eC


Figure 5-2. Signal average of the original ECG


The residue that was subtracted from this original ECG was shown in Figure 5-3.



































Figure 5-3. Characteristics of the residue signal (a) signal in time domain. (b) signal in
frequency domain.


s-
S-
4
2
0,.l


I IrrrIrIrI rrcr rrr


rmT[ir rrrr


-ec]


Figure 5-4. Residue filtering and signal average (a) Bandpass filtered output of the
residue signal, with passband 1-10Hz. (b) True ECG signal with filtered
residue added to the signal average of the ECG.


I I I I I I




?wu~rt~ii~









The impulse-like components formed in the residue signal are caused by the small

changes of the R peaks' amplitude and width, and are exaggerated by the alignment

through stretching. The residue signal was passed through a bandpass filter with a

passband of 1-10Hz. Figure 5-4 shows the result, which is the cleaned signal with high

SNR, preserving non-stationary components of the original ECG.

Signal averages of the four ECG signals from Rangaraj M. Rangayyan's site were

calculated and the residues were investigated [15]. Figure 5-5 and 5-6 shows the filtered

residues and true ECGs respectively.

The conventional bandpass filter is not efficient enough to separate the noise and

non-stationary components of the ECG. While high frequency components are

eliminated in the process, baseline wander and movement artifacts are still contained in

the filtered residue. Thus, it can be noted that lowpass filtering of the residue is able to

separate those noise from high frequency noise. The Figure 5-5 (c) and 5-6 (c) show this

phenomenon.

Filtering of the residue was not efficient for the purpose of obtaining the true ECG

signal. Baseline wander and sharp movement artifact was not successfully eliminated by

this process. This can be improved more and is included in the future work. For

example, we can filter baseline wander noise separately, and can repair the signal portion

that is contaminated with excessive amount of noise or sharp movement artifact.



































0 2 4 0 8 10 12 14 10 18
[see]


Figure 5-5. Bandpass filtered residues (a) ECG3.dat (b) ECG4.dat (c) ECG5.dat (d)
ECG6.dat. Bandpass filter with 1-10Hz passband was used.


Figure 5-6. True ECG signals (a) ECG3.dat (b) ECG4.dat (c) ECG5.dat (d) ECG6.dat


0 2 4 0 8 10 12 14 10 18














CHAPTER 6
QUALITY MEASURES

Parameters that are related to signal quality are PRD (Percentage RMS Difference),

WDD(Weighted Diagnostic Distortion), SD R (Standard Deviation of the Residue),

RMSSD R (RMS of Successive Differences of the Residue), TP (Turning Points), ZCR

(Zero Crossing Rate), TC (Turns Count),, Activity Mobility and Complexity In this

chapter, four selected parameters (i.e. SD- R, RMSSD R, TP, Mobility ) were tested

for individual types of noise, and were tested for general cases.

Current Parameters of Signal Quality

PRD and WDD measure the distortion of the signal. The prevalent measure,

PRD is proven not to have much meaning clinically compared to WDD, which was

proposed by Yaniv Zigel (2000) [5,18]. These parameters measure the distortion

between the original signal and the reconstructed signal through compression algorithms.

Therefore, without having the reference signal to compare, these measures aren't good

for indicating general quality of the signal, and thus are excluded from our consideration.

SD R and RMSSD R were proposed by Velislav Batchvarov (2001) to assess

noise in ECG, thus proving the validity of the ambulatory SEER MC recorders' usability

in serial ECG testing [2]. It is understood that SD R mainly measures slow baseline

changes, while RMSSD- R reflects fast fluctuations in the signal. These two parameters

are tested here to find out how well they represent the overall noise quantity. When x is









the input signal and Dx is successive difference sequence of x, the equations for both of

the parameters are

SD -R = STD(x),

RMSSD R = Exp(Dx2)

STD and Exp represent standard deviation and expectation operator respectively.

In order to test signal's randomness, TP is used. TP is defined to be the total

number of peaks and troughs in the signal, and tested here expecting to represent high

frequency noise well [14]. It is determined by looking at sign changes of the signal x.

From the sign sequence of the signal x, a successive difference sequence is obtained.

Whenever its absolute value is equal to 2, TP was increased by 1.

The analysis of activity of the signal can be done by measures such as ZCR, TC,

and form factor (Activity, Mobility, and Complexity) [14]. ZCR was seen to be

analogous to TP. TC is defined to be every change in slope of the signal that are greater

than an imposed threshold. TC is similar to counting TP as in the test for randomness,

but is expected to be robust in the presence of noise. In our case, we want the parameter

that is able to reflect the noise well, so TC is out of our consideration. Lastly, Activity,

Mobility, and Complexity are three parameters that comprise form factor. Activity is

simply the variance of the signal segment. Mobility is the square root of the ratio of the

Activity of the first derivative of the signal to the Activity of the original signal. The

last parameter, Complexity is defined as the ratio of the Mobility of the first derivative

of the signal to the Mobility of the signal itself. Mobility was selected and tested here to

see the relevance to signal quality.










Mobility of the signal x is computed as the square root of the ratio of the variance

of the first derivative of the signal to the variance of the original signal. x' is the first

derivative of x.


M.= -U


Experiment (Synthetic Signal Case)

A good quality measure should be able to represent any individual type of noise in

the signal, and any composite noise as well. First, we calculated the parameters

individually with four different kinds of noise: powerline noise, baseline noise, EMG

noise, and movement artifact. Each type of noise was simulated as in Chapter 3. The

noise amount is increased in ten levels by 3 dB in SNR for every two epochs, so the

signal quality should decrease in agreement with the SNR decrease, from 24dB to -3dB

by 3 dB. The true ECG signal is obtained from signal average of the ECG3.dat signal.

One epoch of the signal average output was repeated 20 times. (Figure 6-1) Simulated

noises were added to the true signal and four parameters selected above are calculated.













10 12 1 Ie


Figure 6-1. True ECG







42


Figure 6-2 is the result for the true ECG with no noise. All four shows constant

characteristics. The values at the beginning and at the end are due to truncation, thus


insignificant. In Figure 6-2 Figure 6-6, the horizontal axis is Period, which is


calculated as follows:


dB(i) = 27 3* Period(i), where i


d 1.2-

1 2 3 4 5 8 7 8 10
[period]


Figure 6-2. Quality measures of the true ECG (a) SD-R (b) RMSSD-R (c) TP (d)
Mobility


0.4


0I

oD
o0 I___^

250

Ic i ii


2-
1 2 3 4 5 7 9 10
[period]


Figure 6-3. Quality measures of the ECG with powerline noise (a) SD-R (b) RMSSD-R
(c) TP (d) Mobility


-1


c=


u
-1----------------






43
_ 7i i i i i i i i


1, 2, ..., 10.


^I












0.42




x 10



0 I--- I I I I I
10
4-
2-






SI I I I I I ----





0.5 I I I I I----
1 2 3 4 5 6 7 8 9 10
[period]


Figure 6-4. Quality measures of the ECG with baseline wander noise (a) SD-R (b)
RMSSD-R (c) TP (d) Mobility





0.1---i---- ----i---i---- ----i---i------ i----



110

b 0.2

0. i i-i i i i i----

200

20 ---- ---- ---------- i----------i---i---- ----








I ----l-------I
1.5 ---- l --- l --- l --- l ---------------- -- -



1 2 3 4 5 6 7 8 9 10

[period]


Figure 6-5. Quality measures of the ECG with EMG noise (a) SD-R (b) RMSSD-R (c)
TP (d) Mobility







44


In this experiment, the noise amount was varied in SNR. Therefore, SD R looks

like an ideal measure. Despite this bias, this result still gives us some information on

how the parameters reflect noise amount. For example, RMSSD R is very good for

powerline high frequency noise, while produces small value range for baseline wander

noise. This was expected before the experiment. In Figure 6-5 (b), it is shown that

RMSSD R is also good for EMG noise, which is broadband noise. The results of TP

and Mobility are not consistent. Especially for baseline wander noise, reciprocal


relationships with noise amount are shown.


0.2

a O.1 -

0


0.04
b 0.02 /




c 45


1.3

d 1.2
10 1-------i~----- ^ --- ---- ---- ---- ---- ---- I----


1 2 3 4 5 6 7 8 9 10
[period]


Figure 6-6. Quality measures of the ECG with sharp movement artifact (a) SD-R (b)
RMSSD-R (c) TP (d) Mobility

Figure 6-6 shows the result of movement artifact noise. Although its location

seemingly can be detected, the difference of the values is too small. Therefore,

quantifying signal quality from assessing the amount of movement artifact noise is

expected to be a difficult task for all the measures.










Experiment (Random Signal Case)

Another experiment was done for ECG3.dat ECG6.dat signals that are corrupted

with baseline wander noise, movement artifact, high frequency noise.

The parameters were measured in these random signal cases. The parameters were

calculated for each epoch in short time windowing method. The window size W was

200, which was seen to correspond to one epoch approximately. Windows were

overlapped to smooth the output and the size of the overlap L was chosen to be 100.


SD-R

RMSSD-R

TP

Mob ility


0 2 4 6 8 10 12 14 16
[s








o 2 4 6------ 8 10 12 14 16-----


0 2 4 1 8 10 12 14 11


Figure 6-7. ECG3.dat and its quality measures in time sequence (a) ECG3.dat signal (b)
SD-R, RMSSD-R, TP, Mobility (W =200, L =100)

ECG3.dat signal has moderate amount of baseline wander noise. As we anticipated

earlier, SD R is good at representing low frequency component as in Figure 6-7 (a).







46














0 2 4 6 8 10 12 14 16
[sec]




RMSSD-R

'- -- Z. --i- -- .-- - -- --" -



0 2 4 6 8 10 12 14 16
[see]


Figure 6-8. ECG4.dat and its quality measures in time sequence (a) ECG4.dat signal (b)
SD-R, RMSSD-R, TP, Mobility (W =200, L =100)

ECG4.dat signal has moderate amount of high frequency noise and baseline change

at the end. RMSSD R, TP, and Mobility seem to follow the amount change of high

frequency noise, while SD-R was a good measure for the baseline change at the end.

ECG5.dat signal is contaminated with severe amount of movement artifact.

Around 1400 sample point, there is a sharp movement artifact that simulates QRS

complex. This kind of noise is known to make the QRS detection difficult. RMSSD R

is good at detecting the location of this sharp movement artifact in Figure 6-9 (b).

ECG6.dat is contaminated with high frequency noise that appears irregularly. In

Figure 6-10 (b), RMSSD- R and TP represent the high frequency.

























0 2 4 6 8 10 12 14 16 18


0 2 4 6 8 10 12 14 16 18
[sec]

Figure 6-9. ECG5.dat and its quality measures in time sequence (a) ECG5.dat signal (b)
SD-R, RMSSD-R, TP, Mobility (W =200, L =100)


0 2 4 6 8 10 12 14 16
[se,




0 2 -4 0 --- -- -- 1 1 2 1 4 10




--- -- --- -

S--------2 4 6 ------ 10 12 -----4 16

0 2 4 15 2 10 12 14 115


Figure 6-10. ECG6.dat and quality measures in time sequence (a) ECG6.dat signal (b)
SD-R, RMSSD-R, TP, Mobility (W =200, L=100)


SD-R

RMSSD-R


TP

Mobility


I I I I' I '
- - - ..- .

- - -
_- -- - - - - - -- - - --__ _


SD-R


RMSSD-R


TP


Mobility







48


The results do not let us draw any generalization. It may be possible to combine

the measures to calculate one general measure that represents all situations. This type of

real-time quality monitoring can be set as an ultimate goal of our future study.

Instead of using residue, we can use filtered residue and possibly gain different

results. Figure 6-11 (a) is filtered residue of the ECG5.dat signal. As in chapter 5,

bandpass filtering didn't filter out the sharp movement artifact, which is shown in the

figure as well. Using filtered residue instead of the residue, RMSSD- R can be used in

detecting sharp movement artifact to repair the signal, which is a major contribution of

QRS detection errors. This is a valuable finding because sharp movement artifacts make

QRS detection very difficult by simulating QRS complexes.


SD-R

RMSSD-R


TP

Mobility


0 2 4 6 8 10 12 14 16 18


Figure 6-11. ECG5 and quality measures in time sequence (a) Bandpass filtered residue
of ECG5.dat signal (b) SD-R, RMSSD-R, TP, Mobility of ECG5.dat
(W=200, L =175)


.-.. "---_-- -- - -------I --
^ / \,---- ------














CHAPTER 7
KARHUNEN-LOEVE TRANSFORM

ECG diagnosis relies mainly on the signal's morphological features. Thus, the

signal's optimal morphology can be said to represent the true signal that we want to

obtain. The optimal separation between true signal and noise is ideal not only for

cleaning the signal, but also for noise assessment, which is our main goal. We assume

that the signal's quality is highly correlated with the noise amount in the signal.

KLT (Karhunen-Loeve Transform) is known to reduce a large set of variables to a

smaller set. The smaller set will still contain most of the information from the large set.

The reduced set of variables is called principal components (KL basis functions).

Previous studies showed that five principal factors (KL coefficients) are sufficient and

necessary for separating between noisy and clean patterns for both QRS complex and ST

segment, thus being able to represent the optimal morphology [3,4]. Here, we apply this

theory for the whole ECG signal.

First, we represent optimal morphology of the original ECG through KLT.

Subsequently, quality measures are proposed. lT is the percent ratio of the sum of n

largest KL coefficients and the trace of the eigenvalue matrix, which is associated with

representation performance of KLT. Associated with Tn, the proposed measures en and

r which are root mean square error and the residual error respectively, were studied.









KL Representation of Random Process

By using the KLT, a non-periodic random process can be represented as a linear

combination of the KL basis functions, which are KL expansion eigenvectors. The

components of the basis vectors are KL coefficients. KLT has a benefit in that it does not

require the detailed knowledge of the probability density of the problem.

Given a random input of dimension N, we centralized it by subtracting the mean

matrix M and named it P We want to find a set of vectors {(} such that

P = Y,a, >, where a, = P. where 0, = 5,

In this equation, P is the centralized matrix of the original measurement and {a}

is its transformed representation. This representation shows that an N dimensional

random vector can be represented using N orthogonal basis vectors {} If we want to

reduce the dimension N to n (< N), then the projection error will be:

e, = P- P where = :la,,

The minimization of en can be achieved by using least mean square error criterion,

constraining the coefficients {a} to be uncorrelated. That is:

E[a,a = ] = 2S,

where E is the expectation operator. This constraint leads to the classical

eigenvalue equation:

CJ = /1j, where C = E[(P P)(P -P)], P = E[P], and cY = p,-aao

C is the covariance matrix of P, p, is the correlation coefficient between p, and

pJ, and c, and ao are the standard deviations of p, and pJ respectively. The set of









variables {A} are called principal factors (KL coefficients) and the set of vectors {f} are

called principal components (KL basis functions) of the random vector P.

It should be noted that, while the deterministic representation tries to force the data

to fit into a model, KLT describes the data by KL basis functions, which are the

embodiment of the data itself. Another important aspect is that the representation error

e,, can be achieved by a chosen number of representation vectors n. Most measured

data contain considerable redundancy either from interference or from noise and artifact.

By ordering the basis vectors in decreasing order of eigenvalue magnitude, and

representing P with a chosen number of basis functions n, efficient representation of the

data can be obtained.

The measure associated with representation performance is T,, the percent ratio of

the sum of n principal components and the trace of the eigenvalue matrix [19].


T = 1 Z=I ,where tr(C) = A
tr(C) 1 -

The RMS error en, accounted for by using n < N eigenvectors is:





The trace of the covariance, tr(C), is a measure of the information in the random

process P. Thus, T, yields the percent of the trace accounted for by the n eigenvectors

to be used. This measure does not distinguish between signal and noise. The en shows


average error of the KL representation by n principal factors.











KLT and Quality of ECG Signal

The overall KL representation process of the ECG is illustrated in Figure 7-1.

Input Matrix

First, the original ECG was passed through the QRS detector described in Chapter

4. With R wave peaks found as fiducial points, all the epochs of the signal were aligned

to the same duration by the nonlinear mapping described in Chapter 5. Each epoch was

placed in the matrix row in a sequential order, creating the input matrix. The column size

will equal the number of samples in the aligned RR interval, while the row size can be

made dependent on the length of the signal, or can be set by a user.

Next, the input matrix was centralized and its covariance matrix was calculated.

Covariance matrix has all the possible covariance values between the different

dimensions of the input matrix.

Original
ECG


Figure 7-1. KLT algorithm of the ECG









KL Basis Functions and KL Coefficients

Eigenvectors and eigenvalues of the covariance matrix were named as KL basis

functions (principal components) and KL coefficients (principal factors) respectively. It

is important that these eigenvectors are orthonormal basis vectors. This process of taking

the eigenvectors of the covariance matrix enables us to extract the axes along which the

dispersion of the data is minimal. Thus, projection onto the principal axes of reduced

dimension will allow minimal RMS error. Figure 7-2 is an example figure of how the

principal components look in the case of the ECG signal. These are used as basis vectors

to reconstruct the signal. The morphology of QRS complex is evident in the first two

main components.







2

















Figure 7-2. Five largest KL basis functions of ECG6.dat

After the eigenvalue decomposition of the covariance matrix, the eigenvectors are

arranged in descending order of the corresponding eigenvalues' magnitude.









Data Representation

With first largest n principal components preserved, the rest less significant

components were replaced with zeros. This process will eliminate noise because KLT is

theoretically optimal in terms of separating signal from noise. It is known that five KL

coefficients represent the optimal morphology of both of the QRS complex and ST

segment in the ECG [3-4,20]. We assumed that it would also separate the whole true

ECG signal from noise.

The KL representation of the ECG is finally obtained as following [21].

P, = O "'-P'+M', where on is the first n principal components, and is its

transpose.

Quality Measures

The RMS error e, and the residual error r, are proposed as new quality measures.

Residual error r was obtained as follows.


r = E ( P )2

We chose n= 5, hence T, e, and r,.

Experiment

The four signals from Rangaraj's ftp site [15] are tested. Figure 7-3 is the

comparison between the original ECG and its KL representation. By using only the first

five KL coefficients, KLT succeeded in eliminating high frequency noise while

preserving the signal's morphology optimally. Figure 7-4 shows that KLT tends not to

eliminate baseline wander noise. When baseline wander noise is present, it tends to be

represented in the first or second principal factor. It also made the representation easier,

which gives us a large fT.























O 0.5 1 1.5 2 2.5 3 3.5 4 45 5
[s ec]











O 0.5 -1 1.5 2 2.5 3 3.5 4 4.5 5
[sec]


Figure 7-3. KLT ofECG6.dat (a) ECG6.dat (b) KL representation (n=5, T, =0.9183)


2 4 6 8 10 12 14 16 18
[sec














2 4 6 8 10 12 14 16 18


Figure 7-4. KLT of ECG4.dat (a) ECG4.dat (b) KL representation (n=5, T


0.9353)










Future Work

Especially, we were interested in ECG5.dat because of its movement artifacts.

Besides the baseline change caused by patient's movement, it contains a sharp movement

artifact at the 7th second. Sharp movement artifacts cause difficulties in QRS detection.

The following figures show how the KLT represents the ECG5.dat signal with varying

numbers of principal components, from one to three. This test suggests that a value of Tl


larger than 90% might also render an accurate representation of noise. The KL

representation of the ECG5.dat signal follows the signal shape of the movement artifact

at the 7th second when only three principal components were used. Thus, T, or T2 may


be better than T3 for noise assessment. However, choosing n whose T, is right above


90% or 95% for example didn't result in better quality representation. Further study is

suggested for future work.










2 4 0 8 10 12 14 16 18
[sec]








2 4 8 10 12 1 64 1 18
[sec]


Figure 7-4. KLT of ECG5.dat with n = (a) ECG5.dat (b) KL representation (T =
0.8759)





















2 4 6 8 10 12 14 16 18


Figure 7-5. KLT of ECG5.dat with n=2 (a) ECG5.dat (b) KL representation (T,
0.9471)


2 4 6 8 10 12 14 16 18


Figure 7-6. KLT of ECG5.dat with n=3 (a) ECG5.dat (b) KL representation (T,
0.9671)

















CHAPTER 8
MOS TEST

MOS Test

We needed results of a subjective measure to evaluate the performance of the proposed

measures comparatively. The ECG signals that are representative in noise type and

quantity were searched in the European ST-T database, where fifty lead II ECG signal

segments were chosen from. An MOS test was created as in Figure 8-1.





14No.
1. Detail oftester
Hane: ______
2. Quality score fr the signal(cnrle one)
1 e~g 2 god, 3 -tolerable, 4 arnost tolerable, 5 -verybad
3. Iteipietatin:
Check the types of ise recograzed tfat were caribTuted to your decision. Wrie 0 fr none, 1 tor srall, 2 or moderate, and3 fr
severe mramu of noise.
SNoise EMG Noise Basehne Noise: Movement Aitidact Movement Artifact Other
Respiration Slow baseline charge Sharp change specify


4. Comurnts:

5. Graph







n r
t!-- -I- ,r---i-A-I .


Figure 8-1. MOS test questionnaire









The questionnaires were ordered in a sequence of randomly generated numbers and

answered by a clinician. The signals were scored in quality for a rhythm strip, where

features such as P wave, QRS complex, ST segment, and T wave are of interest.

Comparative Study of Quality Measures

Linear Regression

To measure how strong a relation between proposal measures and MOS test we

used linear regression method. After drawing a regression line on the scatter plot, the

variance of vertical deviations from a regression line was calculated [22].



VAR =
n

where r are the ith vertical point deviation, n is the total number of points, and

p, is the mean value of r,; (i = 1,..., n).

The regression lines in Figure 8-2 have positive slope except Mobility. Negative

slope indicates that there is a reciprocal relationship with MOS results. Thus, as signal

quality becomes worse, the value decreases. Other measures have positive slopes and

their value increases as the quality gets worse.

Table 8-1 shows the deviation variance of the measures. Our proposed measures

en and r have lower variance than the rest of the measures. This means that they

conform better to the MOS results. However, this result may not be consistent because

MOS test was performed by only one clinician, which could have resulted in outliers.

















0.4

0.2

S0.2 0.4 0.8 1
0 0.2 0.4 0.6 0.8 1


0 0.2 0.4 0.6 0.8 1
MOS


0.2 0.4 0.6 0.8 1


.8 : :
I *

.4

.2

0 0.2 0.4 0.6 0.8 1
MOS


0 0.2 0.4 0.6 0.8 1


0 0.2 0.4 0.6 0.8 1
MOS


Figure 8-2. Scatter plots of quality measures against MOS quality score a) e, b) r c)
SD- R d) RMSSD- R e) TP f) Mobility

Table 8-1. Variances of vertical deviation from regression line


Measures
e


SD R
RMSSD R
TP
Mobility


VAR
0.0205
0.0220
0.0303
0.0232
0.0293
0.0486


Strength of a Relation

In Table 8-1, e, and r, has higher correlation with the MOS quality score, which

means they have stronger relation with the MOS quality result than the rest of the


* *


0.4

0.2

0 -
0









parameters. Therefore, e, and r, will probably be better measures than SD R and

RMSSD R, which were proposed by Velislav Batchvarov et al. [2]. However, it should

be noted that the strength of a relation doesn't imply the agreement between measures

[23].

Table 8-2. Correlation coefficients between the MOS quality score and proposed
measures
Measures VAR
e, 0.6607
r, 0.6884
SD R 0.4234
RMSSD- R 0.5384
TP 0.2893
Mobility -0.1447


Measuring Agreement

It is most unlikely that different measures will agree. However, we investigated by

how much the measures are likely to differ from the MOS test results. TP and

Mobility were excluded in this test because their relation to the MOS quality score is

rather weak.

First, the difference between the methods against their mean is plotted in a Bland-

Altman plot (Figure 8-3.) This plot will also let us investigate any possible relationship

between the measurement error and the true value. Because the true value is unknown,

the mean of the two measurements is the best estimate we have [23].











a
0.6
0.4 9
0.2
0
9 *
-0.2 *.
-0.4

0 0.5 1
C
0.6
0.4
0.2

-0.2 \ '4 "
.
-0.4
-0.4
,I


b
0.6
0.4
0.2 *


-0.2 *
-0.4

0 0.5 1

d
0.6
0.4
0.2


-0.2
-0.4

0 0.5 1


Figure 8-3. Difference against mean plots with 95% confidence interval lines of MOS
quality score a) e, b) r, c) SD- R d) RMSSD- R


Discussion

The test result showed that e, and r, are good enough to be proposed as new


quality measures. They are the most strongly correlated with the MOS quality score, they

have the least variance of vertical deviation from regression lines, and they show the

greatest agreement with the MOS quality score.

Although our test results have revealed our measures to be promising, the test size

should be enlarged. Not only should more ECG signals be examined, but several

clinicians should also review the signal quality through the MOS test. Regardless of the

limitations, we are content with our results having shown the new measure's potential.














CHAPTER 9
CONCLUSION AND FUTURE WORK

In this thesis, two new parameters for measuring ECG signal quality were

proposed. These parameters are RMS error e, and residual error r, which are related to

the signal's KL representation T. They were compared with four pre-existent measures,

which are SD R, RMSSD- R, TP, and Mobility. Ultimately, these measures were

compared with a MOS signal quality test score in strength of a relation, variance of

deviation from regression line, and agreement. Although if the differences between the

results of e,, r, and RMSSD R are significant is not verified due to the small size of

this study, we are confirmed that e, and r are potentially better quality measures for

ECG signal. The ability to generalize the potential of the proposed measures will depend

on the test size. More ECG signals should be tested, and more clinicians should review

them in quality.

Besides the main goal obtained in this study, we believe that several findings were

accomplished that can improve signal processing of ECG.

Regarding QRS detection we designed QRS detector that is differentiated because

it is based on defining refractory periods of the signal. Without using interpolation of the

missed peak locations, which Tompkins' algorithm uses, we obtained better detection

rate (99.5517 % compared to 99.325%.) The sensitivity and specificity of the detector

were 99.57% and 99.98% respectively. Our detector had higher specificity compared to

the results by Willi Kaiser et al. If an adaptive process is implemented for coarse limit









determination in the future, the detection rate and sensitivity of our QRS detector will be

improved.

In the analysis of the residue signal, we implemented the signal averaging

algorithm of Shahriar Iravanian et al. This algorithm uses nonlinear stretching

transformation to minimize distortion, and filters the residue to retrieve nontransient

components in the signal that can be clinically meaningful. While its idea being novel,

more studies are suggested in residual filtering area. Conventional bandpass filters didn't

succeed in separating noise of the residue from clinically meaningful components.

Velislav Batchvarov et al. used residuum, which is the difference between the

original signal and average signal to assess noise level. The average was calculated

based on cross correlation method. Through the novel signal averaging algorithm

followed by exact QRS detection, we believe that the performance of the pre-existent

parameters such as SD R, RMSSD- R was improved. Additionally, by using

bandpass filtered residue instead of residue, it was revealed that sharp movement artifacts

can be detected by monitoring RMSSD- R. This is a valuable finding because sharp

movement artifact, which simulates QRS complex, gets frequently in the way of accurate

QRS detection.

KLT is the analysis where we proposed two new quality parameters. Previous

studies by George B. Moody and Franc Jager verified five principal components are

optimal for separating signal and noise. By investigating KL representation of the ECG

signal, we feel that further work should be done to verify the number of principal

components to be used. A threshold function for representation performance or a









parameter function that combines t, with e, and r, will possibly allow us to measure

signal quality better.

Currently, the proposed measures have limitations in that fiducial points should be

located in advance to measurement. To eliminate their dependence on QRS detection,

evaluating robust covariance matrix without peak information is also suggested for future

work.

To summarize, we conclude that in measuring signal quality of ECG our proposed

measures, e, and r are potentially better parameters than the pre-existent measures of

SD R, RMSSD R, TP and Mobility.















LIST OF REFERENCES


1. Christian Oberli, Jorge Urzua, Claudia Saez, Marcello Guarini, Aldo Cipriano,
Bernardita Garayar, Guillermo Lema, Roberto Canessa, Carla Sacco, and Manuel
Irarrazaval, 1999, An expert system for monitor alarm integration. Journal of
Clinical Monitoring and Computing, 15: 29-35

2. Velislav Batchvarov, Katerina Hnatkova, and Marek Malik, 2001, Assessment of
noise in digital electrocardiograms. PACE, 25 (4): 499-503

3. George B. Moody and Roger G. Mark, 1989, QRS morphology representation and
noise estimation using the Karhunen-Loeve Transform. Computers in Cardiology:
269-272

4. Franc Jager, 2002, Feature extraction and shape representation of ambulatory
electrocardiogram using the Karhunen-Loeve transform. Elektrotehniski vestnik 69
(2): 83-89

5. Yaniv Zigel, August 1998, ECG signal compression. Thesis for the M.Sc. Degree,
Beer-sheva, Israel, Department of Electrical and Computer Engineering, Ben
Gurion University of the Negev

6. Linda M. Porterfield, 2001, ECG Interpretation Made Incredibly Easy, 2nd edition.
Springhouse, Pennsylvania: Springhouse

7. Huszar R.J. 1994, Basic Dysrhythmias: Interpretation & Management. 2nd ed. St.
Louis, Missouri: Mosby Lifeline

8. Ruben Orozco Morales, Manuel A. Perez Sanchez, Juan V. Lorenzo Ginori,
Ricardo Grau Abalo, and Ramiro Ramos Ramirez, 1997, Evaluation of QRS
morphological classifiers in the presence of noise. Computers and Biomedical
Research 30: 200-210

9. Gary M. Friesen, Thomas C. Jannett, Manal Afify Jadallah, Stanford L. Yates,
Stephen R. Quint, and H. Troy Nagle, January 1990, A comparison of the noise
sensitivity of nine QRS detection algorithms. IEEE Transactions on Biomedical
Engineering, 37 (1): 85-98

10. Ivan A Dotsinsky and Todor V Stoyanov, 2004, Ventricular beat detection in single
channel electrocardiograms. BioMedical Engineering OnLine. 3: 3









11. Jiapu Pan and Willis J. Tompkins, March 1985, A real-time QRS detection
algorithm. IEEE Transactions on Biomedical Engineering, BME-32 (3): 230-235

12. F. Gritzali, G. Frangakis, and G. Papakonstantinou, 1989, Detection of the P and T
waves in an ECG. Computers and Biomedical Research 22: 83-91

13. Antonio Michelucci, Giuseppe Bagliani, Andrea Colella, Paolo Pieragnoli, Maria
Cristina Porciani, Gianfranco Gensini, and Luigi Padeletti, 2002, P wave
assessment: State of the art update. Cardiac Electrophysiology Review. 6: 215-220

14. Rangaraj M. Rangayyan, 2002, Biomedical Signal Analysis: A Case-Study
Approach. Calgary, Alberta, Canada : Wiley InterScience

15. Rangaraj M. Rangayyan, 2002, ftp://ftp.ieee.org/uploads/press/rangayyan Accessed
April 2004

16. PhysioBank, Physiologic signal archives for biomedical research,
http://www.physionet.org/physiobank/database/#ecg Accessed April 2004

17. Shahriar Iravanian, and Leslie Tung, November 2002, A novel algorithm for
cardiac biosignal filtering based on filtered residue method. IEEE Transactions on
Biomedical Engineering, 49 (11): 1310-1317

18. Yaniv Zigel, Arnon Cohen, and Amos Kats, November 2000, The weighted
diagnostic distortion (WDD) measure for ECG signal compression. IEEE
Transactions on Biomedical Engineering, 47 (11): 1422-1430

19. Rober L. Lux, Karhunen-Loeve Representation of ECG Data. Journal of
Electrocardiology. 25 Supplement: 195-198

20. Franc Jager, George B. Moody, and Roger G. Mark, 1998, Detection of transient
ST segment episodes during ambulatory ECG monitoring. Computers and
Biomedical Research 31: 305-322

21. Lindsay I Smith, February 2002, A tutorial on principal component analysis.
Dunedin, New Zealand, Department of Computer Science, University of Otago

22. Martin Bland, 2000, An Introduction to Medical Statistics, 3rd edition. New York,
New York: Oxford University Press

23. J. Martin Bland, Douglas G. Altman, 1986, Statistical methods for assessing
agreement between two methods of clinical measurement. The Lancet, 2 (8): 307-
310

24. Willi Kaiser and Martin Findeis, 2000, Novel signal processing methods for
exercise ECG. International Journal of Bioelectromagnetism, 1 (2): 1310-1317






68


25. Pablo Laguna, George B. Moody, Raimon Jane, Pere Caminal, and Roger G. Mark,
Karhunun-Loeve transform as a tool to analyze the ST-segment, comparison with
QT interval. Journal of Electrocardiology, 28 Supplement: 41-49

26. Ary L. Goldberger and Emanuel Goldberger, 1994, Clinical Electrocardiography:
A Simplified Approach, 5th edition. New York, New York: Mosby

27. Henry J. L. Marriott, 1988, Practical Electrocardiography, 8th edition. Hagerstown
Maryland: Williams & Wilkins
















BIOGRAPHICAL SKETCH

Sungho Oh received a B.S. in electrical and computer engineering from the

Hanyang University, Seoul, Korea, in 2000. He received his M.S. in electrical and

computer engineering from the University of Florida in August 2004. His research

motivation lies in biomedical signal/image processing and non-invasive patient

monitoring.




Full Text

PAGE 1

A NEW QUALITY MEASURE IN ELECTROCARDIOGRAM SIGNAL By SUNGHO OH A THESIS PRESENTED TO THE GRADUATE SCHOOL OF THE UNIVERSITY OF FLOR IDA IN PARTIAL FULFILLMENT OF THE REQUIREMENTS FOR THE DEGREE OF MASTER OF SCIENCE UNIVERSITY OF FLORIDA 2004

PAGE 2

Copyright 2004 by Sungho Oh

PAGE 3

Dedicated to my parents, Junyoung Oh and Euns un Choi, for their blind love and support.

PAGE 4

ACKNOWLEDGMENTS I would like to express my gratitude to my advisor, Prof. Johannes H. van Oostrom, for all his advice and patient support. Without him this thesis would not have been possible. I also like to thank Kelly Spaulding, Dave Lizdas, and Jangyong Huh for being there when I was emotionally unstable after failing driving license tests. Most of all, I would like to thank my parents who supported my decisions without an exception. Words can not express my appreciation. iv

PAGE 5

TABLE OF CONTENTS Page ACKNOWLEDGMENTS .................................................................................................iv LIST OF TABLES ............................................................................................................vii LIST OF FIGURES .........................................................................................................viii ABSTRACT .......................................................................................................................xi 1 INTRODUCTION..........................................................................................................1 2 THE HEART AND THE ECG.......................................................................................4 Electrical Conduction System of the Heart ..................................................................4 Electrical Basis of the Electrocardiogram ....................................................................5 ECG Paper ....................................................................................................................6 Components of the Electrocardiogram .........................................................................7 ECG Leads ....................................................................................................................7 3 NOISE IN ECG.............................................................................................................11 Powerline Interference................................................................................................11 Respiration Noise........................................................................................................12 EMG Noise.................................................................................................................13 Movement Artifact......................................................................................................13 Electro-surgical Noise................................................................................................15 Composite Noise.........................................................................................................16 4 QRS DETECTION.......................................................................................................17 Coarse Limits Determination......................................................................................19 Lowpass Filter.....................................................................................................19 Derivative Filter...................................................................................................21 Non-linear Transform..........................................................................................22 Threshold Function..............................................................................................23 Rejection of the False Limits...............................................................................23 Peaks and Notches Determination..............................................................................24 Lowpass Filter.....................................................................................................24 Derivative Filter...................................................................................................24 Peaks and Notches Determination.......................................................................24 v

PAGE 6

Locating R Peaks.................................................................................................25 Detection of Other features..................................................................................27 Experiment..................................................................................................................27 Results and Discussion...............................................................................................30 5 SIGNAL AVERAGING AND RESIDUE FILTERING..............................................32 Signal Averaging........................................................................................................32 Aligning Each Epoch...........................................................................................33 Residue Filtering.................................................................................................34 Experiment and Discussion........................................................................................34 6 QUALITY MEASURES..............................................................................................39 Current Parameters of Signal Quality.........................................................................39 Experiment (Synthetic Signal Case)...........................................................................41 Experiment (Random Signal Case)............................................................................45 7 KARHUNEN-LOEVE TRANSFORM........................................................................49 KL Representation of Random Process......................................................................50 KLT and Quality of ECG Signal................................................................................52 Input Matrix.........................................................................................................52 KL Basis Functions and KL Coefficients............................................................53 Data Representation.............................................................................................54 Quality Measures........................................................................................................54 Experiment..................................................................................................................54 Future Work................................................................................................................56 8 MOS TEST...................................................................................................................58 MOS Test....................................................................................................................58 Comparative Study of Quality Measures....................................................................59 Linear Regression................................................................................................59 Strength of a Relation..........................................................................................60 Measuring Agreement.........................................................................................61 Discussion...................................................................................................................62 9 CONCLUSION AND FUTURE WORK.....................................................................63 LIST OF REFERENCES...................................................................................................66 BIOGRAPHICAL SKETCH.............................................................................................69 vi

PAGE 7

LIST OF TABLES Table page 8-1 Variances of vertical deviation from regression line................................................60 8-2 Correlation coefficients between the MOS quality score and proposed measures..61 vii

PAGE 8

LIST OF FIGURES Figure page 2-1 Electrical conduction system of the heart..................................................................4 2-2 Electrical basis of the ECG........................................................................................5 2-3 ECG paper..................................................................................................................6 2-4 Components of the ECG............................................................................................7 2-5 The standard (bipolar) limb leads I, II, and III...........................................................8 2-6 The augmented (unipolar) leads aVR, aVL, and aVF................................................9 2-7 Precordial (unipolar) leads.........................................................................................9 3-1 Clean ECG signal (Fs = 125Hz)...............................................................................11 3-2 ECG with powerline interference (18dB, 60Hz)......................................................12 3-3 ECG with respiration noise (32dB, 0.3Hz)..............................................................13 3-4 ECG with EMG noise (18dB)..................................................................................14 3-5 ECG with movement artifact (SNA=0.1, f=0.07Hz, d=0.50s)................................14 3-6 ECG with movement artifact (SNA=1.0, f=6Hz, d=0.04s)......................................15 3-7 ECG with Electro-surgical noise (-12dB, 900Hz)...................................................15 3-8 ECG with a composite noise....................................................................................16 4-1 The original ECG signal (Fs=125Hz)......................................................................19 4-2 Magnitude and phase response of the lowpass filter (fc=25Hz, Fs=125Hz)...........20 4-3 Lowpass filter output (blue) and the original ECG (red).........................................21 4-4 Magnitude and phase response of the derivative filter.............................................21 4-5 Moving average filter output (ymv) and the original ECG......................................22 viii

PAGE 9

4-6 Coarse limits of the QRS complex...........................................................................23 4-7 The first five seconds of d[n]...................................................................................24 4-8 Input/output ECG signals.........................................................................................26 4-9 The exact locations of R wave peaks.......................................................................26 4-11 Locations of QRS onset and offset...........................................................................27 4-12 The result of the QRS detection for ECG3.dat signal..............................................28 4-13 The result of the QRS detection for ECG4.dat signal..............................................28 4-14 The result of the QRS detection for ECG5.dat signal..............................................29 4-15 The result of the QRS detection for ECG6.dat signal..............................................30 5-1 Magnitude spectrum of ECG....................................................................................35 5-2 Signal average of the original ECG..........................................................................35 5-3 Characteristics of the residue signal.........................................................................36 5-4 Residue filtering and signal average........................................................................36 5-5 Bandpass filtered residues .......................................................................................38 5-6 True ECG signals.....................................................................................................38 6-1 True ECG.................................................................................................................41 6-2 Quality measures of the true ECG............................................................................42 6-3 Quality measures of the ECG with powerline noise................................................42 6-4 Quality measures of the ECG with baseline wander noise......................................43 6-5 Quality measures of the ECG with EMG noise.......................................................43 6-6 Quality measures of the ECG with sharp movement artifact...................................44 6-7 ECG3.dat and its quality measures in time sequence...............................................45 6-8 ECG4.dat and its quality measures in time sequence...............................................46 6-9 ECG5.dat and its quality measures in time sequence...............................................47 6-10 ECG6.dat and quality measures in time sequence...................................................47 ix

PAGE 10

6-11 ECG5 and quality measures in time sequence.........................................................48 7-1 KLT algorithm of the ECG......................................................................................52 7-2 Five largest KL basis functions of ECG6.dat...........................................................53 7-3 KLT of ECG6.dat.....................................................................................................55 7-4 KLT of ECG4.dat.....................................................................................................55 7-4 KLT of ECG5.dat with n=1......................................................................................56 7-5 KLT of ECG5.dat with n=2......................................................................................57 7-6 KLT of ECG5.dat with n=3......................................................................................57 8-1 MOS test questionnaire............................................................................................58 8-2 Scatter plots of quality measures against MOS quality score..................................60 8-3 Difference against mean plots with 95% confidence interval lines of MOS quality score.........................................................................................................................62 x

PAGE 11

Abstract of Thesis Presented to the Graduate School of the University of Florida in Partial Fulfillment of the Requirements for the Degree of Master of Science A NEW QUALITY MEASURE IN ELECTROCARDIOGRAM SIGNAL By Sungho Oh December 2004 Chair: Johannes H. van Oostrom Major Department: Electrical and Computer Engineering In recent years quantifying signal quality has been significant in research as well as in clinical practice. Poor quality signals have resulted in false alarms, poor patient monitoring, imprecise measurement, and misleading analysis. In areas such as ECG (electrocardiogram) monitoring, the assessment of the signal quality has been left to the intuitive judgment of the ECG interpreter who has to decide if the noise levels will allow for reliable interpretations. As an attempt to provide for more reliable ECG analysis, we have developed a study which will compare pre-existent quality measuring parameters and newly proposed parameters to a MOS (mean opinion score) test. The pre-existent measures under our investigation consist of four parameters; RSD (standard deviation of the residue), (root mean square of successive differences of the residue), TP (turning points), and Several studies have used the residue measures to assess the noise level. Although these measures do indicate occasional instances of quality, our results RRMSSD Mobility xi

PAGE 12

have led us to believe that they are insufficient in regards to quantifying signal quality. Therefore, we have proposed two measures that are both promising and more precise. The foundation in the development of our parameters is as follows: ECG diagnosis mainly relies on the signals morphology. The KLT (Karhunen-Loeve Transform) is known to separate signal from noise and represent the optimal morphology of the signal. the percent ratio of the sum of largest principal components (KL coefficients) and the trace of the eigenvalue matrix, is a measure that is associated with KL representation performance. Related to KL representation and its performance RMS (Root Mean Square) error and residual error were proposed as new quality measures. nT n nT ne nr As a final baseline comparison between both the pre-existent parameters used in other studies and our newly developed parameters, we used a MOS test as a subjective measure. Fifty lead II ECG signal segments were selected from the European ST-T database and their qualities were evaluated by a clinician. When compared with the other measures, and showed highest correlation and agreement with the MOS test results (0.6607, 0.6884), and lowest deviation variance from regression line (0.0205, 0.0220). This test showed that and are possibly better measures than the pre-existent ones. ne nr ne nr Among the preprocessing steps that we used to compute the measures, QRS detection was the most fundamental task. Our QRS detector was tested with the second one minute 48 ECG signals from the European ST-T database. Excluding the signals of morphologies other than lead II ECG, the detection rate was 99.5517% among the total 5353 beats. The sensitivity and specificity were 99.57% and 99.98% respectively. xii

PAGE 13

CHAPTER 1 INTRODUCTION Patient monitoring provides information on the patients physiological status. An alarm goes off when the value of the monitored variable lies outside a preset threshold range. In practice, seventy-five percent of the alarms by the standard monitors were reported to be false alarms [1]. This high error rate has led attending personnel to disable the alarm rather than to use it for information monitoring. Efforts to increase the efficacy in patient monitoring were made by integrating information from several monitors by using fuzzy logic [1]. While they improve the reliability of an alarm, multiple sources of information are required. However, the presence of noise still accounts for a high probability of misdiagnosis [1]. We have thus attempted to find a parameter that can estimate signal quality. From an indicator of the signal quality we will benefit ourselves as follows: Alerting a clinician about a low quality signal. Storing quality measures with the signal in an automated record keeper. Passing the quality information onto further processing as a weight so that less attention should be paid to the signals of low quality. The majority of false alarms is caused by noise and artifact. Signal quality is in reciprocal relationship with the amount of noise and artifact. Therefore, quantifying the amount of noise and artifact was regarded to be the same as assessing the signals quality. In this thesis, we will focus on the lead II ECG. 1

PAGE 14

2 Velislav Batchvarov et al. defined the residue, which is the difference between the original signal and the aligned averaged signal, as the underlying noise in the ECG [2]. (standard deviation of the residue) and RSD RRMSSD (root mean square of successive differences of the residue) were proposed as measures to compare the quality performance of two ECG monitors. These measures have limitations where RSD measures the low frequency mainly and RRMSSD reflects mostly the high frequency components of the signal. TP (turning points) and will be tested along with the above two measures. They represent the randomness and the mobility of the signal. Their advantages lie in that preprocessing of the original signal is unnecessary. Mobility The original ECG signal contains many local features that are insignificant. We will investigate the KL representation of the ECG. The five largest KL coefficients are known to represent the optimal morphology for both ST segment and QRS complex [3,4]. Thus, KLT can be used to reduce the feature dimension while the output signal still contains the optimal morphology of the original signal. We define a new residue to be the difference between the original signal and the optimal morphology representation of the original signal. Assuming the optimality, the new residue should also be the optimal representation of noise. RMS error, and residual error, of the KL representation are investigated in their relation with the signals quality. ne nr As a subjective quality measure, an MOS test was performed. A clinician marked the quality of fifty different signal segments. Strength of a relation and agreement were studied between different measures.

PAGE 15

3 For achieving our main study goal, several requirements had to be achieved, which include study on noise characteristics, QRS detection, signal average and residual filtering, and KL representation of the ECG. The structure of this work is as follows: Chapter 1 is this introduction that addresses signal quality problem. It also describes the motivation and the purpose of this work. Chapter 2 describes the basics of the heart physiology and the ECG. Chapter 3 describes the common types of noise that are present in ECG signal. We simulated five representative types of noise. Chapter 4 is about QRS detection, which is a required step for signal average, residue processing, and KLT. Chapter 5 presents signal average of the ECG and filtering the residue. Chapter 6 reviews several present parameters that are proposed for assessing the amount of noise in the ECG. Chapter 7 describes KLT that is used to represent signal morphology optimally. Associated with the representation performance, root mean square error and residual error were investigated in its relationship with the signals quality determined by a subjective MOS test, and are proposed as new quality measures. Chapter 8 is about the MOS test and comparative study of the quality measures. Chapter 9 contains result summary with conclusions, and discusses future work.

PAGE 16

CHAPTER 2 THE HEART AND THE ECG Electrical Conduction System of the Heart The heart consists of four hollow chambers. Its purpose is to circulate blood through the circulatory system [5-7]. The heart pumps in a rhythmic sequence. To make this possible, it is regulated by the electrical conduction system comprised of Sinoatrial (SA) node Internodal atrial conduction tracts and the interatrial conduction tract (Bachmanns bundle) Atrioventricular (AV) junction consisting of the atrioventricular (AV) node and bundle of His Right bundle branch, left bundle branch, and left anterior and posterior fascicles Purkinje network The major function of this electrical conduction system of the heart is to transmit electrical impulses from the SA node to the atria and ventricles, causing them to contract. Figure 2-1. Electrical conduction system of the heart 4

PAGE 17

5 Electrical Basis of the Electrocardiogram The ECG is a graphic record of the electric current that is generated by the depolarization and repolarization of the atria and ventricles. This electrical activity is detected by electrodes attached to the skin. Figure 2-2. Electrical basis of the ECG The voltage generated by atrial depolarization is the P wave. Ventricular depolarization is recorded as QRS complex. T waves correspond to the repolarization process. However, the effect of the atrial repolarization (Ta wave) is buried in the QRS complex because it normally occurs during ventricular depolarization.

PAGE 18

6 ECG Paper The paper used in recording electrocardiograms has a grid to show time measurement in seconds along the horizontal lines and voltage amplitudes along the vertical lines. Figure 2-4 illustrates how the box size corresponds to the measurements. The grid consists of intersecting dark and light vertical and horizontal lines. When the ECG is recorded at the standard paper speed of 25 mm/sec: The dark horizontal lines are 0.20 second (5 mm) apart and the light ones are 0.04 second (1 mm) apart. The dark vertical lines are 0.5 mV (5 mm) apart and the light ones are 0.1 mV (1 mm) apart. Figure 2-3. ECG paper The sensitivity of the ECG machine is usually adjusted and calibrated so that 1 mV electrical signal produces a 10 mm deflection on the ECG.

PAGE 19

7 Components of the Electrocardiogram After the electric current is detected by electrodes, is is amplified, displayed on an oscilloscope, recorded on ECG paper, or stored in memory. In a normal cardiac cycle, the P wave occurs first, followed by the QRS complex and the T wave. Figure 2-4. Components of the ECG The sections of the ECG between the waves and complexes are called segments and intervals: the PR segment, the ST segment, the TP segment, the PR interval, the QT interval, and the R-R interval. Intervals include waves and complexes, while segments do not. When electrical activity of the heart is not being detected, the ECG is a straight, flat line, which is called isoelectric line or baseline. ECG Leads An ECG lead is a record of the electrical activity generated by the heart that is sensed by either one of two ways: (1) two discrete electrodes of opposite polarity or (2) one discrete positive electrode and a zero reference point. A lead composed of two discrete electrodes of opposite polarity is called a bipolar lead; a lead composed of a single discrete positive electrode and a zero reference point is a unipolar lead.

PAGE 20

8 Depending on the ECG lead being recorded, the positive electrode may be attached to the right or left arm, the left leg, or one of several locations on the anterior chest wall. The negative electrode is usually attached to an opposite arm or leg or to a reference point made by connecting the limb electrodes together. Figure 2-5. The standard (bipolar) limb leads I, II, and III For a detailed analysis of the hearts electrical activity, usually in the hospital setting, an ECG recorded from 12 separate leads (the 12-lead ECG) is used. The 12-lead ECG is also used in the prehospital phase of emergency care in certain advanced life support services to diagnose acute myocardial infarction and to help in the identification of certain arrhythmias. A 12-lead ECG consists of three standard (bipolar) limb leads (leads I, II, and III), three augmented (unipolar) leads (leads aVR, aVL, and aVF) and six precordial (unipolar) leads (V 1 V 2 V 3 V 4 V 5 V 6 ).

PAGE 21

9 Figure 2-6. The augmented (unipolar) leads aVR, aVL, and aVF Figure 2-7. Precordial (unipolar) leads

PAGE 22

10 In this thesis, we will focus on lead II ECG. The single channel, limb lead II ECG is commonly used in the prehospital phase of emergency care when monitoring the heart for arrhythmias. The signals diagnostic features are very noticeable in lead II ECG. However, the precision can still be affected by patients movement or other interference easily because its millivolt range amplitude is relatively small.

PAGE 23

CHAPTER 3 NOISE IN ECG Noise is omnipresent. ECG signals also suffer from noise originating from various sources. There are five major types of noise in ECG signal: powerline interference, respiration noise, EMG noise, movement artifact, and electro-surgical noise [8-9]. Each type of noise is studied and simulated here. These simulated signals will later be used to evaluate measures of quality. Figure 3-1 shows the clean ECG signal after signal averaging that has normal sinus rhythm. Five different kinds of noises are added to simulate noisy signals. Figure 3-1. Clean ECG signal (Fs = 125Hz) Powerline Interference Powerline interference is due to the environment of the experiment, where it is filled with EM (Electro-Magnetic) waves. The 60Hz powerline interference is notorious 11

PAGE 24

12 for corrupting the signal of interest. Simple EM shielding of cables and grounding of the chassis of equipment can reduce EM and power-supply interference in most cases. Powerline noise consists of the 60Hz tone with random initial phase. Generally, it is consistent for a given measurement situation and once set, it will not change during evaluation. We modeled this with a single sinusoid of period 60Hz. Typically the amplitude can be up to 50 percent of the peak-to-peak ECG amplitude with SNR in the order of 3dB [8]. The harmonic components are present but were not modeled here because 60Hz component is dominant. Figure 3-2. ECG with powerline interference (18dB, 60Hz) Respiration Noise Respiration noise is represented by a sinusoidal drift of the baseline. The frequency corresponds to the respiration rate of the subject. The amplitude variation is about 15 percent of peak-to-peak ECG amplitude. It is simulated with a sinusoid of 0.3Hz frequency with typical 32dB SNR.

PAGE 25

13 Figure 3-3. ECG with respiration noise (32dB, 0.3Hz) EMG Noise If during an ECG acquisition procedure the subject coughs or squirms, the EMG (Electromyogram) associated with such activity will pose interference. The EMG is caused by muscular contraction, which generates microvolt-range electrical signal [9]. Such physiological interference may be minimized by strict instructions and self-control. However, this may not be applicable to infants and children. EMG noise is assumed to be zero mean Gaussian noise. The standard deviation determines the SNR, whose typical value is in the order of 18dB Movement Artifact Movement artifact is simulated with exponential function that decays with time. It contains two noise alternatives [8]. The first one is low-frequency artifact simulating displacements between electrodes and skin due to subjects slow movement. This kind typically shows 0.07Hz sinusoidal behavior with 0.16 second duration with random

PAGE 26

14 initial phase. The amplitude can be nearly up to twice the peak-to-peak amplitude. The second one is relatively high frequency artifact with 6Hz sinusoid of 0.04 second duration. The amplitude can almost be the same as the QRS complex and the initial phase is random. This kind of noise simulates the QRS complex. Therefore, it can cause a difficulty in QRS detection process. The amplitude was decided by SNA (Signal and Noise Amplitude ratio) Figure 3-4. ECG with EMG noise (18dB) Figure 3-5. ECG with movement artifact (SNA=0.1, f=0.07Hz, d=0.50s)

PAGE 27

15 Figure 3-6. ECG with movement artifact (SNA=1.0, f=6Hz, d=0.04s) Electro-surgical Noise Electro-surgical noise is caused by the use of electro-surgery instrument. This completely destroys the ECG. It is simulated with aliased signal with the frequency higher than the sampling frequency. Typical SNR is -12dB, which is highly destructive. Figure 3-7. ECG with Electro-surgical noise (-12dB, 900Hz)

PAGE 28

16 Composite Noise Various examples of composite noise can be simulated by adding the noises created as above. Figure 3-7 shows one example of powerline noise (18dB, 60Hz), EMG noise (24dB), baseline wander noise (18dB, 0.3Hz), and movement artifact (SNA=0.4, 0.07Hz, d=0.50s). Figure 3-8. ECG with a composite noise

PAGE 29

CHAPTER 4 QRS DETECTION The detection of QRS complexes is a crucial task in ECG analysis. It is the basis of ECG processing applications such as rhythm analysis, feature recognition (P, QRS, T) and ECG compression. In our work, fiducial points in each beat needed to be determined first, to carry out the signal averaging process. The peak locations of the R waves were located and used as fiducial points. We developed a real time algorithm for beat detection in signal channel ECG signal. Some detectors operate on two ECG leads simultaneously. Although such an attempt offers direct advantages, often times the detected beats do not coincide in time. A single channel detector will be especially suitable for stand-alone monitors, telemetry devices of limited bandwidth, event recorders for home use, defibrillators, pacemakers, etc [10]. The main challenges in QRS detection lie in patterns with varying morphology, large P and T waves, and different types of artifacts and noise. A general scheme for QRS detector is composed of two stages. In the first stage, the digitized ECG data is passed through a filtering step to eliminate noise, P and T waves. The output is processed by non-linear transformations such as squaring function, to enhance the R waves. Second, decision rules are applied to affirm the occurrence of R waves, where Tompkins algorithm used threshold with adjustment followed by adjustment of the average RR-interval and rate limits and T-wave rejection [11]. 17

PAGE 30

18 Instead of Tompkins algorithm, we chose to use Yaniv Zigels algorithm with some modifications [5]. It is composed of two stages as well, but is different in defining refractory periods in the signal. In the first stage, the refractory periods are defined where no QRS event can happen, thus coarse QRS complexes are obtained. The QRS complex candidates are coarsely determined by lowpass filtering, derivative filtering, moving average filtering, and applying threshold function to obtain coarse limits. False coarse limits caused by T waves and artifact are rejected. Determining coarse limits is important. We used a constant threshold function to determine coarse limits, but especially when the signal is contaminated with high EMG noise or movement artifact, it was not perfect. Making the threshold function adaptive is suggested as future work. In the second stage, we define peaks and notches emphasis signal () whose zero-crossings are candidates for R wave peak locations. The zero-crossings caused by other limits or noise are rejected. Lastly errors are corrected by comparing amplitude of the neighboring points. The signal is defined by threshold as well. Yaniv Zigels algorithm tends to fail when the signal contains large high frequency noise. This is because the threshold depends on the derivative values of the signal. We made this threshold as a function that varies over each epoch, and made it be a user defined parameter. pne pne After locating the R waves peaks, the onset and offset of the QRS complex can be also located from pne signal, if they exist. The rest of the features such as P and T waves can be detected afterwards with additional work [12-13]. For all the processes, the output was compensated in its group delay to be aligned with the input.

PAGE 31

19 Coarse Limits Determination The signal in Figure 4-1 shows a portion of an ECG with normal sinus rhythm. It is a 125Hz sampled signal with 60 seconds duration. Figure 4-1. The original ECG signal (Fs=125Hz) Lowpass Filter First, the ECG signal is passed through 25 Hz lowpass filter. Most of the energy in the ECG lies between 1Hz and 45Hz range. The lowpass filter was designed targeting the 250Hz sampled ECG signals, where the cutoff frequency will be 50Hz. It will represent most of the energy in the signal while suppressing high frequency noise content including 60Hz powerline noise. In some cases more aggressive filtering can be possibly used to improve result, but the purpose of this stage is only to determine the limits of the complexes coarsely. This process is not very dependent on the artifact caused by lowpass filtering. Kaiser window filter of order 20 was used to ensure constant delay.

PAGE 32

20 Figure 4-2. Magnitude and phase response of the lowpass filter (fc=25Hz, Fs=125Hz) The filtered output signal was smoother and contains less noise than the original signal. Figure 4-3 compares the first second of the filtered ECG signal with its lowpass filtered output. It can be seen that the lowpass filter distorts the signal especially at the onset and offset of the QRS complex. After the filtering, the limits became more notched. This can interfere in the peak detection process since they may be included in the signal. Yaniv Zigel used bandpass filter with lower cutoff frequency 1 Hz. This elimination of the low frequency is for eliminating baseline wander. However, it is not as successful in baseline wander noise as it distorts the limits. The original ECG signal is flat at the limits. After bandpass filtering, onset became elevated in amplitude, and the offset became noticeably notched. Even though this kind of distortion wont affect the goal of this stage, it should be noted that some conventional filtering techniques might bias the pne

PAGE 33

21 measurement, and resolution of the ECG systems, when they are used without proper understanding. Figure 4-3. Lowpass filter output (blue) and the original ECG (red) Derivative Filter Figure 4-4. Magnitude and phase response of the derivative filter

PAGE 34

22 The role of the derivative filter is to enhance R waves and diminish other events, such as P and T waves and baseline noise. The equation we used for taking derivative of the signal is 2/])1[]1[(][ nxnxnd where is the output of the lowpass filter. Figure 4-4 shows characteristics of the derivative filter. ][nx Non-linear Transform The derivative filter reduces non-QRS event successfully. But it also exaggerates high frequency noise that survived the lowpass filter. Thus, the signal is passed through the moving average filter. The input is the absolute values of thus making this process non-linear. This moving average reduces the contribution of the transient noise. Filter size is taken to correspond to an approximate width of the QRS complex. In this example, we used 21 samples (0.168sec) as the equation below. ][nd 200][][kkkndnymv The result is shown in Figure 4-5. Figure 4-5. Moving average filter output ( ym v ) and the original ECG

PAGE 35

23 Threshold Function To determine the coarse limits of the QRS complex, we threshold moving average filter output. Yaniv Zigel used an adaptive threshold function as follows [5]: 28.2)()()()1()(minmaxminkymvkymvkymvkthreshkthresh When the coarse limit detection fails, it is due to excessive amount of sporadic high frequency noise or movement artifact. Most of the cases the sudden increase of ym v didnt have influence on the previous epoch. In our test, sometimes was generally a good threshold value. When there is a sudden increase in the ])[max(5.0nymv ym v signal that are larger than twice the rest peaks in amplitude, usually is a better threshold function. Thus, the value thresh was determined heuristically: ])[(nymvmean 2/]))[(])[max(5.0((nymvmeannymvthresh However, an adaptive can be defined for improvement of the algorithm. ][nthresh Rejection of the False Limits Figure 4-6. Coarse limits of the QRS complex

PAGE 36

24 After the threshold, typical width of the coarsely determined QRS complex was around 25 samples (0.2 seconds.) Therefore any coarse QRS complex detected that are out of 20 to 60 samples range in duration were rejected. Figure 4-6 is the final result of the coarse limit determination process. The coarse QRS regions are successfully determined while the rest points are forced to zero. Peaks and Notches Determination Lowpass Filter The same lowpass filter in the coarse limit determination process was used. Derivative Filter The same derivative filter in the coarse limit determination process was also used. Peaks and Notches Determination The original ECG signal often suffers from baseline wander noise. When the derivative of the signal is taken, simple threshold functions become efficient. The output will have constant baseline with exaggerated high frequency components. Thus, noise level can be estimated by looking at the isoelectric part of the output signal. Figure 4-7. The first five seconds of ][nd

PAGE 37

25 The threshold process is done by defining for each epoch, which is calculated with the following equation: dth |}][{|maxmaxnddoffonQRSnQRS |}][{|maxminnddonoffQRSnQRS }20,max{maxmindddth maxd is searched over the coarse QRS complex region, and is searched over an estimated isoelectric segment in order to determine the noise threshold. The function values can be changed by user. In our algorithm the default threshold value was taken to be When there are missed beats because the dth value was too high, often caused by large high frequency noise, we can reduce by multiplying decimals, and vice versa. mind dth dth dth Two thresholds are applied to for determining : and The peaks and notches emphasizing signal, is produced by the equation: ][nd ][npne dth dth ][npne ][npne 1 if dthnd ][ ][npne 0 if dthnddth ][ ][npne -1 if dthnd ][ Locating R Peaks The locations of R wave peaks correspond to the zero crossings of the signal. The R wave locations were found based on the assumption that the R waves are the most sharp amplitude change in the coarse QRS complex regions. To locate the exact peak locations, errors were corrected by comparing amplitudes of the five neighboring points and choosing the point of maximal amplitude among them. Figure 4-8 shows how ][npne

PAGE 38

26 the zero crossing corresponds to the R peaks, and Figure 4-9 shows final results of the QRS detection algorithm. Figure 4-8. Input/output ECG signals (a) Original ECG. (b) (c) ][nd ][npne Figure 4-9. The exact locations of R wave peaks.

PAGE 39

27 Detection of other features From further investigation of the signal, QRS onset and offset points can be located if they exist. Figure 4-11 shows successful detection of QRS onsets and offsets. ][npne Figure 4-11. Locations of QRS onset and offset Experiment Our QRS detector was first tested with the five ECG signals from Rangaraj M. Rangayyans ftp site (ECG3.dat, ECG4.dat, ECG5.dat, ECG6.dat, and ECGPVC.dat). [14-15] They are sampled at 200Hz. The first four signals are 20 seconds in duration and ECGPVC.dat is 60 seconds.

PAGE 40

28 Figure 4-12. The result of the QRS detection for ECG3.dat signal The ECG3.dat signal has moderate amount of baseline wander noise that could have been caused by patients respiration. The QRS detection was successful as shown in Figure 4-12. Peak locations are indicated with red vertical lines. Figure 4-13. The result of the QRS detection for ECG4.dat signal

PAGE 41

29 The ECG4.dat signal is affected by the baseline change at the end. It seems to be caused by patients movement, and the high frequency noise that makes the line look thicker. Figure 4-14. The result of the QRS detection for ECG5.dat signal The ECG5.dat signal is corrupted with severe baseline changes. Also at around 7 seconds, a sharp movement artifact simulating QRS complex appears. This kind of movement artifact makes the QRS detection difficult. Using our detector, value had to be raised to to ensure no error. dth dth8.1 The ECG6.dat signal has irregular rhythm with high frequency noise appearing sporadically. It is also corrupted with a moderate amount of high frequency noise. For four different cases of the ECG signals, the peak finding process could find all the exact locations of R peaks. In ECGPVC.dat signal as well, where there are some ectopic beats, all 398 peaks were successfully located.

PAGE 42

30 Figure 4-15. The result of the QRS detection for ECG6.dat signal Results and Discussion Our QRS detector was trained with five ECG signals of Rangaraj M. Rangayyans ftp site and the European ST-T database. [15-16] The first four signals are 20 seconds in duration and are contaminated with various kinds of noise (Fs = 200Hz, ). They were regarded to be good for training the detector and for demonstration purpose as well. PhysioBank has 48 ECG signals of European ST-T database available. Each record is two hours in duration with two channels. The signals are sampled at 250Hz and have 12 bit resolution over a nominal 20 millivolt input range. Our single channel QRS detector was run for each channel individually, thus for 96 signals in total. The first one minute of all signals were used to train and the second minute to test the QRS detector. 16 signals among the 96 were of morphologies other than lead II ECG. For some of them, R peaks were successfully located, but for others not. In this work, we excluded those of different leads from our interest.

PAGE 43

31 Among the total 5353 beats, only 23 beats were missed and 1 false beat was located. It was regarded to be correct if the detector located local maxima. Sensitivity and specificity were calculated by the following definition: FN T P TP FN T P FNSe 1 F PTPTP F PTPFPSp1 TP was calculated as the total number of correct peak locations. FP is the total number of incorrect peak locations, and FN is the total number of missed beats. If there was an error in locating the beat by even one sample point, FN is incremented [10,24]. Our QRS detector had 99.57% sensitivity and 99.98% specificity. The total detection rate was calculated to be (5353-24)/5353 = 99.5517%. Our algorithm successfully located the peaks of the ectopic beats as well. However, coarse limit determination tends to fail when they were contaminated by high EMG and movement noise, which caused 13 missed beats. Thus, instead of using constant threshold function, an adaptive threshold function can improve the performance. One ectopic beat was missed because of its wide complex, and the rest were missed because the signal was contaminated with excessive amount of noise.

PAGE 44

CHAPTER 5 SIGNAL AVERAGING AND RESIDUE FILTERING An ECG signal is highly repetitive in its nature. Signal averaging is often used to obtain the stationary portion of a signal by taking advantage of its repetitive nature. The main problem in signal averaging lies in the small variations of each epochs duration. This problem is resolved by non-linear stretching that aligns each epoch to the same length [17]. After signal averaging, only the stationary part of the original signal remains. The residue signal, which is the difference between the original signal and the signal averaged output, was used to estimate noise quantity in the ECG [2]. In this chapter, we introduce a new signal average method involving residue filtering and attempt to analyze the residue further in noise representation. Signal Averaging Let be the input data sequence composed of beats of Assuming that the signal is perfectly periodic with a period of ][kx m nk1 sample points, let mn and jik where and 10mi j0 We can model the signal as )()()()(jinjigjfjix ,whereis the underlying stationary periodic signal, f g is the non-stationary part of the signal, and is a white Gaussian noise with zero mean and standard deviation n The signal average of is repetition of the signal of size x s computed as 10)(1)(mijixmjs 32

PAGE 45

33 The assumption behind signal averaging is that the noise at each sample times j j 2j is uncorrelated, while true signal at these times is highly correlated. By definition, If we average points with the same and uncorrelated noise, the average will become 0)(10mijig m )(jf 10)(1)(mijinmjf Based on the central limit theorem, 10)(1mijinm has a normal distribution with zero mean and standard deviation m In conclusion, the SNR improves by the factor of m as a result of signal averaging. As long as is not a multiple of the period of sinusoidal noise, signal averaging will reduce those noises as well. Thus, can be used to represent all types of noise in the ECG. n Aligning Each Epoch The durations of each epoch are not the same and have small variations. Therefore, they should be aligned to the same length in order to be averaged. Consequently, the maximal duration is found and all the epochs are stretched to it. This stretching is a mapping transformation. Instead of using a simple linear mapping function, a function that confines the stretching of low frequency region was used. The reason for this is that the repolarization phase differs among beats more than the upstrokes do. Moreover, regions of the upstrokes have higher frequency content and less vulnerable to non-transient signal components. The following equation is the polynomial function that was used for mapping [17]. This will confine the stretching of the low frequency region, providing almost one-to-one mapping in the neighborhood of the upstrokes. 3max2max'))((2))((3)(iiiiijjjjMj

PAGE 46

34 Residue Filtering The residue is defined to be the difference between the original signal and its signal averaged output. The averaged signal was shrunk back using the inverse of the stretching transformation and subtracted from the original signal. However, the non-stationary component of the signal is not represented in the signal averaged output. It is still contained in the residue. Thus, it is possible that the time-varying information which is clinically significant is obtained from the residue. g Shahriar Iravanian et al. filtered the residue with conventional FIR bandpass filter and added the result back to the signal averaged output, to increase SNR greatly while suppressing high frequency noise successfully [17]. We analyzed the residue through implementing this new signal averaging method. Because the frequency domain does not allow perfect separation of the signal and the noise, further work is suggested in this area. It would be ideal if we can separate the non-stationary part of the signal and noise n to define the true ECG signal and the true noise in the ECG. g Experiment and Discussion The effect of signal averaging was studied in frequency characteristics of the signals. Figure 5-1 is a comparison of the magnitude spectrums of the original ECG (fs = 125Hz), 25Hz lowpass filtered output, and signal averaged ECG. While almost all the high frequency components of the signal are suppressed by lowpass filtering, they are well reserved in the averaged output signal with noise eliminated in time domain. After alignment, the signals were averaged. In a real time application, the average size of fifty epochs can be chosen. In our experiment, the size of the input ECG signal is less than fifty. Therefore, averaging is performed across all the epochs.

PAGE 47

35 Figure 5-1. Magnitude spectrum of ECG (a) the original ECG. (b) the 25Hz lowpass filtered output of the ECG. (c) the signal averaged output of the ECG. Figure 5-2. Signal average of the original ECG The residue that was subtracted from this original ECG was shown in Figure 5-3.

PAGE 48

36 Figure 5-3. Characteristics of the residue signal (a) signal in time domain. (b) signal in frequency domain. Figure 5-4. Residue filtering and signal average (a) Bandpass filtered output of the residue signal, with passband 1-10Hz. (b) True ECG signal with filtered residue added to the signal average of the ECG.

PAGE 49

37 The impulse-like components formed in the residue signal are caused by the small changes of the R peaks amplitude and width, and are exaggerated by the alignment through stretching. The residue signal was passed through a bandpass filter with a passband of 1-10Hz. Figure 5-4 shows the result, which is the cleaned signal with high SNR, preserving non-stationary components of the original ECG. Signal averages of the four ECG signals from Rangaraj M. Rangayyans site were calculated and the residues were investigated [15]. Figure 5-5 and 5-6 shows the filtered residues and true ECGs respectively. The conventional bandpass filter is not efficient enough to separate the noise and non-stationary components of the ECG. While high frequency components are eliminated in the process, baseline wander and movement artifacts are still contained in the filtered residue. Thus, it can be noted that lowpass filtering of the residue is able to separate those noise from high frequency noise. The Figure 5-5 (c) and 5-6 (c) show this phenomenon. Filtering of the residue was not efficient for the purpose of obtaining the true ECG signal. Baseline wander and sharp movement artifact was not successfully eliminated by this process. This can be improved more and is included in the future work. For example, we can filter baseline wander noise separately, and can repair the signal portion that is contaminated with excessive amount of noise or sharp movement artifact.

PAGE 50

38 Figure 5-5. Bandpass filtered residues (a) ECG3.dat (b) ECG4.dat (c) ECG5.dat (d) ECG6.dat. Bandpass filter with 1-10Hz passband was used. Figure 5-6. True ECG signals (a) ECG3.dat (b) ECG4.dat (c) ECG5.dat (d) ECG6.dat

PAGE 51

CHAPTER 6 QUALITY MEASURES Parameters that are related to signal quality are (Percentage RMS Difference), (Weighted Diagnostic Distortion), PRD WDD RSD (Standard Deviation of the Residue), (RMS of Successive Differences of the Residue), TP(Turning Points), (Zero Crossing Rate), TC(Turns Count), , and In this chapter, four selected parameters (i.e. RRMSSD ZCR Activity Mobility Complexity RSD RRMSSD TP, ) were tested for individual types of noise, and were tested for general cases. Mobility Current Parameters of Signal Quality PRD and WDD measure the distortion of the signal. The prevalent measure, is proven not to have much meaning clinically compared to WDD, which was proposed by Yaniv Zigel (2000) [5,18]. These parameters measure the distortion between the original signal and the reconstructed signal through compression algorithms. Therefore, without having the reference signal to compare, these measures arent good for indicating general quality of the signal, and thus are excluded from our consideration. PRD and RSD RRMSSD were proposed by Velislav Batchvarov (2001) to assess noise in ECG, thus proving the validity of the ambulatory SEER MC recorders usability in serial ECG testing [2]. It is understood that RSD mainly measures slow baseline changes, while reflects fast fluctuations in the signal. These two parameters are tested here to find out how well they represent the overall noise quantity. When is RRMSSD x 39

PAGE 52

40 the input signal and is successive difference sequence of the equations for both of the parameters are Dx x )(xSTDRSD )(2DxExpRRMSSD STD and represent standard deviation and expectation operator respectively. Exp In order to test signals randomness, TP is used. TP is defined to be the total number of peaks and troughs in the signal, and tested here expecting to represent high frequency noise well [14]. It is determined by looking at sign changes of the signal From the sign sequence of the signal a successive difference sequence is obtained. Whenever its absolute value is equal to 2, TP was increased by 1. x x The analysis of activity of the signal can be done by measures such as TC, and form factor (, and ) [14]. was seen to be analogous to TC is defined to be every change in slope of the signal that are greater than an imposed threshold. TC is similar to counting TP as in the test for randomness, but is expected to be robust in the presence of noise. In our case, we want the parameter that is able to reflect the noise well, so TC is out of our consideration. Lastly, , and Complexity are three parameters that comprise form factor. is simply the variance of the signal segment. is the square root of the ratio of the of the first derivative of the signal to the of the original signal. The last parameter, is defined as the ratio of the of the first derivative of the signal to the of the signal itself. was selected and tested here to see the relevance to signal quality. ZCR Activity Mobility Complexity ZCR TP Activity Mobility Activity Mobility Activity Activity Complexity Mobility Mobility Mobility

PAGE 53

41 Mobility of the signal is computed as the square root of the ratio of the variance of the first derivative of the signal to the variance of the original signal. is the first derivative of x 'x x xxxxxM'2/122' Experiment (Synthetic Signal Case) A good quality measure should be able to represent any individual type of noise in the signal, and any composite noise as well. First, we calculated the parameters individually with four different kinds of noise: powerline noise, baseline noise, EMG noise, and movement artifact. Each type of noise was simulated as in Chapter 3. The noise amount is increased in ten levels by 3 dB in SNR for every two epochs, so the signal quality should decrease in agreement with the SNR decrease, from 24dB to -3dB by 3 dB. The true ECG signal is obtained from signal average of the ECG3.dat signal. One epoch of the signal average output was repeated 20 times. (Figure 6-1) Simulated noises were added to the true signal and four parameters selected above are calculated. Figure 6-1. True ECG

PAGE 54

42 Figure 6-2 is the result for the true ECG with no noise. All four shows constant characteristics. The values at the beginning and at the end are due to truncation, thus insignificant. In Figure 6-2 ~ Figure 6-6, the horizontal axis is which is calculated as follows: Period )(*327)(iPeriodidB where i 1, 2, 10. Figure 6-2. Quality measures of the true ECG (a) SD-R (b) RMSSD-R (c) TP (d) Mobility Figure 6-3. Quality measures of the ECG with powerline noise (a) SD-R (b) RMSSD-R (c) TP (d) Mobility

PAGE 55

43 Figure 6-4. Quality measures of the ECG with baseline wander noise (a) SD-R (b) RMSSD-R (c) TP (d) Mobility Figure 6-5. Quality measures of the ECG with EMG noise (a) SD-R (b) RMSSD-R (c) TP (d) Mobility

PAGE 56

44 In this experiment, the noise amount was varied in SNR. Therefore, looks like an ideal measure. Despite this bias, this result still gives us some information on how the parameters reflect noise amount. For example, RSD RRMSSD is very good for powerline high frequency noise, while produces small value range for baseline wander noise. This was expected before the experiment. In Figure 6-5 (b), it is shown that is also good for EMG noise, which is broadband noise. The results of TP and are not consistent. Especially for baseline wander noise, reciprocal relationships with noise amount are shown. RRMSSD Mobility Figure 6-6. Quality measures of the ECG with sharp movement artifact (a) SD-R (b) RMSSD-R (c) TP (d) Mobility Figure 6-6 shows the result of movement artifact noise. Although its location seemingly can be detected, the difference of the values is too small. Therefore, quantifying signal quality from assessing the amount of movement artifact noise is expected to be a difficult task for all the measures.

PAGE 57

45 Experiment (Random Signal Case) Another experiment was done for ECG3.dat ~ ECG6.dat signals that are corrupted with baseline wander noise, movement artifact, high frequency noise. The parameters were measured in these random signal cases. The parameters were calculated for each epoch in short time windowing method. The window size W was 200, which was seen to correspond to one epoch approximately. Windows were overlapped to smooth the output and the size of the overlap L was chosen to be 100. Figure 6-7. ECG3.dat and its quality measures in time sequence (a) ECG3.dat signal (b) SD-R, RMSSD-R, TP, Mobility (W=200, L =100) ECG3.dat signal has moderate amount of baseline wander noise. As we anticipated earlier, is good at representing low frequency component as in Figure 6-7 (a). RSD

PAGE 58

46 Figure 6-8. ECG4.dat and its quality measures in time sequence (a) ECG4.dat signal (b) SD-R, RMSSD-R, TP, Mobility (W=200, L =100) ECG4.dat signal has moderate amount of high frequency noise and baseline change at the end. TP, and seem to follow the amount change of high frequency noise, while SD-R was a good measure for the baseline change at the end. RRMSSD Mobility ECG5.dat signal is contaminated with severe amount of movement artifact. Around 1400 sample point, there is a sharp movement artifact that simulates QRS complex. This kind of noise is known to make the QRS detection difficult. RRMSSD is good at detecting the location of this sharp movement artifact in Figure 6-9 (b). ECG6.dat is contaminated with high frequency noise that appears irregularly. In Figure 6-10 (b), and TP represent the high frequency. RRMSSD

PAGE 59

47 Figure 6-9. ECG5.dat and its quality measures in time sequence (a) ECG5.dat signal (b) SD-R, RMSSD-R, TP, Mobility (W=200, L =100) Figure 6-10. ECG6.dat and quality measures in time sequence (a) ECG6.dat signal (b) SD-R, RMSSD-R, TP, Mobility (W=200, L =100)

PAGE 60

48 The results do not let us draw any generalization. It may be possible to combine the measures to calculate one general measure that represents all situations. This type of real-time quality monitoring can be set as an ultimate goal of our future study. Instead of using residue, we can use filtered residue and possibly gain different results. Figure 6-11 (a) is filtered residue of the ECG5.dat signal. As in chapter 5, bandpass filtering didnt filter out the sharp movement artifact, which is shown in the figure as well. Using filtered residue instead of the residue, can be used in detecting sharp movement artifact to repair the signal, which is a major contribution of QRS detection errors. This is a valuable finding because sharp movement artifacts make QRS detection very difficult by simulating QRS complexes. RRMSSD Figure 6-11. ECG5 and quality measures in time sequence (a) Bandpass filtered residue of ECG5.dat signal (b) SD-R, RMSSD-R, TP, Mobility of ECG5.dat (W=200, L =175)

PAGE 61

CHAPTER 7 KARHUNEN-LOEVE TRANSFORM ECG diagnosis relies mainly on the signals morphological features. Thus, the signals optimal morphology can be said to represent the true signal that we want to obtain. The optimal separation between true signal and noise is ideal not only for cleaning the signal, but also for noise assessment, which is our main goal. We assume that the signals quality is highly correlated with the noise amount in the signal. KLT (Karhunen-Loeve Transform) is known to reduce a large set of variables to a smaller set. The smaller set will still contain most of the information from the large set. The reduced set of variables is called principal components (KL basis functions). Previous studies showed that five principal factors (KL coefficients) are sufficient and necessary for separating between noisy and clean patterns for both QRS complex and ST segment, thus being able to represent the optimal morphology [3,4]. Here, we apply this theory for the whole ECG signal. First, we represent optimal morphology of the original ECG through KLT. Subsequently, quality measures are proposed. is the percent ratio of the sum of largest KL coefficients and the trace of the eigenvalue matrix, which is associated with representation performance of KLT. Associated with the proposed measures and which are root mean square error and the residual error respectively, were studied. nT n nT ne nr 49

PAGE 62

50 KL Representation of Random Process By using the KLT, a non-periodic random process can be represented as a linear combination of the KL basis functions, which are KL expansion eigenvectors. The components of the basis vectors are KL coefficients. KLT has a benefit in that it does not require the detailed knowledge of the probability density of the problem. Given a random input of dimension we centralized it by subtracting the mean matrix N M and named it We want to find a set of vectors P }{ such that NiiiP1 where iiP where ijji In this equation, P is the centralized matrix of the original measurement and }{ is its transformed representation. This representation shows that an dimensional random vector can be represented using orthogonal basis vectors N N }{ If we want to reduce the dimension to n N )(N then the projection error will be: nnPPe where niiinP1 The minimization of can be achieved by using least mean square error criterion, constraining the coefficients ne }{ to be uncorrelated. That is: ijjjiE ][ where E is the expectation operator. This constraint leads to the classical eigenvalue equation: jjjC where ]))([(TPPPPEC ][PEP and jiijijc C is the covariance matrix of P ij is the correlation coefficient between and and ip jp i and j are the standard deviations of and respectively. The set of ip jp

PAGE 63

51 variables }{ are called principal factors (KL coefficients) and the set of vectors }{ are called principal components (KL basis functions) of the random vector P It should be noted that, while the deterministic representation tries to force the data to fit into a model, KLT describes the data by KL basis functions, which are the embodiment of the data itself. Another important aspect is that the representation error can be achieved by a chosen number of representation vectors Most measured data contain considerable redundancy either from interference or from noise and artifact. By ordering the basis vectors in decreasing order of eigenvalue magnitude, and representing ne n P with a chosen number of basis functions efficient representation of the data can be obtained. n The measure associated with representation performance is the percent ratio of the sum of principal components and the trace of the eigenvalue matrix [19]. nT n niinCtrT1)(1 where NiiCtr1)( The RMS error accounted for by using ne Nn eigenvectors is: ][))((1NCtreniin The trace of the covariance, is a measure of the information in the random process Thus, yields the percent of the trace accounted for by the eigenvectors to be used. This measure does not distinguish between signal and noise. The shows average error of the KL representation by principal factors. )(Ctr P nT n ne n

PAGE 64

52 KLT and Quality of ECG Signal The overall KL representation process of the ECG is illustrated in Figure 7-1. Input Matrix First, the original ECG was passed through the QRS detector described in Chapter 4. With R wave peaks found as fiducial points, all the epochs of the signal were aligned to the same duration by the nonlinear mapping described in Chapter 5. Each epoch was placed in the matrix row in a sequential order, creating the input matrix. The column size will equal the number of samples in the aligned RR interval, while the row size can be made dependent on the length of the signal, or can be set by a user. Next, the input matrix was centralized and its covariance matrix was calculated. Covariance matrix has all the possible covariance values between the different dimensions of the input matrix. Figure 7-1. KLT algorithm of the ECG

PAGE 65

53 KL Basis Functions and KL Coefficients Eigenvectors and eigenvalues of the covariance matrix were named as KL basis functions (principal components) and KL coefficients (principal factors) respectively. It is important that these eigenvectors are orthonormal basis vectors. This process of taking the eigenvectors of the covariance matrix enables us to extract the axes along which the dispersion of the data is minimal. Thus, projection onto the principal axes of reduced dimension will allow minimal RMS error. Figure 7-2 is an example figure of how the principal components look in the case of the ECG signal. These are used as basis vectors to reconstruct the signal. The morphology of QRS complex is evident in the first two main components. Figure 7-2. Five largest KL basis functions of ECG6.dat After the eigenvalue decomposition of the covariance matrix, the eigenvectors are arranged in descending order of the corresponding eigenvalues magnitude.

PAGE 66

54 Data Representation With first largest n principal components preserved, the rest less significant components were replaced with zeros. This process will eliminate noise because KLT is theoretically optimal in terms of separating signal from noise. It is known that five KL coefficients represent the optimal morphology of both of the QRS complex and ST segment in the ECG [3-4,20]. We assumed that it would also separate the whole true ECG signal from noise. The KL representation of the ECG is finally obtained as following [21]. '''MPPnnn where n is the first principal components, and n 'n is its transpose. Quality Measures The RMS error and the residual error are proposed as new quality measures. Residual error was obtained as follows. ne nr nr 2)(nnPPEr We chose = 5, hence , and n 5T 5e 5r Experiment The four signals from Rangarajs ftp site [15] are tested. Figure 7-3 is the comparison between the original ECG and its KL representation. By using only the first five KL coefficients, KLT succeeded in eliminating high frequency noise while preserving the signals morphology optimally. Figure 7-4 shows that KLT tends not to eliminate baseline wander noise. When baseline wander noise is present, it tends to be represented in the first or second principal factor. It also made the representation easier, which gives us a large nT

PAGE 67

55 Figure 7-3. KLT of ECG6.dat (a) ECG6.dat (b) KL representation (n=5, =0.9183) nT Figure 7-4. KLT of ECG4.dat (a) ECG4.dat (b) KL representation (n=5, = 0.9353) nT

PAGE 68

56 Future Work Especially, we were interested in ECG5.dat because of its movement artifacts. Besides the baseline change caused by patients movement, it contains a sharp movement artifact at the 7th second. Sharp movement artifacts cause difficulties in QRS detection. The following figures show how the KLT represents the ECG5.dat signal with varying numbers of principal components, from one to three. This test suggests that a value of larger than 90% might also render an accurate representation of noise. The KL representation of the ECG5.dat signal follows the signal shape of the movement artifact at the 7th second when only three principal components were used. Thus, or may be better than for noise assessment. However, choosing whose is right above 90% or 95% for example didnt result in better quality representation. Further study is suggested for future work. nT 1T 2T 3T n nT Figure 7-4. KLT of ECG5.dat with =1 (a) ECG5.dat (b) KL representation ( = 0.8759) n nT

PAGE 69

57 Figure 7-5. KLT of ECG5.dat with =2 (a) ECG5.dat (b) KL representation ( = 0.9471) n nT Figure 7-6. KLT of ECG5.dat with =3 (a) ECG5.dat (b) KL representation ( = 0.9671) n nT

PAGE 70

CHAPTER 8 MOS TEST MOS Test We needed results of a subjective measure to evaluate the performance of the proposed measures comparatively. The ECG signals that are representative in noise type and quantity were searched in the European ST-T database, where fifty lead II ECG signal segments were chosen from. An MOS test was created as in Figure 8-1. Figure 8-1. MOS test questionnaire

PAGE 71

59 The questionnaires were ordered in a sequence of randomly generated numbers and answered by a clinician. The signals were scored in quality for a rhythm strip, where features such as P wave, QRS complex, ST segment, and T wave are of interest. Comparative Study of Quality Measures Linear Regression To measure how strong a relation between proposal measures and MOS test we used linear regression method. After drawing a regression line on the scatter plot, the variance of vertical deviations from a regression line was calculated [22]. nrVARniri12)( where are the ith vertical point deviation, is the total number of points, and ir n r is the mean value of ; ir ),...,1(ni The regression lines in Figure 8-2 have positive slope except Negative slope indicates that there is a reciprocal relationship with MOS results. Thus, as signal quality becomes worse, the value decreases. Other measures have positive slopes and their value increases as the quality gets worse. Mobility Table 8-1 shows the deviation variance of the measures. Our proposed measures and have lower variance than the rest of the measures. This means that they conform better to the MOS results. However, this result may not be consistent because MOS test was performed by only one clinician, which could have resulted in outliers. ne nr

PAGE 72

60 Figure 8-2. Scatter plots of quality measures against MOS quality score a) b) c) d) ne nr RSD RRMSSD e) TP f) Mobility Table 8-1. Variances of vertical deviation from regression line Measures VAR ne 0.0205 nr 0.0220 RSD 0.0303 RRMSSD 0.0232 TP 0.0293 Mobility 0.0486 Strength of a Relation In Table 8-1, and has higher correlation with the MOS quality score, which means they have stronger relation with the MOS quality result than the rest of the ne nr

PAGE 73

61 parameters. Therefore, and will probably be better measures than and which were proposed by Velislav Batchvarov et al. [2]. However, it should be noted that the strength of a relation doesnt imply the agreement between measures [23]. ne nr RSD RRMSSD Table 8-2. Correlation coefficients between the MOS quality score and proposed measures Measures VAR ne 0.6607 nr 0.6884 RSD 0.4234 RRMSSD 0.5384 TP 0.2893 Mobility -0.1447 Measuring Agreement It is most unlikely that different measures will agree. However, we investigated by how much the measures are likely to differ from the MOS test results. TP and were excluded in this test because their relation to the MOS quality score is rather weak. Mobility First, the difference between the methods against their mean is plotted in a Bland-Altman plot (Figure 8-3.) This plot will also let us investigate any possible relationship between the measurement error and the true value. Because the true value is unknown, the mean of the two measurements is the best estimate we have [23].

PAGE 74

62 Figure 8-3. Difference against mean plots with 95% confidence interval lines of MOS quality score a) b) c) ne nr RSD d) RRMSSD Discussion The test result showed that and are good enough to be proposed as new quality measures. They are the most strongly correlated with the MOS quality score, they have the least variance of vertical deviation from regression lines, and they show the greatest agreement with the MOS quality score. ne nr Although our test results have revealed our measures to be promising, the test size should be enlarged. Not only should more ECG signals be examined, but several clinicians should also review the signal quality through the MOS test. Regardless of the limitations, we are content with our results having shown the new measures potential.

PAGE 75

CHAPTER 9 CONCLUSION AND FUTURE WORK In this thesis, two new parameters for measuring ECG signal quality were proposed. These parameters are RMS error and residual error which are related to the signals KL representation They were compared with four pre-existent measures, which are , TP, and Ultimately, these measures were compared with a MOS signal quality test score in strength of a relation, variance of deviation from regression line, and agreement. Although if the differences between the results of , and ne nr nT RSD RRMSSD Mobility ne nr R RMSSD are significant is not verified due to the small size of this study, we are confirmed that and are potentially better quality measures for ECG signal. The ability to generalize the potential of the proposed measures will depend on the test size. More ECG signals should be tested, and more clinicians should review them in quality. ne nr Besides the main goal obtained in this study, we believe that several findings were accomplished that can improve signal processing of ECG. Regarding QRS detection we designed QRS detector that is differentiated because it is based on defining refractory periods of the signal. Without using interpolation of the missed peak locations, which Tompkins algorithm uses, we obtained better detection rate (99.5517 % compared to 99.325%.) The sensitivity and specificity of the detector were 99.57% and 99.98% respectively. Our detector had higher specificity compared to the results by Willi Kaiser et al. If an adaptive process is implemented for coarse limit

PAGE 76

64 determination in the future, the detection rate and sensitivity of our QRS detector will be improved. In the analysis of the residue signal, we implemented the signal averaging algorithm of Shahriar Iravanian et al. This algorithm uses nonlinear stretching transformation to minimize distortion, and filters the residue to retrieve nontransient components in the signal that can be clinically meaningful. While its idea being novel, more studies are suggested in residual filtering area. Conventional bandpass filters didnt succeed in separating noise of the residue from clinically meaningful components. Velislav Batchvarov et al. used residuum, which is the difference between the original signal and average signal to assess noise level. The average was calculated based on cross correlation method. Through the novel signal averaging algorithm followed by exact QRS detection, we believe that the performance of the pre-existent parameters such as RSD RRMSSD was improved. Additionally, by using bandpass filtered residue instead of residue, it was revealed that sharp movement artifacts can be detected by monitoring RRMSSD This is a valuable finding because sharp movement artifact, which simulates QRS complex, gets frequently in the way of accurate QRS detection. KLT is the analysis where we proposed two new quality parameters. Previous studies by George B. Moody and Franc Jager verified five principal components are optimal for separating signal and noise. By investigating KL representation of the ECG signal, we feel that further work should be done to verify the number of principal components to be used. A threshold function for representation performance or a

PAGE 77

65 parameter function that combines with and will possibly allow us to measure signal quality better. nt ne nr Currently, the proposed measures have limitations in that fiducial points should be located in advance to measurement. To eliminate their dependence on QRS detection, evaluating robust covariance matrix without peak information is also suggested for future work. To summarize, we conclude that in measuring signal quality of ECG our proposed measures, and are potentially better parameters than the pre-existent measures of , TP, and ne nr RSD RRMSSD Mobility

PAGE 78

LIST OF REFERENCES 1. Christian Oberli, Jorge Urzua, Claudia Saez, Marcello Guarini, Aldo Cipriano, Bernardita Garayar, Guillermo Lema, Roberto Canessa, Carla Sacco, and Manuel Irarrazaval, 1999, An expert system for monitor alarm integration. Journal of Clinical Monitoring and Computing, 15: 29-35 2. Velislav Batchvarov, Katerina Hnatkova, and Marek Malik, 2001, Assessment of noise in digital electrocardiograms. PACE, 25 (4): 499-503 3. George B. Moody and Roger G. Mark, 1989, QRS morphology representation and noise estimation using the Karhunen-Loeve Transform. Computers in Cardiology: 269-272 4. Franc Jager, 2002, Feature extraction and shape representation of ambulatory electrocardiogram using the Karhunen-Loeve transform. Elektrotehniski vestnik 69 (2): 83-89 5. Yaniv Zigel, August 1998, ECG signal compression. Thesis for the M.Sc. Degree, Beer-sheva, Israel, Department of Electrical and Computer Engineering, Ben Gurion University of the Negev 6. Linda M. Porterfield, 2001, ECG Interpretation Made Incredibly Easy, 2 nd edition. Springhouse, Pennsylvania: Springhouse 7. Huszar R.J. 1994, Basic Dysrhythmias: Interpretation & Management. 2 nd ed. St. Louis, Missouri: Mosby Lifeline 8. Ruben Orozco Morales, Manuel A. Perez Sanchez, Juan V. Lorenzo Ginori, Ricardo Grau Abalo, and Ramiro Ramos Ramirez, 1997, Evaluation of QRS morphological classifiers in the presence of noise. Computers and Biomedical Research 30: 200-210 9. Gary M. Friesen, Thomas C. Jannett, Manal Afify Jadallah, Stanford L. Yates, Stephen R. Quint, and H. Troy Nagle, January 1990, A comparison of the noise sensitivity of nine QRS detection algorithms. IEEE Transactions on Biomedical Engineering, 37 (1): 85-98 10. Ivan A Dotsinsky and Todor V Stoyanov, 2004, Ventricular beat detection in single channel electrocardiograms. BioMedical Engineering OnLine. 3: 3 66

PAGE 79

67 11. Jiapu Pan and Willis J. Tompkins, March 1985, A real-time QRS detection algorithm. IEEE Transactions on Biomedical Engineering, BME-32 (3): 230-235 12. F. Gritzali, G. Frangakis, and G. Papakonstantinou, 1989, Detection of the P and T waves in an ECG. Computers and Biomedical Research 22: 83-91 13. Antonio Michelucci, Giuseppe Bagliani, Andrea Colella, Paolo Pieragnoli, Maria Cristina Porciani, Gianfranco Gensini, and Luigi Padeletti, 2002, P wave assessment: State of the art update. Cardiac Electrophysiology Review. 6: 215-220 14. Rangaraj M. Rangayyan, 2002, Biomedical Signal Analysis: A Case-Study Approach. Calgary, Alberta, Canada : Wiley InterScience 15. Rangaraj M. Rangayyan, 2002, ftp://ftp.ieee.org/uploads/press/rangayyan Accessed April 2004 16. PhysioBank, Physiologic signal archives for biomedical research, http://www.physionet.org/physiobank/database/#ecg Accessed April 2004 17. Shahriar Iravanian, and Leslie Tung, November 2002, A novel algorithm for cardiac biosignal filtering based on filtered residue method. IEEE Transactions on Biomedical Engineering, 49 (11): 1310-1317 18. Yaniv Zigel, Arnon Cohen, and Amos Kats, November 2000, The weighted diagnostic distortion (WDD) measure for ECG signal compression. IEEE Transactions on Biomedical Engineering, 47 (11): 1422-1430 19. Rober L. Lux, Karhunen-Loeve Representation of ECG Data. Journal of Electrocardiology. 25 Supplement: 195-198 20. Franc Jager, George B. Moody, and Roger G. Mark, 1998, Detection of transient ST segment episodes during ambulatory ECG monitoring. Computers and Biomedical Research 31: 305-322 21. Lindsay I Smith, February 2002, A tutorial on principal component analysis. Dunedin, New Zealand, Department of Computer Science, University of Otago 22. Martin Bland, 2000, An Introduction to Medical Statistics, 3 rd edition. New York, New York: Oxford University Press 23. J. Martin Bland, Douglas G. Altman, 1986, Statistical methods for assessing agreement between two methods of clinical measurement. The Lancet, 2 (8): 307-310 24. Willi Kaiser and Martin Findeis, 2000, Novel signal processing methods for exercise ECG. International Journal of Bioelectromagnetism, 1 (2): 1310-1317

PAGE 80

68 25. Pablo Laguna, George B. Moody, Raimon Jane, Pere Caminal, and Roger G. Mark, Karhunun-Loeve transform as a tool to analyze the ST-segment, comparison with QT interval. Journal of Electrocardiology, 28 Supplement: 41-49 26. Ary L. Goldberger and Emanuel Goldberger, 1994, Clinical Electrocardiography: A Simplified Approach, 5 th edition. New York, New York: Mosby 27. Henry J. L. Marriott, 1988, Practical Electrocardiography, 8 th edition. Hagerstown Maryland: Williams & Wilkins

PAGE 81

BIOGRAPHICAL SKETCH Sungho Oh received a B.S. in electrical and computer engineering from the Hanyang University, Seoul, Korea, in 2000. He received his M.S. in electrical and computer engineering from the University of Florida in August 2004. His research motivation lies in biomedical signal/image processing and non-invasive patient monitoring. 69