Vous êtes sur la page 1sur 9

Digital Signal Processing 18 (2008) 56–64

www.elsevier.com/locate/dsp

Constrained ECG compression algorithm using the block-based


discrete cosine transform
R. Benzid a,∗ , A. Messaoudi b , A. Boussaad c
a Department of Electronics, Faculty of Science and Engineering, University of M’Sila, 28000 M’Sila, Algeria
b Department of Electronics, Faculty of Science and Engineering, University of Bordj Bou Arréridj, 34000 Bordj Bou Arréridj, Algeria
c Department of Mathematics, Faculty of Science, University of Batna, 05000 Batna, Algeria

Available online 25 August 2007

Abstract
Presented is a novel method dedicated to ECG compression. It uses the block-based discrete cosine transform (DCT) and con-
siders the percent root-mean-square difference (PRD) as a controlled quality criterion. The simple and efficient resulting lookup
table coding in coordination with the non-zero resulting DCT coefficients adaptive linear quantization, proffer to the method a high
performance. The experiments carried out on the MIT-BIH arrhythmia records point out its effectiveness and classify it as a valid
concurrent to some recently published powerful methods.
© 2007 Elsevier Inc. All rights reserved.

Keywords: Electrocardiogram compression; Discrete cosine transform; Quality-controlled

1. Introduction

Biomedical signals, in general, and electrocardiogram (ECG) signals, in particular, have been representing an
important application field for data compression methods. In this context, great efforts have been devoted for the
development of compression techniques that have, nowadays, reach a high degree of sophistication. One can categorize
compression algorithms to lossless/near-lossless methods such as those mentioned in [1,2] and lossy methods such as
in [3–8].

• In the case of lossless/near-losseless algorithms, the very high quality is ensured, however the bit rate is also high.
This latter is their main drawback.
• In opposite to the first case, using the lossy strategies, allow to reach low bit rate (high compression ration).
However, the particularity of medical signals requires that compression must be done with care in order to ensure
medically accepted quality when inspected by physicians.

In addition to the previous categorization, ECG compression algorithms can be classified to:

* Corresponding author. Fax: +213 35 55 15 49.


E-mail address: rbenzid@lycos.com (R. Benzid).

1051-2004/$ – see front matter © 2007 Elsevier Inc. All rights reserved.
doi:10.1016/j.dsp.2007.08.003
R. Benzid et al. / Digital Signal Processing 18 (2008) 56–64 57

• Direct methods [9,10], which attempt to remove redundancy by acting, directly, on the temporal consecutive
samples of an ECG record.
• Transform based methodologies [3–6]. Usually, the transforms (DWT, DCT, DFT) concentrate the large part of
the signal energy in few transformed coefficients. This allows the accomplishment of a high storage capability
according to a high reconstructing quality.
• Model based algorithms [11,12]. In, this case, a set of model parameters is extracted from the ECG record per-
mitting so, the adequate representation of original data as faithfully as possible.

