ECG compression based on wavelet transform and Golomb coding
mechanism in our scheme. The threshold T is the only parameter to be adjusted and acts as a ‘rough’ quality control factor, which is similar to the quality factor in the JPEG image compression standard.
J. Chen, J. Ma, Y. Zhang and X. Shi A new wavelet-based ECG compression method is presented. Wavelet transform coefficients are quantised with a uniform scalar dead zone quantiser. The Exp-Golomb coding is used to code the lengths of runs of the zero coefficients. The Golomb-Rice coding is used to code the nonzero coefficients. Experiments on several records from the MITBIH arrhythmia database show that the proposed coding algorithm outperforms other recently developed ECG compression algorithms.
Introduction: The ECG compression methods based on the discrete wavelet transform (DWT) play an interesting role in the ECG data compression applications owing to their easy implementation and efficiency [1–4]. Among them, the thresholding based schemes [3, 4] yield attractive performance and low computational cost. In these schemes, the wavelet coefficients are thresholded to set small coefficients to zero. Then the nonzero coefficients are uniformly quantised and both the significance map and significant coefficients are Huffman coded. However, the relationship between the threshold and the quantisation step size was not addressed in these works. The improper selection of these parameters may lead to higher distortion for a given bit rate. On the other hand, direct coding of the binary significance map is apparently not efficient since Huffman code is not so good for small alphabet coding. Also, Huffman coding depends on the a priori knowledge of the symbol statistics, making the algorithms less robust to signals with different statistical characteristics. In consideration of these factors, we present a new ECG compression scheme in which a uniform scalar dead zone quantiser (USDZQ) is used to quantise the DWT coefficients. The lengths of runs of the zero coefficients and the nonzero coefficients are entropy coded using two types of Golomb codes which do not require the a priori symbol statistics or the symbol statistics can be learned during the coding process. Compared with the approaches in [1–4], the presented scheme achieves significantly better performance while maintaining low implementation complexity.
Wavelet transform and quantisation: The input signal is divided into contiguous, non-overlapping frames and transformed frame by frame. The frame length is 1024 and the DWT is performed using the 9=7 tap filter bank [5] with five levels of decomposition. The DWT transform coefficients are quantised with the USDZQ described below: 8 ½3d; T Þ k ¼ 1 > > > < ½T ; T k¼0 ð1Þ Ik ¼ > ðT ; 3d k¼1 > > : ðð2k 1Þd; ð2k þ 1Þd k ¼ 2; 3; . . . 0 k¼0 ð2Þ Rk ¼ 2kd k ¼ 1; 2; . . . Here, k is the quantisation output index, Ik describes the kth decision interval and Rk is the corresponding reconstruction level. d is half of the quantisation step size. T is a threshold round zero. The quantisation of the USDZQ can be viewed as a threshold operation followed by a normal uniform quantisation. The central quantisation bin [T, T], in which samples are quantised to 0, is known as the dead zone. If T ¼ d, this will be the standard midtread uniform quantiser. However, for most natural signals, many high frequency subband wavelet coefficients are so small that when these coefficients are set to zero, no significant information will be lost in the reconstructed signals. Therefore, it is desired to have a larger dead zone to set more high frequency coefficients to zero so as to increase compression performance without losing much quality of the reconstructed signals. Hence, T should be larger than d. From our experiment, however, we find that T should also be smaller than 2d, the reconstruction level of the next quantisation bin. That means, d < T < 2d. For a given signal, the optimum relationship between d and T that minimises the distortion under a given bit rate can be found by some searching algorithm. But we observe that for good compression performance, d ¼ 0.6T is a satisfactory choice for the ECG data sets we have tested. Currently, there is no exact rate or distortion control
Entropy coding: The Exp-Golomb code [6], which is suboptimal and robust for coding exponential data when the decay rate is unknown, is used to code the lengths of runs of the zero coefficients. An Exp-Golomb codeword is represented as: M
M zfflfflffl}|fflfflffl{ zfflfflfflfflfflfflffl}|fflfflfflfflfflffl ffl{ 0 01 xM 1 x0
ð3Þ
The leading M ‘0’s and the middle ‘1’ can be regarded as ‘prefix’ bits. The last M-bit ‘suffix’ field is the binary representation of Runlength þ 1 2M. Each codeword is 2M þ 1 bits in length. In fact, the ExpGolomb codeword can be constructed by: M ¼ log2 ðRunlength þ 1Þ ð4Þ xM 1 x0 ¼ Runlength þ 1 2M On the other hand, the Golomb-Rice code [7] is used to code the nonzero coefficients which are commonly known to be distributed geometrically. Given a positive integer parameter m ¼ 2k, the GolombRice code Gm, encodes an integer n 0 in two parts: a binary representation of n mod m, and a unary representation of b n=m c (bn=mc ‘1’s followed by a ‘0’). Actually, the codeword for n is constructed by appending the k least significant bits of n to the unary representation of the number formed by the remaining higher-order bits of n. The length of the encoding is k þ 1 þ bn=mc. Golomb-Rice codes are optimal for geometric probability distributions of the non-negative integers. For every distribution of this form, there exists a value of the parameter k, such that Gm yields the shortest possible average code length. Because Golomb-Rice codes can only code non-negative integers, we use the following invertible function [8] to map the nonzero integers onto the non-negative integers 1 2jsj 1; s < 0 ð5Þ FðsÞ ¼ ’ jsj 2jsj 2; s > 0 2 Thus, we encode s by applying a Golomb-Rice code Gm to F(s), selecting the parameter k based on an estimate of the expected value of jsj 1=2. During the coding process, we maintain a count N of the number of nonzero coefficients encoded so far and an accumulated sum A of the quantity jsj 1=2. The Golomb-Rice code parameter used to encode F(s) is m ¼ 2k, where k is computed as k ¼ minf j j 2 j A=N g
ð6Þ
After encoding a sample s, N is incremented by one and A is incremented by jsj 1=2. (Alternatively, N is incremented by two and A is incremented by 2jsj 1 so that only integer arithmetic is needed.) Whenever N reaches some maximum value Nmax, N and A are rescaled by setting N ¼ bN=2c and A ¼ bA=2c. Based on our experiment results, Nmax ¼ 8 is a satisfactory choice. During the coding process, the codewords for the lengths of zero runs and the codewords for nonzero coefficients appear alternatively. When two consecutive nonzero coefficients are to be coded, a codeword for the zero run of length 0 is inserted between the codewords of these two nonzero coefficients. Results: The proposed algorithm is tested on a few recordings from the MIT-BIH ECG arrhythmia database. All recordings contain two lead ECG signals sampled at 360 Hz. The resolution of each sample is 11 bits=sample. The distortion between the original signal x(n) with length N and the reconstructed signal xˆ (n) is measured by the per cent root mean square difference (PRD): sP ffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffi N ^ ðnÞ2 n¼1 ½xðnÞ x ð7Þ PRD ¼ PN 2 n¼1 ½xðnÞ The 1024 baseline in each MIT-recording is removed before compression to make the PRD measure effective. We first compare our results with those reported in [4]. The tested data set (set I) consists of the first 2-min length of data in both leads of record number: 100, 101, 102, 103, 107, 109, 111, 115, 117, 118, 119 in the MIT-BIH database. The compression ratio (CR) results for the
ELECTRONICS LETTERS 16th March 2006 Vol. 42 No. 6
same PRD values as in [4] are listed in Table 1. We also compare our results with those in [2]. The tested data set (set II) consists of the first 1-min samples in record number: 104, 107, 111, 112, 115, 116, 117, 118, 119, 201, 207, 208, 209, 212, 213, 214, 228, 231, and 232. The PRD results for the same CR values as in [2] are listed in Table 2. From both tables, it can be found that the proposed algorithm achieves better performance in all given PRD or CR values, especially at higher compression ratios. Because at higher CRs more coefficients are quantised to zero, the lengths of runs of zero coefficients will be longer and the number of runs to be coded will be reduced. It is also more efficient for the Exp-Golomb code to encode such longer runs. The comparison on some individual recordings is given in Table 3.
Table 1: CR results on test data set I at given PRD values PRD Proposed method Blanco-Velasco [4]
2.72
2.91
3.47
3.73
4.15
4.79
5.75
11.59 12.48 14.45 15.51 17.12 19.53 22.87 9.41
Conclusion: The uniform scalar dead zone quantiser with carefully determined parameters reduces quantisation distortion. The ExpGolomb coding of the lengths of runs of zero coefficients and the Golomb-Rice coding of the nonzero coefficients improve the entropy coding performance. The algorithm is quite robust to different ECG signals because no a priori signal statistic is required. The Golomb codes used are also quite efficient in terms of computational cost, making the algorithm more appealing to real-time applications. # IEE 2006 Electronics Letters online no: 20063812 doi: 10.1049/el:20063812
30 October 2005
J. Chen, J. Ma, Y. Zhang and X. Shi (Department of Electronic Engineering, Yunnan University, Kunming 650091, People’s Republic of China) E-mail:
[email protected]
10.33 11.84 12.44 13.19 14.13 15.32
References 1
Table 2: PRD results on test data set II at given CR values CR
8
10
12
16
Proposed method 2.39 2.93 3.46 4.67 6.13 SPIHT [2]
2.5
2
20
3.11 3.82 5.46 7.52
3 4
Table 3: Compression results on individual records Method
Signal 117
CR
PRD
8.31
1.07
17.45
2.0
119
18.14
2.65
232
9.78
4.91
Hilton [1]
117
8
2.6
SPIHT [2]
117
8
1.18
117
16.24
2.55
119
17.43
5.13
8.24
1.17
Proposed method
Benzid [3]
117 Blanco-Velasco [4]
17.4
2.53
119
18.02
5.04
232
9.7
6.28
5 6 7
8
Hilton, M.L.: ‘Wavelet and wavelet packet compression of electrocardiograms’, IEEE Trans. Biomed. Eng., 1997, 44, (5), pp. 394–402 Lu, Z., Kim, D.Y., and Pearlman, W.A.: ‘Wavelet compression of ECG signals by the set partitioning in hierarchical trees algorithm’, IEEE Trans. Biomed. Eng., 2000, 47, (7), pp. 849–856 Benzid, R., Marir, F., Boussaad, A., Benyoucef, M., and Arar, D.: ‘Fixed percentage of wavelet coefficients to be zeroed for ECG compression’, Electron. Lett., 2003, 39, (11), pp. 830–831 Blanco-Velasco, M., Cruz-Rolda´n, F., Godino-Llorente, J.I., and Barner, K.E.: ‘ECG compression with retrieved quality guaranteed’, Electron. Lett., 2004, 40, (23), pp. 1466–1467 Antonini, M., Barlaud, M., Methieu, P., and Daubechies, I.: ‘Image coding using wavelet transform’, IEEE Trans. Image Process., 1992, 1, (2), pp. 205–220 Teuhola, J.: ‘A compression method for clustered bit-vectors’, Inform. Process. Lett., 1978, 7, pp. 308–311 Weinberger, M.J., Seroussi, G., and Sapiro, G.: ‘LOCO-I: a low complexity, context-based, lossless image compression algorithm’. Proc. Data Compression Conf., Snowbird, UT, USA, March 1996, pp. 140–149 Kiely, A., and Klimesh, M.: ‘Generalized Golomb codes and adaptive coding of wavelet-transformed image subbands’, IPN Progress Report 2003, 42-154, (online) http://tmo.jpl.nasa.gov/progress_report/42-154/ title.htm
ELECTRONICS LETTERS 16th March 2006
Vol. 42 No. 6