ECG Denoising and Compression Using A Modified Extended Kalman Filter Structure
ECG Denoising and Compression Using A Modified Extended Kalman Filter Structure
9, SEPTEMBER 2008
Abstract—This paper presents efficient denoising and lossy com- vices, and because the data need to be stored or transmitted over
pression schemes for electrocardiogram (ECG) signals based on a a communication channel [1]. In addition, certain transmission
modified extended Kalman filter (EKF) structure. We have used and storage methods can lead to segment corruption or packet
a previously introduced two-dimensional EKF structure and mod-
ified its governing equations to be extended to a 17-dimensional
loss, and therefore, dropouts missing data.
case. The new EKF structure is used not only for denoising, but Several techniques have been proposed to extract the ECG
also for compression, since it provides estimation for each of the components contaminated with the background noise and al-
new 15 model parameters. Using these specific parameters, the low the measurement of subtle features in the ECG signal. One
signal is reconstructed with regard to the dynamical equations of of the common approaches is the adaptive filter architecture,
the model. The performances of the proposed method are eval- which has been used for the noise cancellation of ECGs contain-
uated using standard denoising and compression efficiency mea-
sures. For denosing, the SNR improvement criterion is used, while
ing baseline wander, electromyogram (EMG) noise, and motion
for compression, we have considered the compression ratio (CR), artifacts [2], [3]. Statistical techniques such as principal compo-
the percentage area difference (PAD), and the weighted diagnos- nent analysis [4], independent component analysis [5], [6], and
tic distortion (WDD) measure. Several Massachusetts Institute neural networks [7] have also been used to extract a noise-free
of Technology–Beth Israel Deaconess Medical Center (MIT–BIH) signal from the noisy ECG. Over the past several years, meth-
ECG databases are used for performance evaluation. Simulation ods based on the wavelet transform (WT) have also received a
results illustrate that both applications can contribute to and en-
hance the clinical ECG data denoising and compression perfor- great deal of attention for the denoising of signals that possess
mance. For denoising, an average SNR improvement of 10.16 dB multiresolution characteristics such as the ECG [8]–[13].
was achieved, which is 1.8 dB more than the next benchmark meth- Several ECG compression techniques have been developed
ods such as MABWT or EKF2. For compression, the algorithm was within the last 30 years, most of which are based on lossy
extended to include more than five Gaussian kernels. Results show schemes for their higher compression ratio (CR) [14]. The com-
a typical average CR of 11.37:1 with WDD < 1.73%. Consequently, pression techniques devised for ECG signals are classified into
the proposed framework is suitable for a hybrid system that inte-
grates these algorithmic approaches for clean ECG data storage or three different groups: direct, transformational, and parametric
transmission scenarios with high output SNRs, high CRs, and low extraction methods [14], [15]. Most of the proposed schemes
distortions. are based on the first two approaches. Hence, a few researchers
have investigated the parametric extraction techniques.
Index Terms—Denosing, ECG dynamical model (EDM),
extended Kalman filter (EKF), hidden state variables, lossy On the other hand, a synthetic model has been proposed for
compression. generating artificial ECGs, which has unified the morphology
and pulse timing in a single nonlinear dynamic model [16].
I. INTRODUCTION Concerning the simplicity and flexibility of this model, it can be
LECTROCARDIOGRAM (ECG) recordings obtained by easily used as a base for ECG processing, as demonstrated by
E a noninvasive technique is a harmless, safe, and quick
method of cardiovascular diagnosis. The accuracy and content
Clifford et al. [17], where the use of the model to filter, compress,
and classify the ECG was first proposed. This approach was
of information extracted from a recording require proper char- based on the least squares error (LSE) optimization. The model
acterization of waveform morphologies, which, in turn, require may be further used in dynamic adaptive filters, such as the
the preservation of the phase and amplitude important clinical Kalman Filter (KF). Sameni et al. proposed the use of a KF
features and high attenuation of noise. ECG signals are usu- framework to update the model on a beat-to-beat basis in order
ally corrupted with unwanted interference such as muscle noise, to filter noisy ECGs [18]–[21]. The polar form of the dynamical
electrode artifacts, line noise, and respiration. On the other hand, equations was also used for Kalman-based ECG denoising [20].
efficient ECG compression techniques are desirable due to the In this paper, the KF framework has been further modified by
huge amounts of digital data generated by ECG monitoring de- adding 15 more equations to present the governing equations
of the model parameters. In fact, the new proposed structure is
aimed at estimating these new parameters, as well as the ECG
Manuscript received May 4, 2007; revised August 25, 2007, November 14, signal. The added parameters are further used for reconstructing
2007, December 31, 2007, and January 4, 2008. Asterisk indicates correspond-
ing author. the ECG. Similar to [17], our proposed algorithm puts into work
∗ O. Sayadi is with the Biomedical Signal and Image Processing Laboratory both the denoising and compression approaches simultaneously,
(BiSIPL), School of Electrical Engineering, Sharif University of Technology, but based on a sequential representation on a beat-by-beat dy-
Tehran 11365-9363, Iran (e-mail: [email protected]).
M. B. Shamsollahi is with the Biomedical Signal and Image Processing
namical adaptive basis. Meanwhile, the model is nonlinear and
Laboratory (BiSIPL), School of Electrical Engineering, Sharif University of requires the nonlinear counterparts of the conventional Kalman
Technology, Tehran 11365-9363, Iran (e-mail: [email protected]). filter. Our proposed model-based framework is built upon an ex-
Digital Object Identifier 10.1109/TBME.2008.921150 tended Kalman filter (EKF) structure. Although there are several
0018-9294/$25.00 © 2008 IEEE
SAYADI∗ AND SHAMSOLLAHI: ECG DENOISING AND COMPRESSION USING A MODIFIED EXTENDED KALMAN FILTER STRUCTURE 2241
Bayesian filters such as the extended Kalman smoother (EKS) a trajectory in the Cartesian coordinates. Sameni et al. [20]
and unscented Kalman filter (UKF), in this research, we have transformed these dynamic equations into the polar form to
chosen the EKF for its simplicity and more numerical stabil- obtain a simpler compact set, with the simplified discrete form
ity. However, the overall filtering performance is expected to be shown as:
better with EKS or UKF.
θ = (θk + ωδ)mod(2π)
The paper is organized as follows. Section II provides back- k +1
αi ω ∆θi2
grounds on the EKF theory. Section III summarizes the ECG
z k +1 = − δ ∆θ i exp − + zk + η
artificial model. In Section IV, the new complete EKF structure b2 i 2b2 i
i∈{P ,Q ,R ,S,T }
is proposed to incorporate the ECG dynamical model (EDM) (4)
parameters. In Section V, our proposed algorithm for denoising where δ is the sampling time, αi , bi , θi are the amplitude,
and compression is explained in details. Simulation results are angular spread, and location of the Gaussian functions, and
provided in Section VI. Finally, discussion and conclusions are ∆θi = (θ − θi )mod(2π) represents the RR interval variability.
provided in Section VII. The ECG is then described by the set of discrete samples formed
by z. η is a random additive white noise, which represents the
II. EXTENDED KALMAN FILTER REVIEW baseline wander effects and models other additive sources of
The EKF is a nonlinear extension of conventional Kalman process noise [20]. As it is seen in (4), the palliative/provoking,
filter that has been specifically developed for systems having quality, radiation, severity, timing (PQRST) waves are modeled
nonlinear dynamic models [22]. For a discrete nonlinear system with a sum of five Gaussian functions, each of which is located
with the state vector xk and observation vector yk , the dynamic at a specific angular position θi . In fact, the 3-D trajectory
model and its linear approximation near a desired reference consists of a circular limit cycle in the polar plane, which
point may be formulated as follows: is pushed up and down as it approaches each of the θi . The
projection of the trajectory on the z-axis gives a synthetic ECG.
x = f (xk , wk , k)
k +1
≈ f (x̂k , ŵk , k) + Ak (xk − x̂k ) + Fk (wk − ŵk )
IV. PROPOSED COMPLETE EKF STRUCTURE TO INCORPORATE
y k = g(xk , v k , k)
≈ g(x̂k , v̂ k , k) + Ck (xk − x̂k ) + Gk (v k − v̂ k ) THE ECG MODEL PARAMETERS
(1) In [19]–[21], the authors studied the application of EDM to
where ECG denoising using an EKF structure with only two state
∂f (x, ŵk , k) ∂f (x̂k , w, k) variables (which we call EKF2). In their works, they chose θ
Ak = Fk = and z as the only state variables. Hence, the state vector and the
∂x x= x̂ k ∂w w = ŵ k
process noise vector were:
∂g(x, v̂ k , k) ∂g(x̂k , v, k)
Ck = Gk = . (2) xk = [θk zk ]T
∂x x= x̂ k ∂v v = v̂ k
wk = [αP , . . . , αT , bP , . . . , bT , θP , . . . , θT , ω, N ]T . (5)
Here, wk and vk are the process and measurement noises,
respectively, with covariance matrices Qk = E{wk wkT } and Using the previous state variables, it is only possible to have
Rk = E{vk vkT }. In order to implement the EKF, the time prop- estimations of the ECG (for example, in denoising applications)
agation and the measurement propagation equations are sum- and the phase. Since these parameters are those that make the
marized as follows: artificial ECG adaptable to different ECG signals, we have added
− the αi , bi , and θi (i = P , Q, R, S, and T ) to the state variables
x̂ = f (x̂+ , w, k)
k +1 k w =0 and have proposed new dynamical equations for each. Long-
term ECGs can be described by a series of states described by
Pk−+1 = Ak Pk+ ATk + Fk Qk FkT
+ a given power-spectral density with similar parameters over the
x̂ = x̂−
k + Kk [y k − g(x̂−
k , v, k)|v =0 ] short term [23]. This idea motivated us to propose autoregressive
k
(AR) dynamics as follows:
Kk = Pk− CkT [Ck Pk− CkT + Gk ]−1 (3)
Pk+ = Pk− − Kk Ck Pk− yi [k + 1] = γyi [k] + ui [k] (6)
where yi denotes any of the 15 Gaussians’ parameters αi ,
where x̂−k = E{xk |y k −1 , y k −2 , . . . , y 1 } is the a prior estimate bi , and θi , with ui indicating its corresponding white noise.
of the state vector, xk , at the kth update, using the observations
Regarding the small changes of the PQRST morphology during
k = Ê{xk |y k , y k −1 , . . . , y 1 } is the a posteri-
y1 to yk −1 , and x̂+
several cycles, we have adopted this AR model. In order to en-
ori estimate of the state vector after adding the kth observations sure a valid set of equations, we have set γ = 1 (or γ ≈ 1), since
yk . Pk− and Pk+ are defined in the same manner to be the esti- the Gaussians’ parameters are expected to have little variations
mations of the covariance matrices in the kth stage, before and from one beat to another beat in normal ECG signals. We expect
after using the kth observation, respectively. that the recent sample of any of the newly introduced parameters
can be regressed on the past value of itself to produce a useful
III. ECG DYNAMICAL MODEL estimate for the new sample. However, the AR (1) model also
McSharry et al. [16] proposed a realistic synthetic ECG provides a noise term that accounts for the perturbations in mor-
generator using a set of 3-D state equations that generates phology from beat to beat (such as those caused by respiration,
2242 IEEE TRANSACTIONS ON BIOMEDICAL ENGINEERING, VOL. 55, NO. 9, SEPTEMBER 2008
or changes in heart rate). For constructing the EKF structure, we are related to the state vector as follows:
have the new state vector and process noise vector as follows:
ϕk 1 0 0 ··· 0 v1 k
= xk + (10)
xk = [θk , zk , αP , . . . , bP , . . . , θP , . . . , θT ]T sk 0 1 0 ··· 0 v2 k
wk = [ω, η, u1 , . . . , u15 ]T . (7) where ϕ and s are the noisy observations corresponding to the
With the 17 state variables in (7), the new modified EKF phase and the ECG signal, respectively. v1 and v2 are the obser-
model is formulated as: vation noises. Other state variables for which we have no obser-
vations are considered as the hidden states. In the EKF model,
θ[k + 1] = θ[k] + ωδ = F1 (θk , ω, k)
these variables would be estimated with respect to their dynam-
αi [k]ω ∆θi [k]2 ics given in (8). Also, we have Rk = E{[v1 k , v2 k ][v1 k , v2 k ]T }.
z[k + 1] = − ∆θi [k] exp −
δ
In the context of estimation theory, the variance of the observa-
bi [k]2 2bi [k]2
i∈{P ,Q ,R ,S,T }
tion noise in (10) somehow represents the degree of reliability
+z[k] + η = F2 (θk , zk , αi k , bi k , θi k , N, k) of a single observation. In other words, when a rather precise
measurement of the states of a system is valid, the value of Rk
αP [k + 1] = αP [k] + u1 [k] = F3 (αP k , u1 , k)
. is low, and the Kalman filter gain is adapted such as to rely on
.. that specific measurement. While for the epochs that the mea-
bP [k + 1] = bP [k] + u6 [k] = F8 (bP k , u6 , k) surements are too noisy or there are no measurements available,
the value of Rk is high and the Kalman filter tries to follow its
...
underlying dynamics rather than relying on the observations.
θP [k + 1] = θP [k] + u11 [k] = F13 (θP k , u11 , k)
V. MODEL-BASED DENOSING AND COMPRESSION
..
. Once the EKF structure is constructed, we can perform se-
θT [k + 1] = θT [k] + u15 [k] = F17 (αT k , u15 , k). lected processing applications on ECG signals. The proposed
(8) framework can estimate any of its states according to the dy-
The basic idea of the EKF is to linearize the state-space model namical equations and the observations. In fact, they enable us
(4) at each time instant around the most recent state estimation. to build up denoising and compression blocks, a concept that is
Equation (9) represents the linearized version. Note that the addressed next.
terms which are equal to zero are not cited in this equation.
∂F1 ∂F2 A. Denoising
= 1, =1
∂θk ∂zk The proposed nonlinear Bayesian framework estimates its
variables using the state dynamical equations and its observa-
∂F2 αi ω ∆θi2 ∆θi2
=− δ 2 1 − 2 exp − 2 tions, noisy phase ϕ and noisy ECG s. Since the ECG signal, z,
∂θk bi bi 2bi
i∈{P ,Q ,R ,S,T } is a state variable in the EKF structure, the filtering procedure
provides its estimation, x̂2 , which is regarded as the denoised
∂F2 ω ∆θ2
= −δ 2 ∆θi exp − 2i version of the input signal.
∂αi k bi 2bi
∂F2 αi ω ∆θi2 ∆θi2 B. Compression
= −2δ 3 ∆θi 1 − 2 exp − 2
∂bi k bi 2bi 2bi (9) A mathematical representation for the clean ECG signal can
∂F2 αi ω ∆θi2 ∆θi2 be obtained by integrating the last equation of the continuous
= δ 2 1 − 2 exp − 2 form of EDM (1) with respect to t [16]. This way, the ECG
∂θi k bi 2bi 2bi
signal is formulated as a sum of five Gaussians as:
∂F3 ∂F4 ∂F5 ∂F6 ∂F7
= = = = =1
∂αP k ∂αQ k ∂αR k ∂αS k ∂αT k ∆θi2
z(ai , bi , θi ) = αi exp − 2 . (11)
∂F8 ∂F9 ∂F10 ∂F11 ∂F12 2bi
= = = = =1 i∈{P ,Q ,R ,S,T }
∂bP k ∂bQ k ∂bR k ∂bS k ∂bT k
∂F13 ∂F14 ∂F15 ∂F16 ∂F17 According to (11), if we have only an estimated value for the
= = = = = 1. αi , bi , and θi , we can reconstruct the original ECG. Since we
∂θP k ∂θQ k ∂θR k ∂θS k ∂θT k have considered these variables as the states of EKF, we can
Having linearized the new modified EDM, an EKF may be easily estimate their values from x̂3:17 . But, the EKF updates its
developed. Note that in order to model the effects of the mis- estimations when a new sample is observed. This means that the
match of the EDM with a true ECG signal, it is necessary to EKF estimates the αi , bi , and θi parameters time series, in a sim-
introduce a process noise in the dynamic model. For this, an ilar manner to θ and z. We expect a constant value for each of the
additive random Gaussian white noise has been assumed in (8). 15 Gaussians’ parameters during each heartbeat. This is espe-
This small portion of noise, η, gives more flexibility to the KF, cially true, because the amplitude, spread, and angular location
and prevents it from converging to undesired limit cycles [4]. of the PQRST do not vary within a single ECG beat. In practice,
In the proposed EKF structure, we have only two noisy obser- since the estimated series of αi , bi , and θi are not a definitely
vations corresponding to the state variables θ and z [21], which constant function, we use its average value over each heartbeat
SAYADI∗ AND SHAMSOLLAHI: ECG DENOISING AND COMPRESSION USING A MODIFIED EXTENDED KALMAN FILTER STRUCTURE 2243
and use equation (12) to reconstruct the estimated ECG. wrapped ECG for all phases between −π and π. Using the mean
[ECG(θ)] and the standard deviation (SD) [σECG (θ)] of this
−[(x̂1 − x̂i+10 )mod(2π)]2
zrec = x̂i exp . (12) new representation for the input signal, we are able to estimate
i=3:7
2x̂2i+5 the initial values for the dynamic model parameters using a
This way, for every detected beat of an ECG, we must typical nonlinear optimization scheme like lsqnonlin.m [32],
store/transmit 15 values. Also, as it can be seen from (12) that [33], as proposed in [17]. It should be noted that the algorithm is
we need to store/transmit the estimated phase x̂1 to be able to highly affected by the choice of these initial values. Especially
reconstruct the ECG. However, since the phase values are lin- since the 15 Gaussians parameters need to be estimated only
early distributed between –π and +π, we can only encode the from two observations, errors in assigning their initial values
zero locations (i.e., the R-peaks of x̂2 ). In the decoder, we use cause the output of EKF not to follow the input ECG. Thus, the
these locations to assign the phase values between −π and +π. more precise the initial values are, the less the perturbation in
A more accurate representation for reconstructing the com- the observations affects the filtering performance.
pressed ECG through a sum of Gaussians is possible if we Similarly, the covariance values of Qk are found by calcu-
vary the number of Gaussian functions in (12). Clifford et al. lating the magnitude of the deviation of the parameters of the
proposed an extension of the EDM, which used an arbitrary five Gaussian functions of EDM around the estimated mean,
number of Gaussians, with two Gaussians for each asymmetric that best model the acceptable deviations of the ECG around
turning point [17]. As was shown [24]–[26], using six–eight ECG(θ). This is again a nonlinear least-squares problem that
Gaussians is a more appropriate choice for the number of ker- is solved by finding the optimal parameters that generate the
nels used for reconstruction, but this would further affect the best fit of the mean ECG within the upper and lower ranges
compression performance. We will discuss this point in the next of ECG(θ) ± σECG (θ). We have used a global value for the
section. angular frequency ω, which is a simpler approximation for short
The proposal to use the EDM for compression was previously signals with minor RR-interval deviations (between 10% to
introduced an optimization scheme to find the LSE fit for the 20% [21]). This way, it may be set to ω = 2π/TRR , where TRR
input ECG [17]. This fit was mathematically optimal in the LSE is the average RR-interval of the whole signal. In a similar man-
sense, but did not use any dynamical adaptable information ner to [21], we set E{v12k } = (ωδ)2 /12, and E{v12k } is found
about the input ECG. In the previous approach, the nonlinear from the deviations of the inactive segment of the ECG, between
optimization has to be performed within each cycle of the signal. the end of the T-wave and the beginning of the next P-wave,
Also, initial values of the parameters of the model are required. which correspond to the ending segments of the phase-warped
These initials together with the system dynamics (8) enable ECG.
us to find an optimal fit for the proceeding cycles through the Before presenting the experiments and results, the scope of
recursive solution (3). The current implementation is also based the proposed filtering scheme needs to be further clarified. In
on the EDM. However, our method uses the dynamical set of the presented approach, due to the phase wrapping of the RR-
equations in the construction of an adaptive filter, which not interval to 2π, normal interbeat variations of the RR-interval
only uses the ECG as an observation but also depends on the (between 10% to 20%), or consistent RR-interval abnormalities
state dynamics. Furthermore, the EKF-based algorithm does not such as Bradycardia or Tachycardia do not considerably affect
need to have the initial parameters for every cycle of the input the filter performance. However, for morphological abnormal-
signal. Hence, the proposed EKF-based technique is an efficient ities that only appear in some of the ECG cycles, such as the
idea for ECG compression. Premature Ventricular Contraction (PVC), the phase error of
the model can lead to large errors in the Gaussians function lo-
VI. RESULTS cations. Especially for low input SNRs, where neither the model
nor the measurements are reliable for the filter, the filtering per-
The proposed algorithm implemented in Matlab on a Core formance is not expected to be satisfactory. However, the benefit
Duo computer at 1.86 GHz with 1 Gb RAM. The same machine of the Gaussian mixture representation is that the effect of each
was used to measure processing time for the test signals. To Gaussian term vanishes very quickly (in less than the ECG pe-
study the performance of the proposed method several standard riod), meaning that the errors are not propagated to the follow-
data sets from PhysioBank [27] were used, including the MIT- ing ECG cycles. Moreover, by monitoring the state estimates’
BIH normal sinus rhythm database (DB1) [28], the MIT-BIH covariance matrices and the variations of the innovation signals,
noise stress test database (DB2) [29], the MIT-BIH arrhyth- it is possible to detect such unexpected abnormalities. Of course,
mia database (DB3) [30], and the MIT-BIH compression test it should be considered that the accurate filtering of abnormal
database (DB4) [31]. ECGs with high morphologic changes, such as QT hysteresis
It is worth noting that the initial value for the state vector as and premature contraction beats, remains an open problem [21].
well as the selection of the covariance matrices of the process However, we are now studying EDM-based segmentation meth-
and the measurement noise will highly influence the trajectory ods to extract the abnormal cycles of ECG signals. This way, it
of the estimated vectors. Hence, prior to the implementation is possible to filter any ECG, if we can split the input signal into
of the filter, it is necessary to select their values. In order to two or more signals with little morphological beat variation. The
automate the parameter selection procedure for any given ECG, method proposed in [25] is another possibility. All these show
the parameters should be estimated from the signal itself. Similar the necessity of extensive and more accurate studies to develop
to the approach discussed in [21], we have calculated the phase- a reliable technique to overcome mentioned problems.
2244 IEEE TRANSACTIONS ON BIOMEDICAL ENGINEERING, VOL. 55, NO. 9, SEPTEMBER 2008
Fig. 2. Typical filtering results of EKF2 and EKF17 for an input signal of
5 dB using an additive white Gaussian noise (Record 16265 from DB1). The
peaks distortions for EKF2 are clearly seen, especially in the ST segments and
the R-peaks.
TABLE I
PERFORMANCE EVALUATION OF THE BENCHMARK DENOISING ALGORITHMS
ON DB3. THE VALUES SHOW SNR IMPROVEMENT IN DECIBELS
Fig. 3. The mean (top) and SD (bottom) of the filter output SNR improvements
versus different input SNRs for the selected portions of the records of DB3 and
the first 60 min of all 18 records of DB1, averaged over 100 repetitions for each
of three methods; MABWT, EKF2, and EKF17.
Fig. 5. Typical results of the EKF-based compression algorithms for Record 117 from DB3 (dotted line). The reconstructed signal using EKF17 (5 Gaussians)
and EKF20 (6 Gaussians) are shown with dashed line and solid line, respectively.
distortion in one segment does not necessarily have the same TABLE II
PERFORMANCE EVALUATION OF BENCHMARK COMPRESSION
relevance or importance as the same magnitude of distortion in ALGORITHMS ON DB4
another segment. For example, in many patients’ ECGs, small
changes (elevations or depressions) of the ST segment are much
more diagnostically significant than the TP segment. In the pro-
posed algorithm, we do not track the baseline since we are
constructing the original ECG only through a sum of five or six
Gaussians (12). Hence, the baseline of the reconstructed signal
is expected to be flat. This can increase the error between the
input ECG and the reconstructed one for nonflat portions and
would increase the PRD value as well. To avoid such errors,
baseline wanders have been eliminated using MABWT in the Table II shows compression evaluation results for 50 selected
preprocessing stage. records from DB4 with their complete durations. The results
The weighted diagnostic distortion (WDD) [38] is based on are compared to those of EZW and SPIHT. The CR for the
comparing the PQRST features of the original ECG and the model-based algorithm is formulated as:
reconstructed signal. The WDD measures the relative preserva-
tion of the diagnostic information in the reconstructed signal: L L
CR = = (17)
the location, duration, amplitudes, and shapes of the waves and nparam (3nGauss nb eat ) + nR
complexes that exist in every beat. It is defined as where L is the whole ECG length (in samples), nparam is the
Λ number of parameters required for reconstruction, nb eat is the
WDD(β, β̂) = ∆β T ∆β × 100 (14) total number of beats in the ECG sequence, nGauss is the number
tr(Λ)
of Gaussian kernels used in the EDM, and nR is the number of
total R-peaks locations. Since nR = nb eat the CR reduces to
where β and β̂ represent two vectors of 18 diagnostic features
of the original beat and reconstructed beat, respectively, ∆β is L
CR = . (18)
the normalized difference vector, and Λ is a diagonal matrix of nb eat (1 + 3nGauss )
weights [38] which is set to
It can be seen from Table II that our proposed method pro-
Λ = diag[2.5 2.5 1 1 2 2 1 0.5 0.1 ... vides a higher CR, while preserving the similarity between the
(15)
1.5 1 3 1.5 1.5 1 1 3 3]. original ECG and the reconstructed version most accurately. It is
worth noting that in all cases, the WDD of EKF17 is comparable
In this research, we have used the same features and penalty
to and usually superior to the other methods being tested. Ad-
matrices as [38]. We have also considered another error mea-
ditionally, increasing the number of Gaussians results in lower
sure, called the percentage area difference (PAD) between the
CRs, as expected. Accordingly, EKF20 is chosen as the desired
original and the reconstructed signal, which is defined for the
compression scheme because of its CR and low error measures.
time indexes between ti and tf as [39]:
Another interesting remark is that the CR of EKF-based al-
t
tf gorithm depends upon the number of beats [refer to (18)]. This
t i x(t)dt − t if xr (t)dt means that for ECG signals with lower average heart rates, the
PAD = × 100. (16)
(tf − ti )(xm ax − xm in ) CR is much higher because the resulting ECG contains fewer
SAYADI∗ AND SHAMSOLLAHI: ECG DENOISING AND COMPRESSION USING A MODIFIED EXTENDED KALMAN FILTER STRUCTURE 2247
TABLE III in the EKF structure results in fewer peak distortions. Hence,
HEART RATE AND SAMPLING FREQUENCY EFFECTS ON THE PERFORMANE
OF EKF20 COMPRESSION ALGORITHM
the proposed method can serve as a base for the design of a
robust ECG filter, with vast applications for low SNR ECGs.
The EKF structure not only estimates the clean ECG as a
Kalman state variable, but also estimates the Gaussians param-
eters of the model. Therefore, a simple way to reconstruct the
ECG is to store/transmit only these parameters, as well as the
R-locations, for each beat. However, these estimations are not
constant valued, and therefore, we have used their mean value
over each beat (60 divided by the average heart rate). Accord-
ing to the described procedure, the ECGs were compressed and
reconstructed using different number of Gaussian Kernels. It is
beats. This is beneficial for compression of long-term ECGs, worth noting that the results in this paper are for short ECGs.
like Holter recordings. The CR is also a function of the sam- For longer ECGs, it is likely that the heart rate varies signif-
pling frequency fs ; obviously, the CR for those signals with icantly, and therefore, the performance of the filter will vary.
higher fs would be higher. To simulate the heart rate and the Long ECG sections will probably require an adaptive change of
sampling frequency effects on the CR, we have considered se- the parameters with the RR period.
lected records from DB3 and DB4. The results for EKF20 are For evaluating the performance of the proposed EKF-based
provided in Table III for EKF20. The results show the effect of algorithm for lossy compression and to give different weights
heart rate on the CR. In fact, for a constant fs , the more the to different diagnostic features, we used the WDD measure as
number of beats are, the lower the CR is (see either second– the major distortion index. Its features depend on the PQRST
fourth rows or fifth–seventh rows). Also, by comparing records waveforms, which qualify it to be the well-correlated measure
that have approximately the same sampling frequency, we came with morphological characteristics of the ECG signal. Its only
to this conclusion that for a constant number of beats, the more drawback is its expensive cost in term of time for calculation.
the fs is, the higher the CR is (compare the second row to the Evaluation results showed that the proposed EKF-based algo-
last row in which the number of beats are nearly equal). rithm has a high CR, while giving low WDD values (less than
The actual run time of the algorithms was used to evaluate the 5%). This means that the reconstructed signals can be guaran-
time complexity of the proposed method. Generally, by using m teed to be clinically useful provided that the initial values for
Gaussians kernels in (4), the state vector and the process noise the EKF structure are chosen appropriately. Another fact of the
vector in (7) have 3m + 2 entries, leading Q, A, and F matrices proposed EKF scheme is that the CR depends on the number of
to be (3m + 2) × (3m + 2). C is a (2) × (3m + 2) matrix. beats in the ECG signal. In other words, ECG signals with long
In addition, R and G matrices do not depend on the number RR-intervals result in a higher CR. This is more applicable to
of Gaussians. In other words, since we have two observations, long-term ECG compression.
these matrices are 2 × 2. Consequently, increasing m affects In addition, through simple modifications, the model would be
the dimensionality of the matrices and the run time. For a signal robust to PQRST variations, which incorporates several patho-
with approximately 20 000 samples (corresponding to almost logical conditions such as small ST changes and QT prolonga-
1 min at a sampling frequency of fs = 360 Hz), a run of EKF2, tion. This gives the opportunity to study low amplitude com-
EKF17, EKF20, EKF23, and EKF26 takes about 12.2, 17.1, plexes, even with interbeat changes. By modifying the simple
21.7, 26.9, and 31.5 s, respectively. model of (4) to incorporate more than five waves (P, Q, R, S,
and T), except for the use of two Gaussians for the T-wave in
VII. DISCUSSION AND CONCLUSION EKF20, the error rate decreases (to less than 2%). But, the cost
of using more Gaussian functions is a lowering of the CRs. The
We have presented and validated a new EKF algorithm that
results showed that using six Gaussians (EKF20) can lead to an
incorporates the parameters of the EDM, and its applications to
acceptable CR and WDD value.
ECG denoising and compression. By introducing a simple AR
Future works include incorporating baseline fluctuations in
model for each of the 15 dynamic parameters of the Gaussians,
the EDM to reduce the distortions and cause the algorithm to
the new EKF structure was constructed. The proposed set of
be more reliable. In addition, different dynamical models may
equations aims at integrating into the ECG model a mechanism
be proposed to represent the new state variables behavior. Also,
that estimates the new hidden state variables without having
it is possible not to use a constant value for the AR coefficient,
any corresponding observations, which was later used for com-
but to find an adaptive value during different cycles. Moreover,
pression. The designed filter was applied to noisy ECG signals,
lossless compression schemes may be proposed by combining
and the results demonstrate the filter’s capability in tracking and
EKF17 with a residual difference encoder [40].
filtering noisy ECG.
Compared to benchmark denoising schemes EKF2 and
MABWT, EKF17 provides a larger SNR improvement, espe- REFERENCES
cially fewer input SNRs, where the original signal is lost in
noise. Another point of interest is the low SD of SNR improve- [1] G. M. Friesen, L. C. Jannett, M. A. Jadallah, S. L. Yates, S. R. Quint, and
H. T. Nagle, “A comparison of the noise sensitivity of nine QRS detection
ments for EKF17, which ensures the consistency of results as algorithms,” IEEE Trans. Biomed. Eng., vol. 37, no. 1, pp. 85–98, Jan.
compared to other methods. Furthermore, the new modifications 1990.
2248 IEEE TRANSACTIONS ON BIOMEDICAL ENGINEERING, VOL. 55, NO. 9, SEPTEMBER 2008
[2] N. V. Thakor and Y.-S. Zhu, “Applications of adaptive filtering to ECG [26] G. D. Clifford and M. Villarroel, “Model-based determination of QT
analysis: Noise cancellation and arrhythmia detection,” IEEE Trans. intervals,” Comput. Cardiol., vol. 33, pp. 357–360, Sep. 2006.
Biomed. Eng., vol. 38, no. 8, pp. 785–794, Aug. 1991. [27] PhysioBank, physiologic signal archives for biomedical research [Online].
[3] P. Laguna, R. Jane, O. Meste, P. W. Poon, P. Caminal, H. Rix, and Available: http://www.physionet.org/physiobank/
N. V. Thakor, “Adaptive filter for event related bioelectric signals using [28] The MIT-BIH Normal Sinus Rhythm Database [Online]. Available:
an impulse correlated reference input: Comparison with signal averaging http://www.physionet.org/physiobank/database/nsrdb/
techniques,” IEEE Trans. Biomed. Eng., vol. 39, no. 10, pp. 1032–1044, [29] The MIT-BIH Noise Stress Test Database [Online]. Available:
Oct. 1992. http://www.physionet.org/physiobank/database/nstdb/
[4] G. B. Moody and R. G. Mark, “QRS morphology representation and [30] The MIT-BIH Arrhythmia Database [Online]. Available: http://
noise estimation using the Karhunen-Lo‘eve transform,” in Proc. Comput. physionet.org/physiobank/database/mitdb/
Cardiology, Jerusalem, Israel, Sep. 1989, pp. 269–272. [31] The MIT-BIH Compression Test Database [Online]. Available: http://
[5] A. K. Barros, A. Mansour, and N. Ohnishi, “Removing artifacts from elec- www.physionet.org/physiobank/database/cdb/
trocardiographic signals using independent components analysis,” Neu- [32] T. F. Coleman and Y. Li, “On the convergence of reflective Newton meth-
rocomputing, vol. 22, no. 1–3, pp. 173–186, 1998. ods for large-scale nonlinear minimization subject to bounds,” Math.
[6] T. He, G. D. Clifford, and L. Tarassenko, “Application of independent Program., vol. 67, no. 2, pp. 189–224, 1994.
component analysis in removing artefacts from the electrocardiogram,” [33] T. F. Coleman and Y. Li, “An interior, trust region approach for nonlinear
Neural Comput. Appl., vol. 15, pp. 105–116, 2006. minimization subject to bounds,” SIAM J. Optim., vol. 6, pp. 418–445,
[7] G. D. Clifford and L. Tarassenko, “One-pass training of optimal architec- 1996.
ture auto-associative neural network for detecting ectopic beats,” Electron. [34] M. L. Hilton, “Wavelet and wavelet packets compression of electrocar-
Lett., vol. 37, no. 18, pp. 1126–1127, 2001. diogram,” IEEE Trans. Biomed. Eng., vol. 44, no. 5, pp. 394–402, May
[8] K. Daqrouq, “ECG baseline wander reduction using discrete wavelet trans- 1997.
form,” Asian J. Inf. Technol., vol. 4, no. 11, pp. 989–995, 2005. [35] J. A. Norris, K. B. Englehart, and D. F. Lovely, “Myoelectric signal
[9] H. A. Kestler, M. Haschka, W. Kratz et al., “De-noising of high-resolution compression using zerotrees of wavelets coefficients,” Med. Eng. Phys.,
ECG signals by combining the discrete wavelet transform with the Wiener vol. 25, no. 9, pp. 739–746, Nov. 2003.
filter,” in Proc. Comput. Cardiology, Cleveland, OH, Sep. 1998, pp. 233– [36] Z. Lu, D. Y. Kim, and W. A. Pearlman, “Wavelet compression of ECG
236. signals by the set partitioning in hierarchical trees algorithm,” IEEE Trans.
[10] D. L. Donoho, “De-noising by soft-thresholding,” IEEE Trans. Inf. The- Biomed. Eng., vol. 47, no. 7, pp. 849–856, Jul. 2000.
ory, vol. 41, no. 3, pp. 613–627, May 1995. [37] M. Ishijima, “Fundamentals of the decision of optimum factors in the
[11] M. Popescu, P. Cristea, and A. Bezerianos, “High resolution ECG fil- ECG data compression,” IEICE Trans. Inf. Sys., vol. E76-D, no. 12, Dec.
tering using adaptive BSayesian wavelet shrinkage,” in Proc. Comput. 1993.
Cardiology, Cleveland, OH, Sep. 1998, pp. 401–404. [38] Y. Zigel, A. Cohen, and A. Katz, “The weighted diagnostic distortion
[12] P. M. G. A. Da Silva and J. P. M. DeŚa, “ECG noise filtering using wavelets measure for ECG signal compression,” IEEE Trans. Biomed. Eng., vol. 47,
with soft-thresholding methods,” in Proc. Comput. Cardiology, Hannover, no. 11, pp. 1422–1430, Nov. 2000.
Germany, Sep. 1999, pp. 535–538. [39] A. C. D’Ambrosio, A. Ortiz-Conde, and F. J. G. Sánchez, “Percentage
[13] O. Sayadi and M. B. Shamsollahi, “Multiadaptive bionic wavelet trans- area difference (PAD) as a measure of distortion and its use in maximum
form: Application to ECG denoising and baseline wandering reduction,” enclosed are (MEA), a new ECG signal compression algorithm,” in Proc.
EURASIP J. Adv. Signal Process., vol. 2007, pp. 1–11, 2007. 4th IEEE Int. Caracas Conf. Devices, Circuits Syst., Aruba, Apr. 17–19,
[14] S. M. S. Jalaleddine, C. G. Hutcgens, R. D. Strattan, and W. A. Coberly, 2002, pp. 1035-1–1035-5.
“ECG data compression techniques—A unified approach,” IEEE Trans. [40] R. Kannan and C. Eswaran, “Lossless compression schemes for ECG sig-
Biomed. Eng., vol. 37, no. 4, pp. 329–343, Apr. 1990. nals using neural network predictors,” EURASIP J. Adv. Signal Process.,
[15] M. Blanco-Velasco, F. Cruz-Roldan, F. Lopez-Ferreras, A. Bravo-Santos, vol. 2007, Article ID 35641, pp. 102–122, 2007, doi:10.1155/2007/35641.
and D. Martinez-Munoz, “A low complexity algorithm for ECG sig-
nal compression,” Med. Eng. Phys., vol. 26, no. 7, pp. 553–568, Sep.
2004. Omid Sayadi (S’06) was born in Shiraz, Iran, in
[16] P. E. McSharry, G. D. Clifford, L. Tarassenko, and L. A. Smith, “A 1983. He received the B.Sc. degree in biomedical
dynamic model for generating synthetic electrocardiogram signals,” IEEE engineering from Shahed University, Tehran, Iran,
Trans. Biomed. Eng., vol. 50, no. 3, pp. 289–294, Mar. 2003. in 2005, and the M.Sc. degree in electrical engineer-
[17] G. D. Clifford, A. Shoeb, P. E. McSharry, and B. A. Janz, “Model-based ing, biomedical engineering in 2007 from Sharif Uni-
filtering, compression and classification of the ECG,” Int. J. Bioelectro- versity of Technology, Tehran, where he is currently
magnetis, vol. 7, no. 1, pp. 158–161, 2005. working toward the Ph.D. degree in biomedical engi-
[18] M. Mneimneh, E. Yaz, M. Johnson, and R. Povinelli, “An adaptive kalman neering at the Electrical Engineering Department.
filter for removing baseline wandering in ECG signals,” in Proc. 33rd He is also a member of Biomedical Signal and
Annu. Int. Conf. Comput. Cardiol., 2006, pp. 253–256. Image Processing Laboratory (BiSIPL), Sharif Uni-
[19] R. Sameni, M. B. Shamsollahi, and C. Jutten, “Filtering electrocardiogram versity of Technology. His current research interests
signals using the extended Kalman filter,” in Proc. 27th Annu. Int. Conf. include dynamical models for ECG generation, model-based ECG processing,
IEEE Eng. Med. Biol. Soc. (EMBS), Shanghai, China, Sep. 1–4, 2005, the application of wavelet concepts, and especially multiadaptive bionic wavelet
pp. 5639–5642. transform to biomedical signal processing solutions, signature verification, and
[20] R. Sameni, M. B. Shamsollahi, C. Jutten, and M. Babaie-Zadeh, “Filtering efficient heart modeling.
noisy ECG signals using the extended Kalman filter based on a modified
dynamic ECG model,” in Proc. 32nd Annu. Int. Conf. Comput. Cardiol.,
Lyon, France, Sep. 25–28, 2005, pp. 1017–1020. Mohammad Bagher Shamsollahi (M’02) was born
[21] R. Sameni, M. B. Shamsollahi, C. Jutten, and G. D. Clifford, “A nonlinear in Qom, Iran, in 1965. He received the B.Sc. de-
bayesian filtering framework for ECG denoising,” IEEE Trans. Biomed. gree in electrical engineering from Tehran Univer-
Eng., vol. 54, no. 12, pp. 2172–2185, Dec. 2007. sity, Tehran, Iran, in 1988, the M.Sc. degree in elec-
[22] S. M. Kay, Fundamentals of Statistical Signal Processing: Estimation trical engineering, telecommunications from Sharif
Theory. Englewood Cliffs, NJ: Prentice-Hall, 1993. University of Technology, Tehran, in 1991, and the
[23] P. E. McSharry and G. D. Clifford, “A statistical model of the sleep-wake Ph.D. degree in electrical engineering, biomedical
dynamics of the cardiac rhythm,” Comput. Cardiol., vol. 32, pp. 591–594, signal processing from the University of Rennes 1,
Sep. 2005. Rennes, France, in 1997.
[24] G. D. Clifford and P. E. McSharry, “Method to filter ECGs and evaluate Currently, he is an Associate Professor in the De-
clinical parameter distortion using realistic ECG model parameter fitting,” partment of Electrical Engineering, Sharif University
Comput. Cardiol., vol. 32, pp. 735–738, Sep. 2005. of Technology. His current research interests include biomedical signal pro-
[25] G. D. Clifford, “A novel framework for signal representation and source cessing, brain computer interface, and time-scale and time-frequency signal
separation: Applications to filtering and segmentation of biosignals,” J. processing.
Biol. Syst., vol. 14, no. 2, pp. 169–183, Jun. 2006.