+ All Categories
Home > Documents > Real Time Extraction of ECG Fiducial Points Using Shape ... · Real Time Extraction of ECG Fiducial...

Real Time Extraction of ECG Fiducial Points Using Shape ... · Real Time Extraction of ECG Fiducial...

Date post: 15-Mar-2020
Category:
Upload: others
View: 2 times
Download: 0 times
Share this document with a friend
143
Real Time Extraction of ECG Fiducial Points Using Shape Based Detection This thesis is presented to the School of Computer Science & Software Engineering for the degree of Doctor of Philosophy of The University of Western Australia By John Mark Darrington, BSc (hons) April 2009
Transcript
Page 1: Real Time Extraction of ECG Fiducial Points Using Shape ... · Real Time Extraction of ECG Fiducial Points Using Shape Based Detection This thesis is presented to the School of Computer

Real Time Extraction of ECG FiducialPoints Using Shape Based Detection

This thesis is

presented to the

School of Computer Science & Software Engineering

for the degree of

Doctor of Philosophy

of

The University of Western Australia

By

John Mark Darrington, BSc (hons)

April 2009

Page 2: Real Time Extraction of ECG Fiducial Points Using Shape ... · Real Time Extraction of ECG Fiducial Points Using Shape Based Detection This thesis is presented to the School of Computer
Page 3: Real Time Extraction of ECG Fiducial Points Using Shape ... · Real Time Extraction of ECG Fiducial Points Using Shape Based Detection This thesis is presented to the School of Computer

c© Copyright 2009

by

John Mark Darrington, BSc (hons)

iii

Page 4: Real Time Extraction of ECG Fiducial Points Using Shape ... · Real Time Extraction of ECG Fiducial Points Using Shape Based Detection This thesis is presented to the School of Computer

iv

Page 5: Real Time Extraction of ECG Fiducial Points Using Shape ... · Real Time Extraction of ECG Fiducial Points Using Shape Based Detection This thesis is presented to the School of Computer

To Martina.

Page 6: Real Time Extraction of ECG Fiducial Points Using Shape ... · Real Time Extraction of ECG Fiducial Points Using Shape Based Detection This thesis is presented to the School of Computer

vi

Page 7: Real Time Extraction of ECG Fiducial Points Using Shape ... · Real Time Extraction of ECG Fiducial Points Using Shape Based Detection This thesis is presented to the School of Computer

Abstract

The electrocardiograph (ECG) is a common clinical and biomedical research

tool used for both diagnostic and prognostic purposes. In recent years com-

puter aided analysis of the ECG has enabled cardiographic patterns to be found

which were hitherto not apparent. Many of these analyses rely upon the segmenta-

tion of the ECG into separate time delimited waveforms. The instants delimiting

these segments are called the “fiducial points”.

Rapid automatic identification of the fiducial points is a task which the biomedical

engineer needs to perform as a prerequisite to further analysis. To the researcher,

post-processing of pre-recorded results is an acceptable mode of analysis. However

clinical staff require an immediate real-time diagnosis. This thesis is concerned with

the detection of fiducial points using methods which lend themselves to real-time

analysis, suitable for use in the development of systems intended for environments

where immediate results are called for.

By way of introduction, an examination of contemporary methods of fiducial point

detection is presented, followed by a discussion of the conventional methods of

assessing their performance. It is found that these assessment methods, whilst

widely used, are not only mathematically imprecise but are formed in such a way

as to be useful to the biomedical engineer, but not to the clinician. An alternative

assessment measure which overcomes these problems is proposed, and examples

presented to demonstrate how the proposed new measure can be used.

Secondly, a novel method of ECG peak detection is presented. Since real-time

vii

Page 8: Real Time Extraction of ECG Fiducial Points Using Shape ... · Real Time Extraction of ECG Fiducial Points Using Shape Based Detection This thesis is presented to the School of Computer

detection is of interest, the method is developed with emphasis on optimising its

performance without the use of filtering or other pre-processing stages. The method

relies upon examination of the shape of the signal’s peaks rather than its spectral

analysis. This approach brings benefits in terms of noise immunity, particularly

where the spectral response of the feature is similar to that of the noise signal.

Initially, the method is applied to the task of detecting R peaks, the most prominent

feature of the ECG. Results are presented which demonstrate how the method is

not only effective at discriminating between these peaks, and other maxima in the

ECG, but also how the speed of execution suggests that the method lends itself to

real-time applications in a clinical setting.

Later in the thesis, the method is extended and a hybrid approach developed which

uses the advantages of the new method in conjunction with conventional linear

signal processing techniques to detect another two of the most important features,

namely the P and T waves.

Finally, since the basic method encapsulates the geometry of peaks in the signal, the

author presents a discussion of the opportunities that the method holds for further

uses. In particular it is proposed that the detection of onset and offset detected

waveforms can be extracted without significant extra time penalty.

Overall, the thesis presents an alternative basis for ECG analysis and an alternative

methodology of assessing the performance of such systems. It is hoped that the

reader finds these methods more intuitive than their existing counterparts, and will

inspire further research.

viii

Page 9: Real Time Extraction of ECG Fiducial Points Using Shape ... · Real Time Extraction of ECG Fiducial Points Using Shape Based Detection This thesis is presented to the School of Computer

Preface

This thesis contains material derived from published work which has been co-

authored. The details of these works are set out below.

• John Darrington. Towards real time QRS detection: A fast method using

minimal pre-processing. Biomedical Signal Processing and Control, Volume 1,

Number 2, pages 169–176, April 2006.

The research presented in this paper forms the basis of chapter 4.

• John Darrington and Livia Hool. A new methodology for assessment of the

performance of heartbeat classification systems. BMC Medical Informatics

and Decision Making, Volume 8, Number 7, 2008.

The results presented in appendix A were taken from those presented in this

publication and the research presented in chapter 3 was, in part, derived from

work included in this paper.

Other papers published during the course of the PhD. candidature, which provided

information, insight or inspiration include:

• John Darrington and Livia Hool. EKG Beat Analysis: Minimising Redun-

dancy between Detection and Classification. Proceedings of the 5th IASTED

International Conference on Biomedical Engineering, February 2007.

ix

Page 10: Real Time Extraction of ECG Fiducial Points Using Shape ... · Real Time Extraction of ECG Fiducial Points Using Shape Based Detection This thesis is presented to the School of Computer

• John Darrington Devising a Multidimensional Significant Maxima Detec-

tion Algorithm. Proceedings of the 14th UWA CSSE Research Conference,

September 2005.

Where a number of authors are present, the authors acted in a supervisory capacity

only. The percentage of effort towards the thesis by the candidate is 85%. The can-

didate is the primary author of the above publications. The candidate is responsible

for originality of the research presented in this thesis.

John Darrington

Amitava Datta

Livia Hool

x

Page 11: Real Time Extraction of ECG Fiducial Points Using Shape ... · Real Time Extraction of ECG Fiducial Points Using Shape Based Detection This thesis is presented to the School of Computer

Acknowledgements

I would like to express my sincere thanks to Amitava Datta who supervised me

throughout the entire study. I respect Amitava as an academic and a person of

considerable intellect and understanding. His encouragement and trust was instru-

mental to successful completion of the thesis. It has been an honour to study under

his supervision. I humbly offer him by profound gratitude and appreciation.

Livia Hool is a professional academic who is very knowledgeable in her field. She

has been exceedingly patient and helpful when explaining to me aspects of car-

diology and electrophysiology. She kindly agreed to co-supervise my candidature

and introduced to me aspects of academia I had not previously encountered. Her

assistance to me was immeasurable.

I would also like to extend my gratitude to the students and staff at the University

of Western Australia, School of Computer Science and Software Engineering for the

fun times, and the staff at Student Services for their support in the others.

Finally I would like to thank my partner Martina Faust to whom I dedicate this

thesis. Without her patience, compassion and extraordinary stamina this work

would not have been possible.

xi

Page 12: Real Time Extraction of ECG Fiducial Points Using Shape ... · Real Time Extraction of ECG Fiducial Points Using Shape Based Detection This thesis is presented to the School of Computer

xii

Page 13: Real Time Extraction of ECG Fiducial Points Using Shape ... · Real Time Extraction of ECG Fiducial Points Using Shape Based Detection This thesis is presented to the School of Computer

Contents

1 Introduction 1

1.1 Overview of the ECG. . . . . . . . . . . . . . . . . . . . . . . . . . 2

1.2 Physiological interpretation . . . . . . . . . . . . . . . . . . . . . . 5

1.3 The fiducial points . . . . . . . . . . . . . . . . . . . . . . . . . . . 5

1.4 Multiple channel electrocardiograph . . . . . . . . . . . . . . . . . . 6

1.5 Noise in the ECG . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8

1.6 Real time aspects . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10

1.7 Contribution of this thesis . . . . . . . . . . . . . . . . . . . . . . . 10

2 Literature Review 13

2.1 Filtering . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15

2.1.1 Linear filters . . . . . . . . . . . . . . . . . . . . . . . . . . . 15

2.1.2 Non-linear filters . . . . . . . . . . . . . . . . . . . . . . . . 17

2.2 Non-linear transforms . . . . . . . . . . . . . . . . . . . . . . . . . . 18

2.2.1 Morphological transforms . . . . . . . . . . . . . . . . . . . 18

2.2.2 The wavelet transform . . . . . . . . . . . . . . . . . . . . . 19

2.2.3 Kupeev’s algorithm . . . . . . . . . . . . . . . . . . . . . . . 21

2.3 The decision rule . . . . . . . . . . . . . . . . . . . . . . . . . . . . 22

xiii

Page 14: Real Time Extraction of ECG Fiducial Points Using Shape ... · Real Time Extraction of ECG Fiducial Points Using Shape Based Detection This thesis is presented to the School of Computer

2.3.1 Adaptive thresholding . . . . . . . . . . . . . . . . . . . . . 22

2.3.2 Stochastic methods . . . . . . . . . . . . . . . . . . . . . . . 25

2.4 Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 28

3 Assessment of Performance 29

3.1 Reference sources . . . . . . . . . . . . . . . . . . . . . . . . . . . . 29

3.2 Reference matching . . . . . . . . . . . . . . . . . . . . . . . . . . . 31

3.2.1 Matching tolerance . . . . . . . . . . . . . . . . . . . . . . . 32

3.2.2 Matching algorithms . . . . . . . . . . . . . . . . . . . . . . 32

3.3 Reporting and visualising performance . . . . . . . . . . . . . . . . 36

3.3.1 The receiver operating characteristic . . . . . . . . . . . . . 36

3.3.2 Problems with traditional definitions of sensitivity and speci-

ficity . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 37

3.3.3 Alternative definition of sensitivity and specificity . . . . . . 40

3.4 Time taken for detection . . . . . . . . . . . . . . . . . . . . . . . . 41

3.5 Measurement of precision . . . . . . . . . . . . . . . . . . . . . . . . 42

3.6 Assessing feature classifiers . . . . . . . . . . . . . . . . . . . . . . . 42

3.6.1 Problems with current classification methods . . . . . . . . . 43

3.6.2 Proposed methodology . . . . . . . . . . . . . . . . . . . . . 44

3.6.3 Worked example . . . . . . . . . . . . . . . . . . . . . . . . 46

3.6.4 Summary of classifier assessment . . . . . . . . . . . . . . . 49

3.7 Conclusion . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 49

4 Detection of R peaks 51

4.1 Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 51

xiv

Page 15: Real Time Extraction of ECG Fiducial Points Using Shape ... · Real Time Extraction of ECG Fiducial Points Using Shape Based Detection This thesis is presented to the School of Computer

4.2 Algorithm implementation . . . . . . . . . . . . . . . . . . . . . . . 52

4.2.1 Glossary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 54

4.2.2 Setup and initialisation . . . . . . . . . . . . . . . . . . . . . 55

4.2.3 Identifying the peaks . . . . . . . . . . . . . . . . . . . . . . 55

4.2.4 Constructing the tree . . . . . . . . . . . . . . . . . . . . . . 57

4.2.5 Extracting the maxima . . . . . . . . . . . . . . . . . . . . . 61

4.2.6 Shifting window . . . . . . . . . . . . . . . . . . . . . . . . . 61

4.3 Pre-processing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 64

4.4 Parameterisation . . . . . . . . . . . . . . . . . . . . . . . . . . . . 64

4.4.1 Window size . . . . . . . . . . . . . . . . . . . . . . . . . . . 64

4.4.2 Weight threshold . . . . . . . . . . . . . . . . . . . . . . . . 65

4.5 Effect of filtering . . . . . . . . . . . . . . . . . . . . . . . . . . . . 65

4.6 Experimental results . . . . . . . . . . . . . . . . . . . . . . . . . . 66

4.6.1 Observations . . . . . . . . . . . . . . . . . . . . . . . . . . 66

4.6.2 Analysis . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 67

4.6.3 Time complexity . . . . . . . . . . . . . . . . . . . . . . . . 71

4.7 Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 72

5 Detection of P and T waves 75

5.1 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 75

5.2 Background . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 77

5.2.1 Review of the wavelet transform . . . . . . . . . . . . . . . . 77

5.3 Algorithm implementation . . . . . . . . . . . . . . . . . . . . . . . 79

5.4 Experimental results . . . . . . . . . . . . . . . . . . . . . . . . . . 82

5.4.1 Tests using synthetically generated signals . . . . . . . . . . 83

xv

Page 16: Real Time Extraction of ECG Fiducial Points Using Shape ... · Real Time Extraction of ECG Fiducial Points Using Shape Based Detection This thesis is presented to the School of Computer

5.4.2 Performance tests against the QT database . . . . . . . . . . 88

5.5 Discussion . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 90

5.6 Conclusion . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 92

6 General conclusions and future research 95

6.1 Existing techniques . . . . . . . . . . . . . . . . . . . . . . . . . . . 95

6.2 Assessment of performance . . . . . . . . . . . . . . . . . . . . . . . 96

6.3 R peak detection . . . . . . . . . . . . . . . . . . . . . . . . . . . . 97

6.4 P wave detection . . . . . . . . . . . . . . . . . . . . . . . . . . . . 98

6.5 Future research . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 98

6.5.1 Detection of minima . . . . . . . . . . . . . . . . . . . . . . 98

6.5.2 Continuous real-time operation . . . . . . . . . . . . . . . . 99

6.5.3 Detection of waveform onset and offset . . . . . . . . . . . . 100

6.5.4 Other applications . . . . . . . . . . . . . . . . . . . . . . . 101

A Costs of beat misclassification 103

A.1 Extrapolation of data . . . . . . . . . . . . . . . . . . . . . . . . . . 103

A.2 Costs of incorrect classification . . . . . . . . . . . . . . . . . . . . 104

A.2.1 Costs of misclassification of a normal beat as abnormal . . . 109

A.2.2 Erroneous classification of beats as supra-ventricular ectopic

beats . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 110

Bibliography 111

xvi

Page 17: Real Time Extraction of ECG Fiducial Points Using Shape ... · Real Time Extraction of ECG Fiducial Points Using Shape Based Detection This thesis is presented to the School of Computer

List of Tables

3.1 A priori probabilities derived from the MIT-BIH Arrhythmia database. 47

3.2 Comparative performance of two classifiers . . . . . . . . . . . . . . 48

4.3 Sensitivity and Specificity for record 207 of the MIT-BIH Arrhythmia

database. This record is a particularly difficult one to analyse. . . . 70

4.4 Elapsed time to process a record, demonstrating the benefits of low

pass filtering of the complex lead. Despite the overhead of the filter,

there is considerable nett benefit to be gained by filtering. . . . . . 72

5.5 Distribution of detection error versus P wave position. θ indicates

the phase referenced to the R peak. The default value is −60◦. All

detections performed with SNR: 10dB, β: 1. . . . . . . . . . . . . 86

5.6 Distribution of detection error versus P wave amplitude. a indicates

the amplitude of the P wave. The default value is 0.75mV. All de-

tections performed with SNR: 10dB, β: 1. . . . . . . . . . . . . . . 87

5.7 Distribution of detection error versus P wave width. b indicates the

width of the P wave. The default value is 0.25s. All detections

performed with SNR: 10dB, β: 1. . . . . . . . . . . . . . . . . . . . 87

5.8 Table of beat by beat comparisons of detected P and T waves against

annotated records of the QT database. The ‘O’ column indicates

beats annotated as something other than P or T waves. . . . . . . 90

A.9 Costs of false classification in 1000s of AUD . . . . . . . . . . . . . 105

xvii

Page 18: Real Time Extraction of ECG Fiducial Points Using Shape ... · Real Time Extraction of ECG Fiducial Points Using Shape Based Detection This thesis is presented to the School of Computer

A.10 Expected Loss of life due to Atrial Fibrillation . . . . . . . . . . . . 106

A.11 Expected Loss of life due to Ventricular Fibrillation . . . . . . . . . 107

A.12 Expected loss of life due to Ventricular Ectopic Beats . . . . . . . . 109

xviii

Page 19: Real Time Extraction of ECG Fiducial Points Using Shape ... · Real Time Extraction of ECG Fiducial Points Using Shape Based Detection This thesis is presented to the School of Computer

4.8 The geometry of a peak. This example illustrates a peak P0 contain-

ing two child peaks, P1 and P2. . . . . . . . . . . . . . . . . . . . . 56

4.9 Detection of turning points in the signal. The input signal f(x) is

differentiated to get f ′(x), which is clamped to ±1 resulting with

g(x). g(x) is differentiated to get g′(x). The negative values of g′(x)

indicate the maxima in f(x), and the positive values indicate the

minima. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 58

4.10 Creating the final stack SS from the tree K. Node d is the leaf with

the smallest weight, and is therefore lowest in the stack. . . . . . . 62

4.11 A shifting window provides quasi real time response, and high pass

filtering. The overlapping regions are necessary, since peaks not com-

pletely contained within a window will otherwise go undetected. . . 63

4.12 ROC curves for R-peak detection. Each curve plots data at σ = 0.05,

0.1, 0.2, 0.3, 0.4, 0.5, & 0.6. Smaller values are plotted towards the

lower left hand corner. . . . . . . . . . . . . . . . . . . . . . . . . . 68

4.13 Comparison of two records from the MIT-BIH Arrhythmia database

demonstrating the respective directions of R peaks in normal and

arrhythmic beats. . . . . . . . . . . . . . . . . . . . . . . . . . . . . 69

4.14 ECG channels presented to the detection algorithm. The R peaks

manifest themselves at slightly different temporal locations in chan-

nels 0 and 1, leading to double peaks in the complex lead. Low pass

filtering the complex lead combines the double peaks into a single one. 70

5.15 ECG signal and corresponding discrete wavelet transform. The hor-

izontal axis represents time, and the vertical axis the wavelet level.

This plot shows wavelet levels 1 through to 5; level 1 appearing at the

top. Coefficients of high magnitude are shown as white, and those of

low magnitude as black. . . . . . . . . . . . . . . . . . . . . . . . . 78

xx

Page 20: Real Time Extraction of ECG Fiducial Points Using Shape ... · Real Time Extraction of ECG Fiducial Points Using Shape Based Detection This thesis is presented to the School of Computer

5.16 Intersection of wavelet coefficients and a window N . The window

corresponds to the range of a single node in the binary tree of Ku-

peev’s algorithm. Each coefficient domain which wholly or partially

falls within the range (u, v) contributes to the weight of N . . . . . 80

5.17 Detection results for different noise colours. Each curve is plotted by

running the detection algorithm with the following weight threshold

values: 0.01, 0.02, 0.03, 0.04, 0.05, 0.06, 0.07, 0.08, 0.09, 0.1, 0.2, 0.3,

0.4, 0.5, 0.6, 0.7, 0.8, 0.9; smaller values result in a more promiscuous

detector and are plotted towards the upper right hand corner. . . . 84

5.18 Standard deviation of the difference between the actual and detected

locations vs. signal to noise ratio for different noise colours. The

weight threshold used for each experiment was 0.07. . . . . . . . . . 85

5.19 The result of applying the wavelet weighted Kupeev detector to a

synthetically generated ECG. Undetected P waves were observed to

be preceded by a flat TP segment, whereas correctly detected P waves

are generally associated with a positive slope in this region and no-

ticeably greater negative deflection. . . . . . . . . . . . . . . . . . 91

5.20 The Daubechies-4 mother wavelet. The shape of this wavelet is sim-

ilar to that of the most commonly manifested P waves, and explains

the efficacy of this wavelet in their detection. . . . . . . . . . . . . . 92

6.21 A sliding window would require a dynamically modifiable tree. Leaf

nodes occurring before the window are excised from the tree. New

nodes entering the window require the tree to be re-rooted. The new

nodes becomes the right hand child of the new root. . . . . . . . . . 99

6.22 Principle of a possible system to determine the onset of a feature. The

onset will occur in the region where there is a change in ∆f(t)/∆t. 101

xxi

Page 21: Real Time Extraction of ECG Fiducial Points Using Shape ... · Real Time Extraction of ECG Fiducial Points Using Shape Based Detection This thesis is presented to the School of Computer

xxii

Page 22: Real Time Extraction of ECG Fiducial Points Using Shape ... · Real Time Extraction of ECG Fiducial Points Using Shape Based Detection This thesis is presented to the School of Computer

List of Figures

1.1 Anterior view of the human heart, illustrating the two atria and

ventricles. The arrows indicate the direction of blood flow from atria

to ventricles and through the pulmonary and aortic valves. . . . . . 3

1.2 A single cardiac cycle in an ECG lead representing normal sinus

rhythm. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4

1.3 Configuration of the 12 lead electrocardiograph. These diagrams

show an anterior view of the patient. The right leg is normally con-

nected to signal ground (not indicated here). . . . . . . . . . . . . 7

2.4 An example of peak detection by Kupeev’s algorithm. Excised nodes

are placed into an external stack which will contain peaks sorted by

weight. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23

3.5 Two different permutations for matching reference features to de-

tected features. Reference features are annotated rn and detected

features sn. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 33

3.6 An example of several receiver operating characteristic curves plotted

on the same axes. . . . . . . . . . . . . . . . . . . . . . . . . . . . . 37

4.7 A visualisation of Kupeev’s algorithm applied to an ECG signal.

Each peak becomes a node in the binary tree. Subsequent processing

will extract the nodes of maximal height to select R peaks whilst

discarding P & T waves and high frequency noise. . . . . . . . . . . 53

xix

Page 23: Real Time Extraction of ECG Fiducial Points Using Shape ... · Real Time Extraction of ECG Fiducial Points Using Shape Based Detection This thesis is presented to the School of Computer

Chapter 1

Introduction

An electrocardiograph (ECG) is a cartesian representation of the electrical po-

tential generated by the heart. Since its invention in 1887, it has been an

invaluable diagnostic tool for the clinician. Traditionally, the ECG is recorded in

a hospital setting, or by an ambulatory device[41] and the analysis is done offline

by trained clinical personnel. However recent applications demand analysis online,

where no skilled persons are available, or without any manual intervention.

One such application is the automatic external defibrillator. A defibrillator is a de-

vice which administers a therapeutic electrical shock to a patient exhibiting ventric-

ular fibrillation or other form of ventricular tachyarrhythmia, and if used correctly

will induce the heart to resume normal rhythm. Such equipment has traditionally

been restricted to hospitals since the shock must be applied at the correct instant

with respect to the fibrillating rhythm. However recent advances in automatic ECG

analysis has led to the development of automatic external defibrillators which detect

the appropriate instant to deliver a shock, and can thus be used by persons with no

more than basic first aid training[79]. Patients susceptible to ventricular fibrillation

are sometimes fitted with an implantable cardioverter-defibrillator. Due to the im-

plantable nature of such a device, it must be capable of quickly analysing the ECG

rhythm, using a minimum of hardware. There have however been reports of these

1

Page 24: Real Time Extraction of ECG Fiducial Points Using Shape ... · Real Time Extraction of ECG Fiducial Points Using Shape Based Detection This thesis is presented to the School of Computer

2 CHAPTER 1. INTRODUCTION

devices erroneously detecting arrhythmias and delivering inappropriate shocks to

the wearer[75]. Inappropriate shocks can induce arrhythmias and reducing the like-

lihood of such occurrences is vital since induced arrhythmias expose the patient to

the risk of permanent injury or death.

Offline analysis of ECG can sometimes be useful as a prognostic tool. However, the

patterns useful for prognostic purposes are generally very subtle and impossible to

detect by direct human observation[10]. As a diagnostic tool, offline analysis is not

preferred, since it is costly and it delays diagnosis which can be life threatening.

Whilst computer analysis of ECG signals is becoming acknowledged by the medical

profession, the quality of current automatic analysis is questioned in some areas[37,

48], which demonstrates the need for improved techniques. Other novel applications

of ECG analysis outside the medical field also appear in the literature[11, 33] and

continue to attract interest.

1.1 Overview of the ECG.

An elementary understanding of the ECG and the physiological process it repre-

sents is necessary in order to appreciate the motives for ECG analysis and the

processes involved. The heart comprises four chambers, as depicted in figure 1.1.

The two upper chambers are called the atria and lower two the ventricles. The

