EE 5345 Biomedical Instrumentation Lecture 18: slides 343-361 Carlos E. Davila, Electrical Engineering Dept. Southern Methodist University slides can be viewed at: http:// www.seas.smu.edu/~cd/ee5345.html EE 7345/5345, SMU Electrical Engineering Department, © 2000 343 Data Compression Performance n Compression Ratio (CR): total number of bits before compression CR = total number of bits after compression n Percent Root Mean Square Difference (PRD): M −1 PRD = ∑ ( x[n] − x$[n]) n=0 M −1 2 [ ] x n ∑ 2 × 100 n=0 EE 7345/5345, SMU Electrical Engineering Department, © 2000 344 Case Studies n n Jalaleddine Aydin EE 7345/5345, SMU Electrical Engineering Department, © 2000 345 ECG Signal Processing n n n n ECG Component Detection ECG Arrhythmia Detection High Fidelity ECG via Signal Averaging Measurement of Heart Rate EE 7345/5345, SMU Electrical Engineering Department, © 2000 346 ECG Component Detection R T P Q S 0.6 s typical HR: 70 bpm P: atrial depolarization R: ventricular depolarization T: ventricular repolarization EE 7345/5345, SMU Electrical Engineering Department, © 2000 347 R-Wave Detection •different R-R intervals •different R-wave heights ECG: Detector Output: Automated R-wave detection useful for: •heart rate measurement. •detection of tachycardia (high HR), bradycardia (low HR), or ventricular fibrillation. EE 7345/5345, SMU Electrical Engineering Department, © 2000 348 Noise Sources in ECG n n n motion artifact (can be wide-band) 60 Hz interference baseline drift (generally amplifier related) These noise sources can significantly degrade the quality of the ECG. Simple amplitude thresholding does not produce good R-wave detection. EE 7345/5345, SMU Electrical Engineering Department, © 2000 349 General Approaches to R-Wave Detection n n n Non-Syntactic: rely on characteristic features of QRS complexes to perform the detection-simple. Syntactic: based on grammatical inference-can get complicated. Hidden Markov Models: based on a probabilistic model of R-wave occurrence times-complicated. We’ll cover all three approaches. EE 7345/5345, SMU Electrical Engineering Department, © 2000 350 Non-Syntactic QRS Detection source: J. Pan and W. Tompkins, “A Real-Time QRS Detection Algorithm,” IEEE Transactions on Biomed. Engr. vol. 32, pp. 230-236, March 1985. bandpass filter T1 d/dt ( )2 MA filter T2 dout delay EE 7345/5345, SMU Electrical Engineering Department, © 2000 351 Bandpass Filter lowpass filter highpass filter 1− z ) ( H( z) = (1 − z ) −6 2 lowpass filter: −1 2 ⇒ y[n] = 2 y[n − 1] − y[n − 2] + x[n] − 2 x[n − 6] + x[n − 12] EE 7345/5345, SMU Electrical Engineering Department, © 2000 352 Highpass Filter − 1 + 32z + z ) ( H ( z) = (1 − z ) −16 −32 2 −1 ⇒ y[ n ] = − y [n − 1] − x[ n ] + 32 x[ n − 16] + x [n − 32] Squaring Function: y[n] = x[n]2 EE 7345/5345, SMU Electrical Engineering Department, © 2000 353 Moving Average (MA) Filter 1 y[n] = ( x[n − ( N w − 1)] + x[n − ( N w − 2)]+L+ x[n]) Nw Nw: length of MA (FIR) filter Threshold Devices: x[n] T b H , x[n] ≥ T b= L, x[n] < T (comparator) EE 7345/5345, SMU Electrical Engineering Department, © 2000 Rules for Non-Syntactic Detector n n n n Thresholds T1 and T2 are adjusted from beat-to-beat in order to compensate for trends in R-wave peak amplitude. Processing delays are compensated for. If an R-wave is not detected after a set time interval, the algorithm reprocesses the data going back to the previous detection, using a new lower set of thresholds. Algorithm also detects non-QRS peaks such as P and T waves using a different lower set of thresholds. EE 7345/5345, SMU Electrical Engineering Department, © 2000 355 Detection Assessment n n n False Positive: R-wave detected when none was present. False Negative: R-wave not detected when one was present. Results of Pan-Tompkins algorithm applied to the MIT/BIT arrhythmia database: 0.437% false positive rate (5% typical) 0.239% false negative rate •some subjects show high detection failure. •no noise was added to the data to simulate poor recording conditions. EE 7345/5345, SMU Electrical Engineering Department, © 2000 356 Syntactic Detection of R-Waves n n n n n Based on theory of formal languages called grammars. Grammars are used to describe all signals (sentences) belonging to a given class (language). A class is represented by a given set of known sentences called a training set. We wish to estimate the class associated with a given sentence based on what we know from the training set. There are a number of different grammars, we will consider only finite state grammars. EE 7345/5345, SMU Electrical Engineering Department, © 2000 357 Finite State Grammars n n n Grammar has associated with it a finite set of states, {S0, S1, …, SN-1, T1, T2, …, TM} and a finite set of symbols: {a, b, …, f} Sentences generated by this grammar are composed of the symbols {a, b, … , f} and are determined by a set of rules which are best represented by a graph. Graph starts at start state S0 and ends at one or more terminal states T1, T2, …, TM. EE 7345/5345, SMU Electrical Engineering Department, © 2000 358 Graph for Finite State Grammar S0 a b S1 b a T1 b S2 a T2 possible sentences: b, abbbaa, abbbbbbab, aaa, etc. EE 7345/5345, SMU Electrical Engineering Department, © 2000 359 Finite State Automata n n n n Given a sentence from an unknown finite state grammar, would like to be able to determine whether that sentence comes from a certain grammar. This can be done with a finite state automaton. The automaton has associated with it a finite number of states {Q0, Q1, …, QN-1} The automaton reads in symbols from a sentence, the symbols define state transitions. If certain final states are arrived at, startin from Q0, the sentence is accepted as belonging to a certain grammar. EE 7345/5345, SMU Electrical Engineering Department, © 2000 360 Finite State Automaton for Grammar on slide 330 Q0 a b Q1 b a Q3 b a Q2 a Q4 Any sentence ending in state Q3 or Q4 is accepted, otherwise it is rejected. abbbbbbbbaa: accepted abb: rejected EE 7345/5345, SMU Electrical Engineering Department, © 2000 361