When lossy methods are used, it is coherent to opt to a ‘closed-loop’ or a ‘feed-back’ methodology guarantee-
ing above all, the safeguarding of the pertinent information contained initially in the original data in agreement with
the larger possible compression ratio. In this context, several papers have presented methods to control the com-
pression process of electrocardiogram signals (ECG), according to a user-predefined quality criterion. The control is
done in the optic to guarantee some quantitative constraints which are usually distortion measures. The method pre-
sented in [13] based on the SPIHT algorithm [14], as mentioned, can attain exact bit rate and generates a bit stream,
progressive in quality or rate. Chen and Itoh in [15] used the wavelet transform in combination with an adaptive quan-
tization strategy to ensure the match (by solving an optimization problem) of a predefined MSE (PRD). In [16,17,26],
the used criterion is a predefined energy-packing, it is reached by the iterative thresholding of wavelet coefficients.
Blanchett et al. have resolved in [18] the problem of guaranteeing beat-by-beat the clinically adequate reconstruc-
tion in a way that the different relative-mean-square-errors relevant to PQ, QRS and ST are kept in tolerable bounds.
Also, the work of Nagarajan et al. [19] consisted in choosing the best wavelet packet basis giving the lower possi-
ble rate subjected to the constraint that the PRD is always in a pre-defined tolerance. In [20], the authors presented
a quality-controlled method based on the PRD as a quality measure, combined to an adaptive wavelet coefficients
quantization strategy associated to an efficient two role encoder. The same measure (PRD) is used in [21,22]. The
method quoted in [21] is based on SVD and wavelets. A targeted PRD is searched by starting with preservation of
the first singular value decomposition then the two first and so on until the goal PRD is reached. The algorithm in-
cludes wavelets for more compressing (as reported) the shortest reconstructed ECG signal, then an efficient lossless
modified run-length encoder is used. The paper [22] shows an improvement algorithm of the presented one in [23].
The quality is guaranteed to be retrieved by controlling the PRD using the simple and efficient bisection algorithm to
find the optimal threshold of the resulting coefficients from the nearly perfect reconstruction cosine modulated filter
bank.
As another alternative, we propose a PRD-based controlled method using the DCT transform to bring out its
effectiveness for quasi-periodic signals (i.e., ECG signals). The PRD use is motivated by two reasons:

• The PRD is the widely used measure.


• Its low cost computational time.

2. Method presentation

The encoding process is shown in Fig. 1.


The different steps of this method are described bellow.

2.1. DCT transform and thresholding

First, the ECG signal (after removing its mean value) is transformed by means of the (block-based) DCT transform.
The DCT transform has the property to provide a large number of small coefficients, which can be zeroed without
altering the signal significantly. Let DCTb (i) be the ith DCT coefficient of the bth block. In this method, we adopt the
PRD criterion to control the compression process. In order to meet some user-specific value of the PRD (UPRD), we
need to find an optimal threshold value TH* such that:
 
DCTb (i) = 0, if DCTb (i)  TH∗ . (1)
58 R. Benzid et al. / Digital Signal Processing 18 (2008) 56–64

Fig. 1. Encoding process.

Note that before PRD calculation, the mean value already subtracted is added to both the zero-mean original and the
reconstructed (decompressed) signals. Three different PRD formulas can be found in the open literature. The first
formula is given in [13] and described by (2)

 N
 (Xi − X̂i )2
PRD1 = 100 ×  Ni=1 , (2)
i=1 (Xi − 1024)
2

where Xi and X̂i denote the ith samples of the original and reconstructed signals, respectively.
The second formula can be found in [26] and expressed by (3)

 N
 (Xi − X̂i )2
PRD2 = 100 ×  i=1 N
, (3)
i=1 (Xi − X̄)
2

where X̄ denotes the mean value of the original ECG record.


Finally, the last formula is expressed by

 N
 (Xi − X̂i )2
PRD3 = 100 ×  i=1 N . (4)
2
i=1 (Xi )

In order to identify the optimal threshold value TH* in a quick way the False Position (Regula Falsi) technique
is used [24]. This fast technique permits to attain the desired PRD target (UPRD) with a precision of 1% in few
iterations.
The algorithm for TH* finding is the following:
R. Benzid et al. / Digital Signal Processing 18 (2008) 56–64 59

Step 0: Give UPRD, the precision ε, TH0 , TH1 , MAX_ITERATIONS, ii = 0, m0 = 0, m1 = 0,