walls of each chamber consist of myocardial muscles, which themselves comprise

cells called myocytes . Normally, the interior of the cell has a potential of about

-70mV with respect to the extra cellular fluids surrounding the cell. Thus, there

exists an electrical potential across the cell membrane. A cell in such a state is said

to be polarised . A cell with a trans-membrane potential of zero (or slightly positive)

is said to be depolarised . Ions passing through the cell membrane can alter the po-

tential difference. Similarly, particular ranges of membrane potential are favourable

for the passage of the ions of particular molecules. This inter-relationship between

ion channels and the membrane potential is complex (see chapter 18 of [38]), but in

Page 25: Real Time Extraction of ECG Fiducial Points Using Shape ... · Real Time Extraction of ECG Fiducial Points Using Shape Based Detection This thesis is presented to the School of Computer

1.1. OVERVIEW OF THE ECG. 3

Sinus node

Right ventricle

Right atrium

Left atrium

Left ventricle

Figure 1.1: Anterior view of the human heart, illustrating the two atria and ven-tricles. The arrows indicate the direction of blood flow from atria to ventricles andthrough the pulmonary and aortic valves.

Page 26: Real Time Extraction of ECG Fiducial Points Using Shape ... · Real Time Extraction of ECG Fiducial Points Using Shape Based Detection This thesis is presented to the School of Computer

4 CHAPTER 1. INTRODUCTION

P

Q

R

S

T

P

cardiac cycle←−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−→

PP interval←−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−→

QT interval←−−−−−−−−−−−−−−−−−→

STsegment←−−−→

RR interval←−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−→

T wave←−−−−−→ P wave←−−−−−−→Q

R

S

Figure 1.2: A single cardiac cycle in an ECG lead representing normal sinus rhythm.

normal healthy subjects, the result is a regular, periodic change in trans-membrane

potential versus time. The sinus node is said to be the primary “pacemaker” of the

heart. Under normal conditions it spontaneously produces an action potential, to

which the rest of the myocardial muscles sympathetically respond. A unique prop-

erty of myocytes is their ability to propagate the trans-membrane potential from

one cell to an adjacent cell. Hence, in normal healthy tissue, a wave of depolari-

sation may be observed moving across the heart. Another property is that sudden

depolarisation causes the myocardium to contract. These two properties result in a

wave of contraction, starting from the sinus node, spreading across the heart in the

inferior direction. In general, the myocardial polarisation is a deterministic, peri-

odic process and this gives rise to the regular heartbeat and ECG signal illustrated

in figure 1.2.

Page 27: Real Time Extraction of ECG Fiducial Points Using Shape ... · Real Time Extraction of ECG Fiducial Points Using Shape Based Detection This thesis is presented to the School of Computer

1.2. PHYSIOLOGICAL INTERPRETATION 5

1.2 Physiological interpretation

An ECG recorded for offline analysis is conventionally written to graph paper, with

a horizontal scale of 40ms per division and a vertical scale of 0.1mV per division,

with divisions occurring at 1mm intervals. As a depolarised region moves towards

an electrode, a positive deflection will be recorded on the ECG, and a negative de-

flection will be recorded as the regions closest to the electrode become repolarised.

For historical reasons, the turning points of a normal ECG are conventionally la-

belled P, Q, R, S and T (see figure 1.2). Some texts also include a U wave, but U

is often of very low amplitude or absent altogether. The P wave occurs as the atria

are depolarising, and hence contracting. This typically takes approximately 120ms.

Following the P wave, comes the QRS complex. This represents the ventricles de-

polarising, and completes in about 100ms. Since the ventricles are much larger

cavities than the atria, a larger electrical potential results from their depolarisation

and the QRS complex is of larger magnitude than the P wave. During the T wave,

the ventricles are repolarising. In the human heart, the repolarisation takes place

in the direction of the endocardium to epicardium (ie. in the opposite direction to

polarisation). Hence the T wave extends in the same direction as the R peak.

1.3 The fiducial points

A simple example of ECG analysis is the measurement of heart rate. This involves

detecting the R peaks and measuring the RR intervals (the time between each ven-

tricular contraction). Normally, this will be identical to the PP intervals, however

under pathological conditions, the two may become independent. Hence detection

of the P wave provides useful data. Advanced ECG analysis typically calls for

segmentation of each beat into its component waves. The relative durations and

amplitudes of each wave are often indicative of certain clinical conditions. For exam-

ple, an abnormally wide P wave is known to be a predictor of atrial fibrillation[22].

Page 28: Real Time Extraction of ECG Fiducial Points Using Shape ... · Real Time Extraction of ECG Fiducial Points Using Shape Based Detection This thesis is presented to the School of Computer

6 CHAPTER 1. INTRODUCTION

Similarly, an elevated voltage in the ST segment is commonly associated with acute

transmural myocardial ischemia (loss of blood supply to the cardiac muscles)[46].

Other studies have used the relative positions and magnitudes of the segmented

components in stochastic learning tools to perform beat classification[20]. Con-

temporary research, thus frequently requires detection not only of the peaks, but

also an accurate location of the onset and offset of each “complex”, and the points

delimiting them. These are generally known as the “fiducial” points. There is no

consensus as to which points are the most useful in ECG analysis, but many studies

have been concerned with the peaks of P, Q, R, S and T as well as the onset and

offset of P and T[45, 34, 70].

1.4 Multiple channel electrocardiograph

The heart is a 3 dimensional organ and a single channel does not contain sufficient

information to fully represent its electrophysiology. In modern clinical use, the elec-

trocardiograph provides 12 channels (called leads). This is achieved by connecting a

total of 10 electrodes to the patient: one to each limb, and six to the chest, as shown

in figure 1.3. The electrode connected to the right leg is used as a signal ground

only. The six chest electrodes, labelled {V1, V2 . . . V6}, have a standard anatomical

placement (see chapter 20 of [38]). V1 is placed just to the right of the sternum

in the fourth intercostal space. Each successive V electrode is placed in successive

positions towards the left of and slightly inferior to the previous electrode, with

V6 located on the midaxillary line level within the sixth intercostal space. The

monitoring instrument displays the 12 leads by use of differential amplifiers be-

tween the indicated electrodes. The I, II and III leads are commonly referred to

as Einthoven’s leads, whilst the aVR, aVL and aVF as Wilson’s leads after their

respective inventors[6].

Whilst the 12-lead ECG is the classical form of the electrocardiograph, the practical-

ities of preparing one, especially in emergency situations, often dictate a simplified

Page 29: Real Time Extraction of ECG Fiducial Points Using Shape ... · Real Time Extraction of ECG Fiducial Points Using Shape Based Detection This thesis is presented to the School of Computer

1.4. MULTIPLE CHANNEL ELECTROCARDIOGRAPH 7

aVR�

aVL6

aVF].

............................................

.............................................

..............................................

...............................................

...............................................

......

......

......

......

........................

......

......

......

......

......

......

......

......

.

......

......

......

......

......

......

......

......

..

......

......

......

......

......

......

......

......

..

......

......

......

......

......

......

......

......

...

......

......

......

......

......

......

......

......

.....

......

......

......

......

......

......

......

......

......

..

......

......

......

......

......

......

......

......

......

....

......

......

......

......

......

......

......

......

......

......

.

......

......

......

......

......

......

......

......

......

......

....

(a) Wilson’s leads

}

-II

-I

� III

{V1 . . . V6}6

(b) Einthoven’s leads

Figure 1.3: Configuration of the 12 lead electrocardiograph. These diagrams showan anterior view of the patient. The right leg is normally connected to signal ground(not indicated here).

Page 30: Real Time Extraction of ECG Fiducial Points Using Shape ... · Real Time Extraction of ECG Fiducial Points Using Shape Based Detection This thesis is presented to the School of Computer

8 CHAPTER 1. INTRODUCTION

form. Thus, in ECGs recorded from clinical situations, it is common to find only

one or two channels of information. Conversely, in a laboratory environment, ECGs

using up to 64 electrodes are used where a detailed map of body surface potentials

is needed[81].

Features which occur in one channel may be attenuated or absent in another. For

this reason, it is sometimes desirable to combine the available channels. One method

of doing this is the so called “complex lead”. The complex lead formula is cited by

Christov[15] as

f(xi) =1

L

L∑

j=1

|fj(xi+1)− fj(xi−1)| (1.1)

where:

L = Number of leads available,

fj(xi) = The ith sample from lead j.

Since the complex lead is a union of the features from each of its components, it

gives a marked increase in the sensitivity. However, features which occur in more

than one channel, typically appear with a small but significant phase delay. Also

high frequency noise is amplified since (1.1) implements a derivative. Subsequent

application of a low pass filter is required in order to alleviate these effects.

1.5 Noise in the ECG

Like any physical signal, ECGs suffer from various forms of noise. Noise can arise

from

• Power line interference and other electrical environmental noise. A carefully

prepared ECG can significantly reduce the magnitude of this kind of noise.

However ECGs recorded during emergency situations may not have the benefit

of such careful preparation. Fortunately, this type of noise is generally of a

Page 31: Real Time Extraction of ECG Fiducial Points Using Shape ... · Real Time Extraction of ECG Fiducial Points Using Shape Based Detection This thesis is presented to the School of Computer

1.5. NOISE IN THE ECG 9

higher frequency (≥ 50Hz) than the components normally of interest in ECG

analysis.

• Electrode movement. As the patient’s body moves, electrodes can lift away

from contact with the skin. This type of noise manifests itself as near or

complete saturation lasting for up to one second. In some applications where

a multi-channel ECG is used alternative channels maybe used during periods

where this noise is present.

• Respiration noise. This is caused by the patient’s normal respiratory function

giving rise to electrical activity in the intercostal muscles. It manifests itself

as low frequency “baseline shift” with a frequency of less than 0.4 Hz.

• Muscle noise. The ECG from any conscious patient will exhibit noise due to

muscle contractions. These can be particularly troublesome for ECG analysis

since their spectrum and waveform can closely match that of the wanted

signal.

The various noise sources produce a spectrum distribution which is of the form 1/fβ,

where β is constant. When β = 0, the power distribution is uniform, and this is

called “white noise” and arises from external sources or from within the measuring

equipment. In modern equipment this kind of noise is not of sufficient magnitude

to be troublesome. Noise for which β = 1, called “pink noise”, is most typical of

the ambient background generated within the patient as it naturally occurs in all

stable biological systems[73]. Electrode movement results in “brown noise” (β = 2),

which is very much richer in low frequency components.

Because of the various sources and forms of noise, when measuring and reporting

the performance of ECG analysis techniques it is desirable to use test data across

a wide range of signal to noise levels and across all common noise “colours”. Mea-

surement of noise in a recorded ECG can be difficult. Techniques for doing so

involve estimation of the wanted signal using principle components analysis, and

Page 32: Real Time Extraction of ECG Fiducial Points Using Shape ... · Real Time Extraction of ECG Fiducial Points Using Shape Based Detection This thesis is presented to the School of Computer

10 CHAPTER 1. INTRODUCTION

subtraction from the recorded sample[17]. For this reason, testing using syntheti-

cally generated ECG signals, with noise added post hoc is a common alternative to

testing using recorded signals.

There are several approaches to dealing with the problem of noise. One approach is

to filter the signal. This is feasible where the noise is outside of the frequency range

of the wanted signal, or confined to a narrow, well defined band (such as in the case

of power line interference). Filtering however introduces a phase delay, especially

for low pass filters, which may be unacceptable in certain applications.

1.6 Real time aspects

In many situations analysis of the ECG needs to be performed online, and in “real

time”; ie. within a finite predetermined time frame. For example, the automatic

cardioverter-defibrillator needs to quickly identify a fibrillating rhythm, and identify

the correct instant to deliver a therapeutic shock. Clearly, in these applications,

the online nature puts limits on the extent to which pre-processing can be done.

Filters, for example, have a finite phase delay — the output of the filter lags the

input by a certain time. It can be seen then, that the correct performance of a

ECG analysis algorithm depends not only on the quality of the output it produces,

but also on the time taken to produce that output. Minimising the amount of pre-

processing required, is therefore a major consideration when designing a system for

online analysis.

1.7 Contribution of this thesis

A review of common fiducial point detection techniques found in the literature to

date is presented in chapter 2. In subsequent chapters of this thesis, chapter 3

provides a critical examination the current metrics used to report the performance

of beat detection and classification algorithms. Some problems with these metrics

Page 33: Real Time Extraction of ECG Fiducial Points Using Shape ... · Real Time Extraction of ECG Fiducial Points Using Shape Based Detection This thesis is presented to the School of Computer

1.7. CONTRIBUTION OF THIS THESIS 11

are discussed and some alternative metrics proposed. Chapter 4 introduces a novel

algorithm for the detection of QRS complexes, with an emphasis on real time be-

haviour. Despite not having been used previously for ECG analysis, the method’s

precision is comparable to others from the literature. Furthermore, there is a known

upper bound on the running time. An extension to the method is presented in chap-

ter 5, where a combination of a morphological approach with a traditional linear

signal processing technique is used to detect the P and T waves; a problem which

is difficult due to the low amplitude of these waves. Finally in chapter 6, a concise

summary of previous chapters is given and a discussion of possible research which

might follow from the findings.

Page 34: Real Time Extraction of ECG Fiducial Points Using Shape ... · Real Time Extraction of ECG Fiducial Points Using Shape Based Detection This thesis is presented to the School of Computer

12 CHAPTER 1. INTRODUCTION

Page 35: Real Time Extraction of ECG Fiducial Points Using Shape ... · Real Time Extraction of ECG Fiducial Points Using Shape Based Detection This thesis is presented to the School of Computer

Chapter 2

Literature Review

With the advent of cheap computer technology, the limits on the complexity

of ECG analysis algorithms have been greatly lifted, and this has resulted

in a surge of interest in the subject. A comprehensive review of the techniques used

in fiducial point detection may be found in [40]. Whilst this review concentrates

on QRS detection, the general techniques are also applicable to detection of the

other fiducial points. However since the QRS complex is the most prominent fea-

ture in the ECG, extracting the less prominent ones often involves thresholding or

other classification techniques as a post processing stage[32]. The QRS is often of

primary interest, since it corresponds to ventricular activity. Sustained abnormal

ventricular beats are often fatal. P waves are of interest, not only for the purpose

of segmentation, but because they represent atrial activity, so patterns in P wave

amplitude and timing can be a useful predictor of atrial fibrillation[68, 22]. P wave

detection is a difficult problem, because the magnitude is often low, and the spec-

trum and morphology can be similar to other features. In early studies, the only

reliable means of detecting P waves used invasive sensors, such as the “oesophageal

pill electrode” swallowed by the patient[35] or electrodes surgically implanted inside

the body[74]. Typical P wave detectors first detect the QRS complex, then use a

backward searching technique over a localised area to find a maxima which is as-

sumed to be the P wave[27], or by ventricular cancellation where the QRS complex

13

Page 36: Real Time Extraction of ECG Fiducial Points Using Shape ... · Real Time Extraction of ECG Fiducial Points Using Shape Based Detection This thesis is presented to the School of Computer

14 CHAPTER 2. LITERATURE REVIEW

is first isolated and then subtracted from the input signal[80]. The problem with

these approaches, is that they both depend upon reliable QRS detection. Cascading

two detection algorithms, means that the precision of the union is the product of

the precision of the individual stages. A largely unsolved problem in ECG analysis

is the detection of secondary features (those other than the QRS), without having

first determined the QRS location.

For an ECG signal f(t) (in the case of multi-channel ECG, f is a vector function),

detection and classification of fiducial points is generally achieved by a pipeline

system comprising three consecutive stages:

Filtering to remove noise: Noise in the ECG is described in section 1.5. The

output from this stage is a function in the time domain, but not necessarily

the same number of dimensions as the input.

A non-linear transform: This enhances the desired features, whilst attenuating

those parts of the signal which are not of interest. The transform’s output

need not be a function of t.

A decision rule: In the case of a detector, the decision rule has a binary output

(“feature” or “no feature”). For a classifier, many output states are possible.

In some algorithms, one or more stages may be trivial, relying upon the complexity

of other stages to achieve performance. Others may have additional intermediate

stages. In the literature, some algorithms are presented such that the distinction

between the stages is unclear. For example, authors may describe their non-linear

transform as a “filter”[13, 55]. In the context of this chapter however filtering refers

to the process of removing unwanted parts of the signal, which would otherwise

interfere with subsequent processes, whereas the non-linear transform’s purpose is

to convert the signal into a form suitable for discrimination by the decision rule.

Page 37: Real Time Extraction of ECG Fiducial Points Using Shape ... · Real Time Extraction of ECG Fiducial Points Using Shape Based Detection This thesis is presented to the School of Computer

2.1. FILTERING 15

2.1 Filtering

Most algorithms for fiducial point extraction use filtering as a pre-processing stage,

to remove unwanted components. Some algorithms use differentiation in their non-

linear transform stage, which re-introduces high frequency noise, in which case it

is necessary to postpone filtering or to add a second filter stage to be performed

after the transform. Filters are optimised to a particular noise characteristic. The

most common sources of noise have been described in section 1.5, and the following

sections discuss common filter technologies used to address them.

2.1.1 Linear filters

The traditional “moving average” filter can be used to remove frequency components

within certain ranges. It can be implemented by convolving a filter mask with the

signal. For a signal f(t) and a mask g(t), the convolution operation is defined as

(f ∗ g)(t) ,∫ ∞

−∞

f(x)g(t− x) dx. (2.1)

However since this is an integral over infinite bounds, it cannot, in the general case,

be implemented in practical applications. Instead, it is necessary to choose g(t)

such that

lim|t|→∞

g(t) = 0. (2.2)

Then one may choose a value of t, κ such that

g(t) ≈ 0 where |t| > κ. (2.3)

Now it is necessary to integrate only between t− κ and t+ κ:

(f ∗ g)(t) =

∫ t+κ

t−κ

f(x)g(t− x) dx. (2.4)

In real-time ECG applications, such as cardioverter-defibrillators, it is desirable to

keep κ as small as possible, since it represents a delay between the time when a

Page 38: Real Time Extraction of ECG Fiducial Points Using Shape ... · Real Time Extraction of ECG Fiducial Points Using Shape Based Detection This thesis is presented to the School of Computer

16 CHAPTER 2. LITERATURE REVIEW

feature occurs, and the earliest time it can be detected. However, effective filter

masks with small values of κ are difficult to design (especially for high pass filters),

and is a specialist topic[78].

An alternative implementation is to perform a fast fourier transform on the signal,

multiply the transformed signal with the fourier transform of the mask, and then

perform the inverse fourier transform on the signal. This avoids the expense of

convolution, but requires a forward and inverse fourier transform operations, which

are themselves expensive. It also cannot be performed in real time since the fourier

transform must be performed on the signal over the whole time domain. A detailed

discussion of various types of linear filter used in ECG analysis may be found in

chapter 5 of [19].

The gaussian filter

A commonly used mask is the gaussian function:

g(t) =1√2πσ

e−t2

2σ2 (2.5)

which has the familiar “bell” shape and produces a smooth result, and satisfies

condition (2.2). The problem that the algorithm designer faces, is that of choosing

the most appropriate value of σ. If σ is too large, then not only are wanted features

inadvertently filtered out, but the approximation of (2.3) becomes invalid, and

artifacts in the signal result, triggering false positives in the detection stages. If σ

is too small then the unwanted features will not be sufficiently attenuated.

Typically gaussian filters are used to remove the high frequency noise components

and/or the very low frequency components such as those caused by the patient’s

respiration.

Wiener filtering

If the characteristics of the noise are known, then it is possible to design a mask

optimised to that type of noise. The result is known as the wiener filter[60] and is a

Page 39: Real Time Extraction of ECG Fiducial Points Using Shape ... · Real Time Extraction of ECG Fiducial Points Using Shape Based Detection This thesis is presented to the School of Computer

2.1. FILTERING 17

popular filter in telemetry and image processing. Several studies have used wiener

filters, with varying degrees of success[54, 44]. The drawback of the wiener filter is

that it must be optimised to a particular type of noise. A model of the noise has

to be prepared when designing the filter. In different situations, the nature of the

noise can change, rendering the noise model invalid.

2.1.2 Non-linear filters

For practical reasons, modern signal processing methods involve digitising the signal

into discrete samples. In the discrete world, equations such as (2.4) become:

(f ∗ g)(t) =

t+κ∑

x=t−κ

f(x)g(t− x), (2.6)

which may be equivalently represented in vector notation

(f ∗ g)(t) = g · [f(t− κ), f(t− κ+ 1) . . . f(t+ κ)]T , (2.7)

where g is a 2κ+1 column vector containing the discrete sampled values of g(t) and

T indicates the transpose. As σ → ∞, g → [1/(2κ + 1), 1/(2κ+ 1) · · · 1/(2κ+ 1)].

In other words, the filtered signal is the mean average of the signal values in the

region of the mask.

An alternative type of filter, uses the median average instead of the mean. Such a

filter is an example of a non-linear filter. General non-linear filters are based upon

order statistics instead of arithmetic statistics. Uses of non-linear filters in ECG

analysis are discussed in chapter 6 of [19]. In the literature, specially optimised

filters and filters employing alternative techniques can be found[59].

Page 40: Real Time Extraction of ECG Fiducial Points Using Shape ... · Real Time Extraction of ECG Fiducial Points Using Shape Based Detection This thesis is presented to the School of Computer

18 CHAPTER 2. LITERATURE REVIEW

2.2 Non-linear transforms

A non-linear transform is vital to the fiducial point extraction process. A useful

transform will accentuate the desired features and attenuate those features which

are not of interest. It follows then that the most effective transforms will be opti-

mised to a particular set of fiducial points and to a particular set of input data. In

the Pan-Tompkins detector (see section 2.3.1) the transform used is f(t) 7→ f(t)2,

which has the effect of making regions of high amplitude higher. More complex

transforms may not be representable by simple algebra.

2.2.1 Morphological transforms

Morphological transforms are commonly used in image processing, in order to iden-

tify the peaks and valleys in a signal. The two basic morphological operations are

Minkowski addition ⊕, and Minkowski subtraction ⊖, defined as:

A⊕B =⋃

β∈B

(A + β) (2.8)

A⊖B =⋂

β∈B

(A + β) (2.9)

A common use of morphological operations is found in the field of digital image

processing, where A is the set of pixels comprising an image component and B is an

arbitrary “structuring element”. In signal processing, such as ECG analysis, A is

the signal of interest, and B the structuring element. For ease of use, it’s common

to define the terms “dilation”:

D(A,B) = A⊕ B (2.10)

and “erosion”

E(A,B) = A⊖−B. (2.11)

From these, we further define “opening”

Page 41: Real Time Extraction of ECG Fiducial Points Using Shape ... · Real Time Extraction of ECG Fiducial Points Using Shape Based Detection This thesis is presented to the School of Computer

2.2. NON-LINEAR TRANSFORMS 19

A ◦B = D(E(A,B), B) (2.12)

and “closure”

A •B = E(D(A,−B),−B). (2.13)

The application of morphological operators for QRS detection was first proposed

by Trahanias[76], who suggested the transforms:

PE(f) = f − (f ◦B) (2.14)

and

V E(f) = f − (f •B) (2.15)

to extract peaks and valleys respectively.

When applied to a real, single dimensional signal, such as an ECG, B is a function

b(t) =

1 |t| < K

0 otherwise

where K is constant. One of the problems of the morphological approach is deter-

mining the optimal value of K. If too small, the transform will be sensitive to high

frequency noise, and will erroneously emphasise spikes of short duration. However

K must be less than the width of the components one wishes to detect. Studies

have reported successful results using values between 55–60ms[70].

2.2.2 The wavelet transform

In recent years there has been much research into ECG analysis using wavelet

transforms. Like the fourier transform, the wavelet transform produces an output

indicating the amplitude of the signal in the frequency domain. However, the fourier

transform cannot explicitly indicate which temporal range(s) of the signal contain

which frequency components. One way to address this shortcoming is the windowed

fourier transform, where the signal is first divided into windows of equal duration,

Page 42: Real Time Extraction of ECG Fiducial Points Using Shape ... · Real Time Extraction of ECG Fiducial Points Using Shape Based Detection This thesis is presented to the School of Computer

20 CHAPTER 2. LITERATURE REVIEW

and the fourier transform applied to each. There are two issues with this approach.

The first problem is that of deciding the optimal size of the window. If the window is

too large, then no temporal information will be obtained (in the limit it degenerates

to the non-windowed fourier transform). Conversely, the window must be larger

than the period of the components one desires to identify. The second issue is that

of artifacts at the window boundaries. The wavelet transform aspires to overcome

these problems.

Formally, the wavelet transform is defined as

w(s, τ) =

∫ ∞

−∞

f(t) ∗ ψ∗s,τ(t) dt (2.16)

where the basis functions ψs,τ are obtained by scaling and translation of a single

function ψ, called the mother wavelet:

ψs,τ (t) =1√sψ

(t− τs

)

. (2.17)

The mother wavelet may be chosen from any function which satisfies a number of

