Professional Documents
Culture Documents
Min Yang
BME 499
Prof. Wei Lin
Real time ECG signal compression method
Introduction:
Normally, a few seconds of ECG signal obtained from a patient will generate thousands
of data points. In order to transfer hours of information, a compressed data presentation will be
more favorable and it allows long-term digital storage. Even though there are a great numbers of
compression techniques available online or in the literature, the demand of searching for new
methods and algorithms to achieve higher compression ratio while preserving useful data has
been always there. The ultimate application will be focus on portable devices for 24 hour online
cardiac monitoring [2]. Currently, there are many different methods have been published by
varies research groups. They can all be grouped into two types: Lossless compression and lossy
compression. Lossless compression allows the original signal and reconstructed signal to be
identical. This method is preferred as long as the compression ratio is acceptable. In contrast,
lossy compression method allows some degrees of losing unnecessary data points in order to
achieve high compression ratio. There are also two signal domains in which ECG data
compression can be performed. The first one is compression in the time domain which consists
in approximating the signal by a sequence of straight lines and slopes [3]. The examples of this
domain are amplitude zone time epoch coding or AZTEC [6]. The second one is the frequency
domain method which involves extraction of the frequency components using a suitable
Yang 2
transform and storing the coefficients in the compressed form such as Fourier transform and
discrete cosine transform [7].
In this paper, an algorithm for ECG data lossy compression has been presented using fast
Fourier transform to achieve both high accuracy and high compression ratio. The algorithm has
been tested on a sample ECG records and the performance was evaluated by two important
parameters: compression ratio and percent root-mean-square difference (PRD) besides visual
comparison. We chose PRD measurement for its simplicity and easy to calculate, more over it is
the one of the most popular reported measure among scientific publications which makes it
easier to compare the results.
Method:
Much work has been done in ECG compression with blooming of Fast Fourier
transform(FFT) based methods [4], discrete cosine transform(DCT) and discrete sine
transform(DST) based methods [5], and wavelet based methods [1] in signal processing. For
selecting our best model, we first considered our resources, prior experience (the use of computer
application) and the degree of difficulty. Then, we evaluated some of the developed methods
based on compression ratio and percent root mean square differences (PRD). From figure 1, we
concluded that FFT is the best option because of its relative high compression ratio and low
PRD.
Yang 3
Figure 1. 4 different Transform to compress an ECG signal,DCT transform,DST transform,FFT transform and DCT2
transform.
The environment in which we performed our algorithm was Matlab. Matlab is one of
the most success programming tools in biomedical field and it integrates computation,
visualization and programming in a user friendly environment. It also provides an interactive
graphical environment and a set of useful build in functions that facilities the implementation. It
can transform signals from time domain to frequency domain by simply using command fft.
This build in function is based on a popular mehod called Cooley-Tukey FFT algorithm [8]. This
algorithm divides a discrete Fourier transform of size N into two interleaved DFTs of size N/2.
The discrete Fourier transform (DFT) is defined by the formula:
The algorithm first computes the DFTs of the even-indexed inputs x2m(x0,x1,
,xN-2) and odd-indexed inputs x2m+1(x1,x3,,xN-1), and combines those
two results to produce the DFT of the whole sequence. The algorithm runs at
its maximum speed when N is the power of two.
The equation becomes:
Yang 4
k2
pii
N
Yang 5
Because of the periodicity properties of the DFT, the outputs for N/2k<N
from a DFT of length N/2 are identical to the outputs for 0k<N/2. The whole
equation becomes:
This equation expresses the DFT of length N recursively in terms of two DFTs
of size N/2 which can reduce the computation time by hundreds.
After identifying and analyzing the transform method, we started to
modify a very simple FFT based code for compression which was created by
Nasri, Mehdi at Matlab center. First the data samples are read from a saved
ECG file which contains ten thousand data points and then the subroutine is
called up for performing the FFT. The output array now contains the same
number of FFT coefficients as the number of samples in the input signal. In
order to compress the signal, the higher order coefficients are set to zero and
only lower order coefficients are retained. The remaining data points were
then stored in a excel file. The figure 2 represents the sample code that
describes the function above.
Yang 6
The reconstruction of the signal is obtained by using another useful build in function
called an inverse fast Fourier transform and followed by a command ifft. Before we used this
inverse transform, the same numbers of data points must be restored in order to get a full
decompressed signal. Figure 3 describes a code that generated a new set of array contains same
values when there is a match and fill with zeros otherwise. This new array is then inversely
transformed.
The performance of the proposed data compression algorithm is measured in terms of the
compression ratio and percent root-mean-square difference. The efficiency of a compression
method is related directly to the compression ratio which is given by the ratio of the amount of
Yang 7
original data to that of the compressed data [3]. To evaluate the distortion in the reconstructed
signal, PRD is used as the basis because of its simplicity and popularity. The PRD between the
reconstructed and original signals is calculated as:
where Xorg and Xrecon are the samples of the original and reconstructed signals,
respectively
Yang 8
Result:
Figure 4. top represents original and bottom represents compressed signal for base algorithm.
Yang 9
Figure 5. Improved algorithm with each sub-arrays original data and compressed data.
Figure 7. left picture shows discontinuity, and right picture shows connection between each sub-arrays.
Yang 10
Column1
CR
PRD
Base
Improved
algorithm
algorithm
After filtering
89.57
88.42
1.1661
5.6897
13.277
Yang 11
when signals combined from each compressed sub signals. From figure 7, we found that
separating original signal into several sub-signal arrays increases the PRD value; this is because
larger sample size contains more information and generates lower random errors. In fact, for any
experiments, as the sample size goes to infinity, the random errors will go to zero. We also found
that our filtering method increase the PRD and did not significantly reduce the high frequency
component as shown in figure 8. It can be solved by using new filtering method or completely
remove filtering function. Even though we did not test the time spend for compression, we would
predict a much short time spent by improve algorithm than the base algorithm.
Conclusion:
Data compression of ECG signals allows long-term digital storage and archiving of ECG
recordings [2]. A lossy compression algorithm for ECG signals based on Fast Fourier transform
is experimented. The performance parameters of the compression technique shows a
compression ratio can be as high as 89% with a PRD of 1.17 for base algorithm and 5.69 for
improved algorithm. This represents a substantial reduction in ECG signal and an increased
storage capacity of the digital recorder. By comparing the results with other published literature
[1] [2] [3] [4], we found that our compression ratio was much higher than others; however, our
PRD value is also significantly higher than others.
In conclusion, this algorithm has its clinical potential, but need to be further improved in
order to reduce PRD value and achieve better performance. The developed algorithm can then be
transfer into physical channels to perform real ECG compression.
Yang 12
Reference:
1. Hilton, M.L., 1997. Wavelet and Wavelet Packet Compression of Electrocardiograms.
IEEE Trans. on Biomedical Engg., 44(5): 394-402.
2. Hossain, Md. Sharafat, and Nowshad Amin. "ECG Compression Using Subband
Thresholding Of The Wavelet Coefficients." Australian Journal Of Basic &
Applied Sciences 5.5 (2011): 739-749. Academic Search Complete. Web. 6 May
2012.
3. Kulkarni, P K, V Kumar, and H K Verma. "Diagnostic Acceptability Of FFT-Based ECG
Data
(1997): 185-189.
MEDLINE with Full Text. Web. 6 May 2012.
4. Wei, Yang, Zhao Zhiqin, and Nie Zaiping. "Fast Fourier Transform Multilevel Fast
Multipole
47(11): 1422-1430.
6. Cox, J. R., NOLLE,F . M., FOZZARD, H. A. and OLIVERG,. C. (1968) AZTEC a
preprocessing program for real-time ECG rhythm analysis. IEEX Transactions on
Biomedical Engmeering.
7. Reddy, B . R. S. and MURTHY, 1. S. N. (1986) ECG data compression using Fourier
descriptors. IEEX Transactions on Biomedical Engmeering. 33, 428 - 433.
8. Lexing, Ying, and SERGEY FOMEL. "Fast Computation Of Partial Fourier Transforms."
Multiscale Modeling & Simulation 8.1 (2009): 110-124. Academic Search
Complete.