EKG realtime

7
IEEE TRANSACTIONS O N BIOMEDICAL ENGINEERING, VOL. BME-32, N O . 3 , MARCH 1985 A Real-Time Q R S Detection Algorithm JIAPU P AN AND WILLIS J . TOMPKINS, SENIOR MEMBER, IEEE Abstract-We have developed a real-time algorithm f or detection o f t h e QR S complexes o f E CG signals. It reliably recognizes QR S com- plexes based upon digital analyses o f slope, amplitude, a n d width. A special digital bandpass filter reduces false detections caused by t h e var- ious types o f interference present in E CG signals. This filtering permits u s e o f l o w thresholds, thereby increasing detection sensitivity. T he algo- rithm automatically adjusts thresholds a n d parameters periodically t o adapt t o such E CG changes a s QR S morphology a n d heart rate. F o r t h e standard 2 4 h MIT/BIH arrhythmia database, this algorithm cor- rectly detects 99.3 percent o f t h e Q R S complexes. INTRODUCTION THERE a r e many uses f o r a reliable Q R S recognition algo- rithm. Computer interpretation of t h e 12-lead EC G i s a popular technique. Coronary care units n o w u s e arrhythmia monitors extensively. Widely used Holter tape recording r e - quires a Holter scanning device that includes a QRS detector to analyze t h e tapes much faster than real time. Currently under development a r e arrhythmia monitors f o r ambulatory patients which analyze t h e E C G i n real time [ 1 ] -[31. When n arrhythmia appears, such a monitor c an b e programmed to immediately store a n interval o f the abnormal E C G f o r sub- sequent transmission t o a central station where a physician c a n interpret i t . Such a device requires a very accurate QR S recog- nition capability. False detection results i n unnecessary trans- mission o f data t o t h e central station o r requires a n excessively large memory t o store a n y E C G segments that a r e unnecessarily captured. Thus, a n accurate QR S detector is a n important part o f many E C G instruments. QR S detection i s difficult, n o t only because o f t h e physio- logical variability of t h e QR S complexes, b u t also because o f the various types o f noise that c a n be present i n t h e EC G signal. Noise sources include muscle noise, artifacts d u e to electrode motion, power-line interference, baseline wander, a n d T waves with high-frequency characteristics similar t o QR S complexes. In our approach, digital filters reduce h e influence o f these noise sources, a n d thereby improve the signal-to-noise ratio. O f the many Q R S detectors proposed i n t h e literature, f ew give serious enough attention t o noise reduction. Software QR S detectors typically include o n e o r more of three different types of processing steps: linear digitalfiltering, nonlinear transformation, a n d decision rule algorithms [4]. W e u s e a l l three types. Linear processes include a bandpass filter, Manuscript received July 2 7 , 1984; revised October 2 4 , 1984. This work w a s supported i n part b y h e National Institutes o f Health under Grant HL00765. J . P a n i s with t h e Department o f Biophysics, Shanghai Second Medical College, Shanghai, People's Republic of China. W . J . Tompkins i s with t h e Department o f Electrical a n d Computer Engineering, University o f Wisconsin, Madison, W I 53706. a derivative, a n d a moving window integrator. Th e nonlinear transformation that w e u se i s signal amplitude squaring. Adaptive thresholds a n d T-wave discrimination techniques pro- vide part of thedecision rule algorithm. T h e slope o f the R wave i s a popular signal feature used t o locate t h e Q R S complex i n many QR S detectors [5]. A n analog circuit or a real-time derivative algorithm that provides slope information i s straightforward t o implement. However, b y i ts very nature, a derivative amplifies t h e undesirable higher frequency noise components. Also, many abnormal QR S com- plexes with large amplitudes a n d long durations a re missed i n a purely derivative approach because o f their relatively l o w R - wave slopes. Thus, R-wave slope alone i s insufficient f o r proper Q RS detection. T o achieve reliable performance, w e must e x - tract other parameters from t h e signal such a s amplitude, width, a n d QR S energy [6], [7]. I t i s very important t o evaluate a QR S detector algorithm using a standard arrhythmia database. There a r e n o w t w o such databases available: MIT/BIH [ 8 ] a n d A H A (American Heart Association) [ 9 ] . T h e performance o f a n algorithm o n a data- base i s n o t t h e ultimate answer a s t o i t s utility i n a clinical e n - vironment, b ut it provides a standardized means o f comparing t h e basic performance o f o n e algorithm to another. ALGORITHM OVERVIEW W e implemented t h e QR S detection algorithm i n assembly language. I t operates o n either a Z 8 0 (Zilog) or a n NSC800 (National Semiconductor) microprocessor. A l l the processing i s done with integer arithmetic s o that t he algorithm c a n o p - erate i n real time without requiring excessive computing power. T h e database provides t wo simultaneous EC G channels. W e attempted two-channel analysis, b u t abandoned this approach. D u e t o th e w a y that th e electrode positions a r e orthogonally placed i n Holter recording, a high-quality signal onone channel normally implies a low-amplitude E C G with a poor signal-to- noise ratio o n the second channel. T h e only w a y that two- channel algorithms will yield improved performance f o r most patients i s b y adopting a n e w w a y o f electrode placement that will provide usable signals i n both channels. Fig. 1 shows signals a t various steps i n digital signal processing. First, in order t o attenuate noise, t h e signal passes through a digital bandpass filter composed o f cascaded high-pass a n d low- pass filters. Fig. l(b) shows th e output o f this filter. T h e next process after filtering is differentiation [see Fig. 1 (c)] , followed b y squaring [see Fig. 1 (d)], and then moving window integra- tion [see Fig. 1 (e)]. Information about t h e slope o th e QR S i s obtained i n t h e derivative stage. T h e squaring process in - tensifies t h e slope o f t h e frequency response curve o f t h e deriv- ative a n d helps restrict false positives caused b y T waves with 0 0 18-9294/85/0300-0230$0 1.00 © 1985 IEEE 230 Authorized licensed use limited to: IEEE Xplore. Downloaded on November 8, 2008 at 09:28 from IEEE Xplore. Restrictions apply.

Transcript of EKG realtime

8/3/2019 EKG realtime

http://slidepdf.com/reader/full/ekg-realtime 1/7

I E E ETRANSACTIONSO NBIOMEDICALENGINEERING,VOL. B M E - 3 2 ,N O .3 , M A R C H1 9 8 5

A R e a l - T i m eQRSD e t e c t i o nA l g o r i t h m

JIAPUP A NAND WILLISJ . TOMPKINS,S E N I O RMEMBER, IEEE

A b s t r a c t - Weh a v ed e v e l o p e da r e a l - t i m ea l g o r i t h mf o rd e t e c t i o no ft h eQR Sc o m p l e x e so f ECGs i g n a l s .I t r e l i a b l yr e c o g n i z e sQR Sc o m -p l e x e sb a s e du p o nd i g i t a la n a l y s e so f s l o p e ,a m p l i t u d e ,a n dw i d t h . As p e c i a ld i g i t a lb a n d p a s sf i l t e rr e d u c e sf a l s ed e t e c t i o n sc a u s e db y t h ev a r -i o u st y p e so f i n t e r f e r e n c ep r e s e n ti nECGs i g n a l s .T h i sf i l t e r i n gp e r m i t sus eo fl o wt h r e s h o l d s ,t h e r e b yi n c r e a s i n gd e t e c t i o ns e n s i t i v i t y .T h ea l g o -r i t h ma u t o m a t i c a l l ya d j u s t st h r e s h o l d sa n d p a r a m e t e r sp e r i o d i c a l l yt oa d a p tt o s u c hECGc h a n g e sa s QR Sm o r p h o l o g ya n dh e a r tr a t e .F o rt h es t a n d a r d2 4 h M I T / B I Ha r r h y t h m i ad a t a b a s e ,t h i sa l g o r i t h mc o r -r e c t l yd e t e c t s9 9 . 3p e r c e n to f t h e QRSc o m p l e x e s .

INTRODUCTIONTHERE a r emanyu s e sf o ra r e l i a b l eQRSr e c o g n i t i o na l g o -

r i t h m .C o m p u t e ri n t e r p r e t a t i o no f t h e1 2 - l e a dECGi sap o p u l a r t e c h n i q u e .C o r o n a r yc a r eu n i t snowu s ea r r h y t h m i am o n i t o r se x t e n s i v e l y .W i d e l yu s e dH o l t e rt a p e r e co r d i n gr e -q u i r e sa H o l t e rs c a n n i n g d e v i c et ha t i n c lu d e sa QRSd e t e c t o rt o a n a l y z et h et a p e sm u c hf a s t e rt h a n r e a lt i m e .C u r r e n t l yu n d e rd e v e l o p m e n ta r ea r r h y t h m i am o n i t o r sf o ra m b u l a t o r yp a t i e n t sw h i c ha n a l y z et h eECGi n r e a lt i m e[ 1 ]- [ 3 1 .W h e na n a r r h y t h m i aa p p e a r s ,s ucha m o n i t o rc a nb e p r o g r a m m e dt oi m m e d i a t e l ys t o r ea n i n t e r v a lo f t h ea b n o r m a lECGf o rs u b -s e q u e n tt r a n s m i s s i o nt oa c e n t r a ls t a t i o nw h e r ea p h y s i c i a nc a ni n t e r p r e ti t . S u c ha d e v i c er e q u i r e s av e r y a c c u r a t eQR Sr e c o g -n i t i on c ap a b i l i t y .F a l s ed e t e c t i o nr e s u l t si nu n n e c e s s a r yt r a n s -

m i s s i o no f d a t at ot h ec e n t r a ls t a t i o no rr e q u i r e sa n e x c e s s i v e l yl a r g ememoryt os t o r ea n yECGs e g m e n t st h a ta r eu n n e c e s s a r i l yc a p t u r e d .T h u s ,a n a c c u r a t eQR Sd e t e c t o ri sa ni m p o r t a n tp a r to fmanyECGi n s t r u m e n t s .

QR Sd e t e c t i o ni s d i f f i c u l t ,n o t o n l yb e c a u s eo f t h ep h y s i o -l o g i c a lv a r i a b i l i t yo f t h eQRSc o m p l e x e s ,b u t a l s ob e c a u s eo ft h ev a r i o u st y p e so f n o i s et h a tc a nb e p r e s e n ti nt h eECGs i g n a l .N o i s es o u r c e si n c l u d em u s c l en o i s e ,a r t i f a c t sd uet o e l e c t r o d em o t i o n ,p o w e r - l i n ei n t e r f e r e n c e ,b a s e l i n ew a n d e r ,a n dT w a v e sw i t hh i g h - f r e q u e n c yc h a r a c t e r i s t i c ss i m i l a rt oQR Sc o m p l e x e s .I no u r a p p r o a c h ,d i g i t a lf i l t e r sr e d u c et h ei n f l u e n c eo f t h e s en o i s e s o u r c e s ,a n dt h er e by i m p r o v et h es i g n a l - t o - n o i s er a t i o .O ft h emanyQRSd e t e c t o r sp r o p o s e di n t h el i t e r a t u r e ,f e wg i v e

s e r i o u se n o u g ha t t e n t i o nt on o i s er e d u c t i o n .S o f t w a r eQR S d e t e c t o r st y p i c a l l yi n c l u d eo n e o r m o r eo ft h r e ed i f f e r e n tt y p e so f p r o c e s s i n gs t e p s :l i n e a rd i g i t a l f i lt e ri n g ,n o n l i n e a rt r a n s f o r m a t i o n ,a n dd e c i s i o nr u l ea l g o r i t h m s[ 4 ] .Weu s ea l lt h r e et y p e s .L i n e a rp r o c e s s e si n c l u d ea b a n d p a s sf i l t e r ,

M a n u s c r i p tr e c e i v e dJ u l y 2 7 ,1 9 8 4 ;r e v i s e dO c t o b e r24 , 1 9 8 4 . T h i sw o r kw a ss u p p o r t e di n p a r tb y t h e N a t i o n a lI n s t i t u t e so f H e a l t hu n d e rG r a n tH L 0 0 7 6 5 .

J . P a ni sw i t ht h eD e p a r t m e n to f B i o p h y s i c s ,S h a n g h a iS e c o n dM e d i c a lC o l l e g e ,S h a n g h a i ,P e o p l e ' sR e p u b l i co f C hi n a.

W . J . T o m p k i n si sw i t ht h e D e p a r t m e n to f E l e c t r i c a la n dC o m p u t e rE n g i n e e r i n g ,U n i v e r s i t yo f Wi s c o n s i n ,M a d i s o n ,W I5 3 7 0 6 .

a d e r i v a t i v e ,a n da m o v i n gw i n d o wi n t e g r a t o r .T h en o n l i n e a rt r a n s f o r m a t i o nt h a tw e u s ei s s i g n a la m p l i t u d es q u a r i n g .A d a p t i v et h r e s h o l d sa n dT- w a v ed i s c r i m i n a t i o nt e c h n i q u e sp r o -v i d ep a r to f t h e d e c i s i o nr u l ea l g o r i t h m .

T h es l o p eo f t h eR w a v ei sa p o p u l a rs i g n a lf e a t u r eu s e dt ol o c a t et h eQRS c o m p l e xi n manyQR Sd e t e c t o r s[ 5 ] .Ana n a l o gc i r c u i to r a r e a l - t i m ed e r i v a t i v ea l g o r i t h mt h a tp r o v i d e ss l o p ei n f o r m a t i o ni ss t r a i g h t f o r w a r dt o i m p l e m e n t .H o w e v e r ,b y i t sv e r yn a t u r e ,a d e r i v a t i v ea m p l i f i e st h eu n d e s i r a b l eh i g h e rf r e q u e n c yn o i s ec o m p o n e n t s .A l s o ,manya b n o r m a lQR Sc o m -p l e x e sw i t hl a r g ea m p l i t u d e sa n dl o n gd u r a t i o n sa r em i s s e di na p u r e l yd e r i v a t i v ea p p r o a c hb e c a u s eo f t h e i rr e l a t i v e l yl o wR -

w a v es l o p e s .T h u s ,R - w a v es l o p ea l o n ei si n s u f f i c i e n tf o rp r o p e rQRSd e t e c t i o n .T oa c h i e v er e l i a b l ep e r f o r m a n c e ,w em u s te x -t r a c to t h e rp a r a m e t e r sf r o mt h es i g n a ls u c ha sa m p l i t u d e ,w i d t h ,a n dQR Se n e r g y[ 6 ] ,[ 7 ] .

I t i s v e r yi m p o r t a n tt o e v a l u a t ea QR Sd e t e c t o ra l g o r i t h mu s i n ga s t a n d a r da r r h y t h m i ad a t a b a s e .T h e r ea r en owt w os u c hd a t a b a s e sa v a i l a b l e :M I T / B I H[ 8 ]a n dAHA( A m e r i c a nH e a r tA s s o c i a t i o n )[ 9 ]. T h ep e r f o r m a n c eo f a n a l g o r i t h mo na d a t a -b a s ei sn o t t h eu l t i m a t ea n s w e ra st oi t su t i l i t yi n ac l i n i c a le n -v i r o n m e n t ,b u t i t p r o v i d e sa s t a n d a r d i z e dm e a n so f c o m p a r i n gt h eb a s i cp e r f o r m a n c eo f o n ea l g o r i t h mt oa n o t h e r .

ALGORITHMOVERVIEW

We i m p l e m e n t e dt h eQR Sd e t e c t i o na l g o r i t h mi n a s s e m b l yl a n g u a g e .I t o p e r a t e so n e i t h e ra Z 8 0( Z i l o g )o r a n N S C 8 0 0( N a t i o n a lS e m i c o n d u c t o r )m i c r o p r o c e s s o r .A l lt h ep r o c e s s i n gi s d o n e w i t hi n t e g e ra r i t h m e t i cs ot h a tt h ea l g o r i t h mc a no p -e r a t ei nr e a lt i m ew i t h o u tr e q u i r i n ge x c e s s i v ec o m p u t i n gp o w e r .T h ed a t a b a s ep r o v i d e st w o s i m u l t a n e o u sECGc h a n n e l s .W ea t t e m p t e dt w o - c h a n n e la n a l y s i s ,but a b a n d o n e dt h i sa p p r o a c h .D u et o t h ew a yt h a tt h ee l e c t r o d ep o s i t i o n sa r eo r t h o g o n a l l yp l a c e di nH o l t e rr e c o r d i n g ,a h i g h - q u a l i t ys i g n a lo n o n ec h a n n e ln o r m a l l yi m p l i e sa l o w - a m p l i t u d eECGw i t ha p o o rs i g n a l - t o -n o i s er a t i oo n t h es e c o n dc h a n n e l .T h eo n l yw a yt h a tt w o -c h a n n e la l g o r i t h m sw i l ly i e l di m p r o v e dp e r f o r m a n c ef o rm o s tp a t i e n t si sb y a d o p t i n ga n eww a yo f e l e c t r o d ep l a c e m e n tt h a tw i l lp r o v i d eu s a b l es i g n a l si nb o t hc h a n n e l s .

F i g .1 s h o w ss i g n a l sa tv a r i o u ss t e p si nd i g i t a ls i g n a lp r o c e s s i n g .F i r s t , i no r d e rt o a t t e n u a t en o i s e ,t h es ig na l p a s s e st h r o u g had i g i t a lb a n d p a s sf i l t e rc o m p o s e do f c a s c a d e dh i g h - p a s sa n dl o w -p a s sf i l t e r s .F i g .l ( b )s h o w st h eo u t p u to f t h i sf i l t e r .T h en e x tp r o c e s sa f t e rf i l t e r i n gi sd i f f e r e n t i a t i o n[ s e eF i g .1( c ) ], f o l l o w e db y s q u a r i n g[ s e eF i g .1( d ) ] ,a nd t he nm o v i n gw i n d o wi n t e g r a -t i o n[ s e eF i g .1( e ) ] .I n f o r m a t i o na b o u tt h es l o p eo f t h eQR Si s o b t a i n e di n t h ed e r i v a t i v es t a g e .T h es q u a r i n gp r o c e s si n -t e n s i f i e st h es l o p eo f t h ef r e q u e n c yr e s p o n s ec u r v eo f t h ed e r i v -a t i v ea n dh e l p sr e s t r i c tf a l s ep o s i t i v e sc a u s e db y T w a v e sw i t h

0 01 8 - 9 2 9 4 / 8 5 / 0 3 0 0 - 0 2 3 0 $ 01 . 0 0

© 1 9 8 5I E E E

2 3 0

Authorized licensed use limited to: IEEE Xplore. Downloaded on November 8, 2008 at 09:28 from IEEE Xplore. Restrictions apply.

8/3/2019 EKG realtime

http://slidepdf.com/reader/full/ekg-realtime 2/7

P A NAND TOMPKINS:REAL-TIMEQR S D E T E C T I O NALGORITHM

( a )

( b )

( c )

( d )

( e )

( f )

( g )

F i g .1 . QRSd e t e c t i o na l g o r i t h mp r o c e s s i n gs t e p sf o ra n o r m a lECGf r o mt h e M I T / B I Hd a t a b a s e . ( a )O r i g i n a ls i g n a l .( b )O u t p u to f b a n d p a s sf i l t e r.( c )O u t p u to f d i f f e r e n t i a t o r .( d )O u t p u to f s q u a r i n gp r o c e s s .( e )R e s u l t so f m o v i n g - w i n d o wi n t e g r a t i o n .( f ) O r i g i n a lECGs i g n a ld e l a y e db y t h e t o t a lp r o c e s s i n gt i m e . ( g )O u t p u tpulse s t r e a m .

h i g h e rt h a nu s u a ls p e c t r a le n e r g i e s .T h em o v i n gw i n d o wi n t e -g r a t o rp r o d u c e sa s i g n a lt h a t i n c l u d e si n fo r ma t io n a b o utb o t ht h es l o p ea n dt h e w i d t ho f t h eQRSc o m p l e x .F i g .1 ( f )i st h es a m e a s t h e o r i g i n a lECGi n F i g .1 ( a )e x c e p td e l a y e db y t h et o t a lp r o c e s s i n gt i m e o f t h ed e t e c t i o na l g o r i t h m .F i g .l ( g )s h o w st h e f i n a lo u t p u ts t r e a mo f p u l s e sm a r k i n gt h el o c a t i o n so f t h e QRS c o m p l e x e sa f t e ra p p l i c a t i o no f t h e a d a p t i v et h r e s h o l d s .

F i g .2 i l l u s t r a t e sa s e to f s i g n a l ss i m i l a rt o t h o s ei nF i g .1 f o ra n o i s e - c o n t a m i n a t e dECGi nt h ed a t a b a s e .T h ea l g o r i t h mi sa b l et o c o r r e c t l yd e t e c tQRSc o m p l e x e si nt h ep r e s e n c e o f t h es e v e r en o i s et y p i c a lo f t h e a m b u l a t o r yECGe n v i r o n m e n t .Web a s e da l lj u d g m e n t so f c o r r e c t n e s su p o n t h ea n n o t a t i o n si nt h ed a t a b a s e .E a c ha n n o t a t i o non t h el o c a t i o na n d m o r p h o lo g yo f a b e a tw a s d e t e r m i n e db y a r b i t r a t i o nb e t w e e ntw o c a r d i o l -o g i s t swh oh a dt o b e i na g r e e m e n ton a l lb e a t si no r d e rf o ran

ECGd a t as e g m e n tt o b e p l a c e di nt h e d a t a b a s e .T h ea l g o r i t h mi sd i v i d e di n t ot h r e eprocesses: l e a r n i n gp h a s e

1 ,l e a r n i n gp h a s e2 ,a n dd e t e c t i o n .L ea r n in g p h as e1 r e q u i r e s

a b o u t2 s t o i n i t i a l i z ed e t e c t i o nt h r e s h o l d sb a s e dupon s i g n a la n dn o i s ep e a k sd e t e c t e dd u r i n gt h e l e a r n i n gp r o c e s s . L e a r n i n gp h a s e2 r e q u i r e stw o h e a r t b e a t st o i n i t i a l i z eR R- i n t e r v a la v e r a g e

a n dR R - i n t e r v a ll i m i tv a l u e s .T h es u b s e q u e n td e t e c t i o np h a s ed o e st h e r e c o g n i t i o nprocess a n dp r o d u c e sa p u l s ef o re a c hQRSc o m p l e x .T h et h r e s h o l d sa n do t h e rp a r a m e t e r so ft h ea l g o r i t h ma r e a d j u s t e dp e r i o d i c a l l yt o a d a p tt o c h a n g i n gc h a r a c t e r i s t i c so f t h es i g n a l .

W eu s e tw o s e t so f t h r e s h o l d st o d e t e c tQRSc o m p l e x e s .O n es e t t h r e s h o l d st h e f i l t e r e dE C G ,a n dt h e o t h e rt h r e s h o l d st h es i g n a lp r o d u c e db ym o v i n gwindowi n t e g r a t i o n .B yu s i n gt h r e s h -o l d son b o t hs i g n a l s ,we improve t h e r e l i a b i l i t yo f d e t e c t i o nc o m p a r e dt o u s i n go n e w a v e f o r ma l o n e .P r e p r o c e s s i n gt h e

( a )

( b )

( c )

( d )

( e )

F i g .2 . QR Sd e t e c t i o na l g o r i t h mp r o c e s s i n gs t e p sf o ra n o i s e - c o n t a m -i n a t e dECGf r o mt h eM I T / B I Hd a t a b a s e .( a )O r i g i n a ls i g n a l .( b )O u t -p u t o f b a n d p a s sf i l t e r .( c )R e s u l t so f m o v i n g - w i n d o wi n t e g r a t i o n .( d )O r i g i n a lECG s i g n a ld e l a y e db y t h e t o t a lp r o c e s s i n gt i n e . ( e )O u t p u tp u l s es t r e a m .

ECGw i t ht h i sd i g i t a lb a n d p a s sf i l t e ri m p r o v e st h es i g n a l - t o -n o i s er a t i oa n dp e r m i t st h eu s eo f l o w e rt h r e s h o l d st h a nw o u l db e p o s s i b l eo n t h eu n f i l t e r e dE C G .T h i si n c r e a s e st h eo v e r a l ld e t e c t i o ns e n s i t i v i t y .T h ed e t e c t i o nt h r e s h o l d sf l o a to v e rt h en o i s et h a ti ss e n s e db y t h e a l g o r i t h m.T h i sa p p r o a c hr e d u c e st h en u m b e ro f f a l s ep o s i t i v e sc a u s e db y t y p e so f n o i s et h a tm i m i ct h ec h a r a c t e r i s t i c so f t h eQRSc o m p l e x .

T h ea l g o r i t h mu s e sa d u a l - t h r e s h o l dt e c h n i q u et o f i n dm i s s e db e a t s ,a n dt h e r e b yr e d u c ef a l s en e g a t i v e s .T h e r ea r et w os e p a -r a t e

t h r e s h o l dl e v e l si ne a c ho f t h et w os e t so f t h r e s h o l d s .O n e

l e v e li s h a l fo f t h eo t h e r .T h et h r e s h o l d sc o n t i n u o u s l ya d a p tt o t h ec h a r a c t e r i s t i c so f t h es i g n a ls i n c et h e ya r eb a s e du p o nt h em o s t - r e c e n ts i g n a la n dn o i s ep e a k st h a ta r ed e t e c t e di nt h eo n g o i n gp r o c e s s e ds i g n a l s .I ft h ep r o g r a md o e sn o t f i n da QRSc o m p l e xi n t h et i m ei n t e r v a lc o r r e s p o n d i n gt o 1 6 6p e r c e n to ft h ec u r r e n t a v e r a g eRR i n t e r v a l ,t h em a x i m a lp e a kd e t e c t e di nt h a tt i m ei n t e r v a lt h a tl i e sb e t w e e nt h e s et w ot h r e s h o l d si sc o n -s i d e r e dt o b e a p o s s i b l eQRSc o m p l e x ,a n dt h el o w e ro f t h et w ot h r e s h o l d si s a p p l i e d .I n t h i sw a y ,we a v o i dr e q u i r i n gal o n gmemoryb u f f e rf o rs t o r i n gt h ep a s th i s t o r yo f t h eE C G ,a n dt h u sr e q u i r em i n i m a lc o m p u t i n gt i m et o a c c o m p l i s ht h es e a r c h - b a c kp r o c e d u r et o l o o kf o ra m i s s i n gQR Sc o m p l e x .

U n f o r t u n a t e l y ,t h ed u a l - t h r e s h o l dt e c h n i q u ei s o n l yu s e f u li f t h e h ea r tr a t ei sr e g u l a r .I na b n o r m a l i t i e ssucha sb i g e m i n yo r t r i g e m i n y ,we c a n n o tf i n dt h em i s s e db e a tb ys e a r c h i n gb a c kt h r o u g ht h es a m et i m ei n t e r v a la sf o rr e g u l a rh e a r tr a t e s .F o rt h ec a s eo f i r r e g u l a rh e a r tr a t e s ,b o t ht h r e s h o l d sa r er e d u c e db yh a l fi no r d e rt o i n c r e a s et h es e n s i t i v i t yo f d e t e c t i o na n dt oa v o i dm i s s i n gv a l i db e a t s .

O n c ea v a l i dQR Sc o m p l e xi sr e c o g n i z e d ,t h e r ei sa 2 0 0m sr e f r a c t o r yp e r i o db e f o r et h en e x t o n e c a n b e d e t e c t e ds i n c eQRSc o m p l e x e sc a n n o t o c c urm o r ec l o s e l yt h a nt h i sp h y s i o -l o g i c a l l y.T h i sr e f r a c t o r yp e r i o de l i m i n a t e st h ep o s s i b l i t yo faf a l s ed e t e c t i o nsucha s m u l t i p l et r i g g e r i n go n t h es a m eQRSc o m p l e xd u r i n gt h i st i m e i n t e r v a l .W h e na QRSd e t e c t i o n

2 3 1

Authorized licensed use limited to: IEEE Xplore. Downloaded on November 8, 2008 at 09:28 from IEEE Xplore. Restrictions apply.

8/3/2019 EKG realtime

http://slidepdf.com/reader/full/ekg-realtime 3/7

IEEE TRANSACTIONSON BIOMEDICALENGINEERING,VOL. B M E - 3 2 ,NO. 3 , MARCH 1 9 8 5

o c c u r sf o l l o w i n gt h ee n do f t h er e f r a c t o r yp e r i o db ut w i t h i n3 6 0ms o f t h e p r ev i o u sc o m p l e x ,w em u s td e t e r m i n ei fi t i sav a l i dQRSc o m p l e xo r a T w a v e . I nt h i sc a s e ,w ej u d g et h ew a v e f o r mw i t ht h el a r g e s ts l o p e t ob e t h eQRSc o m p l e x .

T o b e r e l ia b l e , aQRSd e t e c t i o na l g o r i t h mm u s ta d a p te a c ho f i t sp a r a m e t e r sw i t h t im es oa st ob e a b l e t oo p e r a t ep r o p e r l yf o rE C G' s o fd i f f e r e n tp a t i e n t sa sw e l la sf o rECGm o r p h o l o g yc h a n g e si n a s i n g l ep a t i e n t .I no ur a l g o r i t h m ,e a c ht h r e s h o l da u t o m a t i c a l l y a d a p t sp e r i o d i c a l l yb a s e du p o np e a kv a l u e so fs i g n a la n dn o i s e .W h e na QRSm u s tb e f o u n du s i n gs e c o n d( l o w e r )t h r e s h o l d s ,t h r e s h o l dr e a d j u s t m e n to c c u r s t w i c ea sf a s ta su s u a l .I nt h ed u a l - t h r e s h o l dt e c h n i q u e ,t h eR R- i n t e r v a la v e r -a g em u s tb e u p d a t e df o re a c hh e a r t b e a t .

Tw o s e p a r a t em e a s u r e m e n t so f t h ea v e r a g eRR i n t e r v a la r em a i n t a i n e d .O n eR R - i n t e r v a la v e r a g ei st h em e a no f a l lo f t h em o s tr e c e n te i g h tRR i n t e r v a l s .A s e c o n dR R- i n t e r v a la v e r a g ei st h em e a no f t h em o s tr e c e n te i g h tb e a t s t h a tf e l lw i t h i nt h er a n g eo f 9 2 - 11 6p e r c e n to f t h ec u r r e n tR R - i n t e r v a la v e r a g e .Wi t h o u tt h i sf i r s ta v e r a g e ,t h i sa p p r o a c hw o u l db e s u i t a b l eo n l yf o ra s l o w l yc h a n g i n ga n dr e g ul a r h e a r tr a t e .W h e nt h eh e a r tr a t es u d d e n l yc h a n g e s ,t h ef i r s tR R - i n t e r v a la v e r a g es u b s t i t u t e sf o rt h es e c o n do n e . T h ea l g o r i t h ma d a p t sr a p i d l yt o a c h a n g i n gs i g n a l .I t c a n e v e na d a p tr a p i d l yw h e ns w i t c h i n gf r o mo n ep a t i e n t ' sECGt o a n o t h e rw i t h o u tr e q u i r i n gs p e c i a ll e a r n i n gp h a s e s .

METHODSAn a n a l o gf i l t e rb a n d l i m i t st h eECGs i g n a la t 5 0 Hz . An a n a -

l o g - t o - d i g i t a lc o n v e r t e r( A D C )s a m p l e st h eECGa ta r a t eo f2 0 0s a m p l e s / s .T h e r e s u l t i n gd i g i t a ls i g n a lp a s s e ss u c c e s s i v e l yt h r o u g ha s e q u e n c eo f p r o c e s s i n gs t e p st h a ti n c l u d e st h r e el i n e a rd i g i t a lf i l t e r si m p l e m e n t e di ns o f t w a r e .F i r s ti sa ni n t e g e r -

c o e f f i c i e n tb a n d p a s sf i l t e rc o m p o s e do f c a s c a d e dl o w - p a s sa n dh i g h - p a s sf i l t e r s .I t sf u n c t i o ni sn o i s er e j e c t i o n .N e x ti sa f i l t e rt h a ta p p r o x i m a t e sa d e r i v a t i v e .A f t e ra n a m p l i t u d es q u a r i n gp r o c e s s ,t h es i g n a lp a s s e st h r o u g ha m o v i n g - w i n d o wi n t e g r a t o r .A d a p t i v et h r e s h o l d st h e nd i s c r i m i n a t et h el o c a t i o n so ft h eQRSc o m p l e x e s .

B a n d p a s sF i l t e rT h eb a n d p a s sf i l t e rr e d u c e st h ei n f l u e n c eo f m u s c l en o i s e ,

6 0 H zi n t e r f e r e n c e ,b a s e l i n ew an de r, a n dT- w a v ei n t e r f e r e n c e .T h ed e s i r a b l ep a s s b a n dt om a x i m i z et h eQRSe n e r g yi sa p p r o x -i m a t e l y5 - 1 5H z [ 1 0 ] ,( 1 1 1 .O u rf i l t e ri sa f a s t ,r e a l - t i m er e -c u r s i v ef i l t e ri nw h i c hp o l e sa r el o c a t e dt oc a n c e lz e r o so n t h e

u n i tc i r c l eo f t h ez p l a n e[ 1 2 ]. T h i sa p p r o a c hr es u lt s i na f i l t e rd e s i g nw i t hi n t e g e rc o e f f i c i e n t s .S i n c eo n l yi n t e g e ra r i t h m e t i ci sn e c e s s a r y ,a r e a l - t i m ef i l t e rc a nb e i m p l e m e n t e dw i t has i m p l em i c r o p r o c e s s o ra n d s t i l lh a v ea v a i l a b l ec o m p u t i n gp o w e rl e f tt od ot h eQRSr e c o g n i t i o nt a s k .

T h i sc l a s so ff i l t e r sh a v i n gp o l e sa n dz e r o so n l yo n t h eu n i tc i r c l ep e r m i t sl i m i t e dp a s s b a n dd e s i g nf l e x i b i l i t y.F o r o u rc h o s e ns a m p l er a t e ,w ec o u l dn o t d e s i g na b a n d p a s sf i l t e rd i -r e c t l yf o rt h ed e s i r e dp a s s b a n do f 5 - 1 5H zu s i n gt h i ss p e c i a l i z e dd e s i g nt e c h n i q u e .T h e r e f o r e ,w e c a s c a d e dt h e l o w - p a s sa n dh i g h - p a s sf i l t e r sd e s c r i b e db e l o wt o a c h i e v ea 3 d Bp a s s b a n df r o ma b o u t5 - 1 2H z ,r e a s o n a b l yc l o s et ot h ed e s i g ng o a l .F i g .3s h o w st h eo v e r a l lf r e q u e n c yr e s p o n s e .

F r e q u e n c y( H z )

.L ;

(r )

L

E LE 4

F i g .3 . A m p l i t u d er e s p o n s eo f t h e d i g i t a lb a n d p a s sd B )i s5 - 11Hz .

L o w - P a s sF i l t e rT h et r a n s f e rf u n c t i o no f t h es e c o n d - o r d e rl o w - p a s sf i l t e ri s

( 1- 62

H ( Z )= ( I z 1 ) 2.

T h ea m p l i t u d er e s p o n s ei s

s i n 2( 3 o T )wT = s i n 2( w T I 2 )

( 3

( 1 )

( 2 )

w h e r eT i s t h es a m p l i n gp e r i o d .T h ed i f f e r e n c ee q u a t i o no ft h ef i l t e ri s

y ( n T )= 2 y ( n T- T )- y ( n T- 2 T )+ x ( n T )

- 2 x ( n T-6 T ) + x ( n T-1 2 T ) ( 3 )

w h e r et h ec u t o f ff r e q u e n c yi sa b o u t1 1H za n dt h eg a i ni s3 6 .T h ef i l t e rp r o c e s s i n gd e l a yi ss i xs a m p l e s .

H i g h - P a s sF i l t e rT h ed e s i g no f t h eh i g h - p a s sf i l t e ri sb a s e don s u b t r a c t i n gt h e

o u t p u to fa f i r s t - o r d e rl o w - p a s sf i l t e rf r o ma na l l - p a s sf i l t e r( i . e . ,t h es a m p l e si n t h eo r i g i n a ls i g n a l ) .T h et r a n s f e rf u n c t i o nf o rs u c ha h i g h - p a s sf i l t e ri s

H ( z )= ( 1 + z 1 ))

T h ea m p l i t u d er e s p o n s ei s

| H ( w T ) I= [ 2 5 6+ s i n 2( 1 6 c T ) ]1 / 2c o s( w T / 2 )T h ed i f f e r e n c ee q u a t i o ni s

y ( n T )= 3 2 x ( n T- 1 6T )- [ y ( n T- T )+ x ( n T )- x ( n T- 3 2T ) ].

( 4 )

( 5 )

( 6 )T h el o wc u t o f ff r e q u e n c yo f t h i sf i l t e ri sa b o u t5 H z ,t h e g a i ni s3 2 ,a n dt h ed e l a yi s1 6s a m p l e s .

D e r i v a t i v eA f t e rf i l t e r i n g ,t h es i g n a li sd i f f e r e n t i a t e dt o p r o v i d et h eQ R S -

c o m p l e xs l o p ei n f o r m a t i o n .W eu s e a f i v e - p o i n td e r i v a t i v ew i t h

2 3 2

Authorized licensed use limited to: IEEE Xplore. Downloaded on November 8, 2008 at 09:28 from IEEE Xplore. Restrictions apply.

8/3/2019 EKG realtime

http://slidepdf.com/reader/full/ekg-realtime 4/7

P A NAND TOMPKINS:RE AL-TIME QRS D E T E C T I O NALGORITHM

t h et r a n s f e rf u n c t i o nH ( z ) ( l / 8T )( - z - 2- 2 z - + 2 z '+ Z2)

T h ea m p l i t u d er e s p o n s ei s

| H ( w T ) j= ( 1 / 4 T )[ s i n( 2 c o T )+ 2 s i n( c w T ) ] .T h ed i f f e r e n c ee q u a t i o ni s [ 7 ]

y ( n T )= ( 1/ 8T ) [ - x ( n T- 2 T ) - 2 x ( n T- T )

F r e q u e n c y( H z )

( 7 )LI

a U -

~L

( 8) 1 : J

,,

L

+ 2 x ( n T+ T )+ x ( n T +2 T ) ] . ( 9 )F i g .4 s h o w st h a tt h ef r e q u e n c yr e s p o n s eo f t h i s d e r iv a t iv ei sn e a r l yl i n e a rb e tw e e n d ca n d 3 0H z( i . e . ,i t a p p ro x im a te s a ni d e a ld e r i v a t i v eo v e rt h i sr a n g e ) .I t sd e l a yi st w os a m p l e s .

S q u a r i n gF u n c t i o nA f t e rd i f f e r e n t i a t i o n ,t h es i g n a li s s q u a r e dp o i n tb y p o i n t .

T h ee q u a t i o no f t h i so p e r a t i o ni s

1.I

D- 0

--I

E

V

F i g .4 . A m p l i t u d er e s p o n s eo f t h ed i g i t a ld e r i v a t i v ef i l t e r .

y ( n T ) =[ x ( n T ) ] 2 .T h i sm a k e sa l ld a t ap o i n t sp o s i t i v ea n dd o e sn o n l i n e a ra m p l i f i -c a t i o no f t h e o u t p u to f t h ed e r i v a t i v ee m p h a s i z i n gt h e h i g h e rf r e q u e n c i e s( i . e . ,p r e d o m i n a n t l yt h eECGf r e q u e n c i e s ) .

M o v i n g - W i n d o wI n t e g r a t i o n

T h epu rp os e o f m o v i n g - w i n d o wi n t e g r a t i o ni st o o b t a i nw a v e -f o r mf e a t u r ei n f o r m a t i o ni na d d i t i o nt o t h es l o p eo f t h eR w a v e .

I ti sc a l c u l a t e df r o m

y ( n T )= ( 1 / N )[x(nT- ( N - 1 ) T ) + x ( n T- ( N - 2) T )

( W - Q S )

F i g .5 . T h er e l a t i o n s h i po f a QRSc o m p l e xt o t h e m o v i n gi n t e g r a t i o nw a v e f o r m .( a )E C Gs i g n a l .( b )O u t p u to f m o v i n g - w i n d o wi n t e g r a t o r .Q S :QR Sw i d t h . W :w i d t ho f t h ei n t e g r a t o rw i n d o w .

( 11 )

w h e r eN i s t h e n u m b e ro f s a m p l e si nt h e w i d t ho f t h ei n t e g r a -t i o nw i n d o w .

F i g .5 s h o w st h er e l a t i o n s h i pb e t w e e nt h em o v i n g - w i n d o wi n t e g r a t i o nw a v e f o r ma n dt h e QR Sc o m p l e x .T h en u m b e ro fs a m p l e sN i nt h em o v i n gw i n d o wi si m p o r t a n t .G e n e r a l l y ,t h ew i d t ho f t h e windows h o u l db e a p p r o x i m a t e l yt h e s a m e a s t h ew i d e s tp o s s i b l eQRSc o m p l e x .I f t h e w i n d o wi st o o w i d e ,t h ei n t e g r a t i o nw a v e f o r mw i l lm e r g e t h e-QRS a n d T c o m p l e x e st o g e t h e r .I fi t i st o on a r r o w, some QRSc o m p l e x e sw i l lp r o d u c es e v e r a lp e a k si nt h e i n t e g r a t i o nw a v e f o r m .T h e s ec a n c au se d i f -f i c u l t yi n s u b s e q u e n tQRSd e t e c t i o nprocesses. T h ew i d t ho ft h e w i n d o wi s d e t e r m i n e de m p i r i c a l l y .F o r o u r s a m p l er a t eo f 2 0 0s a m p l e s / s ,t h ew i n d o wi s3 0 s a m p l e sw i d e ( 1 5 0m s ) .

F i d u c i a lMark

T h eQRSc o m p l e xc o r r e s p o n d st o t h e r i s i n ge d g eo f t h e i n t e -g r a t i o nw a v e f o r m .T h et i m ed u r a t i o no f t h er i s i n ge d g ei se q u a lt o t h e w i d t ho f t h e QRSc o m p l e x .A f i d u c i a lm a r kf o r t h et e m p o r a ll o c a t i o no f t h e QRSc o m p l e xca n b ed e t e r m i n e df r o mt h i sr i s i n ge d g ea c c o r d i n gt o t he d e si re dw a v e f o r mf e a t u r et ob e m a r k e ds u c ha s t h e m a x i m a ls l o p eor t h ep e a ko ftheR w a v e .

A d j u s t i n gt h e T h r e s h o l d s

T h et h r e s h o l d sa r e a u t o m a t i c a l l ya d j u s t e dt o f l o a to v e r t h en o i s e .Lo w t h r e s h o l d sa r e p o s s i b l eb e c a u s eo f t h e i m p r o v e -men t o f t h e s i g n a l - t o - n o i s er a t i ob y t h e b a n d p a s sf i l t e r.

T h eh i g h e ro f t h e tw o t h r e s h o l d si ne a c ho f t h e tw o s e t si s

u s e df o rt h e f i r s ta n a l y s i so f t h e s i g n a l .T h el o w e rt h r e s h o l di su s e di f n o QRSi sd e t e c t e di n a c e r t a i nt i m ei n t e r v a lso t h a ta s e a r c h - b a c kt e c h n i q u ei snecessary t o l o o kb a c ki n t i m ef o rt h e QRSc o m p l e x .T h es e to f t h r e s h o l d si n i t i a l l ya p p l i e dt ot h e i n t e g r a t i o nw a v e f o r mi sc o m p u t e df r o m

S P K I= 0 . 1 2 5PEAKI+ 0 . 8 7 5S P K I

( i fPEAKIi st h e s i g n a lp e a k )

NPKI= 0 . 1 2 5PEAKI+ 0 . 8 7 5NPKI

( i fPEAKIi st h e n o i s ep e a k )

THRESHOLDI l = NPKI+ 0 . 2 5 ( S P K I- N P K I )

THRESHOLDI 2= 0 . 5THRESHOLDI lw h e r ea l lt h e v a r i a b l e sr e f e rt o t h e i n t e g r a t i o nw a v e f o r m :

PEAKIi st h e o v e r a l lp e a k ,S P K Ii st h e r u n n i n ge s t i m a t eo f t h e s i g n a lp e a k ,NPKIi st h e r u n n i n ge s t i m a t eo f t h e noise p e a k ,THRESHOLDI l i st h e f i r s tt h r e s h o l da p p l i e d ,a n dTHRESHOLD1 2i st h e s e c o n dt h r e s h o l da p p l i e d .

( 1 2 )

( 1 3 )

( 1 4 )

( 1 5 )

A p e a ki s a l o c a lm a x i m u md e t e r m i n e db yo b s e r v i n gw h e nt h es i g n a lc h a n g e sd i r e c t i o nw i t h i na p r e d e f i n e dt i m ei n t e r v a l .T h es i g n a lp e a kS P K Ii sa p e a kt h a tt h e a l g o r i t h mh a sa l r e a d ye s t a b -l i s h e dt o b e a QRSc o m p l e x .T h en o i s ep e a kNPKIi sa n y p e a k

( 1 0 )

2 3 3

+ - * * + x ( n T ) ]

Authorized licensed use limited to: IEEE Xplore. Downloaded on November 8, 2008 at 09:28 from IEEE Xplore. Restrictions apply.

8/3/2019 EKG realtime

http://slidepdf.com/reader/full/ekg-realtime 5/7

IEEE TRANSACTIONSON BIOMEDICALENGINEERING,VOL. B M E - 3 2 ,NO . 3 , MARCH 1 9 8 5

t h a ti sn o t r e l a t e dt o t h eQRS( e . g . ,t h eT w a ve ) . T het h r e s h -o l d sa r eb a s e du p o nr u n n i n ge s t i m a t e so f S P K Ia n dN P K I .T h a ti s ,n e wv a l u e so f t h e s ev a r i a b l e sa r ec o m p u t e di np a r tf r o mt h e i rp r i o rv a l u e s .W h e na n e wp e a ki s d e t e c t e d ,i t m u s tf i r s tb ec l a s s i f i e da sa n o i s ep e a ko r a s i g n a lp e a k .T ob e a s i g n a lp e a k ,t h ep ea k m us t e x c e e dTHRESHOLDI 1a s t h es i g n a li sf i r s t

a n a l y z e do rTHRESHOLD1 2i fs e a r c h b a c ki sr e q u i r e dt of i n dt h eQ R S .W h e nt h eQRSc o m p l e xi sf o u n du s i n gt h es e c o n dt h r e s h o l d - ,

S P K I= 0 . 2 5P E A K I+ 0 . 7 5S P K I . ( 1 6 )T h es e to f t h r e s h o l d sa p p l i e dt ot h ef i l t e r e dECGi sd e t e r m i n e df r o m

S P K F= 0 . 1 2 5PEAKF+ 0 . 8 7 5SPKF

( i fPEAKFi st h es i g n a lp e a k )

NPKF= 0 . 1 2 5PEAKF+ 0 . 8 7 5NPKF

( i fPEAKFi st h en o i s ep e a k )THRESHOLDF 1 = NPKF+ 0 .25( S P K F- N P K F )

THRESHOLDF 2= 0 . 5THRESHOLDF l

w h e r ea l lt h ev a r i a b l e sr e f e rt ot h ef i l t e r e dE C G :

PEAKFi st h eo v e r a l lp e a k ,S P K Fi st h er u n n i n ge s t i m a t eo f t h es i g n a lp e a k ,NPKFi st h er u n n i n ge s t i m a t eo f t h en o i s ep e a k ,THRESHOLDF li st h ef i r s tt h r e s h o l da p p l i e d ,a n dTHRESHOLDF 2i st h es e c o n dt h r e s h o l da p p l i e d .

( 1 7 )

( 1 8 )( 1 9 )( 2 0 )

W h e nt h e QRSc o m p l e xi sf o u n du s i n gt h e s e c o n dt h r e s h o l d ,

SPKF= 0 . 2 5P E A K F+ 0 . 7 5 SPKF. ( 2 1 )

F o r i r r e g u l a rh e a r tr a t e s ,t h e f i r s tt h r e s h o l do f e a c hs e ti s r e -

d u c e db y h a l fs o a s t o i n c r e a s et h e d e t e c t i o ns e n s i t i v i t ya n dt oa v o i dm i s s i n gb e a t s :

THRESHOLDIIv - 0 . 5THRESHOLDI I ( 2 2 )THRESHOLDF l 0 . 5THRESHOLDF l . ( 2 3 )

To b e i d e n t i f i e da s a QRSc o m p l e x ,a p e a km u s t b er e c o g n i z e da s s u c ha c o m p l e xi nb o t ht h e i n t e g r a t i o na n db a n d p a s s - f i l t e r e dw a v e f o r m s .

A d j u s t i n gt h eAv e r a g eRRI n t e r v a la n dR a t eL i m i t s

Tw oR R - i n t e r v a la v e r a g e sa r e m a i n t a i n e d .O n ei st h ea v e r a g eo f t h ee i g h tm o s t - r e c e n tb e a t s .T h eo t h e ri st h ea v e r a g e o f t h ee i g h tm o s t - r e c e n tb e a t sh a v i n gR R i n t e r v a l st h a tf a l lw i t h i nc e r -

t a i nl i m i t s .T h er e a s o n f o rm a i n t a i n i n gt h e s etw o s e p a r a t ea v e r -

a g e si st o b e a b l et o a d a p tt o q u i c k l yc h a n g i n go r i r r e g u l a rh e a r tr a t e s .T h ef i r s taverage i st h e mean o f t h ee i g h tm o s t - r e c e n ts e q u e n t i a lR R i n t e r v a l sr e g a r d l e s so f t h e i rv a l u e s .

R RAVERAGE1= 0 . 1 2 5 ( R R I n - I 7+ R R I n - 6+ - + R R n )( 2 4 )

w h e r eR Rn i st h e m o s t - r e c e n tRR i n t e r v a l .T h es e c o n da v e r a g ei sb a s e don s e l ec t ed b e a t s .

RR AVERAGE2= 0 . 1 2 5( R R ' _7 + R R ' ? 6+ * * - + R R ' )( 2 5 )

w h e r eR R ' i s t h em o s tr e c e n tR R i n t e r v a lt h a tf e l lb e t w e e nt h ea c c e p t a b l el o wa n dh i g hR R- i n te r va l l i mi t s .T h eRR - i n t e r -v a ll i m i t sa r e

R R L OWL I M I T= 9 2 %RRAVERAGE2R R HIGHL I M I T= 1 1 6 %R R AVERAGE2.

R RM I S S E DL I M I T= 1 6 6 %RR AVERAGE2

( 2 6 )( 2 7 )( 2 8 )

I fa QRSc o m p l e xi sn o t f o u n dd u r i n gt h ei n t e r v a ls p e c i f i e db yt h eR RM I S S E DL I M I T ,t h em a x i m a lp e a kr e s e r v e db e t w e e nt h e- t w o e s t a b l i s h e dt h r e s h o l d si s c o n s i d e r e dt o b e a QR Sc a n d i d a t e .

I fe a c ho f t h ee i g h tm o s t - r e c e n ts e q u e n t i a lRR i n t e r v a l st h a ta r ec a l c u l a t e df r o mR RAVERAGE1i sb e t w e e nt h eRR L OWL I M I Ta n d t h eR R H I G HL I M I T,w e i n t e r p r e tt h eh e a r tr a t et ob e r e g u l a rf o rt h e s ee i g h th e a r tb e a t sa n d

( 2 9 )R AVERAGE2>-RR AVERAGE1.

T h i si st h ec a s ef o rn o r m a ls i n u sr h y t h m .

T- Wa v eI d e n t i f i c a t i o nW h e na n R I i n t e r v a li sl e s st h a n3 6 0ms ( i tm u s tb e g r e a t e r

t h a nt h e2 0 0m s l a t e n c y ) ,a j u d g m e n ti s m a d et o d e t e r m i n ew h e t h e rt h ec u r r e n tQR Sc o m p l e xh a sb e e nc o r r e c t l yi d e n t i f i e do r w h e t h e ri t i s r e a l l ya T w a v e . I f t h em a x i m a ls l o p et h a to c c u r sd u r i n gt h i sw a v e f o r mi s l e s st h a nh a l ft h a to f t h eQRSw a v e f o r mt h a tp r e c e d e di t ,i t i si d e n t i f i e dt ob ea Tw a v e ;o t h e r -w i s e ,i t i sc a l l e da QRSc o m p l e x .

EVALUATIONW eu s e dt h eM I T / B I Ha r r h y t h m i ad a t a b a s et o e v a l u a t et h e

QRS d e t e c t i o na l g o r i t h m[ 8 ] . T h ed a t a b a s ec o n s i s t so f 4 8h a l f - h o u r r e c o r d in g sf o ra t o t a lo f 2 4h o f ECGd a t a .T h ed a t a -b a s ei so n f o u r - c h a n n e lF Mm a g n e t i ct a p e .C h a n n e l sI a n d2a r et h et w o - c h a n n e lECGs i g n a l s .C h a n n e l3 i sa n a n n o t a t i o nc h a n n e lr e c o r d e di n a s t a n d a r db i n a r yf o r m a t ,a n dc h a n n e l4i sa b i n a r y - r e c o r d e dt i m i n gt r a c k .

F i g .6 s h o w st h ee x p e r i m e n t a ls e t u pf o re v a l u a t i o no f t h eQR S a l g o r i t h m .I t i n c l u d e st w o f o u r - c h a n n e lF Mt a p er e -c o r d e r s ,t w o Z 8 0 - b a s e dl a b o r a t o r ym i c r o c o m p u t e rs y s t e m s ,ad c a m p l i f i e r ,a n da n o n f a d eo s c i l l o s c o p e .

U s i n gt h eQR Sd e t e c t i o na l g o r i t h m ,o n e o f t h em i c r o c o m -p u t e rs y s t e m ss a m p l e sa n da n a l y z e st h ed a t a b a s eECGp l a y e db a c kf r o mo n eo f t h eF Mr e c o r d e r s .I fi t d e t e c t sa QRSc o m -p l e x ,i t g e n e r a t e sa p u l s e .S i m u l t a n e o u s l y ,t h es e c o n dm i c r o -c o m p u t e rm o n i t o r st h ee n c o d e db e a ta n n o t a t i o nc h a n n e lo ft h er e c o r d e ra n dg e n e r a t e sa p u l s ec o i n c i d e n tw i t ht h ef i d u c i a lm a r ka n n o t a t e di nt h ed a t a b a s e .

A s e c o n df o u r - c h a n n e lF Mt a p er e c o r d e rr e c o r d st h eo r i g i n a lECGw a v e f o r mb e i n ga n a l y z e do n o n ec h a n n e la n dt h ep u l s e sf r o me a c ho f t h em i c r o c o m p u t e rs y s t e m so n t w oo t h e rc h a n -n e l s .A l lo f t h e s es i g n a l sa p p e a ro n a n o n f a d ed i s p l a yo s c i l l o -s c o p eo r a c h a r tr e c o r d e rf o rf u r t h e rv i s u a le v a l u a t i o n .

2 3 4

Authorized licensed use limited to: IEEE Xplore. Downloaded on November 8, 2008 at 09:28 from IEEE Xplore. Restrictions apply.

8/3/2019 EKG realtime

http://slidepdf.com/reader/full/ekg-realtime 6/7

P A NANDT O MP KI NS : R E A L- T IM EQ R SD E T E C T I O NA L G O R I T H M

F i g .6 . E x p e r i m e n t a ls e t u pf o re v a l u a t i n gt h eQR Sd e t e c t i o na l g o r i t h mu s i n gt h e M I T / B I Hd a t a b a s e .1 : ECGs i g n a lf r o mM I T / B I Hd a t a b a s ec h a n n e l1 . 2 : B i n a r ya n n o t a t i o nf r o mM I T / B I Hd a t a b a s ec h a n n e l3 .3 :S a m p l e da n dr e c o n s t r u c t e dECGs i g n a l .4 :P u l s eg e n e r a t e db yd e t e c -t i o na l g o r i t h m .5 :P u l s eo b t a i n e df r o ma n n o t a t i o nt r a c kf i d u c i a lm a r k .

TABLEIR E S U LT SO FE VA L U AT I N GT H ER E A L - T I M EQR SD E T E C T I O NA L G O R I T H M

U S I N GT H EM I T / B I HD ATA B A S E

To t a l F a i l e d F a i l e dT a p e ( N o . FP FN D e t e c t i o n D e t e c t i o n( N o . ) B e a t s ) ( B e a t s )( B e a t s ) ( B e a t s )( %)

2 2 7 31 8 6 52 1 8 72 0 8 42 2 3 02 5 7 22 0 2 72 1 3 71 7 6 32 5 3 22 1 2 42 5 3 91 7 9 51 8 7 91 9 5 32 4 1 21 5 3 5

2 2 7 51 9 8 71 8 6 32 4 7 61 5 1 81 6 1 92 6 0 11 9 6 32 1 3 62 9 8 22 6 5 61 8 6 22 9 5 63 0 0 42 6 4 72 7 4 83 2 5 1

2 2 6 23 3 6 32 2 0 82 1 5 42 0 4 82 4 2 72 4 8 42 6 0 52 0 5 32 2 5 61 8 8 61 7 8 03 0 7 92 7 5 3

1 1 6 1 3 7

0 0 0

5 3 80 0 0

0 0 0

1 0 1

6 7 2 2 8 95 2 70 2 2

1 9 9 2 2 2 2 10 1 11 0 10 1 10 0 0

3 1 7 2 00 0 0

3 2 2 2 51 1 2

1 0 11 0 14 7 1 11 1 20 0 0

0 0 0

6 3 90 1 0 1 00 4 4

5 3 3 0 8 30 2 24 4 84 1 4 1 83 0 32 8 1 00 0 0

1 2 3

2 4 60 1. 14 6 1 00 0 0

0 0 0

2 0 01 0 1 8 1 1 8 2

1 0 12 5 5 3 0

1 0 10 0 0

6 1 70 1 1O - 0 0

5 0 7 2 7 7 7 8 4

0

0 . 4 30

0

0 . 0 43 . 4 60 .050 . 0 9

1 2 . 5 40 . 0 40 .050 . 0 40

1 . 0 60

1 . 0 40 . 1 3

0 . 0 40 . 0 50 . 5 90 . 0 80

0

0 . 3 50 . 5 10 . 1 92 . 7 80 . 0 80 . 4 30 . 6 00 . 1 00 . 3 80

0 . 0 9

0 . 2 60 . 0 30 . 4 50

0

0 . 0 87 . 3 30 . 0 41 . 4 60 . 0 40

0 . 3 90 . 0 30

0 . 6 7 5

T h em a x i m a la mp l i tu d e o ft h eECGf r o mt h eF Mr e c o r d e ri sl e s st h a n+1 V ,s o ad c a m p l i f i e ra m p l i f i e st h es i g n a lb ya g a i no f 2 . 5t o e n s u r et h a tt h es i g n a lu s e st h ef u l lr a n g eo f t h eA / Dc o n v e r t e r( t h ei n p u tv o l t a g er a n g ei s± 2 . 5V ) .

T h e 2 4 h M I T / B I Hd a t a b a s ec o n t a i n sm o r et h a n 1 1 60 0 0b e a t s .Ta b l eI s u m m a r i z e st h ep e r f o r m a n c eo f o ura l g o r i t h mf o rt h i sd a t a b a s e .I t p r o d u c e d5 0 7f a l s ep o s i t i v eb e a t s( 0 . 4 3 7p e r c e n t )a n d2 7 7f a l s en e g a t i v eb e a t s( 0 . 2 3 9p e r c e n t )f o ra t o t a ld e t e c t i o nf a i l u r eo f 0 .6 75p e r c e n t .

T h ep r o b l e mt a p e sa r ec h a r a c t e r i z e d ,i ng e n e r a l ,b ys t r e t c h e so f n o i s e ,b a s e l i n es h i f t s ,a n da r t i f a c t s .Ta p e1 0 8h a su n u s u a l l yt a l l ,p e a k e dP w a v e sq u i t eu n c h a r a c t e r i s t i ci nm o r p h o l o g yo ft y p i c a lP w a v e s .P a r t i c u l a r l ya t t h eb e g i n n i n ga n de n do f t h i st a p e ,t h e s eP w a v e sa r ec la s s i f i e d a sQR Sc o m p l e x e sb e c a u s eo ft h e i rh i g hs l o p e s .T h i sl e a d st o ah i g hf a l s ep o s i t i v ec o u n to nt h i st a p e .Ta p e2 2 2a l s oh a ss o m en o n - Q R Sw a v e sw i t hh i g h l yu n u s u a lm o r p h o l o g i e st h a tl e a dt of a l s ep o s i t i v e s .A f a l s ep o s i -t i v ed e t e c t i o nf o ro n e o f t h e s eb i z a r r ew a v e s h a p e sc a ns o m e -

t i m e sl e a dt o a f a l s en e g a t i v eo n t h ef o l l o w i n gQRSc o m p l e xb e c a u s et h ea l g o r i t h mi n c l u d e sa l a t e n c yt i m ef r o mt h et i m eaQRSi sd e t e c t e dt ot h en e x tp e r m i t t e dd e t e c t i o n .

SUMMARYWeh a v ed e v e l o p e da n o n - l i n er e a l - t i m eQR Sd e t e c t i o na l g o -

r i t h m a n di m p l e m e n t e di t i n Z 8 0a s s e m b l yl a n g u a g e .T h i sa l g o r i t h mr e l i a b l yd e t e c t sQR Sc o m p l e x e su s i n gs l op e , a m p l i -t u d e ,a n dw i d t hi n f o r m a t i o n .A b a n d p a s sf i l t e rp r e p r o c e s s e st h es i g n a lt o r e d u c ei n t e r f e r e n c e ,p e r m i t t i n gt h eus e o f l o w -a m p l i t u d et h r e s h o l d si no r d e rt og e th i g hd e t e c t i o ns e n s i t i v i t y .I nt h ea l g o r i t h m ,we us ead u a l - t h r e s h o l d st e c h n i q u ea n ds e a r c h -b a c kf o rm i s s e db e a t s .

T h ea l g o r i t h mp e r i o d i c a l l ya d a p t se a c ht h r e s h o l da n dRR i n -t e r v a ll i m i ta u t o m a t i c a l l y .T h i sa d a p t i v ea p p r o a c hp r o v i d e sf o ra c cu r a t e u s eo nECGs i g n a l sh a v i n gmanyd i v e r s es i g n a lc h a r -a c t e r i s t i c s ,QR Sm o r p h o l o g i e s ,a n dh e a r tr a t ec h a n g e s .I ne v a l u -a t i o n su s i n gt h eM I T / B I Ha r r h y t h m i ad a t a b a s e ,t h ea l g o r i t h mf a i l e dt op r o p e r l yd e t e c to n l y0 . 6 7 5p e r c e n to f t h eb e a t s .

R E F E R E N C E S[ 1 ] N . V . T h a k o r ,J . G . We b s t e r ,a n dW .J . To m p k i n s ," D e s i g n ,i m -

p l e m e n t a t i o n ,a n de v a l u a t i o no f a m i c r o c o m p u t e r - b a s e dp o r t a b l ea r r hy t h m i a m o n i t o r ,"M e d .B i o l .E n g .C o m p u t . ,v o l .2 2 ,p p .1 5 1 -1 5 9 ,1 9 8 4 .

[ 2 1R . G . M a r k ,G . B. M o o d y ,W . H . O l s o n ,S . K . P e t e r s o n ,P . S .S c h u l t e r ,a n d J . B .Wa l t e r s ,J r . , " R e a l - t i m ea m b u l a t o r ya r r h y t h -m i aa n a l y s i sw i t ha m i c r o c o m p u t e r , "C o m p u t .C a r d i o l . ,p p .5 7 -

6 2 ,1 9 7 9 .[ 3 ] L .P a t o m a k i ,J . F o r s t i ,V- M .N o k s o - K o i v i s t o ,Y . J o k i n e n ,a n dE .L a n s i m i e s ,"On l i n er e c o r d i n ga n da n a l y s i so f t h e ECGi na m b u l a -t o r yp a t i e n t s , "C o m p u t .C a r d i o l . ,p p .1 7 3 - 1 7 5 ,1 9 8 1 .

[ 4 ]0 . P a h l ma n dL .S o r n m o , " S o ft w a reQRSd e t e c t i o ni na m b u l a t o r ym o n i t o r i n g - Ar e v i e w, "M e d .B i o l .E n g .C o m p u t . ,v o l .2 2 , p p .2 8 9 - 2 9 7 ,1 9 8 4 .

[ 5 ] M . L . A hl s t ro m a n dW. J . To m p k i n s ," A u t o m a t e dh i g h - s p e e da n a l y s i so f H o l t e r t a p e s w i t h m i c r o c o m p u t e r s , "IEEE T r a n s .B i o m e d .E n g . ,v o l .B M E - 3 0 ,p p .6 5 1 - 6 5 7 ,O c t .1 9 8 3 .

[ 6 1M .N y g a r d sa n dL .S o r n m o ," A QRSd e l i n e a t i o na l go r it h m w i t hl o w s e n s i t i v i t yt o n o i s e a n d m o r p h o l o g yc h a n g e s , "C o m p u t .C a r d i o l . ,p p .3 4 7 - 3 5 0 ,1 9 8 1 .

[ 7 1A . L i g t e n b e r ga n dM .K u n t ," Ar o b u s t - d i g i t a lQ R S - d e t e c t i o na l g o -r i t h mf o ra r r h y t h m i am o n i t o r i n g , "C o m p u t .B i o m e d .R e s . ,v o l .1 6 ,p p .2 7 3 - 2 8 6 ,1 9 8 3 .

1 0 01 0 11 0 21 0 31 0 41 0 51 0 61 0 71 0 81 0 91 1 11 1 21 1 31 1 41 1 51 1 61 1 7

1 1 81 1 91 2 112 21 2 31 2 42 0 02 0 12 0 22 0 32 0 52 0 72 0 82 0 92 1 02 1 221 3

2 1 42 1 52 1 72 1 92 2 02 2 12 2 22 2 32 2 82 3 02 3 12 3 22 3 32 3 4

4 8p a t i e n t s

2 35

Authorized licensed use limited to: IEEE Xplore. Downloaded on November 8, 2008 at 09:28 from IEEE Xplore. Restrictions apply.

8/3/2019 EKG realtime

http://slidepdf.com/reader/full/ekg-realtime 7/7

IEEE T R A N S A C T I O N SONBIOMEDICALENGINEERING,VOL. BME-32,NO. 3 , MARCH 1985

[ 8 ] " M I T / B I Ha r r h y t h m i ad a t a b a s e - Ta p ed i r e c t o r ya n df o r m a ts p e c -i f i c a t i o n , "D o c u m e n tBMECT R 0 0 ,M a s s .I n s t .T e c h n o l . ,C a m -b r i d g e ,1 9 8 0 . D a t a b a s ei sa v a i l a b l ef r o mB i o e n g i n e e r i n gD i v i -s i o nKB-26 ,B e t h - I s r a e lH o s p i t a l ,3 3 0B r o o k l i n eAv e n u e ,B o s t o n ,MA 0 2 2 1 5 .

[ 9 ] "AHAd a t a b a s e . "D a t a b a s ei sa v a i l a b l ef r o mE m e r g e n c yC a r eR e -s e a r c hI n s t i t u t e ,5 2 0 0B u t l e rP i k e ,P l y m o u t hM e e t i n g ,P A 1 9 4 6 2 .

[ 1 0 ]H .G .G o o v a e r t s ,H . H . R o s ,T .J . v a n d e nA k k e r ,a n d H .S c h n e i d e r ,"A d i g i t a lQRSd e t e c t o rb a s e do n t h ep r i n c i p l eo f c o n t o u rl i m -i t i n g , " I E E ET r a n s .B i o m e d .E n g . ,v o l .B M E - 2 3 ,p . 1 5 4 ,1 9 7 6 .

[ 11 ]N. V .T h a k o r ,J . G .W e b s t e r ,a n d W .J .To m p ki n s , " O pt i m a lQRSd e t e c t o r , "M e d .B i o LE n g .C o m p u t . ,v o l .2 1 ,p p .3 4 3 - 3 5 0 ,1 9 8 3 .

[ 1 2 ]P .A . L y n n, " On l i ned i g i t a lf i l t e rf o rb i o l o g i c a ls i g n a l s :Somef a s td e s i g n sf o ra s m a l lc o m p u t e r , "M e d .B i o l .E n g .C o m p u t . ,v o l .1 5 ,p p .5 3 4 - 5 4 0 ,1 9 7 7 .

J i a p uP a nr e c e i v e dt h e M . D .d e g r e ei n1 9 6 2w i t ha s p e c i a l t yi n b i o p h y s i c si nm e d i c i n ef r o mt h eS h a n g h a iS e c o n dM e d i c a lC o l l e g e ,S h a n g h a i ,P e o p l e ' sR e p u b l i co fC h i n a .

S i n c et h a tt i m e ,h e h a sb e e n o nt h e F a c u l t yo f t h eD e p a r t m e n to fB i o p h y s i c so ft h eS h a n g h a iS e c o n dM e d i c a lC o l l e g e .Hi s b a c k g r o u n di n -c l u d e sr e s e a r c hi nm e d i c a la p p l i c a t i o n so f l a s e r s ,f l o w c y t o m e t r yf o r s i n g l ec e l la n a l y s i sa n ds o r t i n g ,a r t i f i c i a la r mc o n t r o lu s i n ge l e c t r o m y o -g r a p h i cs i g n a l s ,b o d ys u r f a c em a p p i n gi ne l e c t r o -

c a r d i o g r a p h y ,a n dm i c r o c o m p u t e r - b a s e dm e d i c a li n s t r u m e n t a t i o n .R e -c e n t l yh e s p e n tt w oy e a r si nt h eU n i t e dS t a t e sa s av i s i t i n gs c h o l a r .T h ef i r s to f t h e s ew a sa t C a s eWe s t e r nR e s e r v eU n i v e r s i t y ,C l e v e l a n d ,O H ,

a n dt h es e c o n dy e a rw a sa t t h e U n i v e r s i t yo fWi s c o n s i n ,M a d i s o n ,w h e r eh e c o m p l e t e dt h ew o r kr e p o r t e dh e r e .

f Wi l l i sJ .To m p k i n s( S ' 6 1 - M ' 6 6 - S M ' 7 7r e c e i v e_ t h e B . S .a n d M . S .d e g r e e si n e l e c t r i c a le n g i -

>n e e r m gf r o mt h eU n i v e r s i t yo f M a i n e ,O r o n o ,

| l mW n 1 9 6 3a n d 1 9 6 5 ,r e s p e c t i v e l y ,a n dt h e P h . D .d e g r e ei nb i o m e d i c a le l e c t r o n i ce n g i n e e r i n gf r o m

* 0 i t h e U n i v e r s i t yo f P e n n s y l v a n i a ,P h i l a d e l p h ii n1 9 7 3 .

From 1 9 6 5t o 1 9 6 8h e w a sa nE l e c t r i c a lE n g i -n e e r a t S a n d e r sA s s o c i a t e s ,I n c . ,N a s h u a ,N H ,w h e r eh e w o r k e don r e s e a r c ha n dd e v e l o p mo f d a t as t o r a g es y s t e m s .He w a se m p l o y e d f r o

1 9 7 3t o 1 9 7 4a t t h eH o s p i t a lo f t h e U n i v e r s i t yo f P e n n s y l v a n i aa sa B i o -m e d i c a lE n g i n e e r .S i n c e1 9 7 4h e h a sb e e no n t h e F a c u l t yo f t h e U n i -v e r s i t yo f W i s c o n s i n ,M a d i s o n ,w h e r eh i st e a c h i n gs p e c i a l t yi s o n t h et o p i co f c o m p u t e r si nm e d i c i n e ,a na r e ai nw h i c hh e h a sd e v e l o p e dt w on e wc o u r s e s .Hi sr e s e a r c hi n t e r e s t si n c l u d eo n - l i n eb i o m e d i c a lc o m p u t i n ga p p l i c a t i o n s .He i sc o - e d i t o r ,w i t hJ . G .We b s t e r ,o f t h et e x t b o o k D e s i go f M i c r o c o m p u t e r - B a s e dM e d i c a lI n s t r u m e n t a t i o n( E n g l e w o o dC l i f f s ,NJ : P r e n t i c e - H a l l ,1 98 1) a n dc o - e d i t o r ,w i t hJ . G .We b s t e r ,A .M .C o o k ,a n d G . C . Va n d e r h e i d e n ,o f t h et e x t b o o kE l e c t r o n i cD e v i c e sf o r R e -h a b i l i t a t i o n( N e wYo r k :W i l e y ,1 9 8 4 ) .

D r .To m p k i n si sa m e m b e ro f t h e I E E EE n g i n e e r i n gi nM e d i c i n ea n dB i o l o g yS o c i e t y( c u r r e n t l yR e g i o nI VA d m i n i s t r a t i v eC o m m i t t e eR e p -r e s e n t a t i v ea n dV i c eP r e s i d e n tf o rTe c h n i c a lA c t i v i t i e s ) ,t h e I E E ECom-p u t e rS o c i e t y ,t h e A s s o c i a t i o nf o rt h e A d v a n c e m e n to f M e d i c a lI n s t r um e n t a t i o n ,a n dt h eB i o m e d i c a lE n g i n e e r i n gS o c i e t y .He i sa R e g i s t e r e dP r o f e s s i o n a lE n g i n e e ri nt h e S t a t eo f W i s c o n s i n .

2 36