conditions. Details of these conditions and a general description of wavelet trans-

forms may be found in [77] and in many text books.

The convolution operator in (2.16) means that the simple application of a wavelet

transform is an expensive operation. Fortunately however there is a special case

of the wavelet transform called the discrete wavelet transform (DWT), somewhat

analogous to the fast fourier transform, which when applied to a discrete signal

with n samples, operates in time O(n).

The DWT imposes a condition on (2.17) such that s = 2j and τ = k, where j and

k are non-negative integers:

ψj,k(t) =1√2jψ

(t− k2j

2j

)

[j ∈ N, k ∈ N]. (2.18)

In the literature, j is often called the ‘level’ of the wavelet. For a signal with n

samples, meaningful values of j are in the range [0, log2 n] and k has the range

Page 43: Real Time Extraction of ECG Fiducial Points Using Shape ... · Real Time Extraction of ECG Fiducial Points Using Shape Based Detection This thesis is presented to the School of Computer

2.2. NON-LINEAR TRANSFORMS 21

[0, 2j−1]. At j = 0, the wavelet transform gives no temporal information, but a high

resolution of frequency information. Conversely at j = log2 n, temporal resolution

is high, but frequency resolution is low. The complete DWT is the combination of

ψj,k(t) for all valid values of j and k.

Wavelet transforms are an attractive tool for ECG fiducial point detection since they

allow frequency components in a time series to be identified. Successful fiducial

point detection systems based on wavelet transforms have been done offline [45]

or online using purpose built hardware[63]. Software algorithms tend to use the

discrete wavelet transform[36, 50] because it operates in linear time. The questions

raised when designing a wavelet based detection system include the choice of mother

wavelet, and what level of wavelet coefficients are to be regarded as containing useful

information.

2.2.3 Kupeev’s algorithm

This thesis draws upon the work of Kupeev[42] who presents a general algorithm for

the detection of maxima in a single dimensional signal. It uses a discrete approach,

and does not rely upon filtering, nor on any direct thresholding techniques. The

algorithm provides absolute reliable detection of maxima in an arbitrary signal. The

algorithm was not presented with a view to ECG analysis, but rather, applications

in image processing were envisaged.

Kupeev describes two variants of his algorithm, one for detecting a predefined num-

ber of maxima in a signal, and another for detecting all the maxima which exceed

a given level of “significance”. The “significance” of a maximum is a scalar value

normalised to the range (0, 1). The unnormalised significance is called the “weight”.

Kupeev does not prescribe the definition of “weight”, but suggests the area and the

height of the peaks as candidates. In this context, a ‘peak’ of a signal is an interval

[t1, t2] on the function domain t, (see figure 2.4a) which satisfies the properties:

1. f(t1) = f(t2), and

Page 44: Real Time Extraction of ECG Fiducial Points Using Shape ... · Real Time Extraction of ECG Fiducial Points Using Shape Based Detection This thesis is presented to the School of Computer

22 CHAPTER 2. LITERATURE REVIEW

2. At either t = t1 or t = t2, f(t) satisfies the conditions:

(a) f ′(t) = 0, and

(b) f ′′(t) > 0.

The algorithm creates a binary tree, where each node represents a peak in the

signal. It is a property of this tree, that all nodes have as their parent, a node

representing the peak formed by the union of its children. Figure 2.4 illustrates the

process. Next, the algorithm iterates the leaves of the tree, and removes the peaks

of smallest weight, placing them onto a stack. The process continues until all nodes

have been removed from the tree. The result is a stack of leaf nodes sorted by

weight. In a noisy signal many of the nodes will be of very low weight, and can be

easily discarded by setting a suitable threshold. Performing this process efficiently

is non-trivial. However if implemented optimally, the complexity of the algorithm

is O(n logn) where n is the number of samples.

2.3 The decision rule

The decision rule is a classification algorithm. It takes each time sample and makes

a decision which feature, if any, occurs at that instant, based on the output of the

non-linear transform. In the case of a simple detector, the classifier is a binary

classifier, and the possible classes are (“feature” and “no feature”). More general

classifiers will have a number of different feature types.

2.3.1 Adaptive thresholding

Thresholding is the most trivial decision rule. This rule states that if the output

from the non-linear transformation exceeds a certain value, then a feature exists,

otherwise no feature exists. In its unmodified form, thresholding is vulnerable to

noise; both low frequency noise (baseline shift) and high frequency interference. For

Page 45: Real Time Extraction of ECG Fiducial Points Using Shape ... · Real Time Extraction of ECG Fiducial Points Using Shape Based Detection This thesis is presented to the School of Computer

2.3. THE DECISION RULE 23

a

b

c

d

e

f

g

t1 t2

(a) Initially, the tree contains one nodefor each peak in the signal. Peak ‘a’ isdefined on the range [t1, t2]. Other peaksare defined similarly.

b

c

d

e

f

g

(b) The leaf node with the smallest weightis excised from the tree.

b

c

d

e

f

(c) The leaf node with the smallest weightis excised from the tree. Excising nodesmay uncover new parent nodes which be-come new leaves.

d

e

f

(d) The final peak represents the most sig-nificant peak in the signal.

Figure 2.4: An example of peak detection by Kupeev’s algorithm. Excised nodesare placed into an external stack which will contain peaks sorted by weight.

Page 46: Real Time Extraction of ECG Fiducial Points Using Shape ... · Real Time Extraction of ECG Fiducial Points Using Shape Based Detection This thesis is presented to the School of Computer

24 CHAPTER 2. LITERATURE REVIEW

this reason, practical implementations use an adaptive heuristic where the value of

the threshold varies according to data gathered over a predetermined time window

immediately preceding the input time.

Pan-Tompkins detector

A widely cited algorithm by Pan and Tompkins[56] uses a square function as its

non-linear transform an adaptive dual threshold as the decision rule. This is one of

the earliest reliable software based detectors, from which much subsequent work is

derived. The algorithm has the following successive steps:

1. Filtering, for noise removal.

2. Differentiation, to select regions of high slope,

3. Squaring, which enhances the detected slope and discards its sign

4. Integration over a moving window of 150ms duration. This helps to select

features which have both large slope and width, reducing false detections

caused by spikes.

5. An adaptive dual threshold is applied both to the output of steps 1 and 4. A

QRS complex is considered to be present, if and only if the signal exceeds the

upper threshold in both cases. If a QRS is not detected withing 1.66 times

the running average of the RR period, then the thresholding stage is applied

again, but using the lower of the two thresholds.

The Pan-Tompkins detector suffers a number of problems:

• The algorithm tends to misidentify T waves as QRS complexes. So it’s neces-

sary to compare the slope of the detected feature with that of the previously

detected QRS complex. If the slope is less than one half, then it is declared

to be a T wave and discarded.

Page 47: Real Time Extraction of ECG Fiducial Points Using Shape ... · Real Time Extraction of ECG Fiducial Points Using Shape Based Detection This thesis is presented to the School of Computer

2.3. THE DECISION RULE 25

• Any QRS occurring within 200ms of the previous one is not detected. Further,

the dual thresholds are lowered, depending upon the time from the previous

detection.

• The complex nature of the algorithm involves many parameters, eg. the ratio

between upper and lower threshold, the period over which the first threshold

stage applies, the size of the moving window etc. The authors present results

based on empirical optimisations of these parameters. Whilst the results seem

impressive, it cannot be determined to what extent the parameters have been

over-optimised to suit the test data.

These problems mean that abrupt changes in rhythm or ectopic beats can be missed

or delayed. It also means that the output lags the input by 200ms.

2.3.2 Stochastic methods

One family of classifiers may be jointly called stochastic classifiers. In these types

of classifiers, a generalised underlying model of the process is assumed. However

the parameters of that model are initially unknown. Sampled output from the

system is collected over a period of time. These data are used in conjunction with

the known ideal output, obtained by some other reliable method of classification,

in order to “train” the model with the necessary parameters to perform optimal

classification. Training is normally an iterative process, which consumes significant

resources. However once trained, a classifier can perform rapid classifications. A

well trained model, will then be able to perform classifications on hitherto unseen

data.

There are two general problems with the stochastic approach:

• The training process is subject to “overfitting”; if the model is trained too

well, then it produces good results on the training set, but poor results on

other data. In the case of ECG analysis therefore it is necessary to use a very

Page 48: Real Time Extraction of ECG Fiducial Points Using Shape ... · Real Time Extraction of ECG Fiducial Points Using Shape Based Detection This thesis is presented to the School of Computer

26 CHAPTER 2. LITERATURE REVIEW

generalised training set, or to restrict the application of a the system to a

narrow class of input. For example a system trained on ECGs recorded from

healthy subjects might perform poorly when presented with an ECG from a

patient exhibiting premature ventricular beats. It is hard to be sure that a

system has not been over optimised to a particular data set.

• The parameters of the model are “non-parametric”; they do not contain values

which can be associated with any physical or mathematical quantity. This

means that, even if a model performs well, it does not contribute to un-

derstanding of the physiological process. Neither does it lend itself to easy

modification; in general adding a new record to the training set cannot be

done independently. It is necessary to completely retrain the system.

Neural networks

Neural networks are a mathematical approach to learning problems inspired by the

physiology of the brain. For a general introduction to neural networks see [8]. A

network comprising several “neurons” is used to produce an output from a given

input. Each neuron has a single output, many inputs, and a non-linear addition

operator mapping input to output. The connections between each neuron has a

“weight” parameter. The weights are initially set to random values, and progressive

training steps mutate the weights into values which produce optimal output. There

are many different possible arrangements of the neurons and many different training

schemes.

In the field of ECG fiducial point detection, neural networks have been used in

conjunction with wavelet transforms[69], regression coefficients[82] and directly on

the sampled data in the time domain[71]. One popular configuration, the “multi-

layer perceptron” uses a layer of “hidden” neurons. Choosing the optimal number

of hidden neurons, the most appropriate configuration, and the best representation

of input data is crucial to the success of neural network based systems.

Page 49: Real Time Extraction of ECG Fiducial Points Using Shape ... · Real Time Extraction of ECG Fiducial Points Using Shape Based Detection This thesis is presented to the School of Computer

2.3. THE DECISION RULE 27

Genetic algorithms

In a genetic algorithm, the decision rule is regarded as a parameterised function

of the non-linear transform’s output. The parameters are represented by a string

of binary digits, called a genotype. A population of several hundred genotypes are

created, which are initially set to random values. The genetic algorithm tests each

genotype in turn, and discards those which perform badly. Those which perform

better are selected to form the basis of the population of the next “generation”.

The new generation comprises new genotypes formed by “crossover combination”

of the better genotypes from the previous generation. After a number of genera-

tions, the population will have converged, so as to comprise genotypes which are

of optimal performance. Issues to be solved in genetic algorithms include selection

of appropriate function parameters, and the criteria upon which to halt training so

as to avoid overfitting. Successful QRS detectors have been implemented using a

genetic algorithm based system where the parameters are the amplitude thresholds

and time onset and offset of the windows within which a peak is deemed to have

occurred[58]. In the literature there does not appear to be any reports of successful

detection of other features using genetic algorithms.

Hidden markov models

Markov models consider the ECG to be generated from a probabilistic function

according to the state of an underlying state sequence. If the state sequence can

be determined, then the model can be used to predict features. An overview of

hidden markov models and their application to signal processing may be found in

[61] and similar, but more concise tutorial in [26]. The ECG may be modelled by

a markov chain where each feature (or lack thereof) corresponds to a state in the

state space[4].

Page 50: Real Time Extraction of ECG Fiducial Points Using Shape ... · Real Time Extraction of ECG Fiducial Points Using Shape Based Detection This thesis is presented to the School of Computer

28 CHAPTER 2. LITERATURE REVIEW

2.4 Summary

Algorithms from the literature can generally be described by the filter—non-linear

transform—decision rule pipeline model, and this can be a useful schema to organise

different techniques. However not all authors choose to describe their work accord-

ing to this model, so some interpretation is required on the part of the reader.

Nevertheless, for the purposes of this thesis, the pipeline model serves well as a

guide to understanding different approaches to fiducial point extraction.

Page 51: Real Time Extraction of ECG Fiducial Points Using Shape ... · Real Time Extraction of ECG Fiducial Points Using Shape Based Detection This thesis is presented to the School of Computer

Chapter 3

Assessment of Performance

To determine the efficacy of a system intended to detect or classify features in

an ECG, the system will need to be tested and its performance reported. How

to test it, what parameters to report, and which metrics should be used depends

upon what the system is supposed to do, and the perceived application. Quanti-

tative measures are preferred so as to allow comparison between systems. In the

literature various metrics based upon the number of correctly and incorrectly de-

tected or classified features are customarily used. However they are poorly defined,

which raises uncertainty when comparing systems.

3.1 Reference sources

Systems intended to detect or classify heartbeats or features in an ECG, are gen-

erally assessed by comparison with results from a nominated reference source. For

this purpose, there are several publicly available databases containing pre-recorded

ECG signals and annotations indicating the temporal position and other proper-

ties of the salient features. One well known database is the MIT-BIH Arrhythmia

Database[67]. This database has two data channels and an annotation channel

indicating the temporal position of each R peak, the class of each beat and some

29

Page 52: Real Time Extraction of ECG Fiducial Points Using Shape ... · Real Time Extraction of ECG Fiducial Points Using Shape Based Detection This thesis is presented to the School of Computer

30 CHAPTER 3. ASSESSMENT OF PERFORMANCE

auxiliary information. The QT database[2] annotates not only the R peaks, but also

the intra-beat features, for example the P wave and T wave. However, each record

in the database is annotated only for a short period, which limits its usefulness.

Comparison against annotated databases has a number of problems:

• The database may not contain a representative sample of the type of ECG data

which one desires to analyse. This is particularly true for clinical conditions

which are very rare. Conversely, since most databases comprise records taken

from hospital patients, it is unsafe to assume them to be a representative

sample of the general population.

• The annotations are created by human judgement. Typically, two or more

expert cardiologists are asked to indicate where features occur in the records,

and to classify that feature. The annotated temporal location is then deemed

to be the mean average of those indications. Investigation has shown that

disagreement between experts is common, and that the same cardiologist can

have a different interpretation of the same ECG on different occasions[64].

An alternative reference source may be found in the form of synthetically generated

signals. Such a reference has the following advantages:

• The temporal location of the features are precise and unambiguous.

• Signals satisfying particular criteria may be generated on demand.

• Noise free signals may be generated. Alternatively noise of a particular mag-

nitude, and of a particular type can be added.

• The sampling rate can be chosen to suit the application.

However, the artificial nature of such signals leads one to question how well they

model a signal found in clinical practice. Testing a system using both synthetic and

database reference sources would provide the most comprehensive evaluation of the

system, but in the literature this is rarely done.

Page 53: Real Time Extraction of ECG Fiducial Points Using Shape ... · Real Time Extraction of ECG Fiducial Points Using Shape Based Detection This thesis is presented to the School of Computer

3.2. REFERENCE MATCHING 31

3.2 Reference matching

Before any metric can be calculated, it is necessary to match each beat or feature

from the system’s output against the reference source. A number of problems arise

here:

• The system may not define its feature set or beat class according to the same

rules as the reference source. In general, some mapping from classes in the

system’s domain to the reference domain is necessary. For example, a database

may consider bundle-branch-block beats as a separate class, whereas they

would be regarded as “normal” by a system interested only in discriminating

ventricular ectopic beats.

• Differences in sampling rate, and the accuracy of both the reference source

and the system will mean that no feature will occur at precisely the same

instant. The researcher must choose a tolerance, between the reference time

and the system time, within which an annotation from the reference and a

detection from the system are deemed to refer to the same feature.

• However refined a system, it is unreasonable to expect that every feature

present in the reference source will be detected or that all features detected

will have corresponding features in the reference source, or that both sources

will contain the same number of features. Hence some algorithm for matching

features from the reference source to those from the system must be defined,

and this algorithm must be tolerant to features which may be present in one

source, but not the other.

These issues are discussed in greater length below.

Page 54: Real Time Extraction of ECG Fiducial Points Using Shape ... · Real Time Extraction of ECG Fiducial Points Using Shape Based Detection This thesis is presented to the School of Computer

32 CHAPTER 3. ASSESSMENT OF PERFORMANCE

3.2.1 Matching tolerance

The length of time that might be considered a reasonable matching tolerance de-

pends, amongst other factors, upon the type of features being matched. Clearly,

as the tolerance increases, the number of “false negatives” decreases giving a false

appearance of improved performance. The AAMI/ANSI standard EC57:1998[1]

recommends 150ms. Whilst this figure is reasonable for the detection of individual

beats in a healthy patient, it is clearly too wide for a system detecting P, Q and R

peaks, or when detecting beats during periods of fibrillation. In these circumstances,

features may be as little as±120ms apart. In the literature, many authors have pub-

lished figures for Se and Sp (see section 3.3) which are quite high. However, in many

of these papers (both those published before and after AAMI/ANSI EC57:1998) the

matching tolerance is either not mentioned or appears to be arbitrarily selected. In

at least two studies, different asymmetric tolerances are used[23, 28] with no men-

tion of why these figures were chosen. Another study[15] uses two tolerances —

beats which fall outside the lower tolerance but within the higher are regarded as

“shifted errors” and used to modify the definitions of Se and Sp in a way which

the authors justify in the paper, but is nevertheless not ubiquitous. According to

one report[83], opinion on the acceptable tolerance for QRS duration (and by im-

plication, the position of the Q and S features) vary from ±7ms to as low as ±2ms.

It should be noted however, that most reference databases are available only in

digitised format with a sampling period of between 2.7ms and 4ms. Further, in the

case of a 12-lead ECG, a propagation delay between leads will be observed, making

the precise instant of a feature’s occurrence ambiguous.

3.2.2 Matching algorithms

Having decided upon an appropriate acceptance tolerance, there are a number of

ways of matching the reference annotations to the features detected by the system.

By way of example, figure 3.5 illustrates two plausible ways of matching a short

Page 55: Real Time Extraction of ECG Fiducial Points Using Shape ... · Real Time Extraction of ECG Fiducial Points Using Shape Based Detection This thesis is presented to the School of Computer

3.2. REFERENCE MATCHING 33

r1 r2 r|R|

s1 s2 s|S|

r1 r2 r|R|

s1 s2 s|S|

time−−−−−−−−−−−−−−−−−−−−→Figure 3.5: Two different permutations for matching reference features to detectedfeatures. Reference features are annotated rn and detected features sn.

sequence of reference features to a detected sequence. Formally, the problem may

be described as follows:

Given a series of reference features

R = r1, r2, . . . ri, . . . r|R|

and a series of features as detected by the system

S = s1, s2, . . . sj, . . . s|S|,

one desires to find a series of pairs

W = w1, w2, . . . wk, . . . w|W | max(|R|, |S|) ≤ |W | < |R|+ |S|,

where each element takes the form wk = (i, j)k i, j ∈ (N ∪ X) where X indicates

a missing value. The series W matches each feature in the reference source to a

feature detected by the system. There is a constraint on W :

wk = (i, j), wk+1 = (i′, j′) i ≤ i′ ≤ i+ 1 ∀i 6= X, j ≤ j′ ≤ j + 1 ∀j 6= X

which ensures that all elements from both the reference and the system are matched,

and that no pair of matched features are straddled by another.

Dynamic time warping

There are many possible combinations for W but there is no obvious optimal choice.

Finding such a combination is a process known as “dynamic time warping”[39]. One

Page 56: Real Time Extraction of ECG Fiducial Points Using Shape ... · Real Time Extraction of ECG Fiducial Points Using Shape Based Detection This thesis is presented to the School of Computer

34 CHAPTER 3. ASSESSMENT OF PERFORMANCE

approach is to choose a combination such that the total of the differences between

a feature in the reference and its matched feature in the system is minimised. In

other words to minimisek=|W |∑

k=1

|wk,i − wk,j|. (3.1)

Another choice would be to minimise the sum of squares. These choices would find

the “best fit” of the system to the reference source, but would not be optimal in

terms of reducing the number of false positives and false negatives.

Instead, if we were to maximisek=|W |∑

k=1

xk, (3.2)

where

xk =

0 if wk,i = Xor wk,j = X

1 if |wk,i − wk,j| < θ

0 otherwise,

and θ is the chosen acceptance tolerance, then false detections will occur with

the lowest possible frequency. However, this approach is arguably inappropriate

since it deliberately optimises the test metric in order to find a figure which most

closely matches the desired result, rather than objectively reporting the results of

the system.

General solutions to the dynamic time warping problem require quadratic time

to find, although methods for obtaining faster solutions are an area of active

research[65]. The quadratic time requirement may be one reason why general dy-

namic time warping techniques are not used in the assessment of ECG feature

detection/classification systems. However, this need not be an issue, since assess-

ment can be performed offline, and need not affect the speed of the system itself.

Furthermore, a typical database record is of 30 minutes duration, which for a sys-

tem detecting R peaks corresponds to approximately 1800 features, which is well

within the capabilities of modern computer hardware. Despite this, AAMI/ANSI

EC57:1998 recommends a very simplified form of the general time warp matching

Page 57: Real Time Extraction of ECG Fiducial Points Using Shape ... · Real Time Extraction of ECG Fiducial Points Using Shape Based Detection This thesis is presented to the School of Computer

3.2. REFERENCE MATCHING 35

algorithm. The algorithm is described in verbose terms, by section 4.3.2 of the

standard, but using the notation of this chapter may be written:

1. Let i = j = k = 1.

2. If sj < ri then

if |sj − ri| < |sj+1 − ri| and |sj − ri| < θ then

wk = (i, j), increment i, increment j,

else wk = (X, j), increment j,

else

if |sj − ri| < |sj − ri+1| and |sj − ri| < θ then

wk = (i, j), increment i, increment j

else wk = (i, X), increment i.

3. Increment k

4. Goto 2

Elements of the form (i, X) indicate a feature is present in R, but a matching feature

cannot be found in S — a false negative. Elements of the form (X, j) indicate a

feature which is present in S, but a matching feature does not exist in R — a false

positive.

This matching algorithm, whilst simple, considers only those features which are

closest to each other as matching pairs, whereas the general dynamic time warping

problem permits features at opposite ends of the series to be matched. Whilst it

would be unreasonable to match a feature to a reference annotation several minutes

apart, it is plausible that more than one intermediate feature might exist in either

series between the matched pairs.

Page 58: Real Time Extraction of ECG Fiducial Points Using Shape ... · Real Time Extraction of ECG Fiducial Points Using Shape Based Detection This thesis is presented to the School of Computer

36 CHAPTER 3. ASSESSMENT OF PERFORMANCE

3.3 Reporting and visualising performance

Performance is often reported by quoting the sensitivity and specificity when match-

ing against a reference source with some acceptance tolerance. In the literature

sensitivity is defined as

Se ,TP

TP + FN(3.3)

and specificity as

Sp ,TN

TN + FP, (3.4)

where the following definitions apply

TP the number of true positives,

FN the number of false negatives,

TN the number of true negatives,

FP the number of false positives.

Both metrics are real numbers in the range (0, 1) and are often expressed as per-

centages. Sensitivity expresses the ability of a system to detect features, whereas

specificity represents the ability to reject false detections. It is trivial, but not use-

ful, to produce a system which has a sensitivity of 100% or specificity of 100%. In

a useful system, both the figures will approach 100%.

In practice, a compromise between high sensitivity and high specificity is necessary.

It is commonly found that adjusting a parameter of the system increases one figure

but reduces the other. For example, reducing a decision rule threshold would result

in a more promiscuous detector, hence a higher sensitivity but a lower specificity.

3.3.1 The receiver operating characteristic

One way of concurrently representing the specificity and sensitivity is the receiver

operating characteristic (commonly abbreviated to ROC). This is a cartesian plot

Page 59: Real Time Extraction of ECG Fiducial Points Using Shape ... · Real Time Extraction of ECG Fiducial Points Using Shape Based Detection This thesis is presented to the School of Computer

3.3. REPORTING AND VISUALISING PERFORMANCE 37

0.0 0.2 0.4 0.6 0.8 1.00.0

0.2

0.4

0.6

0.8

1.0

1 − Sp

Se

Figure 3.6: An example of several receiver operating characteristic curves plottedon the same axes.

indicating how Se varies with Sp. By convention, Se is plotted on the vertical

scale and 1 − Sp on the horizontal scale, as shown in figure 3.6. For an ideal

detector, the entire plot would be clustered in the upper left hand corner, whereas a

“detector” which randomly “guesses” features would result in diagonal line running

from bottom-left to top-right. The ROC representation is useful because several

curves can be plotted on the same axes, thus giving a good visualisation of how a

detector performs when various parameters are changed.

3.3.2 Problems with traditional definitions of sensitivity

and specificity

The receiver operating characteristic was developed in the 1950s during research

into interference in radar equipment. Today, it is commonly used in the reporting

of medical decision making, including ECG analysis. However, there are aspects of

the definition of the ROC and the metrics it represents which are misunderstood in

the literature and this leads to inappropriate use.