and ZX (the zero-mean version of the original signal X).
Step 1: Calculate the block-based DCT of ZX (called DCTZX).
Step 2: if m0 = 0 then
Threshold a copy of DCTZX according to TH0, calculate the inverse block-based
DCT (XTH0 ) and the corresponding PRD called PRDTH0
endif.
Step 3: if m1 = 0 then
Threshold a copy of DCTZX according to TH1, calculate the inverse block-based
DCT (XTH1 ) and the corresponding PRD called PRDTH1
endif.
− PRDTH0 )(TH1 − TH0 )
Step 4: Calculate TH = TH0 + (UPRD (PRDTH1 − PRDTH0 ) .
Step 5: Threshold a copy of DCTZX according to TH, calculate the inverse block-based
DCT (XTH) and the corresponding PRD called PRDTH.
− PRDTH|
Step 6: if 100|UPRD
UPRD < ε then go to Step 8
else
if (PRDTH − UPRD) × (PRDTH1 − UPRD) < 0 then TH0 = TH, m0 = 0, m1 = 1
else TH1 = TH, m0 = 1, m1 = 0
endif
endif.
Step 7: ii = ii + 1
if ii >MAX_ITERATIONS
then go to Step 8
else
go to Step 2
endif.
Step 8: END.

Note that PRDTH, PRDTH0 and PHDTH1 are calculated, as needed, using Eqs. (2) or (3) or (4). The calculation
is done after the addition of the mean value, already subtracted, to both original and reconstructed signals in the cases
of Eqs. (2) and (4).

2.2. Quantization and coding of the non-zero DCT coefficients

After the thresholding step, from the DCT thresholded coefficients vector (THDCT), two vectors result:

• An extracted vector containing non-zero only DCT coefficients (NZDCT).


• A binary lookup table BT locating (by 1’s) the sequential positions of the NZDCT coefficients in the THDCT
vector.

The NZDCT coefficients are quantized by a linear quantizer defined as


NZDCT − NZDCTmin
QNZDCT = (2m − 1) , (5)
NZDCTmax − NZDCTmin
where NZDCTmin and NZDCTmax represent the minimum and maximum values of the NZDCT coefficients re-
spectively. The parameter m stands for the quantization resolution determined in such a way that the PRD of the
reconstructed signal resulting from the quantized DCT coefficients, denoted QPRD, meets the following condition:
|QPRD − UPRD|
100 ×  εPRD , (6)
UPRD
where εPRD is the tolerated error ratio after quantization. This manner of quantization uses adaptively a variable
width of bits suitable to the nature of each data signal. It means that the QPRD is calculated for 6, 7, 8, 9, and 10 bits
60 R. Benzid et al. / Digital Signal Processing 18 (2008) 56–64

resolutions and the lowest one matching the exigency of (6) is kept as the adopted quantizer resolution. We adopted
10% as a value of εPRD in all reported results.
We note that, after the quantization operation, the non-zero DCT coefficients are compressed by means of the
well-known arithmetic encoder.

2.3. Lookup table encoding

Inspired from the method described in [25], the binary lookup table BT (which allows the memorization of the
positions of the non-zero DCT coefficients) is constructed and encoded as follows: it is composed of binary blocks
of 64 bits (corresponding to the adopted DCT block size), where each ‘1’ indicates the chronological position of a
NZDCT coefficient. In order to encode the lookup table, we employ one of the DCT interesting properties that is: most
of its blocks—after the thresholding process—contain a long run (succession of zeros) at their ends. Accordingly, each
block is variable length-encoded by means of a systematic code of two components. The first one consists in K bits
used to indicate the position of the last ‘1’ encountered in the considered block. In our case, the number K is equal to
6 to permit the encoding of all possible positions of the last ‘1,’ from the minimum position 1 encoded by 1 − 1 (0) or
000000 in binary, to the maximum position 64 encoded by 64 − 1 (63) or 111111 in binary. The second component
consists in reproducing all the bits preceding the last ‘1’ encountered in the considered block. The rule governing this
coding is very simple. If the position of the last one encountered in a block is in decimal n, then K should contain the
binary value of the decimal value n − 1. This systematic code is preceded by a bit indicating if the block is active or
inactive. A block is considered inactive if all the 64 constituent bits are 0. It means that all the 64 DCT coefficients
corresponding to this block are thresholded (zeroed). Note that if a block is inactive, only the activity bit set to 0 is
necessary to code and replace all the 64 zeros.
To illustrate the coding method, we assume that an active block of 64 bits is as follows:
11110010 11100011 00000000 0000000000000000 00000000 00000000 00000000.
the activity bit K bits all bits preceding the last 1

 
 

The corresponding code will be 1 001111 11110010 1110001 with a reduction of 22/64.
We note that in all experiments 2 min, of each MIT-BIH ECG record, were taken. As reported previously, each
signal is split into segments containing 64 samples for each. It means that we obtain 675 segments.
Figure 2 shows the (zoomed in) binary lookup table. The representative image is constituted of 675 blocks (rows).
Each binary row (block of 64 elements) indicates the chronological positions of non-zero elements (in black color)
and zeroed elements (in white color). It illustrates clearly the interesting property, that the most part of blocks (after
the thresholding process) contain long runs of zeros at their ends, which allows the compression of the BT efficiently
by the proposed systematic encoder.
The decompression process can be summarized in the following steps:

• Decompression of the QNZDCT, already compressed, by means of the arithmetic decoder.


• Dequantization of QNZDCT, by reversing (5), in order to obtain the dequantized vector DQNZDCT.
• Decompression of the lookup table to obtain the original lookup table BT.
• Construction of the THDCT vector by means of the use of both the BT and the DQNZDCT vectors.
• The inverse DCT transform application and the addition of the mean value already subtracted.

3. Experimental results

In order to assess the effectiveness of the proposed method the standard arrhythmia MIT-BIH records characterized
by a resolution of 11 bits and a sampling frequency equal to 360 Hz were used. The considered length for each ECG
signal was equal to 43,200 samples (2 min) corresponding to 675 blocks of 64 samples for each.
For the data set 100, 101, 102, 103, 107, 109, 111, 115, 117, 118, and 119 (taken from [13]), Table 1 gives for
different UPRD values: different average PRD of signals after quantization denoted by QPRD, average compression
ratios (CR), and the average allocated bits (m) of the quantizer, versus results of those of [22] and SPIHT methods [13].
PRD formula used is (2), i.e., PRD1.
For visual inspection by physicians, Figs. 3 and 4 are reported. They correspond to record 117 for UPRD fixed to
1.75 and record 121 for UPRD fixed to 1.5. In this case PRD1 formula is used.
R. Benzid et al. / Digital Signal Processing 18 (2008) 56–64 61

Fig. 2. The lookup table of record 117. εPRD = 10% (UPRD1 = 1.75, QPRD1 = 1.82, CR = 14.73:1, m = 7 bits).

Table 1
Results of average UPRD, average QPRD, average CR, and average allocated bits for the quantizer versus those of other methods (εPRD = 10%)
Proposed method m (bits) 7.81 7.81 7.45 7.36 7.09 6.91 6.63
UPRD (%) 2.50 2.75 3.30 3.60 3.95 4.60 5.55
QPRD (%) 2.66 2.89 3.48 3.77 4.18 4.81 5.79
CR 10.84 11.46 13.45 14.29 15.43 17.10 19.64
Blanco-Velasco [22] PRD (%) 2.72 2.91 3.47 3.73 4.15 4.79 5.75
CR 9.4 10.33 11.84 12.44 13.19 14.13 15.32
SPIHT [13] PRD (%) – 2.96 3.57 – – 4.85 –
CR – 10 12 – – 16 –

Finally, for the aim of comparison with other elaborated methods, we report in Table 2 some demonstrative results.
From the obtained results, we can report that the method presents a high capability of compression according to
the preservation of medical pertinent information initially contained in the original ECG records.

4. Conclusions

The elaborated method is considered as one among the large panorama of the lossy compression methods. The
method demonstrates, by results, high performance for ECG compression and this is due to:
62 R. Benzid et al. / Digital Signal Processing 18 (2008) 56–64

Fig. 3. Record 117 compression results εPRD = 10% (UPRD = 1.75, QPRD = 1.82, CR = 14.73:1, m = 7 bits).

Fig. 4. Record 121 compression results εPRD = 10% (UPRD = 1.50, QPRD = 1.58, CR = 16.55:1, m = 8 bits).

Table 2
Performance comparison for record 117 between developed method and other methods
Methods Compression ratio (CR) PRD m (bits)
Proposed 21.74:1 2.56 (QPRD1) 6
Blanco-Velasco [22] 17.40:1 2.54 (PRD1) 8
Proposed 9.56:1 1.18 (QPRD1) 8
Lu, SPIHT [13] 8:1 1.18 (PRD1) –
Proposed 12.02:1 5.3 (QPRD2) 7
Al-Shrouf [26] 11.6:1 5.3 (PRD2) –
Proposed 20.44:1 2.38 (QPRD1) 6
Ouamri [27] 15.5:1 2.37 (PRD1) –
R. Benzid et al. / Digital Signal Processing 18 (2008) 56–64 63

• The guaranteed-retrieved quality is ensured by matching the desired, fixed in advance, PRD within tolerance
of 1%. The convergence is done after few iterations by using numerical methods such as: bisection, false position.
• The simple and efficient adaptive quantization strategy of the non-zero DCT coefficients. It is evident that the
lowest quantizer resolution which fill the tolerance of the PRD in the margin 10% is depending of the nature of
each ECG record.
• The arithmetic encoder applied on the non-zero quantized DCT coefficients which enhance the storage efficiency.
• The simple and effective binary lookup table encoding which improve also considerably the storage efficiency.

References

[1] Z. Arnavut, Lossless and near-lossless compression of ECG signals with block-sorting techniques, Int. J. High Perform. Comp. Appl. 21
(2007) 50–58.
[2] S.-G. Miaou, S.-N. Chao, Wavelet-based lossy-to-lossless ECG compression in a unified vector quantization framework, IEEE Trans. Biomed.
Eng. 52 (2005) 539–543.
[3] M.-S. Abarimalai Manikandan, S. Dandapat, Wavelet threshold based ECG compression using USZZQ and Huffman coding of DSM, Biomed.
Signal Process. Control 1 (2006) 261–270.
[4] G. Tohumoglu, K. Erbil Sezgin, ECG signal compression by multi-iteration EZW coding for different wavelets and thresholds, Comput. Biol.
Med. 37 (2007) 173–182.
[5] X. Wang, J. Meng, A 2-D ECG compression algorithm based on wavelet transform and vector quantization, Digital Signal Process. (2007),
doi: 10.1016/j.dsp.2007.03.003, in press.
[6] J. Chen, J. Ma, J. Zhang, J. Shi, ECG compression based on wavelet transform and Golomb coding, Electron. Lett. 42 (2006).
[7] E. Alexandre, A. Pena, M. Sobreira, On the use of 2-D coding techniques for ECG signals, IEEE Trans. Inform. Technol. Biomed. 10 (2006)
809–811.
[8] R. Borsali, A. Nait-Ali, J. Lemoine, ECG compression using an ensemble polynomial modeling: Comparison with the DCT based technique,
Cardiovasc. Eng. 4 (2004) 237–244.
[9] B. Boucheham, ShaLTeRR: A contribution to short- and long-term redundancy reduction in digital signals, Signal Process. 87 (2007) 2336–
2347.
[10] B. Boucheham, Y. Ferdi, M.-C. Batouche, Recursive versus sequential multiple error measures reduction: A curve simplification approach to
ECG data compression, Comp. Methods Programs Biomed. 81 (2006) 162–173.
[11] A. Chatterjee, A. Nait-Ali, P. Siarry, An input-delay neural-network-based approach for piecewise ECG signal compression, IEEE Trans.
Biomed. Eng. 52 (2005) 945–947.
[12] G. Nave, A. Cohen, ECG compression using long-term prediction, IEEE Trans. Biomed. Eng. 40 (1993) (2005) 877–885.
[13] Z. Lu, D.-Y. Kim, W.A. Pearlman, Wavelet compression of ECG signals by the set partitioning in hierarchical trees algorithm, IEEE Trans.
Biomed. Eng. 47 (2000) 849–856.
[14] A. Said, W.-A. Pearlman, A new, fast and efficient image codec based on set partitioning in hierarchical trees, IEEE Trans. Circuits Syst. II 6
(1996) 243–250.
[15] J. Chen, S. Itoh, A wavelet transform-based ECG compression method guaranteeing desired signal quality, IEEE Trans. Biomed. Eng. 45
(1998) 1414–1419.
[16] M. Abo-Zahhad, B.A. Rajoub, An effective coding technique for the compression of one-dimensional signals using wavelet transform, Med.
Eng. Phys. 24 (2002) 185–199.
[17] B.A. Rajoub, An efficient coding algorithm for the compression of ECG signals using the wavelet transform, IEEE Trans. Biomed. Eng. 49
(2002) 355–362.
[18] T. Blanchett, G.-C. Ember, G.A. Fenton, KLT-based quality controlled compression of single lead ECG, IEEE Trans. Biomed. Eng. 5 (1998)
942–945.
[19] K. Nagarajan, E. Kresch, S. Rao, Y. Kresh, Constrained ECG compression using best adapted wavelet packet bases, IEEE Signal Process.
Lett. 3 (1996) 273–275.
[20] R. Benzid, F. Marir, N.-E. Bouguechal, Electrocardiogram compression method based on the adaptive wavelet coefficients quantization com-
bined to a modified two-role encoder, IEEE Signal Process. Lett. 14 (6) (2007) 373–376.
[21] S.M. Ahmed, Q. Al-Zoubi, M. Abo-Zahhad, A hybrid ECG compression algorithm based on singular value decomposition and discrete wavelet
transform, J. Med. Eng. Technol. 31 (1) (2007) 54–61.
[22] M. Blanco-Velasco, F. Cruz-Roldan, J.I. Godino-Llorente, K.E. Barner, ECG compression with retrieved quality guaranteed, Electron. Lett. 40
(2004) 1466–1467.
[23] R. Benzid, F. Marir, A. Boussaad, M. Benyoucef, D. Arar, Fixed percentage of wavelet coefficients to be zeroed for ECG compression,
Electron. Lett. 39 (11) (2003) 830–831.
[24] W.H. Press, S.-A. Teukolsky, W.-T. Vetterling, B.P. Flannery, Numerical Recipes in C—The Art of the Scientific Computing, second ed.,
Cambridge Univ. Press, Cambridge, UK, 1992.
[25] L.V. Batista, L.C. Carvalho, E.U.K. Melcher, Compression of ECG signals based on optimum quantization of discrete cosine transform
coefficients and Golomb–Rice coding, in: Proc. of the 25th Annual IEEE Int. Conf., EMBS, 2003.
[26] A. Al-Shrouf, M. Abo-Zahhad, S.M. Ahmed, A novel compression algorithm for electrocardiogram signals based on the linear prediction of
the wavelet coefficients, Digital Signal Process. 13 (2003) 604–622.
[27] A. Ouamri, A. Naït-Ali, ECG compression method using Lorentzian functions model, Digital Signal Process. 17 (2007) 319–326.
64 R. Benzid et al. / Digital Signal Processing 18 (2008) 56–64

Redha Benzid was born in Batna, Algeria, in January 1971. He received the Dipl.-Ing. degree in electronics
in 1994, the M.Sc. degree in electronics in 1999, and the Ph.D. degree in electronics in 2005, all obtained
from Batna University, Algeria. Currently, he is an Assistant Professor in the Department of Electronics at
M’Sila University, Algeria. His research interests include data compression, biomedical engineering, and digital
watermarking. Dr. Benzid was an IEE member in 2006.

Abdelhamid Messaoudi was born in Batna, Algeria, in April 1973. He received the Dipl.-Ing. degree in
electronics in 1996 and the M.Sc. degree in electronics in 2002, both from Batna University, Algeria. He is
now a Ph.D. candidate in electronics at the same university. Currently, he works as an Assistant Professor in
the Department of Electronics at Bordj Bou Arréridj University, Algeria. His research interests include data
compression and biomedical engineering.

Abdelmalek Boussaad was born in Batna, Algeria, in October 1973. He received the DES diploma in mathematics from Batna
University, Algeria, in 1996. He pursued the master courses in mathematics at Annaba University where he obtained the DEA
degree in 1998. His research interests include higher order statistics (HOS), data compression, and applied mathematics for engi-
neering.

Vous aimerez peut-être aussi