Page 60: Real Time Extraction of ECG Fiducial Points Using Shape ... · Real Time Extraction of ECG Fiducial Points Using Shape Based Detection This thesis is presented to the School of Computer

38 CHAPTER 3. ASSESSMENT OF PERFORMANCE

The definitive texts [57, 72] on the ROC do not mention “sensitivity” or “speci-

ficity”. Instead, the ROC is defined in terms of probabilities. Let the following

events assume the indicated definitions:

α0 the event that the system indicates a feature is present,

ω0 the event that a feature is actually present at the system’s input,

and

ω1 the event that no feature is present at the system’s input.

The ROC curve plots P (α0|ω0) on the vertical scale and P (α0|ω1) on the horizontal

scale. Now P (α0|ω0) is the probability of detecting a feature which is known to be

present and P (α0|ω1) is the probability of a “false alarm”.

For digitally sampled signals, one could write:

P (α0|ω0) = TPTP+FN

(3.5)

and

P (α0|ω1) = FPFP+TN

. (3.6)

Hence,

1− P (α0|ω1) = 1− FPFP+TN

= FP+TNFP+TN

− FPFP+TN

= FP+TN−FPFP+TN

= TNFP+TN

.

(3.7)

Equations (3.5) and (3.7) appear identical to the definitions of Se and Sp which has

prompted their adoption in the assessment of ECG analysis systems.

However most features of interest in a ECG are discrete events, for example, the

R peak, the P wave onset/offset etc. Careful examination of equations (3.5) and

(3.7) reveals that they are valid for the measurement of continuous events, but not

for discrete events occurring in a continuous medium. A “positive” (either true or

Page 61: Real Time Extraction of ECG Fiducial Points Using Shape ... · Real Time Extraction of ECG Fiducial Points Using Shape Based Detection This thesis is presented to the School of Computer

3.3. REPORTING AND VISUALISING PERFORMANCE 39

false), since it is instantaneous, does not occupy the entire duration of one sample,

whereas “negatives” have a duration equal to the sampling period. Hence addition

and division of these heterogeneous values have no meaningful result. The problem

affects Sp the greatest, and is most easily realised by way of example.

Example 1: A 30 minute ECG with a mean heart rate of 1 beat

per second will contain 1800 beats. Consider a system which correctly

detects all 1800 beats, but erroneously reports an additional 1800 beats.

Thus FN = 0, TP = 1800 and FP = 1800. If the system is sampled at

100Hz, then the total number of samples is 30× 60× 100 = 180, 000, so

TN = 180, 000− 0− 1800− 1800 = 176, 400. Hence,

Sp = 176400176400+1800

= 98.9898%.(3.8)

Example 2: If however, the same record is sampled at 500Hz, and

tested with the same system, then the total number of samples is 30×60×500 = 900, 000. Hence TN = 900, 000−0−1800−1800 = 896, 400,

and

Sp = 896400896400+1800

= 99.7995%.(3.9)

From these examples two problems are clear:

1. Despite the fact that there are just as many erroneous detections as correct

detections Sp is very close to 100%.

2. Increasing the sampling rate gives the appearance of improving performance.

Problem 1 means that specificity, as defined by equation (3.4) is of limited usefulness

when visualising the performance of a system, since in almost all systems it will be

close to 100%. Problem 2 is a particular concern since it means that a parameter

which is independent of the system affects the measure of the system’s performance.

Page 62: Real Time Extraction of ECG Fiducial Points Using Shape ... · Real Time Extraction of ECG Fiducial Points Using Shape Based Detection This thesis is presented to the School of Computer

40 CHAPTER 3. ASSESSMENT OF PERFORMANCE

The underlying problem is that features of interest are not continuous but instan-

taneous. Hence, increasing the sampling rate does not in general increase FP but

will most certainly result in an increase of TN.

3.3.3 Alternative definition of sensitivity and specificity

Despite these problems, Se and Sp have been freely used in the literature to report

the performance of ECG detection systems. One author[15] alludes to the problem

with the words:

The logic of using shifted errors [. . . ] is that thus the total number of

beats in a record retains its value. Otherwise it would change depending

on the type and number of errors and thus impede correct computation

of Se and Sp.

However, the Se and Sp metrics continue to be used, it would appear, for no other

reason than convention. What is required is a calculation of the probabilities of cor-

rect detection and of “false alarm” based on the digitised results. Here, a modified

calculation of Se and Sp is proposed. Let

Se′ ,TPθ

TPθ + FN/s(3.10)

and

Sp′ ,TN/s

TN/s+ FPθ, (3.11)

where s is the sampling rate of the digitised ECG record and θ is the acceptance

tolerance discussed in section 3.2.1. Note that the dimensions of both the numerator

and denominator in these definitions are time. By the following examples, it can

be seen that the metric is largely independent of the sampling rate and, for cases

where FN is high, has a value significantly less than 100%.

Example 3: Using the figures from the previous examples, the value

for Sp′ when sampled at 100Hz, and using an acceptance tolerance of

Page 63: Real Time Extraction of ECG Fiducial Points Using Shape ... · Real Time Extraction of ECG Fiducial Points Using Shape Based Detection This thesis is presented to the School of Computer

3.4. TIME TAKEN FOR DETECTION 41

150ms, is

Sp′ = 176400/100176400/100+1800×0.15

= 17641764+270

= 86.7256%.

(3.12)

Example 4: However, increasing the sampling rate to 500Hz does not

have significant effect on the value of Sp′.

Sp′ = 176400/500176400/500+1800×0.15

= 18001800+270

= 86.9565%.

(3.13)

Using Se′ and Sp′ instead of Se and Sp has the advantages that

• The figures more closely represent the historical definitions, and have mean-

ingful mathematical interpretations.

• They are independent of the sampling rate.

• Large numbers of false positives and/or false negatives are more easily seen.

3.4 Time taken for detection

In real time applications, a system’s performance is measured not only by the quality

of the results it produces, but also the time taken to produce those results. Hence,

for completeness, studies should report the time between a feature’s occurrence

and the feature being detected by the system. For many systems, especially those

which employ windowed techniques, this time will not be constant. In these cases,

the maximum time or parameters indicating the distribution of the detection time

should be reported.

Page 64: Real Time Extraction of ECG Fiducial Points Using Shape ... · Real Time Extraction of ECG Fiducial Points Using Shape Based Detection This thesis is presented to the School of Computer

42 CHAPTER 3. ASSESSMENT OF PERFORMANCE

3.5 Measurement of precision

Whilst many applications are not overly concerned with the difference between the

detected time and the event time, it can be important for cardioversion and other

therapeutic purposes. Biomedical engineers working in such areas will therefore

be interested in the mean and standard deviation of the differences. However, in

the literature, very few studies report both the mean and standard deviation of

the differences. A system with systematic error will have a non-zero mean, and

applications can subtract this value to improve results. Knowing the standard

deviation will allow estimates, using the central limit theorem, of the proportion of

detections falling outside any particular tolerance to be made.

3.6 Assessing feature classifiers

So far, this chapter has discussed only the assessment of systems designed to de-

tect features, and not those designed to classify them. A feature classifier can be

considered as the generalised case of a detector. Whereas a detector makes only

two possible decisions, α0 or α1, a classifier’s decision has a number of possibilities

{α1, α2 . . . αn}, where one possible decision (say αn) is “no feature”. A classifier

might be designed to decide the waveform of a feature (ie. P, Q, R, S or T) or

to classify beats according to their clinical diagnosis — normal beat, premature

ventricular beat, supra-ventricular beat, bundle branch block beat etc.

The literature to date, compares techniques on a low level, parameter-by-parameter

basis[14, 21, 16]. These comparisons are of interest to those working on the devel-

opment of new algorithms or the enhancement of existing ones, but are of little

interest to a clinician when making a decision about which algorithm suits a par-

ticular purpose.

Page 65: Real Time Extraction of ECG Fiducial Points Using Shape ... · Real Time Extraction of ECG Fiducial Points Using Shape Based Detection This thesis is presented to the School of Computer

3.6. ASSESSING FEATURE CLASSIFIERS 43

3.6.1 Problems with current classification methods

Performance is reported either by a table giving counts of correctly and incorrectly

classified beats, or by way of statistics inferred from such a table. Recognising

that classification is the generalised case of detection, researchers have attempted

to generalise the traditional definitions of Se and Sp. However these values are

defined only for binary classification, and do not readily lend themselves to problems

involving more than two classes. Nevertheless, in the literature, one often sees beat

classifier performance reports where sensitivity and specificity are freely quoted.

Whilst the definitions of these measures for the context are normally not given,

they appear to use the following extended definitions:

TPj the number of instances where the system decides αj and the

feature belongs to class ωj,

FPj the number of instances where the system decides αj and the

feature belongs to a class other than ωj ,

TNj the number of instances where the system makes a decision other

than αj and the feature belongs to a class other than ωj,

FNj the number of instances where the system makes a decision other

than αj and the feature belongs to class ωj.

Hence Sej and Spj for each value of j can be defined accordingly.

In addition to the concerns of section 3.3.2, further problems become apparent when

using such statistics to evaluate the performance of a classifier:

1. They do not take into account the a priori probabilities of the features.

2. They do not take into account the relative costs of false classification.

Page 66: Real Time Extraction of ECG Fiducial Points Using Shape ... · Real Time Extraction of ECG Fiducial Points Using Shape Based Detection This thesis is presented to the School of Computer

44 CHAPTER 3. ASSESSMENT OF PERFORMANCE

3. They can be presented only as a multi-dimensional value, even where only

two classes are being considered. There is no obvious single ordinal value.

Problem 1 has been recognised in the medical literature[3]. Problems 2 and 3 how-

ever are rarely mentioned, possibly because the metrics are devised by biomedical

engineers and not clinicians. Problem 3 makes reports particularly unhelpful from

the point of view of the clinician trying to compare systems with a view to adopt-

ing one for use. For an n class classifier, there are 2n scalar quantities, so ranking

classifiers using these quantities is not possible.

In the following section a new method is proposed, which overcomes these problems

and aims to be generally useful for the quantitative comparison of beat classification

systems.

3.6.2 Proposed methodology

A system’s utility as a prognostic medical tool is a measure of the benefit afforded

by selecting it against other alternatives. Choosing a system involves maximising

the benefit, or alternatively, minimising the risk. A measure for the overall risk

associated with making a decision based upon the output of a classifier is a useful

measure of its performance. Risk is characterised by the probability of error and

the costs associated with making a decision based upon the erroneous classification.

This proposal uses Bayesian decision theory to determine a method of calculating

the associated risk.

Review of Bayesian risk

Bayesian decision theory is presented in many texts on statistics and classification

theory [66, 25, 72] and will be introduced here only briefly. In a system which is

claimed to recognise n different classes of beats {ω1, ω2 . . . ωn}, there are n possible

Page 67: Real Time Extraction of ECG Fiducial Points Using Shape ... · Real Time Extraction of ECG Fiducial Points Using Shape Based Detection This thesis is presented to the School of Computer

3.6. ASSESSING FEATURE CLASSIFIERS 45

outputs, {α1, α2 . . . αn}. Bayes rule states:

P (ωj|αk) =P (αk|ωj)P (ωj)

P (αk). (3.14)

Since {α1, α2 . . . αn} are mutually exclusive and P (⋃n

i=1 αi) = 1 then

P (αk) =

n∑

i=1

P (αk|ωi)P (ωi). (3.15)

The quantity P (ωj) is called the a priori probability, P (αk|ωj) the likelihood or class

conditional probability and P (ωj|αk) the a posteriori probability. From (3.14) and

(3.15) one can write:

P (ωj|αk) =P (αk|ωj)P (ωj)n∑

i=1

P (αk|ωi)P (ωi)

. (3.16)

Let λ(αk|ωj) be the cost incurred for making decision αk when ωj is the true class.

Therefore, the risk of making decision αk based upon the classifier’s output (the

risk of reliance) is:

R(αk) =n∑

j=1

λ(αk|ωj)P (ωj|αk). (3.17)

Combining the above gives

R(αk) =

n∑

j=1

λ(αk|ωj)P (αk|ωj)P (ωj)

n∑

i=1

P (αk|ωi)P (ωi)

. (3.18)

The overall risk of relying on a classifier is

R =

n∑

k=1

R(αk)P (αk), (3.19)

or equivalently

R =n∑

k=1

n∑

j=1

λ(αk|ωj)P (αk|ωj)P (ωj). (3.20)

Page 68: Real Time Extraction of ECG Fiducial Points Using Shape ... · Real Time Extraction of ECG Fiducial Points Using Shape Based Detection This thesis is presented to the School of Computer

46 CHAPTER 3. ASSESSMENT OF PERFORMANCE

A proposed new measure of classifier utility

In this proposal {R(α1), R(α2) . . . R(αn)} is used in the consideration of a classifier’s

utility, and R is used for overall rating. R has the range (0,∞) and its units are

the same as those chosen for λ(αk|ωj). In many circumstances a unitless measure,

having the range (0, 1) will be more useful. Accordingly, a normalised metric

R =RRmax

, (3.21)

where Rmax is the value obtained from equation (3.18) when the class conditional

probabilities are set to

P (αk|ωj) =

1 if λ(αk|ωj) = maxi λ(αi|ωj)

0 otherwise(3.22)

is suggested. Thus, a perfect classifier has a R value of zero and, at the opposite

extreme, unity.

Equation (3.18) comprises the terms P (αk|ωi), P (ωj) and λ(αk|ωj). P (αk|ωi) are

parameters of the classifier and can be tested experimentally. P (ωj) and λ(αk|ωj)

are parameters of the classes of interest. They are respectively the a priori proba-

bilities and the costs of making decisions.

3.6.3 Worked example

AAMI/ANSI EC57:1998 section 4.3 identifies 5 classes of beats which are recom-

mended in performance reports, viz: normal beats, supra-ventricular ectopic beats,

ventricular ectopic beats, fusions of normal and ventricular ectopic beats and other

unclassified beats. This section shows how a value for R can be calculated, using

secondary sources and published figures from each of the systems.

Calculation of a priori probabilities

Table 3.1 shows the a priori probabilities. These were calculated using the beat

counts from the MIT-BIH Arrhythmia database. The records chosen were the

Page 69: Real Time Extraction of ECG Fiducial Points Using Shape ... · Real Time Extraction of ECG Fiducial Points Using Shape Based Detection This thesis is presented to the School of Computer

3.6. ASSESSING FEATURE CLASSIFIERS 47

j ωj cj P (ωj)0 Not a Beat 577 .1 (n) Normal Beat 46097 0.96702 (sveb) Supra Ventricular Ectopic Beat 192 0.00403 (veb) Ventricular Ectopic Beat 1345 0.28004 (f) Fusion of Normal and VEB 13 0.00025 (q) Unclassified Beat 0 0.00

Table 3.1: A priori probabilities derived from the MIT-BIH Arrhythmia database.

first group of records (numbers 100–124) from the database. The second group

(numbers 200–234) were disregarded since they are not randomly selected data

but were deliberately selected by the authors of the database to contain “rare but

clinically important phenomena”. The first group, however was randomly selected

so as to “serve as a representative sample of the variety of waveforms and artifact

that an arrhythmia detector might encounter in routine clinical use”.

Class 0 was disregarded, since these annotations are not beats, but are used to mark

other interesting features in the signal. cj are the counts of beats of class ωj. P (ωj)

was calculated by dividing cj by∑5

1 cj, Note that c5 = 0 and we therefore conclude

that beat classes other than 1–4 are sufficiently rare to have negligible effect on the

utility of a system.

Calculation of costs

Cost is a subjective concept, and will depend upon the objectives of the researcher.

Table A.9 shows a set of costs of making an incorrect classification calculated on

a particular set of propositions and criteria. The derivation of this table, and the

propositions and criteria used, are given in appendix A.

Page 70: Real Time Extraction of ECG Fiducial Points Using Shape ... · Real Time Extraction of ECG Fiducial Points Using Shape Based Detection This thesis is presented to the School of Computer

48 CHAPTER 3. ASSESSMENT OF PERFORMANCE

Chazal et al. Melo et al.R(αn) 2.05 1.67R(αsveb) 65.46 17.91R(αveb) 0.07 0.03R(αf) 1.79 0.71

R 6.67 1.71

R 0.126 0.033

Table 3.2: Comparative performance of two classifiers

Calculation of risk

Together with the values of P (αk|ωj), tables 3.1 and A.9 enable the risk to be cal-

culated. Unfortunately, in many cases the literature presents neither the values for

P (αk|ωj), nor the table of beat-by-beat comparisons from which they could be de-

duced. A search of the literature revealed only two classifiers for which this data was

reported. These are the classifiers of de Chazal et al. [20] and of Melo et al. [53].

Melo et al. publishes separate results for aberrated and non-aberrated atrial pre-

mature beats. For the purposes of comparison, aberrated and non-aberrated atrial

premature beats are regarded as a single class (ωsveb).

From tables 3.1 and A.9, the value of Rmax was calculated as described in sec-

tion 3.6.2 as $52,817.

The results are shown in table 3.2. In these results, the overall risk R is significantly

lower for the Melo classifier, and the risks of reliance R(αi) is also lower for all i. In

other words, this classifier dominates in all respects. In general however this may

not be the case, and one classifier may have a lower risk of reliance for one decision

whilst having a higher risk of reliance for another.

Page 71: Real Time Extraction of ECG Fiducial Points Using Shape ... · Real Time Extraction of ECG Fiducial Points Using Shape Based Detection This thesis is presented to the School of Computer

3.7. CONCLUSION 49

3.6.4 Summary of classifier assessment

A system designed to classify beats into more than two classes is not a binary clas-

sifier and performance should not be reported as if it is. The utility of the classifier

cannot be fully quantified in terms of the number of correct and incorrect beats.

Instead, the number of misclassifications for each class is required. This may be

reported as a n× n matrix of beat classifications (the class conditional frequen-

cies). Together with the a priori probabilities and the costs of misclassification,

quantitative measures of a classifier’s utility can be calculated.

AAMI/ANSI EC57:1998 describes how to compile such a matrix, but makes no rec-

ommendation for its publication. This thesis recommends publication of the matrix,

either within the text of the paper or by reference to an external source. It is trivial

to calculate sensitivity and specificity from such a matrix if desired, and it allows

for more useful measures of performance as described above. Clinicians wishing to

assess a classifier need to obtain estimates for the costs of misclassification, and

calculate the overall risk of reliance.

3.7 Conclusion

Fiducial point extraction algorithms are assessed by comparing their results with

features from a nominated reference source. Features which fall within a certain

tolerance of a reference feature are considered to be matched and the others mis-

matched. There is no general consensus as to the most appropriate matching tol-

erance to use, and there are variants on the matching process. The precise details

of the matching algorithm used to assess the system is seldom mentioned in the

literature, but is nevertheless important for repeatability of results and meaningful

comparison.

The commonly used calculations for sensitivity and specificity do not result in a true

Page 72: Real Time Extraction of ECG Fiducial Points Using Shape ... · Real Time Extraction of ECG Fiducial Points Using Shape Based Detection This thesis is presented to the School of Computer

50 CHAPTER 3. ASSESSMENT OF PERFORMANCE

figure for the probabilities intended by their historical definitions. Misunderstand-

ings are likely to occur if this detail is not appreciated by the research community.

The proposed alternative calculations given in (3.10) and (3.11) may help to avoid

such misunderstanding.

In order to make performance results pertinent to a real-time system, at least some

mention of the total time taken to produce results and the phase delay needs to

be mentioned. For time and precision results, the mean average provides only the

bare minimum of information that the biomedical engineer requires. If the full

table of results is not published, then the mean and standard deviation, or some

other description of the probability density function should be provided in order for

results to be useful in implementation of larger systems.

Page 73: Real Time Extraction of ECG Fiducial Points Using Shape ... · Real Time Extraction of ECG Fiducial Points Using Shape Based Detection This thesis is presented to the School of Computer

Chapter 4

Detection of R peaks

The most prominent feature of the ECG is the QRS complex. It corresponds to

the contraction of the ventricles, which are the largest chambers of the heart.

At the centre of the QRS complex is the R peak. Accurate measurement of the

RR interval is a fundamental aspect of ECG analysis. In this chapter a method of

detecting R using Kupeev’s algorithm[42] is introduced. This method performs well

in the presence of noise, even without filtering or any other pre-processing steps.

However, low-pass filtering not only improves results but, despite the overhead,

yields an overall improvement in the speed of the algorithm.

4.1 Overview

The method uses a window of fixed time and applies Kupeev’s algorithm to the

windowed portion of the signal. The algorithm approximates the ECG signal with

a binary tree where each node of the tree represents a peak. Initially, all regions

between successive minima are considered to be peaks, as illustrated in figure 4.7.

Successive pruning of leaf node peaks with the smallest weight results in only the

most prominent ones remaining. These remaining peaks indicate the R peaks in

the ECG signal.

51

Page 74: Real Time Extraction of ECG Fiducial Points Using Shape ... · Real Time Extraction of ECG Fiducial Points Using Shape Based Detection This thesis is presented to the School of Computer

52 CHAPTER 4. DETECTION OF R PEAKS

A general discussion of Kupeev’s algorithm is presented in section 2.2.3. There are

several aspects of the algorithm used in this chapter, which are not covered by [42]

and these are listed below.

• Kupeev describes two variants of his algorithm. The first variant detects the n

most significant peaks of a signal, where n is chosen beforehand. The second

variant detects all peaks which exceed a given magnitude. In this chapter

only the second variant is used.

• This algorithm allocates a “weight” to every peak of the signal and isolates

those peaks of greatest weight. Kupeev suggests that either the height or

the area of each peak be used as the “weight”. QRS complexes are typically

of high amplitude and short duration, which makes the area an unsuitable

choice in this application. Therefore, throughout this chapter, the height of

a peak is used as the weight, and except where indicated otherwise the terms

“height” and “weight” are used synonymously.

• Kupeev states the optimal complexity of the algorithm, but does not describe

how to implement an algorithm with that complexity. This chapter presents

such a description.

• The algorithm is used in conjunction with the shifting window approach de-

scribed in section 4.2.6.

4.2 Algorithm implementation

There are a number of ways to implement the algorithm. However, because of the

emphasis on speed, the most obvious ones are not suitable. To implement the al-

gorithm efficiently one must avoid repetitive iteration over the same regions of the

signal. This requires the creation and maintenance of a number of data structures

Page 75: Real Time Extraction of ECG Fiducial Points Using Shape ... · Real Time Extraction of ECG Fiducial Points Using Shape Based Detection This thesis is presented to the School of Computer

4.2. ALGORITHM IMPLEMENTATION 53

(a) ECG signal with baselines ateach minima.

(b) Nodes are allocated for eachpeak.

h1

h6

h3

h4

h5

h2h7

h8

h9

h10

h11

h12

h13

h14

h15

h16 h17

h18h19

.

........................................................

..........................................................................................................................................................

.

.................................................................................................................................................

..............................................................

.

........................................................................................................................................

................................................................................................................................................

.

........................................................................................

........................................................................

.

................................................................

.............................................................................

.............................................................................................................................................................................

...............................................................................

...............................................................................................................................................................................................................................

.................

....................................................................................................................................

.

.....................................................................

......................................................................

(c) Peaks formed into a binary tree,and heights are added.

h1

h6

h3

h4

h5

h2h7

h8

h9

h10

h11

h12

h13

h14

h15

h16 h17

h18h19

.

........................................................

..........................................................................................................................................................

.

.................................................................................................................................................

..............................................................

.

........................................................................................................................................

................................................................................................................................................

.

........................................................................................

........................................................................

.

................................................................

.............................................................................

.............................................................................................................................................................................

...............................................................................

...............................................................................................................................................................................................................................

.................

....................................................................................................................................

.

.....................................................................

......................................................................

(d) The resultant binary tree.

Figure 4.7: A visualisation of Kupeev’s algorithm applied to an ECG signal. Eachpeak becomes a node in the binary tree. Subsequent processing will extract the nodesof maximal height to select R peaks whilst discarding P & T waves and high frequencynoise.

Page 76: Real Time Extraction of ECG Fiducial Points Using Shape ... · Real Time Extraction of ECG Fiducial Points Using Shape Based Detection This thesis is presented to the School of Computer

54 CHAPTER 4. DETECTION OF R PEAKS

and a somewhat non-intuitive sequence of processes. However the resulting algo-

rithm performs in O(n logn) time, where n is the number of samples, whereas a

naıve implementation has a complexity of O(n2).

Implementation of the algorithm can be divided into four distinct processes:

1. Setup and initialisation.

2. Identification of the peaks.

3. Creation of the binary tree.

4. Iteration and pruning of the tree, to form a list of maxima.

Details of each of these steps are discussed in the following sections.

4.2.1 Glossary

The following additional terminology is used to describe the algorithm. Figure 4.8

should be consulted for examples.

Peak Every region of the signal which is bounded by a point with negative slope

at its lower extreme and positive slope at its upper extreme. Example: The

regions P0, P1 and P2 are peaks.

Upper Bound The upper extreme of the peak, ie. the largest value of x which

comprises the peak. Example: xc is the upper bound of P1.

Lower Bound The lower extreme of the peak, ie. the smallest value of x which

comprises the peak. Example: xc is the lower bound of P2.

Base Value The value of the signal at the peak’s upper (and its lower) bound.

Elevation A peak’s elevation is the difference between its base value, and the high-

est point in the signal between its upper and lower bounds. A peak’s elevation

Page 77: Real Time Extraction of ECG Fiducial Points Using Shape ... · Real Time Extraction of ECG Fiducial Points Using Shape Based Detection This thesis is presented to the School of Computer

4.2. ALGORITHM IMPLEMENTATION 55

is always less than the elevation of its parent. Example: The elevation of P0

is f(xb)− f(xa).

Height For a peak with no child, the height takes the same value as the elevation.

For any other peak, the height is its elevation, minus the elevation of the child

with the largest elevation. Example: The height of P0 is f(xc)− f(xa).

Left hand peak A peak whose upper bound occurs at a minimum. Example: P1

is a left hand peak.

Right hand peak A peak whose lower bound occurs at a minimum. Example: P2

is a right hand peak.

Edge An edge is a series of points in the signal,

{(x0, f(x0)

),(x1, f(x1)

). . .

(xn−1, f(xn−1)

)},

for which {x0, x1 . . . xn−1} and {f(x0), f(x1) . . . f(xn−1)} are monotonically

increasing. Example: The segments−→AB and

−−→CD each form an edge.

4.2.2 Setup and initialisation

The optimal implementation described herein is designed to be fast. It does not

attempt to minimise memory usage. A number of data structures must be main-

tained, which imposes significant memory requirements. In modern devices however

memory is cheap, so this requirement is not considered a serious drawback. The

structures involved, and their initialisation are shown in Process 1.

4.2.3 Identifying the peaks

In order to identify the upper and lower bounds of each peak, it is necessary to first

identify all the minima in the signal regardless of their significance. This is done

Page 78: Real Time Extraction of ECG Fiducial Points Using Shape ... · Real Time Extraction of ECG Fiducial Points Using Shape Based Detection This thesis is presented to the School of Computer

56 CHAPTER 4. DETECTION OF R PEAKS

︸ ︷︷ ︸

P0

︸ ︷︷ ︸

P2

︸ ︷︷ ︸

P1

6

?

elevation of P0

6

?height of P0

A

(xa, f(xa))

B

(xb, f(xb))

C

(xc, f(xc))

6

?

height of P1

D

6

?

height of P2

E

Figure 4.8: The geometry of a peak. This example illustrates a peak P0 containingtwo child peaks, P1 and P2.

• Define S to be a stack of edges {E0, E1 . . . Ek−1} which is initiallyempty. Denote the top element of S, Ek−1 by Etop.

• Represent a peak J (xlower, xupper, y) by a structure with the followingelements:

xlower = lower bound of the peak

xupper = upper bound of the peak

y = value of the peak’s baseline.

• Define L to be an ordered pair of peaks, (Jleft,Jright).

• Define L to be a stack of peak pairs, {L0,L1 . . .Lκ−1}. Denote thetop element of L, Lκ−1 by Ltop. L is initially empty.

Process 1: Initialisation of the structures involved in peak detection.

Page 79: Real Time Extraction of ECG Fiducial Points Using Shape ... · Real Time Extraction of ECG Fiducial Points Using Shape Based Detection This thesis is presented to the School of Computer

4.2. ALGORITHM IMPLEMENTATION 57

by iterating the data points and noting the change in direction of the signal. The

precise steps are given in Process 2.

Each data point in the signal is considered in turn. Comparison between a datum

and the preceding datum enables the local first derivative, f ′(x) at x to be found.

A new function g(x) (refer to figure 4.9) is defined

g(x) ,

1 if f ′(x) > 0

0 if f ′(x) = 0

−1 if f ′(x) < 0

. (4.1)

Now the derivative of g(x), determines whether f(x) is locally maximum or mini-

mum at x.

Within regions with positive slope, such as−→AB and

−−→CD in figure 4.8, every point

contributes to an edge. Maximal points such as B and D indicate the termination

of an edge, whereas minimal points such as A and C indicate the start of a new

edge and the presence of a left hand peak. At this instant, the corresponding right

hand peak has not been identified, so a placeholder is reserved for this peak to be

filled subsequently.

Data points within regions of negative slope such as−−→BC and

−−→DE are compared to

f(x) at the start of the most recently completed edge. If the datum falls below this

value, then this indicates the existence of a right hand peak. This right hand peak

belongs to the most recently identified left hand peak which has not already had a

right hand peak associated with it.

The result of this process is the stack L, containing pairs of left and right hand

peaks. The next step in the algorithm forms these pairs into the binary tree.

4.2.4 Constructing the tree

The root node of the tree is the only node without a sibling, and its creation is a

special case. Its lower bound is set to the minimum value of x and the upper bound

to the maximum value of x, or in the case of a windowed system (see section 4.2.6)

Page 80: Real Time Extraction of ECG Fiducial Points Using Shape ... · Real Time Extraction of ECG Fiducial Points Using Shape Based Detection This thesis is presented to the School of Computer

58 CHAPTER 4. DETECTION OF R PEAKS

f(x)

f ′(x)

g(x)

g′(x)

Figure 4.9: Detection of turning points in the signal. The input signal f(x) isdifferentiated to get f ′(x), which is clamped to ±1 resulting with g(x). g(x) is differ-entiated to get g′(x). The negative values of g′(x) indicate the maxima in f(x), andthe positive values indicate the minima.

Page 81: Real Time Extraction of ECG Fiducial Points Using Shape ... · Real Time Extraction of ECG Fiducial Points Using Shape Based Detection This thesis is presented to the School of Computer

4.2. ALGORITHM IMPLEMENTATION 59

1. If f ′(x) > 0 or g′(x) < 0 then append(x, f(x)

)to Etop.

2. If g′(x) > 0 then

(a) Let i = |S|(b) Let

((x0, f(x0)

)be the first element of Ei−1.

(c) If f(x) ≤ f(x0) then

i. Decrement i.

ii. Goto 2b.

(d) Let j = |Etop| − 1.

(e) Let(xj , f(xj)

)= the jth element of Etop.

(f) If f(x) ≤ f(xj) then

i. Decrement j.

ii. Goto 2e.

(g) Pop S.

(h) Let L =((xj , x, f(x)

), ∅

)

, where ∅ indicates an undefined ele-

ment (a placeholder).

(i) Push L onto L.

(j) Let E ={(x, f(x)

)}.

(k) Push E onto S.

3. If f ′(x) < 0 then, while S is not empty:

(a) Let((x0, f(x0)

)be the first element of Etop.

(b) If f(x) ≤ f(x0) then

i. Set the second member of Ltop (currently occupied by ∅) to(x0, x, f(x)

).

ii. Pop the element Etop from S.

Process 2: Actions taken for each point in the signal in order to identify peaks.These actions populate L using S as a temporary storage structure. As peaks areidentified they are allocated into pairs. In subsequent processes, the members of apair become siblings in the binary tree.

Page 82: Real Time Extraction of ECG Fiducial Points Using Shape ... · Real Time Extraction of ECG Fiducial Points Using Shape Based Detection This thesis is presented to the School of Computer

60 CHAPTER 4. DETECTION OF R PEAKS

1. Sort L by ascending value of Jright[y].

2. Initially, K has a single node k = (min(x),max(x),−∞).

3. Let i = 0.

4. Let (Jleft,Jright) be the ith element of L.

5. Find the leaf node k in K for which k[xlower] ≤ Jleft[xupper] ≤ k[xupper].

6. Insert Jleft and Jright as the left and right children of k respectively.

7. Increment i.

8. If i < |L| then goto 4.

Process 3: Procedure to create the binary tree K from L, the stack of peak pairs.

the lower and upper bounds of the window. This means that the bounds of every

other node fall within the bounds of the root node. It is also necessary to ensure

that the root node’s baseline value is no greater than the baseline of any other node.

Setting it to −∞ is a simple way to achieve this.

Next, the list of pairs, L is sorted by ascending order of their baselines. The baseline

is the value of f(xm) where xm is the common bound (the upper bound of the left

hand peak and the lower bound of the right hand peak).

So far, the tree contains only the root node. The pair at the top of L is now removed

from L, and inserted into the tree as the children of the root node. Now there are

three nodes; a root node, and two leaf nodes. The process continues, by examining

the upper and lower bounds of top pair from L, and each of the leaf nodes of the

partially built tree. One of the leaves will have upper and lower bounds which

encompass the pair, and this leaf becomes the parent of that pair. The process is

presented formally in Process 3. Having constructed the binary tree, L is no longer

required, and may be discarded.

Page 83: Real Time Extraction of ECG Fiducial Points Using Shape ... · Real Time Extraction of ECG Fiducial Points Using Shape Based Detection This thesis is presented to the School of Computer

4.2. ALGORITHM IMPLEMENTATION 61

1. Let wmax = 0.

2. Pick the leaf k in K of smallest weight.

3. Push the node k onto the stack SS.

4. If the number of leaves exceeds 1, then

(a) Remove k from K.

(b) Let wmax = max(wmax, wk) where wk is the weight of node k.

(c) Goto 2

5. Let k be the top element of SS.

6. If k has a weight greater than or equal to σ × wmax then output k.

7. Pop SS.

8. If SS is not empty then goto 5

9. Stop.

Process 4: Iteration of the binary tree K to determining all the significant maxima.

4.2.5 Extracting the maxima

The final phase orders the leaves of the tree by their significance value, and outputs

all the peaks whose significance exceeds a predetermined fraction σ, where 0 ≤ σ ≤ 1.

Significance of the ith maximum is defined as σi = wi/wmax, where wmax is the max-

imum value of wi. A new stack SS is required, which is initially empty. The leaf

node with the smallest weight is placed onto SS, and that node is excised from K.

The process is repeated until K is empty. The process is illustrated in figure 4.10

and the presented formally in Process 4.

4.2.6 Shifting window

The algorithm as described so far, takes a digitised set of data points from an

input signal and, if all the data are present, produces a list of maxima. This post

hoc mode of operation makes its raw application unsuitable for real time analysis.

Page 84: Real Time Extraction of ECG Fiducial Points Using Shape ... · Real Time Extraction of ECG Fiducial Points Using Shape Based Detection This thesis is presented to the School of Computer

62 CHAPTER 4. DETECTION OF R PEAKS

a 0.34

b 2.54 c 5.67

g 98.3e 123

m 234 h 34

j 99 n 421

l 20.9k 31

d 0.1 f 23

K

.

............

.

............

.

...........

.

..........

.

..........

...........

..........

..........

.........

.........

.........

.........

..........

..............

..............

. ............. ...........

. ............ ..........

. ......... . ......... .......... .......... .......... ......... ..................

..................

..............................

........

.........

.........

.........

..........

..........

.

......

...

.

......

....

.

......

....

.

......

....

.

......

.....

.

......

.....

.

......

.....

.

......

......

.

......

......

.

.

......

......

.

.

......

......

..

...............

..............

.............

............

...........

..........

.........

........

.....................

......... ..... .......... .......... ...........

...........

............

........

.........

...................

..........

.

......

....

.....

......

.

.

......

.....

.

.

......

......

.

......

......

.

......

......

.

.......

...............

...........

............ .......... ..... . ........... ...........

.............................................

.

......

...

.

......

....

.

......

.....

.

......

......

.

......

......

.

.......

d 0.1

l 20.9

SS

Figure 4.10: Creating the final stack SS from the tree K. Node d is the leaf withthe smallest weight, and is therefore lowest in the stack.

Therefore, a shifting window approach is used in this study. The signal is divided

into windows of a constant duration W as shown in figure 4.11. Kupeev’s second

algorithm is applied successively to each window. It is necessary that each window

includes a finite amount of data V from the previous window, otherwise maxima

could be missed if the lower and upper bounds of a peak fell in different windows.

Such errors would attribute undue significance to the less significant maxima. The

optimal size of the window and the overlap are discussed below. The overlap,

however introduces a problem. Maxima situated in the region overlapping two

adjacent windows may be detected twice. To overcome this problem, in this study

all maxima detected within the leading overlap region were discarded regardless

of whether a corresponding maxima had been detected in the previous window.

A more rigorous method of identifying duplicated detections, perhaps based upon

dynamic time warping (see section 3.2.2), would give fewer false negative results

and a corresponding increase in sensitivity.

This windowing process has the secondary benefit of implicitly high pass filtering the

signal which, in the results presented below, almost completely eliminated baseline

Page 85: Real Time Extraction of ECG Fiducial Points Using Shape ... · Real Time Extraction of ECG Fiducial Points Using Shape Based Detection This thesis is presented to the School of Computer

4.2. ALGORITHM IMPLEMENTATION 63

...........

............

............

............

.

.........

.

...........

.

...........

............

........................

............

............

.

..........

.

.

..........

.

..........

.

..........

...........

...........

...........

...........

.

..........

.

...........

.

...........

.

.........

.

.........

.

.

..........

.

.......

....

.

..........

...................

............

.

..........

.

..........

.

...........

.

...........

...........

...........

︸ ︷︷ ︸

V︸ ︷︷ ︸

V

W︷ ︸︸ ︷

time−−−−−−−−−−−−−−−−−−−−−−−−−→

Figure 4.11: A shifting window provides quasi real time response, and high passfiltering. The overlapping regions are necessary, since peaks not completely containedwithin a window will otherwise go undetected.

Page 86: Real Time Extraction of ECG Fiducial Points Using Shape ... · Real Time Extraction of ECG Fiducial Points Using Shape Based Detection This thesis is presented to the School of Computer

64 CHAPTER 4. DETECTION OF R PEAKS

shift. In general, any frequencies below 12W

will be blocked.

4.3 Pre-processing

The algorithm proves to give good results without any pre-processing. However

addition of the complex lead, and low pass filtering increases the sensitivity and

specificity to figures comparable to those found in the literature. The shifting

window approach described above implicitly effects a high pass filter. This can be

seen, by recognising that a peak is formed by one half of the period of a sinusoid,

and that the peak will not be detected if it does not fit withing the width of a single

window. Hence no specific measures are necessary to combat baseline shift because

the windowing removes the low frequencies.

4.4 Parameterisation

A big advantage of the method is that it requires very few quantitative parameters

to be chosen. Those few parameters required are discussed in this section. The

analytic and experimental evidence suggests that the algorithm is robust to small or

moderate changes in these parameters. This property implies that deployment of the

algorithm in larger systems would require minimal application specific optimisation.

4.4.1 Window size

The window size W and the size of the overlap between windows V need to be set.

It is necessary that V exceeds the RR interval TRR, otherwise beats can be lost. W

must be shorter than half the period of any baseline shift TBaseline present on the

Page 87: Real Time Extraction of ECG Fiducial Points Using Shape ... · Real Time Extraction of ECG Fiducial Points Using Shape Based Detection This thesis is presented to the School of Computer

4.5. EFFECT OF FILTERING 65

signal. In summary, the following conditions must hold:

W ≥ V (4.2)

V ≥ TRR (4.3)

W ≤ TBaseline. (4.4)

Since the overlap causes data to be processed twice, the algorithm is redundant

by VW

. A large window size imposes a corresponding detection latency. Thus,

application constraints will dictate the optimum window size. The RR interval is,

of course, unknown. However, in a healthy human subject at rest a value of 1

second may be expected. Setting V to a value of 3 seconds is unlikely to violate

condition (4.3). Baseline shift is dependent upon external factors, but except during

patient motion normally does not have a period of less than 10 seconds.

4.4.2 Weight threshold

The significance threshold σ described in section 4.2.5 is the ratio of the least

significant peak which is to be considered a maximum, to the most significant peak

in the signal. The results presented below suggest that 0.3 is a stable figure which

produces optimal results.

4.5 Effect of filtering

In this system filtering is generally unnecessary. The shifting window implicitly

serves as a high pass filter, removing the baseline shift, whilst the nature of the

Kupeev’s algorithm makes it immune to high frequency noise except in the case of

spikes of very high amplitude. High frequencies serve only to increase the number of

child peaks (and hence the size of the tree) but since they will be of low magnitude

they will not be detected as significant. However, application of a low pass filter

can be beneficial in several respects:

Page 88: Real Time Extraction of ECG Fiducial Points Using Shape ... · Real Time Extraction of ECG Fiducial Points Using Shape Based Detection This thesis is presented to the School of Computer

66 CHAPTER 4. DETECTION OF R PEAKS

• Removal of the high frequency components reduces the number of peaks in

the signal and therefore the size of the tree produced. Removal of such com-

ponents can improve speed even after the overhead of applying the filter is

considered.

• Due to the propagation delay though the tissues, combination of two or more

channels, such as with the complex lead formula (1.1), from a multichannel

surface ECG can produce multiple peaks for each beat (see figure 4.14(c)).

Low pass filtering can help resolve these into a single peak, thus avoiding false

positives.

Filtering has the disadvantage of introducing phase delay, which may be unaccept-

able in real time applications.

4.6 Experimental results

To investigate the efficacy of this detection method, experiments were performed

on pre-recorded ECG data, using a software implementation of the algorithm de-

scribed. The software was written in ANSI C, and run on a single processor Intel

Pentium IV 2.8GHz machine using the GNU/Linux operating system. The WFDB

library from Physionet[31] was incorporated into the software in order to extract

test data and their annotations, but the algorithm itself depends upon no special

external libraries. For this study, V and W were fixed at 3 seconds and 9 seconds

respectively.

4.6.1 Observations

The algorithm was applied to all 48 records of the MIT-BIH Arrhythmia database

[67]. The database provides two channels of ECG data sampled from patients at a

rate of 360Hz, and cardiologists’ annotations indicating the positions of beats and

other features in the data.

Page 89: Real Time Extraction of ECG Fiducial Points Using Shape ... · Real Time Extraction of ECG Fiducial Points Using Shape Based Detection This thesis is presented to the School of Computer

4.6. EXPERIMENTAL RESULTS 67

Results from four experiments were noted:

1. The algorithm was ran on channel 0 of the database. For all but two records

this corresponds to modified limb lead II. In records 102 and 104 (which have

no II lead) it corresponds to lead V5.

2. The “complex” combination of both channels, as described in section 1.4.

3. The “complex” combination of both channels, subsequently filtered by a low

pass FIR filter of order 60, having its first zero at 7Hz.

4. Channel 1 of the database. In most records, this channel records V1, but in

some V2 or V5.

Each experiment used detection based purely on Kupeev’s algorithm and the sliding

window as described above. Each experiment was conducted with an acceptance

tolerance of 30ms. This tolerance was chosen so as to be ten times smaller than

the RR interval encountered even in the worst case of ventricular tachycardia, thus

eliminating the possibility of detected P waves or other features being erroneously

matched with R peak annotations and giving an inflated impression of performance.

The experiments were run for values of σ equal to 0.05, 0.1, 0.2, 0.3, 0.4, 0.5 and 0.6,

where σ is the weight threshold described in section 4.4.2. For each of these values,

the algorithm was run on all 48 records of the MIT-BIH Arrhythmia database, and

matched with the annotated positions of R peaks, according to the method specified

by ANSI/AAMI. The numbers of true positives, false positives and false negatives

were recorded, along with the total number of samples in each record. From these,

the number of true negatives was calculated.

4.6.2 Analysis

Figure 4.12 shows ROC curves plotting the mean average of the Se′ and Sp′ values,

calculated per (3.10) and (3.11). It can be seen that the optimum value of σ falls in

Page 90: Real Time Extraction of ECG Fiducial Points Using Shape ... · Real Time Extraction of ECG Fiducial Points Using Shape Based Detection This thesis is presented to the School of Computer

68 CHAPTER 4. DETECTION OF R PEAKS

0.0 0.1 0.2 0.3 0.40.84

0.86

0.88

0.90

0.92

0.94

0.96

0.98

1.00

Channel 1

I

(a) Small scale ROC plot, showing com-parison of Channel 1 data with othercurves.

0.00 0.05 0.10 0.15 0.200.95

0.96

0.97

0.98

0.99

1.00

Channel 1

R

Complexlead

I

Channel 0

6

Filtered Complex lead

I

(b) Large scale version of 4.12(a), show-ing details of higher performing data.

Figure 4.12: ROC curves for R-peak detection. Each curve plots data at σ = 0.05,0.1, 0.2, 0.3, 0.4, 0.5, & 0.6. Smaller values are plotted towards the lower left handcorner.

the region of 0.3. At this value of σ, both Se′ and Sp′ exceed 0.98 for all experiments

except that using data from channel 1. Further, with the exception of the channel 1

experiments, the results are stable at this value of σ; a change of ±0.1 results in less

than 0.1 change in sensitivity and less than 0.05 specificity. The poorer results in

the case of channel 1, can be attributed to the fact that channel 1, often encounters

bi-phasic or negative going R peaks (see figure 4.13).

Analysis of poorly performing records

It is instructive to examine poorly performing records from the database. The worst

performing record is number 207, which is annotated with the words:

This is an extremely difficult record. The predominant rhythm is

normal sinus with first degree AV block and left bundle branch block.

There are periods when the conduction block changes to a right bundle

branch block pattern. The PVCs are multiform. Idioventricular rhythm

Page 91: Real Time Extraction of ECG Fiducial Points Using Shape ... · Real Time Extraction of ECG Fiducial Points Using Shape Based Detection This thesis is presented to the School of Computer

4.6. EXPERIMENTAL RESULTS 69

(a) Excerpt from record 105 showing normal sinus rhythm with positive peaks in the II leadand negative peaks in the V1 lead.

(b) Excerpt from record 207 showing bundle branch block beats. The II lead has negative peakswhilst the V1 has bi-phasic features.

Figure 4.13: Comparison of two records from the MIT-BIH Arrhythmia databasedemonstrating the respective directions of R peaks in normal and arrhythmic beats.

appears following the longest episode of ventricular flutter. The record

ends during the episode of SVTA.

In the unpre-processed results, this record performs particularly poorly. Exami-

nation shows this is due to the presence of left bundle branch block beats, which

manifest themselves in modified limb lead II as negative going peaks. As can be

seen from figure 4.13, the opposite is generally true in normal sinus rhythm beats.

From table 4.3 it can be seen that sensitivity for channel 0 (the II lead) is particularly

poor. This can be attributed to the large number of left bundle branch block

beats which manifest themselves as negative going peaks rather than the positive

going peaks one normally expects from this lead. Acceptable figures are seen from

Channel 1, but this is not often true for other records, so cannot be relied upon

in the general case. The complex lead, which combines both channels, provides

Page 92: Real Time Extraction of ECG Fiducial Points Using Shape ... · Real Time Extraction of ECG Fiducial Points Using Shape Based Detection This thesis is presented to the School of Computer

70 CHAPTER 4. DETECTION OF R PEAKS

(a) Channel 0

(b) Channel 1

(c) Complex Lead

(d) Filtered Complex Lead

Figure 4.14: ECG channels presented to the detection algorithm. The R peaks man-ifest themselves at slightly different temporal locations in channels 0 and 1, leadingto double peaks in the complex lead. Low pass filtering the complex lead combinesthe double peaks into a single one.

Source Se′ Sp′

Channel 0 (II) 0.720854 0.971033Channel 1 (V5) 0.990553 0.983645Complex Lead 0.988836 0.921509Filtered Complex Lead 0.993688 0.987915

Table 4.3: Sensitivity and Specificity for record 207 of the MIT-BIH Arrhythmiadatabase. This record is a particularly difficult one to analyse.

acceptable sensitivity but poorer specificity. This can be attributed to the phase

delay between the two channels, resulting in a double peak, where only one is

actually present, hence increasing the false positive count. Figure 4.14 illustrates

the problem, and demonstrates how applying the low pass filter before detection

alleviates this problem by combining the two peaks into one. Despite the poor

results in the cases without pre-processing, use of the complex lead, either with or

without filtering, provides results in excess of 98% sensitivity and 92% specificity. In

this study, the filtered complex lead returned figures close to 99% for both sensitivity

and specificity.

Page 93: Real Time Extraction of ECG Fiducial Points Using Shape ... · Real Time Extraction of ECG Fiducial Points Using Shape Based Detection This thesis is presented to the School of Computer

4.6. EXPERIMENTAL RESULTS 71

Performance in the presence of noise

Low frequency noise, such as baseline shift is eliminated by the shifting window.

In general, Kupeev’s algorithm is immune to high frequency random noise which

merely increases the complexity (see section 4.6.3). High frequency noise with

phase and bandwidth similar to that of the wanted signal may cause problems.

One notable source of noise which plagues QRS detection is muscle noise, but the

results do not show significant evidence that this algorithm is affected.

4.6.3 Time complexity

The time taken to process each record (30 minutes of data sampled at 360Hz) was

measured at 1.5s without pre-processing, and 1.8s with pre-processing. Using this

method output will be delayed by a time equal to the window size W . However

W may be chosen at any value which satisfies (4.2) and (4.4). In the limit, where

W = V , the total time could increase by a factor of 50% from the values observed

above. Thus we can trade off phase delay against speed of execution.

It is interesting to note that whilst low pass filtering imposes a time overhead, it

also has the potential to improve the time of Kupeev’s algorithm since it reduces

the total number of peaks. From [42] the complexity of the algorithm presented in

this chapter is O(M + P logP ) where M is the number of samples, and P is the

number of peaks. Random noise on a ECG signal will set P = M2

. Thus, low pass

filtering changes the complexity from effectively O(M + M logM) to near O(M).

Table 4.4 shows the time taken to process a single record, both with, and without

filtering. It can be seen from these figures that, in this example, filtering adds a

time overhead of 36% but results in a net benefit of 33%.

Page 94: Real Time Extraction of ECG Fiducial Points Using Shape ... · Real Time Extraction of ECG Fiducial Points Using Shape Based Detection This thesis is presented to the School of Computer

72 CHAPTER 4. DETECTION OF R PEAKS

Pre-Processing Time / secondsNot filtered. 2.7Filtered. Detection using unfiltered results. 3.7Filtered. Detection using filtered results. 1.8

Table 4.4: Elapsed time to process a record, demonstrating the benefits of low passfiltering of the complex lead. Despite the overhead of the filter, there is considerablenett benefit to be gained by filtering.

4.7 Summary

This method of detecting R peaks is a novel application of Kupeev’s algorithm. It

requires no pre-processing of the input signal although low pass filtering improves

results and can increase speed of execution. The method requires only a few user

defined parameters to be set, and proves to be robust in the presence of small to

moderate variation of these parameters. The method operates well on a single lead,

and better if more than one lead is available. If pre-processing can be afforded,

even the most difficult cases can be analysed with acceptable results. The speed of

execution is fast enough that it could be used in real-time applications as well as

off line processing. However, some researchers may consider the method not to be a

“true” real-time system, in the sense that a feature occurring at time t, may not be

detected until t+W and this may be a concern since, from equations (4.3) and (4.4),

W is typically much larger than one RR interval. Extension of the method to true

real-time application would be possible by substituting the shifting window with

a sliding window. Whilst this would complicate the algorithm for generating the

binary tree, which would need to be dynamically adjusted, there would appear to

be no fundamental reason why such an extension would not be feasible.

The method does not rely on spectral analysis of the signal. Instead, it examines

the shape of the peaks as they are encountered. This approach has the advantage

of making the method largely immune to noise, except in the case of high frequency

Page 95: Real Time Extraction of ECG Fiducial Points Using Shape ... · Real Time Extraction of ECG Fiducial Points Using Shape Based Detection This thesis is presented to the School of Computer

4.7. SUMMARY 73

spikes of very large amplitude. Whilst this study is concerned with ECG peak de-

tection, the method’s robustness suggests that it may be used for any physiological

signal where detection of the significant maxima is required, or indeed any single

dimensioned physical signal.

In the implementation described in this chapter, only the height of the peaks is con-

sidered. However, a considerably greater amount of information is contained within

the peaks, and methods of using Kupeev’s algorithm to exploit this information is

the focus of the next chapter.

Page 96: Real Time Extraction of ECG Fiducial Points Using Shape ... · Real Time Extraction of ECG Fiducial Points Using Shape Based Detection This thesis is presented to the School of Computer

74 CHAPTER 4. DETECTION OF R PEAKS

Page 97: Real Time Extraction of ECG Fiducial Points Using Shape ... · Real Time Extraction of ECG Fiducial Points Using Shape Based Detection This thesis is presented to the School of Computer

Chapter 5

Detection of P and T waves

Although the QRS complex is the most prominent feature of the ECG, the

P waves and the T waves are of considerable interest. The P wave occurs

as the atria are depolarising (hence contracting) and filling the ventricles with

blood. The T wave is a result of the atria repolarising; returning to their relaxed

state. Analysis of P and T waves is often useful in prediction of clinical condi-

tions. For example, P wave dispersion (the differences in width between P waves

recorded on different surface leads) has been shown to be indicative of susceptance

to atrial fibrillation[22]. Similarly, the existence of T wave alternans (periodic fluc-

tuations in morphology or position) are often a predictor of malignant ventricular

arrhythmias[10]. A system to quickly and reliably identify P and T waves therefore

is important in ECG analysis.

5.1 Introduction

The previous chapter described the application of Kupeev’s algorithm to the prob-

lem of detecting R peaks. Kupeev’s algorithm is a non-linear approach which iden-

tifies peaks based upon their shape. In this chapter the approach is extended so as

to incorporate a conventional linear signal processing technique, namely the wavelet

75

Page 98: Real Time Extraction of ECG Fiducial Points Using Shape ... · Real Time Extraction of ECG Fiducial Points Using Shape Based Detection This thesis is presented to the School of Computer

76 CHAPTER 5. DETECTION OF P AND T WAVES

transform, whilst retaining the basis of the original algorithm. The first stage of the

algorithm is identical to that used for R peak detection, however it does not depend

upon previously detected R peaks, so detection of one type of peak is independent

of the existence or detection of another. If a system for R peak detection, has a

probability of error Perror(R), and a system to detect P waves has a error probability

of Perror(P ) given correct input, then for a combined system, where the output of

R is used as the input of P , the probability of error for the combination is

Perror(S) = 1− (1− Perror(R))(1− Perror(P )). (5.1)

and in general for a system comprising a chain of n dependent subsystems the

probability will be

Perror(S) = 1−n∏

i=1

(1− Perror(Xi)). (5.2)

It is easy to see that for Perror(Xi) < 1, Perror(S) increases as n increases. In other

words, minimising the number of dependent subsystems is a worthwhile goal since

it minimises the overall error.

In the following sections a description of the algorithm is presented in conjunction

with some results to demonstrate its performance and tolerance to noise, baseline

wander and variations in P and T wave morphology. Since the first part of the

algorithm is substantially identical to that used for R peak detection, optimisation

can be made to efficiently detect both kinds of peaks concurrently. The resulting

algorithm proves to be effective as a tool to isolate the P and T waves from other

features in the signal. If the locations of the R peaks are known, they may be

used to distinguish the P waves from the T waves. Experimental results using this

approach are presented later in this chapter.

Page 99: Real Time Extraction of ECG Fiducial Points Using Shape ... · Real Time Extraction of ECG Fiducial Points Using Shape Based Detection This thesis is presented to the School of Computer

5.2. BACKGROUND 77

5.2 Background

The wavelet transform is a popular tool for the analysis of ECG signals. Like the

fourier transform, it is useful for determining the frequencies which comprise a sig-

nal. Unlike fourier analysis however, it offers a means of analysing the non-periodic

components. Many applications use the wavelet transform as a pre-processing stage,

merely to implement a linear filter[18]. Typically, the forward transform is per-

formed, coefficients of low magnitude are discarded, and then the inverse transform

is performed. The method introduced here makes explicit use of the wavelet coeffi-

cients and does not use the inverse transformation.

Li et al.[45] recognised that modulus maxima in the wavelet transform of a signal

correspond to singularities in the signal and first used this observation to identify

fiducial points in an ECG. Subsequently, the technique has been used in systems

with various degrees of success [63, 49]. However, since the most fundamental

singularities of interest are themselves maxima, it merely shifts the problem of

maxima detection from one function to another. Furthermore, it is unclear which

wavelet level is optimal for detecting a particular feature. Since Kupeev’s algorithm

has been shown to be an effective and fast tool for maxima detection, it is logical to

use it in conjunction with the wavelet transforms of ECGs in order to find features.

As in the case of R peak detection however, keeping complexity low and the number

of parameters to a minimum is desirable, so a means of applying Kupeev’s algorithm

concurrently across all wavelet levels is sought.

5.2.1 Review of the wavelet transform

A definition and overview of the wavelet transform is given in section 2.2.2. The

convolution operator in (2.16) means that simple application of the continuous

wavelet transform is an expensive operation. However the discrete wavelet trans-

form (DWT), operates in time O(n) and is therefore a more attractive choice for

real time ECG analysis.

Page 100: Real Time Extraction of ECG Fiducial Points Using Shape ... · Real Time Extraction of ECG Fiducial Points Using Shape Based Detection This thesis is presented to the School of Computer

78 CHAPTER 5. DETECTION OF P AND T WAVES

Figure 5.15: ECG signal and corresponding discrete wavelet transform. The hori-zontal axis represents time, and the vertical axis the wavelet level. This plot showswavelet levels 1 through to 5; level 1 appearing at the top. Coefficients of high mag-nitude are shown as white, and those of low magnitude as black.

The DWT of a discrete signal with n samples, takes the form of n real valued

coefficients. The first value is the “smoothing” coefficient and is of little interest

here. Subsequent values are the “detail” coefficients and their magnitudes describe

the “energy” of the signal at a particular translation. The sign of the coefficient

contains information describing the phase of the signal and is therefore pertinent

for the purposes of P wave and T wave detection.

A common method of visualizing the DWT is to display time on the horizontal

scale, the wavelet level on the vertical scale and the magnitude of the wavelet co-

efficient as the intensity. Figure 5.15 shows a single channel ECG signal and a plot

of its corresponding discrete wavelet transform using the Haar mother wavelet to a

maximum level of 5. At level 0 (not shown in figure 5.15), there is a single coefficient

d0,0 which describes the frequencies covered by all the samples [0, n − 1]. At level

1, there are two coefficients, d1,0 and d1,1 which cover the ranges [0, n/2 − 1] and

[n/2, n−1] respectively. In general, there are 2j coefficients, dj,0, dj,1, · · · dj,2j−1, cov-

ering the ranges [0, n/2j−1], [2n/2j, 3n/2j−1], · · · [n−1−n/2j , n−1]. Throughout

this chapter, these ranges are called the “domains” of the coefficients.

Page 101: Real Time Extraction of ECG Fiducial Points Using Shape ... · Real Time Extraction of ECG Fiducial Points Using Shape Based Detection This thesis is presented to the School of Computer

5.3. ALGORITHM IMPLEMENTATION 79

5.3 Algorithm implementation

In chapter 4, peak height was used as the weight parameter since R peaks are

typically tall and of short duration. Clearly this is not true for P or T waves,

so an alternative parameter is sought. Kupeev suggests the area under the peak.

However this proves to be ineffective since in many cases the waves are of very

low amplitude. In the method described below, the weight parameter is a value

determined from the wavelet coefficients whose domains coincide with the temporal

range of each node. This approach awards greater weight to nodes whose shape

matches the mother wavelet, and is independent of the node’s amplitude. Hence,

the method is effective for the detection of P or T waves of very low amplitude and

in noisy signals.

The weight is calculated from the wavelet coefficients whose domains overlap the

range of the node N , as depicted in figure 5.16. The most straightforward method

of calculation would be a simple algebraic sum of the coefficients. Here, a slightly

less direct method is used because of two concerns:

• Wavelet coefficients are real numbers, possessing a sign and a magnitude com-

ponent. Both components are required. Scalar addition would discard useful

information.

• In order for the algorithm to operate with optimal speed, repetitive iteration

over the wavelet coefficients must be avoided.

In view of these concerns, the algorithm has been devised thus:

1. Perform a discrete wavelet transform on the signal. Designate the detail

coefficients as {d0,0, d1,0, d1,1, d2,0, · · · dj,k, · · · dJ−1,2J−1−1}.1

2. For each level j, define two arrays, a+j and a−j , each of length 1 + log2 j.

1Many software implementations of the discrete wavelet transform, omit the√

2j divisor (seeequation (2.18)). For this algorithm it is important to ensure the coefficients use this divisor sothat the correct energy is attributed to each level.

Page 102: Real Time Extraction of ECG Fiducial Points Using Shape ... · Real Time Extraction of ECG Fiducial Points Using Shape Based Detection This thesis is presented to the School of Computer

80 CHAPTER 5. DETECTION OF P AND T WAVES

54321j

. . . . . .d3,0 . . . d3,7

d2,0 d2,1 d2,2 d2,3

d1,0 d1,1

u v

︸ ︷︷ ︸

N

Figure 5.16: Intersection of wavelet coefficients and a window N . The window cor-responds to the range of a single node in the binary tree of Kupeev’s algorithm. Eachcoefficient domain which wholly or partially falls within the range (u, v) contributesto the weight of N .

Page 103: Real Time Extraction of ECG Fiducial Points Using Shape ... · Real Time Extraction of ECG Fiducial Points Using Shape Based Detection This thesis is presented to the School of Computer

5.3. ALGORITHM IMPLEMENTATION 81

3. Let a+j,0 = 0 and a−j,0 = 0.

4. Define c+j,k =

|dj,k| if dj,k > 0

0 otherwise.

Similarly, define c−j,k =

|dj,k| if dj,k < 0

0 otherwise.

5. Let a+j,k+1 =

∑ki=0 c

+j,i and a−j,k+1 =

∑ki=0 c

−j,i ∀k ∈ {0, 1, · · ·2j−1 − 1}.

6. Create the structure of the binary tree for Kupeev’s algorithm as described

in sections 4.2.3 and 4.2.4. For each node, N with range (u, v); u and v both

have range [0, 1] (see figure 5.16), let

Iu,j(N ) be the integer part of u2j/n

Fu,j(N ) be the fractional part of u2j/n

Iv,j(N ) be the integer part of v2j/n

Fv,j(N ) be the fractional part of v2j/n.

7. Let

w+N =

J−1∑

j=1

(

a+j,Iv,j(N ) + Fv,j(N )a+

j,Iv,j(N )+1 − a+j,Iu,j(N ) − Fu,j(N )a+

j,Iu,j(N )+1

)

and

w−N =

J−1∑

j=1

(

a−j,Iv,j(N ) + Fv,j(N )a−j,Iv,j(N )+1 − a−j,Iu,j(N ) − Fu,j(N )a−j,Iu,j(N )+1

)

.

8. Assign the weight wN = max(w+N , w

−N ).

Note that step 1 and step 5 each have complexity O(n), step 6 has complexity

O(n logn), step 7 O(logn) and the other steps have constant complexity. The

dominating complexity is therefore O(n logn). Whilst this process requires addi-

tional workspace in which to store intermediate data, it avoids repeated iteration

Page 104: Real Time Extraction of ECG Fiducial Points Using Shape ... · Real Time Extraction of ECG Fiducial Points Using Shape Based Detection This thesis is presented to the School of Computer

82 CHAPTER 5. DETECTION OF P AND T WAVES

over the wavelet coefficients so provides considerable speed improvement over the

most obvious implementation.

At this point in the algorithm there exists a binary tree, similar to that depicted in

figure 4.7. In this tree however, each node contains a value for wN instead of (or in

addition to) the height of the peak. The algorithm continues exactly as described

in section 4.2.5; the leaf node of smallest weight is repeatedly excised from the tree

and placed onto a stack, and elements of the stack above the threshold contain

the peaks of significance. This wavelet weighting method awards higher values to

those peaks which are similar in shape to the P waves, so the “significant” peaks

correspond to those most closely matching the P wave shape.

5.4 Experimental results

Two separate methods were used to assess the performance of the algorithm. The

first method used synthetically generated ECG signals from the ECGSYN software

described in [51, 52]. The motivation for using synthetic signals arises from the

need to control the signal morphology in order to examine how the method per-

forms when the P wave or T wave is of low magnitude or appears in an unusual

position with respect to other features, and to obtain reliable reference annotations

of each feature. The second method used signals obtained by clinical measurements;

specifically, the data published in the QT database[2, 43]. Since this database an-

notates only a small sample of the features contained within it, only limited results

can be obtained from it. In particular, no meaningful specificity figures can be

obtained. Nevertheless, it is a useful test to indicate how well the method performs

upon natural signals.

The first test method allows fine control of the test data, and provides exact refer-

ence points, but the synthetic nature of the signals gives rise to lack of confidence in

their applicability. Conversely, the QT database provides real-life signals, but the

reference points are incompletely annotated, which means that one cannot perform a

Page 105: Real Time Extraction of ECG Fiducial Points Using Shape ... · Real Time Extraction of ECG Fiducial Points Using Shape Based Detection This thesis is presented to the School of Computer

5.4. EXPERIMENTAL RESULTS 83

complete quantitative analysis of the algorithm’s performance. Experiments showed

that best results were obtained using the daubechies-4 mother wavelet (2 vanishing

moments), and this wavelet was used for all results presented here.

5.4.1 Tests using synthetically generated signals

A modified version of the ECGSYN software was used to test the algorithm. The

modifications were devised in order to allow easy control of the wave morphology,

to conform to modern coding conventions, to accommodate a readily available fast

fourier transform library[30] and to allow control of the injected noise. However,

the algorithms of the software were unchanged from the authors’ original program.

The synthetic signals produced results where the algorithm consistently accepted

the P waves, whilst rejecting the T waves (a result not upheld by the experiments

with the QT database). In this section therefore, results are presented exclusively

on a two class basis with respect to P wave detection.

Noise tolerance

The input signals were generated, specifying 1024 RR periods and all other param-

eters at their default values. Noise was added post-hoc, after measuring the total

power contained in the signal. As noted in section 1.5, noise in ECG signals is

typically not uniform, but has a power spectrum of the form 1/fβ, where β is a

non-negative constant. The algorithm was tested in the presence of three different

types of noise; white (uniform) noise (β = 0), pink noise (β = 1) and brown noise

(β = 2). Figure 5.17 shows the measured receiver operator characteristic for these

noise spectra at various signal to noise levels. These were created by varying the

threshold σ, and calculating the sensitivity and specificity for each value of σ. The

high density of points around the upper left hand corner of the plots occur in the

region of σ = 0.07, which suggests that this is an appropriate value to use when

applying the method.

Page 106: Real Time Extraction of ECG Fiducial Points Using Shape ... · Real Time Extraction of ECG Fiducial Points Using Shape Based Detection This thesis is presented to the School of Computer

84 CHAPTER 5. DETECTION OF P AND T WAVES

0.00 0.05 0.10 0.15 0.20 0.25 0.300.0

0.2

0.4

0.6

0.8

1.0

1 − Sp

Se

30dB

20dB

10dB0dB

-10dB

(a) White noise (β = 0)

0.00 0.05 0.10 0.15 0.20 0.25 0.300.0

0.2

0.4

0.6

0.8

1.0

1 − Sp

Se

20dB

10dB

0dB

-10dB

(b) Pink noise (β = 1)

0.00 0.05 0.10 0.15 0.20 0.25 0.300.0

0.2

0.4

0.6

0.8

1.0

1 − Sp

Se

20dB

10dB

0dB

-10dB

(c) Brown noise (β = 2)

Figure 5.17: Detection results for different noise colours. Each curve is plotted byrunning the detection algorithm with the following weight threshold values: 0.01, 0.02,0.03, 0.04, 0.05, 0.06, 0.07, 0.08, 0.09, 0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9; smallervalues result in a more promiscuous detector and are plotted towards the upper righthand corner.

Page 107: Real Time Extraction of ECG Fiducial Points Using Shape ... · Real Time Extraction of ECG Fiducial Points Using Shape Based Detection This thesis is presented to the School of Computer

5.4. EXPERIMENTAL RESULTS 85

0 5 10 15 20 25 300

10

20

30

40

50

SNR (dB)

std.

dev

. (m

s)

β = 0

β = 1

β = 2

Figure 5.18: Standard deviation of the difference between the actual and detectedlocations vs. signal to noise ratio for different noise colours. The weight thresholdused for each experiment was 0.07.

In these tests, an acceptance tolerance of ±13ms was used. This value was chosen

because research has shown that this value approximates the standard deviation of

known detection methods[83], and other studies have used this tolerance[34]. This

figure however is not universally accepted. As mentioned previously, ANSI/AAMI

EC57[1] recommends that beats occurring within ±150ms of the annotated time be

considered true positives. Ultimately, the application will determine the acceptable

tolerance. Hence, figure 5.18 shows how the standard deviation of the error depends

upon signal to noise ratio for different noise colours. These results were obtained

by running the detector with the weight threshold fixed at 0.07, and recording

the differences between the predicted and detected P wave peaks which did not

exceed ±150ms. Since the errors are normally distributed, this graph can be used

to calculate the proportion of correct detections which fall within an arbitrary

tolerance. Note that the sampling period for the signal is approximately 4ms.

Page 108: Real Time Extraction of ECG Fiducial Points Using Shape ... · Real Time Extraction of ECG Fiducial Points Using Shape Based Detection This thesis is presented to the School of Computer

86 CHAPTER 5. DETECTION OF P AND T WAVES

θ/◦ std. dev./ms mean/ms-100.00 22.24 2.62-90.00 12.92 0.62-80.00 12.34 0.15-70.00 6.95 0.14-60.00 6.94 -0.30-50.00 6.92 -0.23-40.00 8.16 0.45-30.00 7.84 0.02-20.00 37.05 26.44-10.00 22.69 -8.19

Table 5.5: Distribution of detection error versus P wave position. θ indicates thephase referenced to the R peak. The default value is −60◦. All detections performedwith SNR: 10dB, β: 1.

Wave morphology tolerance

Any useful P or T wave detector needs to perform well when presented with signals

which represent non-ideal ECGs. In order to evaluate this aspect of the detector,

the modified ECGSYN program was used to vary the temporal position, height and

width of the P wave. The temporal position of the P wave is called its “timing”

and is measured in degrees, where −60◦ (the default timing) means that the P wave

occurs one sixth of a full RR period before the R peak. Tables 5.5, 5.6 and 5.7 show

how the distribution of the detection error varies with respect to each of these

parameters whilst keeping the others constant. These tables follow the notation of

[52] and denote the timing, height and width parameters as θ, a and b respectively.

In each case, a signal to noise ratio of 10dB, with β = 1 was used.

Examination of table 5.5 shows that variations in the P wave’s temporal position

up to ±30◦ have negligible effect on the detector’s performance. Beyond this range,

the P wave starts to coincide with the T waves and R peaks.

Page 109: Real Time Extraction of ECG Fiducial Points Using Shape ... · Real Time Extraction of ECG Fiducial Points Using Shape Based Detection This thesis is presented to the School of Computer

5.4. EXPERIMENTAL RESULTS 87

a/mV std. dev./ms mean/ms0.10 5.94 -0.390.20 4.29 -0.340.40 3.27 -0.140.60 3.19 -0.200.80 3.19 -0.151.00 7.03 -0.481.20 7.17 -0.501.40 7.28 -0.461.60 9.68 -0.861.80 7.18 -0.53

Table 5.6: Distribution of detection error versus P wave amplitude. a indicates theamplitude of the P wave. The default value is 0.75mV. All detections performed withSNR: 10dB, β: 1.

b/ms std. dev./ms mean/ms.05 53.88 5.36.10 29.18 -2.58.20 8.56 -0.71.30 8.69 0.13.40 13.04 0.31.50 17.38 1.62.60 22.04 1.98.70 26.09 3.69.80 30.88 5.71

Table 5.7: Distribution of detection error versus P wave width. b indicates the widthof the P wave. The default value is 0.25s. All detections performed with SNR: 10dB,β: 1.

Page 110: Real Time Extraction of ECG Fiducial Points Using Shape ... · Real Time Extraction of ECG Fiducial Points Using Shape Based Detection This thesis is presented to the School of Computer

88 CHAPTER 5. DETECTION OF P AND T WAVES

Execution time

Each of the signals used in these tests contained approximately 1024× 256 samples

(representing a ECG of 17 minutes duration). The mean execution time for each

signal was 1.4s when performed on a 32bit 2.8GHz Pentium IV machine.

5.4.2 Performance tests against the QT database

Whilst synthetically generated signals permit detailed examination of the algo-

rithm’s performance, recorded ECGs provide better confidence in its applicability.

Clinical recordings of ECG signals from the QT database were used to assess the

combination of the P/T wave detection algorithm and a classification heuristic based

on the temporal relationship to the R peak. This heuristic is necessary since, on

the recorded signals, good discrimination between P and T waves was not observed.

The R peaks were detected as a pre-processing stage, using the method described in

chapter 4. Since the first stage of that method is identical to that described above,

it is easy to recognise that optimisation opportunities exist to improve the overall

running speed. The R peaks were detected using 0.2 as the weight threshold.

Discriminating between the P and T waves was performed as follows. Given m

detected R peaks and n P/T waves, a m × n matrix M was constructed, where

each element of M was the temporal difference of the R peak and P/T wave. Two

additional matrices M+ and M− were defined, where each element is defined by

M+i =

Mi if Mi > 0

+∞ otherwise(5.3)

and

M−i =

Mi if Mi < 0

−∞ otherwise. (5.4)

Page 111: Real Time Extraction of ECG Fiducial Points Using Shape ... · Real Time Extraction of ECG Fiducial Points Using Shape Based Detection This thesis is presented to the School of Computer

5.4. EXPERIMENTAL RESULTS 89

The method then proceeds as follows:

1. Define an array W of size m; all elements initially null.

2. Find d, the element of M+ whose value is closest to zero.

3. Let Wc = d, where c is the column of d.

4. Delete the row and column of M+ which contains d.

5. If the number of columns of M+ is greater than zero, goto 2.

6. Find d′, the element of M− whose value is closest to zero.

7. If |d′| < |Wc|, then let Wc = d′, where c is the column of d′.

8. Delete the row and column of M− which contains d′.

9. If the number of columns of M− is greater than zero, goto 6.

10. For each element Wc, ofW which is greater than 0, wave c represents a P wave.

Each element less than or equal to 0, represents a T wave.

This method of classifying beats was used in conjunction with the algorithm to

construct a table of beat by beat comparisons (table 5.8), according to the rec-

ommendations of [1]. The table considers three classes: P, T and O, representing

P waves, T waves and unclassifiable or false detections respectively. When col-

lecting these data, all records in the QT database for which both P and T waves

annotations exist were used — a total of 96 records. Detected beats were matched,

using the method described in ANSI/AAMI EC57, to beats from the “q1c” channel

of the database, with a tolerance of ±150ms. For detecting the P/T waves, the

algorithm was run using 0.02 as the weight threshold.

The large numbers in the ‘O’ column appear because the QT database is only par-

tially annotated. Hence, beats in unannotated areas of the database show as false

Page 112: Real Time Extraction of ECG Fiducial Points Using Shape ... · Real Time Extraction of ECG Fiducial Points Using Shape Based Detection This thesis is presented to the School of Computer

90 CHAPTER 5. DETECTION OF P AND T WAVES

Annotated BeatsDetectedBeats P T OP 2363 276 0T 229 2102 0R 484 849 248671

Table 5.8: Table of beat by beat comparisons of detected P and T waves againstannotated records of the QT database. The ‘O’ column indicates beats annotated assomething other than P or T waves.

detections. No attempt was made to classify detected P/T waves which were anno-

tated as neither P nor T waves. On a 2 class basis, the sensitivity from these figures

is 93.7%. The incomplete annotations of the QT database, prevents calculation of

the specificity.

5.5 Discussion

Visual examination of cases where the algorithm fails to identify the P wave suggests

that the region immediately preceding P is pertinent to successful detection. Fig-

ure 5.19(a) shows several cycles of a synthetically generated ECG, and the results

of applying the wavelet weighted Kupeev algorithm. Observation shows that the

majority of P waves are preceded by a TP segment with a distinct positive slope and

significant deflection below the isoelectric line like that illustrated in figure 5.19(b).

However in cases where the P wave could not be detected, the TP segment had

a negative or zero slope and an average potential at or near zero (figure 5.19(c)).

This observation can be explained by noting the similarity between the shape of this

feature and that of the daubechies 4 mother wavelet (figure 5.20). In the majority

of correctly detected cases, a similarity between the mother wavelet and the P wave

shape can be noticed. However, in the instances where a positively sloped TP seg-

ment is absent, the wavelet has greater similarity to the T wave, which causes false

detections. The negative or zero sloped TP segment most frequently occurs on the

Page 113: Real Time Extraction of ECG Fiducial Points Using Shape ... · Real Time Extraction of ECG Fiducial Points Using Shape Based Detection This thesis is presented to the School of Computer

5.5. DISCUSSION 91

(a) A sequence of ECG cycles with detected P waves indicated. One T wave is erroneouslydetected as a P wave.

(b) Detail of the TP segment preceding a cor-rectly detected P wave.

(c) The TP segment preceding a P wave whichthe algorithm failed to detect.

Figure 5.19: The result of applying the wavelet weighted Kupeev detector to asynthetically generated ECG. Undetected P waves were observed to be preceded bya flat TP segment, whereas correctly detected P waves are generally associated witha positive slope in this region and noticeably greater negative deflection.

Page 114: Real Time Extraction of ECG Fiducial Points Using Shape ... · Real Time Extraction of ECG Fiducial Points Using Shape Based Detection This thesis is presented to the School of Computer

92 CHAPTER 5. DETECTION OF P AND T WAVES

Figure 5.20: The Daubechies-4 mother wavelet. The shape of this wavelet is similarto that of the most commonly manifested P waves, and explains the efficacy of thiswavelet in their detection.

downslope of the underlying low frequency baseline shift, suggesting that high pass

filtering may improve the results.

5.6 Conclusion

The T and P waves are the most important feature of the ECG after the QRS

complex. Identification and delimitation of these features is desirable in order to

predict clinical conditions and for diagnostic purposes. The wavelet transform has

previously been used successfully to identify P and T waves, but required a choice

of wavelet level to be made when analysing the result.

The algorithm presented in this chapter is a hybrid approach, combining the wavelet

transform with the shape based approach of Kupeev. The algorithm requires no

extra heuristics beyond those of the base Kupeev algorithm, and operates with a

complexity no greater than O(n logn). Because the first stage of the algorithm is

identical to that used for R peak detection, applications which need to detect both

R and P can share the results from this stage, thus reducing the overall time to

complete. The P wave detection does not require that the R peak also be detected,

but if it is available, then this information can be used to improve P/T wave dis-

crimination. Experiments showed that the algorithm is generally tolerant to noise,

Page 115: Real Time Extraction of ECG Fiducial Points Using Shape ... · Real Time Extraction of ECG Fiducial Points Using Shape Based Detection This thesis is presented to the School of Computer

5.6. CONCLUSION 93

although elimination of baseline shift may improve P wave detection.

Page 116: Real Time Extraction of ECG Fiducial Points Using Shape ... · Real Time Extraction of ECG Fiducial Points Using Shape Based Detection This thesis is presented to the School of Computer

94 CHAPTER 5. DETECTION OF P AND T WAVES

Page 117: Real Time Extraction of ECG Fiducial Points Using Shape ... · Real Time Extraction of ECG Fiducial Points Using Shape Based Detection This thesis is presented to the School of Computer

Chapter 6

General conclusions and future

research

It is evident that fiducial point detection and classification are important aspects

of biomedical research. Applications may be found in cardiographic instrumen-

tation, the development of therapeutic cardiological devices, prognostic tools and

other areas. In many of these applications it is essential or desirable for the analysis

to be performed whilst connected to the patient (either physically or wirelessly) and

for each point to be detected within some specified finite time from its occurrence.

That is to say, it must operate in real-time. When analysing an ECG, various types

of noise are inevitable and the method of analysis must tolerate this noise. Useful

algorithms are fast, robust and reliable.

6.1 Existing techniques

The literature provides many existing techniques for detecting and/or classifying

fiducial points, and the advent of computer technology has made available many

new and interesting applications for them. Certain techniques rely upon filtering

and several levels of pre-processing, which will conflict with any requirement for the

95

Page 118: Real Time Extraction of ECG Fiducial Points Using Shape ... · Real Time Extraction of ECG Fiducial Points Using Shape Based Detection This thesis is presented to the School of Computer

96 CHAPTER 6. GENERAL CONCLUSIONS AND FUTURE RESEARCH

analysis to be performed in real-time. Some algorithms are stochastic in nature.

The applicability stochastic algorithms is limited to ECGs drawn from a similar

set of subjects similar to that used to train the algorithm. There are two general

requirements of a system intended for real-time fiducial point analysis:

• The number of pre-processing stages should be kept to a minimum.

• If the method is based on stochastic techniques, the demographics of the data

to which the system is optimised must be available and clearly understood.

In the literature reports tend to focus only on the precision of the algorithm and

generally do not discuss its applicability to real-time use.

6.2 Assessment of performance

Although the literature presents a wide range of fiducial point extraction algorithms,

comparison between them is not straightforward. This thesis has examined the ef-

ficacy of established methods of assessment and made recommendations for their

improvement. Not only is there doubt over the most appropriate tolerance to be

used when matching features to a reference source, but there are many possible ways

of matching reference features to features from a system under test. There is no

reason why the method suggested by [1] should not be used, but many publications

make no reference to it, nor to any other method. Furthermore, whilst sensitiv-

ity and specificity are common metrics used to describe a system’s performance,

these are inappropriate when applied to digitally sampled ECG signals, since the

method of calculation makes the metric dependent upon the sampling rate. Two

recommendations of this thesis are:

• A new method of calculating sensitivity and specificity is required. The

method should not depend upon the manner in which the ECG was recorded

and should faithfully represent the probabilities of correct detection and false

detection respectively. One such method has been proposed in section 3.3.3.

Page 119: Real Time Extraction of ECG Fiducial Points Using Shape ... · Real Time Extraction of ECG Fiducial Points Using Shape Based Detection This thesis is presented to the School of Computer

6.3. R PEAK DETECTION 97

• When quoting sensitivity and specificity, the matching tolerance and the al-

gorithm used to perform the matching must be explicitly stated.

In addition, the literature often contains statistics claiming to describe the perfor-

mance of classifiers. Whilst those statistics are useful for the purpose of identifying

areas where a technique performs well or where improvement is required, they are

of little use when choosing a classifier for use within a larger system. In order to

facilitate informed judgement when comparing fiducial point extraction systems,

this thesis recommends that authors make available the table of beat by beat com-

parisons. Such a table can be published either within the text of a paper or by

reference to an external source.

Finally, in many publications the time taken to produce output is not given. Whilst

the differing nature of algorithms might make uniform reporting metrics difficult,

the worst case time and the mean time would be useful to researchers.

6.3 R peak detection

This thesis has introduced a novel approach for fiducial point detection, using a

maxima detection algorithm based upon the shape of features in the ECG. A

demonstrated advantage of this approach is that little or no filtering or other pre-

processing is required, although an improvement in speed can result if the phase

delay can be accepted. A second advantage is that the method requires very few

parameters to be chosen. This means that it does not become over-optimised to a

specific input data set, but is effective at detecting features from the ECGs both

from healthy patients, and also from those exhibiting arrythmias. A simple appli-

cation of the algorithm using the height of peaks as the “weight” parameter proves

to be an effective tool for detecting the R-peaks of the QRS complex. The algo-

rithm’s complexity has an upper bound of O(n logn) and this approaches O(n) as

the signal’s high frequency components are filtered out.

Page 120: Real Time Extraction of ECG Fiducial Points Using Shape ... · Real Time Extraction of ECG Fiducial Points Using Shape Based Detection This thesis is presented to the School of Computer

98 CHAPTER 6. GENERAL CONCLUSIONS AND FUTURE RESEARCH

6.4 P wave detection

The R peak detection algorithm can be extended by combining it with a wavelet

transform approach, to produce an algorithm suitable for detecting P and T waves.

In general, these features do not have large amplitude and they may be indistinct.

However, if present they do posses a distinct morphology. Drawing upon this obser-

vation, this thesis investigates a method where the system used earlier for R peak

detection is modified by choosing the weight value such that higher weights are

awarded to peaks which match the shape of the P wave. The wavelet transform

was used in this role, since it is known to have properties for matching a signal to

the mother wavelet’s shape. In order to maintain emphasis upon real-time detection

however, care has been taken to find a method of calculating the weight parameter

which does not increase the overall complexity of the algorithm.

6.5 Future research

This thesis has introduced a technique for fiducial point extraction and has demon-

strated two separate ways in which it can be applied. Researchers are also interested

in many additional fiducial points which have not been considered herein. The bi-

nary tree used by both variants of the algorithm is rich in geometrical data extracted

from the ECG, and further exploitation of this data could form the impetus for re-

search into the extraction of these other fiducial points.

6.5.1 Detection of minima

Chapters 4 and 5 presented methods involving maxima detection. Clearly, these

methods will also be effective at detecting minima simply by inverting the input

signal. In most instances the Q and S points, which approximate the onset and offset

of the QRS complex, are prominent and would make good candidates for detection

by Kupeev’s algorithm. Such a process would be independent of R peak detection,

Page 121: Real Time Extraction of ECG Fiducial Points Using Shape ... · Real Time Extraction of ECG Fiducial Points Using Shape Based Detection This thesis is presented to the School of Computer

6.5. FUTURE RESEARCH 99

< >W

6current time

Nodes excisedfrom tree aftertime t1 +W

U

New root nodeafter time t2 -

t1

t2

Figure 6.21: A sliding window would require a dynamically modifiable tree. Leafnodes occurring before the window are excised from the tree. New nodes entering thewindow require the tree to be re-rooted. The new nodes becomes the right hand childof the new root.

and could therefore be performed concurrently with it. If parallel processors are

available, this could be done without reduction in speed. As an implementation

detail, it would be unnecessary to actually invert the data. Instead the algorithm

could be generalised to detect either minima or maxima depending on a preset

parameter.

6.5.2 Continuous real-time operation

Kupeev’s algorithm does not produce output until the entire data set has been read

and processed. In section 4.2.6 a shifting window approach was presented which

gives an apparent continuous output. In fact however, the output is delayed for as

much as one window length. Instead of creating windows with discrete positions, it

would be possible to use a single window whose position continuously changes. An

additional advantage of this approach would be the elimination of the need for an

overlap between adjacent windows.

Page 122: Real Time Extraction of ECG Fiducial Points Using Shape ... · Real Time Extraction of ECG Fiducial Points Using Shape Based Detection This thesis is presented to the School of Computer

100 CHAPTER 6. GENERAL CONCLUSIONS AND FUTURE RESEARCH

It would be necessary to dynamically add nodes to the right hand side of the tree,

whilst trimming them from the left hand side, as depicted in figure 6.21. The

deleted nodes would be leaf nodes which fall outside the window. Adding nodes

would involve creating a new root for the tree. The existing root would become

the left hand child of the new root, and a node corresponding to the new peak

would become the right hand peak. Whilst it would be possible to create a new

stack and significance threshold every time the tree changes, doing so would be

computationally expensive. A better approach would be to dynamically insert and

delete values from the stack, as the tree changes. That is to say, the “stack” would

no longer be a stack but a hash table where nodes could be inserted and removed

from arbitrary positions.

6.5.3 Detection of waveform onset and offset

This thesis has concentrated on detecting the maximal points of features. In many

applications the researcher wishes to identify the onset and/or offset of a feature.

In Kupeev’s algorithm, since each node in the binary tree contains the upper and

lower bounds of the peak, it is reasonable to believe that a similar technique could

be used as the basis for determining the onset and offset. The onset of a waveform

is determined by the change of slope of the signal. One indicator of the slope of the

signal is the difference between the lower bound of a node and that of its parent

expressed as a ratio of the difference between the baselines (see figure 6.22). Thus,

identifying where a change in slope occurs, could provide an indication of the onset

of the waveform.

The binary tree represents the entire signal, or windowed portion thereof, and con-

tains many nodes. Typically, each node contains not only the height of each peak,

but also the lower and upper bounds. It is invariant that a parent node has a

smaller lower bound than that of its child. Similarly it has a greater upper bound.

It is reasonable to assume, that in the region of a waveform’s onset, there will be

Page 123: Real Time Extraction of ECG Fiducial Points Using Shape ... · Real Time Extraction of ECG Fiducial Points Using Shape Based Detection This thesis is presented to the School of Computer

6.5. FUTURE RESEARCH 101

∧∆1f(t)

< >∆1t

∧∆2f(t)

∆2t< >

Approximate pointof waveform onset

R

U

Figure 6.22: Principle of a possible system to determine the onset of a feature. Theonset will occur in the region where there is a change in ∆f(t)/∆t.

a larger difference between the bounds of parent and child, compared to the differ-

ences within other parts of the waveform. This observation could be used as the

basis of a system to detect the onset and/or offset of a waveform. Because the data

structures are already present, having found the maximal point of a waveform there

will be little extra complexity finding the onset by this method.

6.5.4 Other applications

Whilst the focus of this thesis is concerned with the extraction of features from

ECG signals, the techniques described might well be applied to other physiological

signals, or indeed to any single dimensional physical signal from which maxima are

required to be extracted. Whilst the details of the techniques’ optimisation will

differ, there is no reason to believe that hitherto unresearched applications cannot

be found for the work.

Page 124: Real Time Extraction of ECG Fiducial Points Using Shape ... · Real Time Extraction of ECG Fiducial Points Using Shape Based Detection This thesis is presented to the School of Computer

102 CHAPTER 6. GENERAL CONCLUSIONS AND FUTURE RESEARCH

Page 125: Real Time Extraction of ECG Fiducial Points Using Shape ... · Real Time Extraction of ECG Fiducial Points Using Shape Based Detection This thesis is presented to the School of Computer

Appendix A

Costs of beat misclassification

This appendix demonstrates one method of assigning costs to incorrect beat clas-

sifications. The propositions used in the calculation are not universally applicable.

Given the class conditional matrix, an ordinal measure for a beat classifier may be

determined, applicable to any particular situation. The application might demand

consideration for classes other than those investigated here. This calculation uses

monetary units to measure costs, which may raise ethical concerns. However, the

methodology imposes no requirement on the nature of the units of cost. Any unit

acceptable to the community of interest may be used.

Each application may have different ancillary parameters, and these may affect

the costs involved. The methods and figures provided in this study reflect the most

general situation, as best as could be determined. Propositions made in calculations

of costs should be examined when applying the figures.

A.1 Extrapolation of data

Where possible, longitudinal studies, giving data gathered over a period of 10 years

or longer have been used. In many instances, the data was available only in graphical

form in which case trapezoidal approximation of integrals was used. Where data

103

Page 126: Real Time Extraction of ECG Fiducial Points Using Shape ... · Real Time Extraction of ECG Fiducial Points Using Shape Based Detection This thesis is presented to the School of Computer

104 APPENDIX A. COSTS OF BEAT MISCLASSIFICATION

over a 10 year period was not available, it was necessary to use data gathered over

a shorter period and extrapolated by the following method.

Presume survival to be described by an exponential expression

s = κeβt (A.1)

where κ and β are constants for which β < 0 and 0 < κ ≤ 1. Equation (A.1) implies

that the mortality fraction m is

m = 1− κeβt. (A.2)

Integrating m over 10 years gives the total loss:

∫ 10

0

1− κeβt dt, (A.3)

which can be expressed as

10− eX

β

[eβ×10 − 1

], (A.4)

where X = lnκ. Thus equation (A.1) implies

ln(s) = X + βt. (A.5)

Hence, X and β can be found from the data by linear regression of t against ln(s),

and the total expected mortality over 10 years from equation (A.4).

A.2 Costs of incorrect classification

Standard clinical treatment of abnormal beats, or non-treatment of normal beats

according to the system’s output is presumed. Costs, in monetary terms, of taking

that course of action under each state of nature are investigated. In this context,

‘costs’ are interpreted to mean the general cost to society, rather than the price

paid by any particular entity. A summary of these figures is presented in Table A.9.

All costs have been normalised the year 2006, and are in Australian dollars except

where otherwise noted.

Page 127: Real Time Extraction of ECG Fiducial Points Using Shape ... · Real Time Extraction of ECG Fiducial Points Using Shape Based Detection This thesis is presented to the School of Computer

A.2. COSTS OF INCORRECT CLASSIFICATION 105

λ ωn ωsveb ωveb ωf ωq

αn 0 38.63a 170.19b 170.19c 0αsveb 0 0 170.19d 170.19e 0αveb 2.15f 2.15g 0 0 0αf 2.15h 2.15i 0 0 0αq 0 0 0 0 0

Table A.9: Costs of false classification in 1000s of AUD

aDatum 5bDatum 13cDatum 13dDatum 13eDatum 13fDatum 14gDatum 14hDatum 14iDatum 14

Proposition 1 The clinical treatment for fusions of normal and ventricular ectopic

beats (class ωf) is identical to that for ventricular ectopic beats.

This proposition is made on the basis that sustained ventricular ectopic beats are

potentially life threatening, and must be treated. To a clinician, the fact that the

polarisation of the waveform coincides with the preceding beat is merely incidental.

Proposition 2 The maximum future projection which may affect costs of misclas-

sification is 10 years.

10 years is chosen as a reasonable period beyond which the advances in medical

technology can be expected to invalidate the results of future prediction.

Datum 1 The expected loss of life of a healthy subject, projected over the next 10

years, is 1.21 years.

This datum is from the control group of Benjamin et al.[9]. This was a longitudinal

study which investigated the mortality of subjects who had developed atrial fibril-

lation. The survival results presented by Figure A of that paper are integrated to

determine the expected number of years of life lost by a healthy subject.

Page 128: Real Time Extraction of ECG Fiducial Points Using Shape ... · Real Time Extraction of ECG Fiducial Points Using Shape Based Detection This thesis is presented to the School of Computer

106 APPENDIX A. COSTS OF BEAT MISCLASSIFICATION

Women without atrial fibrillation 0.87Men without atrial fibrillation 1.55Mean Average 1.21

Women with atrial fibrillation 3.75Men with atrial fibrillation 4.05Mean Average 3.90

Expected Loss Due to AF 2.69

Table A.10: Expected Loss of life due to Atrial Fibrillation

Datum 2 The probability that a subject with supra-ventricular ectopic beats will

develop atrial fibrillation is 0.324.

Datum 2 comes from the results of Frost et al.[29].

Datum 3 The expected loss of life due to a person suffering from atrial fibrillation

is 2.69 years (projected over 10 years).

Datum 3 is determined from Benjamin et al. in a similar fashion to Datum 1: The

calculations are presented in Table A.10.

Datum 4 A person’s contribution to society is $44,320 per annum.

Datum 4 is the mean average wage in Australia for the year 2006[5].

Datum 5 The cost of misdiagnosing a supra-ventricular ectopic beat as a normal

beat, λ(αn|ωsveb) is $38,627.

This figure is the product of Data 2, 3 and 4.

Datum 6 The probability of initially surviving ventricular fibrillation is 146886

=

0.164.

Page 129: Real Time Extraction of ECG Fiducial Points Using Shape ... · Real Time Extraction of ECG Fiducial Points Using Shape Based Detection This thesis is presented to the School of Computer

A.2. COSTS OF INCORRECT CLASSIFICATION 107

Group P loss of life ExpectationSurvival 0.16a × 6.36b = 1.04Non-survival 0.84 × 10 = 8.40Healthy subject (1.21)c

Total loss due to VF 8.19

aDatum 6bDatum 7cDatum 1

Table A.11: Expected Loss of life due to Ventricular Fibrillation

Baum et al.[7], reports that, in a 3 year study of ventricular fibrillation cases, 146

patients out of 886 initially survived ventricular fibrillation.

Datum 7 The total expected loss of life by a person who initially survives ventric-

ular fibrillation is 6.33 years (projected over 10 years).

To derive Datum 7 the results of Baum et al.[7] are used. In Figure 2 of that

paper, survival curves are presented for subjects who initially survived ventricular

fibrillation. Survival data are presented for only 24 months. Survival data over a

10 year period are extrapolated by the method described above.

Datum 8 The expected loss of life, attributable to ventricular fibrillation, by a

subject who suffers ventricular fibrillation is 8.19 years (projected over 10 years).

From Datum 3 it can be seen that the expected loss of life of healthy subjects is

1.21 years. Hence one can calculate the loss due to ventricular fibrillation as per

Table A.11.

Datum 9 The expected loss of life, attributable to ventricular tachycardia by a

subject who suffers ventricular tachycardia is 2.59 years (projected over 10 years).

This datum was obtained from Doval et al.[24] by the data extrapolation method

described previously. In that study of 516 subjects both with and without non-

sustained ventricular tachycardia, the projected loss over 10 years for the group

Page 130: Real Time Extraction of ECG Fiducial Points Using Shape ... · Real Time Extraction of ECG Fiducial Points Using Shape Based Detection This thesis is presented to the School of Computer

108 APPENDIX A. COSTS OF BEAT MISCLASSIFICATION

with ventricular tachycardia was 9.24 years, whereas the projected loss for the

group without ventricular tachycardia was 6.65 years. The difference is 2.59 years.

Datum 10 The probability that a subject who experiences one or more episodes of

ventricular ectopic beats, will develop ventricular fibrillation is 0.34.

Datum 11 The probability that a subject who experiences one or more episodes of

ventricular ectopic beats, will develop ventricular tachycardia is 0.41.

Datum 10 and Datum 11 are implied from Carrim and Khan[12]. In that study

of 44 subjects exhibiting ventricular ectopic beats, V T is the set of subjects devel-

oping ventricular tachycardia and V F is the set of subjects developing ventricular

fibrillation. From their data:

|V T ∪ V F | = 21, (A.6)

|V T ∩ V F | = 6, (A.7)

and

|V F ∩ V T | = 3, (A.8)

from which one can deduce that |V T ∩V F | = 12, |V T | = 18 and |V F | = 15. Thus,

P (veb V T ) =|V T ||E| =

18

44(A.9)

and

P (veb V F ) =|V F ||E| =

15

44. (A.10)

Datum 12 The expected loss of life, when a ventricular ectopic beat is misdiagnosed

as a normal beat is 3.84 years.

Datum 12 is derived from Data 10, 11, 8 and 9. The derivation is shown in Ta-

ble A.12.

Page 131: Real Time Extraction of ECG Fiducial Points Using Shape ... · Real Time Extraction of ECG Fiducial Points Using Shape Based Detection This thesis is presented to the School of Computer

A.2. COSTS OF INCORRECT CLASSIFICATION 109

Group P loss of life ExpectationTachycardia 0.41a × 2.59 b = 1.06Fibrillation 0.34c × 8.19 d = 2.78Total 3.84

aDatum 11bDatum 9cDatum 10dDatum 8

Table A.12: Expected loss of life due to Ventricular Ectopic Beats

Datum 13 The cost of misdiagnosing a ventricular ectopic beat as a normal beat,

λ(αn|ωveb) is $170,189.

This is the product of Datum 12 and Datum 4. By Proposition 1 the same cost is

attributed to λ(αn|ωf).

A.2.1 Costs of misclassification of a normal beat as abnor-

mal

Ventricular ectopic beats are of potential concern to a physician. If a system misclas-

sifies a normal beat (ωn), or a supra-ventricular ectopic beat (ωsveb) as ventricular

ectopic beat or a fusion beat (decisions αveb and αf), the likely result is that the

patient will be unnecessarily detained in observation, pending further examination.

Thus, the cost of misclassification, in this case, is the cost of retaining a patient in

intensive care for one day.

Datum 14 The cost of retaining a patient in intensive care for 1 day is $2146

This datum is the mean average of figures obtained from two independent Australian

health insurance providers. A case study by Rechner and Lipman[62] for the year

2003 cites the figure $2670. This study however was conducted within a teaching

hospital, and we therefore expect the costs to be higher than average.

Page 132: Real Time Extraction of ECG Fiducial Points Using Shape ... · Real Time Extraction of ECG Fiducial Points Using Shape Based Detection This thesis is presented to the School of Computer

110 APPENDIX A. COSTS OF BEAT MISCLASSIFICATION

The cost of retaining a patient in intensive care for one day is the cost of mis-

classification of a normal beat. Thus λ(αveb|ωn) = λ(αf|ωn) = λ(αveb|ωsveb) =

λ(αf|ωsveb) = $2146.

From Proposition 1 one can conclude that λ(αf|ωveb) = λ(αveb|ωf) = 0.

A.2.2 Erroneous classification of beats as supra-ventricular

ectopic beats

Unlike ventricular ectopic beats, supra-ventricular ectopic beats are typically not life

threatening, and are therefore not normally treated unless recurrent[47]. Thus, the

cost of misclassification as a normal beat (λ(αsveb|ωn)) is zero. By the same token,

misclassification of ventricular ectopic beats or fusion beats as supra-ventricular

ectopic beats bears the same penalty as an erroneous classification as a normal

beat. Thus λ(αsveb|ωveb) = λ(αn|ωveb) and λ(αsveb|ωf) = λ(αn|ωf).

Page 133: Real Time Extraction of ECG Fiducial Points Using Shape ... · Real Time Extraction of ECG Fiducial Points Using Shape Based Detection This thesis is presented to the School of Computer

Bibliography

[1] Testing and reporting performance results of cardiac rhythm and ST-segment

measuring algorithms. Arlington, VA, USA, 1988. Published as American

National Standard ANSI/AAMI EC57:1988.

[2] The QT database. Online database, 1997. http://www.physionet.org/

physiobank/database/html/mitdbdir/qtdb/.

[3] Douglas G. Altman and J. Martin Bland. Statistics notes: Diagnostic tests 2:

predictive values. British Medical Journal, Volume 309, Number 6947, pages

102, 1994.

[4] Rodrigo V. Andreao, Bernadette Dorizzi and Jerome Boudy. ECG signal anal-

ysis through hidden Markov models. IEEE Transactions on Biomedical Engi-

neering, Volume 53, Number 8, pages 1541–1549, August 2006.

[5] Australian Bureau of Statistics. 6306.0 — employee earnings and hours, Aus-

tralia, May 2006, February 2007. http://www.abs.gov.au/ausstats/abs@

.nsf/mf/6306.0/.

[6] S. Serge Barold. Willem Einthoven and the birth of clinical electrocardiography

a hundred years ago. Cardiac Electrophysiology Review, Volume 7, pages 99–

104, 2003.

[7] Robert S. Baum, Hernan Alvarez III and Leonard A. Cobb. Survival after re-

suscitation from out-of-hospital ventricular fibrillation. Circulation, Volume 50,

pages 1231–1235, December 1974.

111

Page 134: Real Time Extraction of ECG Fiducial Points Using Shape ... · Real Time Extraction of ECG Fiducial Points Using Shape Based Detection This thesis is presented to the School of Computer

112 BIBLIOGRAPHY

[8] Russell Beale and T. Jackson. Neural Computing: An Introduction. CRC

Press, 1990.

[9] Emila J. Benjamin, Philip A. Wolf, Ralph B. D’Agostino, Halit Silbershatz,

William B. Kannel and Daniel Levy. Impact of atrial fibrillation on the risk of

death: The Framingham heart study. Circulation, Volume 98, pages 946–952,

May 1998.

[10] Daniel M. Bloomfield, Stefan H. Hohnloser and Richard J. Cohen. Interpreta-

tion and classification of microvolt T wave alternans tests. Journal of Cardio-

vascular Electrophysiology, Volume 13, Number 5, pages 502–512, May 2002.

[11] A. S. Bugaev, V. V. Chapursky, S. I. Ivashov, V. V. Razevig, A. P. Sheyko and

I. A. Vasilyev. Through wall sensing of human breathing and heart beating by

monochromatic radar. In Proceedings of the Tenth International Conference

on Ground Penetrating Radar, pages 291–294, June 2004.

[12] Zia I. Carrim and Ashraf A. Khan. Mean frequency of premature ventricular

complexes and predictor of malignant ventricular arrythmias. The Mount Sinai

Journal of Medicine, Volume 72, Number 6, pages 374–380, March 2005.

[13] H. C. Chen and S. W. Chen. A moving average based filtering system with its

application to real-time QRS detection. Computers in Cardiology, Volume 30,

pages 585–588, 2003.

[14] Ivalyo Christov and G. Bortolan. Ranking of pattern recognition parameters

for premature ventricular contractions classification by neural networks. Phys-

iological Measurement, Volume 25, pages 1281–1290, 2004.

[15] Ivaylo Christov. Real time electrocardiogram QRS detection using combined

adaptive threshold. BioMedical Engineering OnLine, Volume 3, Number 28,

August 2004.

Page 135: Real Time Extraction of ECG Fiducial Points Using Shape ... · Real Time Extraction of ECG Fiducial Points Using Shape Based Detection This thesis is presented to the School of Computer

BIBLIOGRAPHY 113

[16] Ivaylo Christov, German Gomez-Herrero, Vessela Krasteva, Irena Jekova,

Atanas Gotchev and Karen Egiazarian. Comparative study of morphologi-

cal and time-frequency ECG descriptors for heartbeat classification. Medical

Engineering and Physics, Volume 28, Number 9, pages 876–887, November

2006.

[17] Gari D. Clifford. ECG statistics, noise, artifacts and missing data. In Gari D.

Clifford, Francisco Azuaje and Patrick E. McSharry (editors), Advanced Meth-

ods and Tools for ECG Data Analysis, Chapter 3, pages 55–99. Artech House

Inc, 685 Canton St. Norwood, MA 02062, 2006.

[18] Gari D. Clifford. Linear filtering methods. In Gari D. Clifford, Francisco

Azuaje and Patrick E. McSharry (editors), Advanced Methods and Tools for

ECG Data Analysis, Chapter 5, pages 135–170. Artech House Inc, 685 Canton

St. Norwood, MA 02062, 2006.

[19] Gari D. Clifford, Francisco Azuaje and Patrick E. McSharry (editors). Ad-

vanced Methods and Tools for ECG Data Analysis. Artech House Inc, 685

Canton St. Norwood, MA 02062, 2006.

[20] Philip de Chazal, Maria O’Dwyer and Richard B. Reilly. Automatic classifi-

cation of heartbeats using ECG morphology and heartbeat interval features.

IEEE Transactions on Biomedical Engineering, Volume 51, Number 7, pages

1196–1206, July 2004.

[21] Philip de Chazal and Richard B. Reilly. A comparison of the ECG classification

performance of different feature sets. Computers in Cardiology, Volume 27,

pages 327–330, 2000.

[22] Polychronis E. Dilaveris and John E. Gialofos. P-wave dispersion: A novel

predictor of paroxysmal atrial fibrillation. Annals of Noninvasive Electrocardi-

ology, Volume 6, Number 2, pages 159–165, 2001.

Page 136: Real Time Extraction of ECG Fiducial Points Using Shape ... · Real Time Extraction of ECG Fiducial Points Using Shape Based Detection This thesis is presented to the School of Computer

114 BIBLIOGRAPHY

[23] Ivan A. Dotsinsky and Todor V. Stoyanov. Ventricular beat detection in single

channel electrocardiogram. BioMedical Enineering OnLine, Volume 3, Num-

ber 3, January 2004.

[24] Hernan Doval, Daniel Nul, Hugo Grancelli, Sergio Varini, Saul Soifer, Gianni

Corrado, Sergio Dubner, Omar Scapin and Sergio Perrone. Nonsustained ven-

tricular tachycardia in severe heart failure: Independent marker of increased

mortality due to sudden death. Circulation, Volume 94, Number 12, pages

3198–3203, December 1996.

[25] Richard O. Duda and Peter E. Hart. Pattern Classification and Scene Analysis,

Chapter 2, pages 10–39. Kluwer Academic Publishers, 1st edition, 1973.

[26] Raksesh Dugad and U. B. Desai. A tutorial on hidden Markov models. Tech-

nical Report SPANN-96-1, Signal Processing and Artificial Neural Networks

Laboratory, Dept. of Electrical Engineering, Indian Institute of Technology,

Powai, Mumbai 400 076 India, May 1996.

[27] Ken Freeman and Avtar Singh. P wave detection of ambulatory ECG. In

Annual International Conference of the IEEE Engineering in Medicine and

Biology Society, Volume 13. IEEE, 1991.

[28] Gary M. Friesen, Thomas C. Jannett, Stanford L. Yates, Stephen R. Quint

and H. Troy Nagle. A comparison of the noise sensitivity of nine QRS detec-

tion algorithms. IEEE Transactions on Biomedical Engineering, Volume 37,

Number 1, pages 85–98, January 1990.

[29] L. Frost, H. Mølgaard, E. H. Christiansen, C-J. Jacobsen, H. Allermand and

P. E. B. Thomsen. Low vagal tone and supraventricular ectopic activity predict

atrial fibrillation and flutter after coronary artery bypass grafting. European

Heart Journal, Volume 16, pages 825–831, 1995.

Page 137: Real Time Extraction of ECG Fiducial Points Using Shape ... · Real Time Extraction of ECG Fiducial Points Using Shape Based Detection This thesis is presented to the School of Computer

BIBLIOGRAPHY 115

[30] M. Galassi, J. Davies, J. Theiler, B. Gough, G. Jungman, M. Booth and

F. Rossi. GNU Scientific Library Reference Manual. Network Theory Ltd.,

Bristol, United Kingdom, 2nd edition, February 2007. ISBN 0954161734.

[31] A. L. Goldberger, L. A. N. Amaral, L. Glass, J. M. Hausdorff, P. Ch.

Ivanov, R. G. Mark, J. E. Mietus, G. B. Moody, C.-K. Peng and H. E.

Stanley. PhysioBank, PhysioToolkit, and PhysioNet: Components of a new

research resource for complex physiologic signals. Circulation, Volume 101,

Number 23, pages e215–e220, 2000 (June 13). Circulation Electronic Pages:

http://circ.ahajournals.org/cgi/content/full/101/23/e215.

[32] A. I. Hernandez, G. Carrault and F. Mora. Improvement of a P-wave detector

by a bivariate classification stage. Transactions of the Institute of Measurement

and Control, Volume 22, Number 3, pages 231–242, 2000.

[33] Steven A. Israel, John M. Irvine, Andrew Cheng, Mark D. Wiederhold and

Brenda K. Wiederhold. ECG to identify individuals. Pattern Recognition,

Volume 38, pages 133–142, 2005.

[34] R. Jane, A. Blasi, J. Garcıa and P. Laguna. Evaluation of an automatic thresh-

old based detector of waveform limits in holter ECG with the QT database.

Computers in Cardiology, Volume 24, pages 295–298, 1997.

[35] Janice M. Jenkins, Delon Wu and Robert C. Arzbaecher. Computer diagno-

sis of supraventricular and ventricular arrhythmias. Circulation, Volume 60,

Number 5, pages 977–987, 1979.

[36] Shubha Kadambe. Wavelet transform-based QRS complex detector. IEEE

Transactions on Biomedical Engineering, Volume 46, Number 7, pages 838–

848, July 1999.

[37] Alan H. Kadish, Alfred E. Buxton, Harold L. Kennedy, Bradley P. Knight,

Jay W. Mason, Claudio D. Schuger and Cynthia M. Tracy. ACC/AHA clinical

Page 138: Real Time Extraction of ECG Fiducial Points Using Shape ... · Real Time Extraction of ECG Fiducial Points Using Shape Based Detection This thesis is presented to the School of Computer

116 BIBLIOGRAPHY

competence statement on electrocardiography and ambulatory electrocardiog-

raphy. Circulation, Volume 104, pages 3169–3178, 2001.

[38] Arnold M. Katz. Physiology of the Heart. Lippincott Williams & Wilkins,

Philadelphia, PA 19106, USA, 3rd edition, 2001.

[39] Eamonn Keogh and Chotirat Ann Ratanamahana. Exact indexing of dynamic

time warping. Knowledge and Information Systems, Volume 7, pages 358–386,

2005.

[40] Bert-Uwe Kohler, Carsten Hennig and Reinhold Orglmeister. The principles

of software QRS detection. IEEE Engineering in Medicine and Biology, 2002.

[41] Peter R. Kowey and Dusan Z. Kocovic. Ambulatory electrocardiographic

recording. Circulation, Volume 108, pages e31–e33, 2003.

[42] Konstantin Y. Kupeev. On significant maxima detection: A fine-to-coarse al-

gorithm. In Proceedings of the 13th International IEEE Conference on Pattern

Recognition, Volume 2, pages 270–274, Los Alamitos, CA, USA, August 1996.

IEEE.

[43] P. Laguna, R. G. Mark, A. Goldberg and G. B. Moody. A database for eval-

uation of algorithms for measurement of QT and other waveform internals in

the ECG. Computers in Cardiology, Volume 24, pages 673–676, 1997.

[44] Paul Lander and Edward J. Berbari. Time-frequency plane Wiener filtering

of the high-resolution ECG: Development and application. IEEE Transactions

on Biomedical Engineering, Volume 44, Number 4, pages 256–265, April 1997.

[45] Cuiwei Li, Chongxun Zheng and Changfeng Tai. Detection of ECG charac-

teristic points using wavelet transforms. IEEE Transactions on Biomedical

Engineering, Volume 42, Number 1, pages 21–28, January 1995.

Page 139: Real Time Extraction of ECG Fiducial Points Using Shape ... · Real Time Extraction of ECG Fiducial Points Using Shape Based Detection This thesis is presented to the School of Computer

BIBLIOGRAPHY 117

[46] Ronald A. Li, Michelle Leppo, Takashi Miki, Susumu Seino and Eduardo

Marban. Molecular basis of electrocardiographic ST-segment elevation. Circu-

lation Research, Volume 87, pages 837–839, 2000.

[47] Carina Blomstrom Lundqvist. ACC/AHA/ESC guidelines for the management

of patients with supraventricular arrhythmias — executive summary a report

of the American College of Cardiology/American Heart Association task force

on practice guidelines and the European Society of Cardiology committee for

practice guidelines (writing committee to develop guidelines for the manage-

ment of patients with supraventricular arrhythmias). Journal of the American

College of Cardiology, Volume 42, Number 8, pages 1493–1531, 2003. Devel-

oped in Collaboration with NASPE-Heart Rhythm Society.

[48] Marek Malik. Errors and misconceptions in ECG measurement used for the de-

tection of drug induced QT interval prolongation. Journal of Electrocardiology,

Volume 37, pages 25–33, 2004.

[49] Juan Pablo Martınez, Rute Almeida, Salvador Olmos, Ana Paula Rocha and

Pablo Laguna. A wavelet-based ECG delineator: Evaluation on standard

databases. IEEE Transactions on Biomedical Engineering, Volume 31, Num-

ber 4, pages 371–381, April 2004.

[50] Juan Pablo Martınez, Salvador Olmos and Pablo Laguna. Evaluation of a

wavelet-based ECG waveform detector on the QT database. Computers in

Cardiology, Volume 27, pages 81–84, 2000.

[51] Patrick E. McSharry and Gari D. Clifford. ECGSYN - a realistic ECG wave-

form generator. Free Software, published by Internet. http://www.physionet.

org/physiotools/ecgsyn/ Accessed September 2007.

Page 140: Real Time Extraction of ECG Fiducial Points Using Shape ... · Real Time Extraction of ECG Fiducial Points Using Shape Based Detection This thesis is presented to the School of Computer

118 BIBLIOGRAPHY

[52] Patrick E. McSharry, Gari D. Clifford, Lionel Tarassenko and Leonard A.

Smith. A dynamical model for generating synthetic electrocardiogram sig-

nals. IEEE Transactions on Biomedical Engineering, Volume 50, Number 3,

pages 289–294, March 2003.

[53] S. L. Melo, L. P. Caloba and J. Nadal. Arrhythmia analysis using artificial

neural network and decimated electrocardiographic data. Computers in Car-

diology, Volume 27, pages 73–76, 2000.

[54] N. Nikolaev, Z. Nikolov, A. Gotchev and K. Egiazarian. Wavelet domain

Wiener filtering for ECG denoising using improved signal estimate. In IEEE In-

ternational Conference on Acoustics, Speech, and Signal Processing, Volume 6,

pages 3578–3581. ICASSP, IEEE, 2000.

[55] Masahiko Okada. A digital filter for the QRS complex detection. IEEE Trans-

actions on Biomedical Engineering, Volume 26, Number 12, pages 700–703,

December 1979.

[56] Jaipu Pan and Willis J. Tompkins. A real-time QRS detection algorithm.

IEEE Transactions on Biomedical Engineering, Volume 32, Number 3, pages

230–236, March 1985.

[57] W. W. Peterson, T. G. Birdsall and W. C. Fox. The theory of signal detectabil-

ity. IEEE Transactions on Information Theory, Volume 4, Number 4, pages

171–212, September 1954.

[58] Riccardo Poli, Stefano Cagnoni and Guido Valli. Genetic design of optimum

linear and nonlinear QRS detectors. IEEE Transactions on Biomedical Engi-

neering, Volume 42, Number 11, pages 1137–1141, November 1995.

[59] M. Potter, N. Gadhok and W. Kinsner. Separation performance of ICA on

simulated EEG and ECG signals contaminated by noise. In Proceedings of

the 2002 IEEE Canadian Conference on Electrical & Computer Engineering,

pages 1099–1104. IEEE, 2002.

Page 141: Real Time Extraction of ECG Fiducial Points Using Shape ... · Real Time Extraction of ECG Fiducial Points Using Shape Based Detection This thesis is presented to the School of Computer

BIBLIOGRAPHY 119

[60] William K. Pratt. Generalized Wiener filtering techniques. IEEE Transactions

on Computers, Volume C-21, Number 7, pages 636–641, July 1972.

[61] Lawrence R. Rabiner and Biing-Hwang Juang. An introduction to hidden

Markov models. IEEE ASSP Magazine, Volume 3, Number 1, pages 4–16,

January 1986.

[62] I. J. Rechner and J. Lipman. The costs of caring for patients in a tertiary

refereral Australian intensive care unit. Anaesthesia Intensive Care, Volume 33,

Number 4, pages 477–482, August 2005.

[63] J. S. Sahambi, S. N. Tandon and R. K. P. Bhatt. Using wavelet transforms

for ECG characterization. IEEE Engineering in Medicine and Biology, pages

77–83, January/February 1997.

[64] Stephen M. Salerno, Patrick C. Aliguire and Herbert S. Waxman. Competency

in interpretation of 12-lead electrocardiograms: A summary and appraisal of

published evidence. Annuls of Internal Medicine, Volume 138, Number 9, pages

751–761, 2003.

[65] Stan Salvador and Philip Chan. Toward accurate dynamic time warping in

linear time and space. Intelligent Data Analysis, Volume 11, Number 5, pages

561–580, 2007.

[66] Michail I. Schlesinger and Vaclav Hlavac. Ten Lectures on Statistical and

Structural Pattern Recognition, Volume 24, Chapter 1, pages 1–22. Kluwer

Academic Publishers, 2002.

[67] Paul Schluter, Scott Peterson, George Moody, Larry Siegal, Cheryl Jack-

son, Diane Perry, Esmerey Acarturk, John Aumiller, Sidney Blake, Alvin

Blaustein, Chester Conrad, Gary Heller, Michael Malagold, Roger Mark and

Candice Miklozek. MIT-BIH arrhythmia database directory. Online database,

1987. http://www.physionet.org/physiobank/database/html/mitdbdir/

mitdbdir.htm.

Page 142: Real Time Extraction of ECG Fiducial Points Using Shape ... · Real Time Extraction of ECG Fiducial Points Using Shape Based Detection This thesis is presented to the School of Computer

120 BIBLIOGRAPHY

[68] Jonathan S. Steinberg, Steven Zelenkofske, Shing-Chiu Wong, Mark Gelernt,

Robert Sciacca and Edith Menchavez. Value of the P-wave signal averaged

ECG for predicting atrial fibrillation. Circulation, Volume 88, pages 2618–

2622, 1993.

[69] Karsten Sternickel. Automatic pattern recognition in ECG time series. Com-

puter Methods and Programs in Biomedicine, Volume 68, pages 109–115, 2002.

[70] Yan Sun, Kap Luk Chan and Shankar Muthu Krishnan. Characteristic wave

detection in ECG signal using morphological transform. BMC Cardiovascular

Disorders, Volume 5, Number 28, September 2005.

[71] Yukinori Suzuki. Self-organizing QRS-wave recognition in ECG using neural

networks. IEEE transactions on Neural Networks, Volume 6, Number 6, pages

1469–1477, November 1995.

[72] John A. Swets, Wilson P. Tanner and Theodore G. Birdsall. Decision processes

in perception. In John A. Swets (editor), Signal Detection and Recognition by

Human Observers, Chapter 1, pages 3–57. John Wiley & Sons, 1964.

[73] P. Szendro, G. Vincze and A. Szasz. Pink-noise behaviour of biosystems. Eu-

ropean Biophysics Journal, Volume 30, pages 227–231, 2001.

[74] Heinz Theres, Weimin Sun, William Combs, Eric Panken, Hardwin Mead, Gert

Baumann and Karl Stangl. P wave and far-field R wave detection in pacemaker

patient atrial electrograms. Pacing and Clinical Electrophysiology, Volume 23,

pages 434–440, April 2000.

[75] Dominic A.M.J. Theuns, A. Peter J. Klootwijk, Dick M. Goedhart and

Luc J.L.M. Jordaens. Prevention of inappropriate therapy in implantable

cardioverter-defibrillators: Results of a prospective, randomized study of tach-

yarrhythmia detection algorithms. Journal of the American College of Cardi-

ology, Volume 44, Number 12, pages 2362–2367, 2004.

Page 143: Real Time Extraction of ECG Fiducial Points Using Shape ... · Real Time Extraction of ECG Fiducial Points Using Shape Based Detection This thesis is presented to the School of Computer

BIBLIOGRAPHY 121

[76] P. E. Trahanias. An approach to QRS complex detection using mathemati-

cal morphology. IEEE Transactions on Biomedical Engineering, Volume 40,

Number 2, pages 201–205, February 1993.

[77] C. Valens. A really friendly guide to wavelets. http://citeseer.ist.psu.

edu/valens99really.html Accessed June 2007.

[78] Ba-Ngu Vo, Antonio Cantoni and Kok Lay Teo. Filter Design with Time

Domain Mask Constraints: Theory and Applications, Volume 56 of Applied

Optimization. Kluwer Academic Press, 2001.

[79] Malcolm Woollard, Richard Whitfield, Anna Smith, Michael Colquhoun,

Robert G. Newcombe, Norman Vetter and Douglas Chamberlain. Skill acqui-

sition and retention in automated external defibrillator (AED) use and CPR

by lay responders: a prospective study. Resuscitation, Volume 60, Number 1,

pages 17–28, January 2004.

[80] Qin Xi, Alan V. Sahakian and Steven Swiryn. The effect of QRS cancellation on

atrial fibrillatory wave signal characteristics in the surface electrocardiogram.

Journal of Electrocardiology, Volume 36, Number 3, pages 243–249, 2003.

[81] Wu Xiaomei, Yang Cuiwei and Fang Zuxiang. The simultaneous multiple sites

epicardial mapping of ventricular fibrillation. In Engineering in Medicine and

Biology 27th Annual Conference, pages 3861–3863. IEEE, September 2005.

[82] Qiuzhen Xue, Yu Hen Hu and Willis J. Tompkins. Neural-network-based adap-

tive matched filtering for QRS detection. IEEE Transactions on Biomedical

Engineering, Volume 39, Number 4, pages 317–329, April 1992.

[83] C. Zywietz and D. Celikag. Testing results and derivation of minimum per-

formance criteria for computerized ECG-analysis. Computers in Cardiology,

pages 97–100, 1992.


Recommended