An Improved Lossless ECG Data Compression Using ASCII Character Encoding
An Improved Lossless ECG Data Compression Using ASCII Character Encoding
Abstract—Telecardiology includes variety of applications and is and Walsh transform, the discrete cosine transform (DCT) [6-
one of the fastest-growing fields in telemedicine. In telecardiology 7]. The third category of data compression is parameter
the amount of recorded ECG data is very much high, hence the extraction based compression in which the features and
necessity of efficient data compression methods for biomedical
signals is currently widely recognized. In this paper improved
parameters of the ECG signal is extracted and compression
version of existing ASCII character encoding ECG data done according to the extracted parameter. The linear
compression method is proposed. The existing method require prediction method and the neural network method [8] are the
minimum of 12 ASCII characters to store an array of 8 ECG examples of this third category.
voltage values but in proposed method it reduces to 8 ASCII ECG data compression techniques can also be divided into two
characters. Hence by eliminating the necessity of some ASCII major group i.e. lossy data compression and lossless data
characters from existing method the compression ratio improved
up to 65%, while the quality of the signal remain same. The
compression. During ECG data compression if the quality of
proposed gives the compression ratio (CR) is 11.25 and the the signal is highly degraded then this is called lossy
percent root mean squared difference (PRD) is 0.0206 on average compression. In many cases signal without any degradation is
for all 12 ECG signals. In addition, propose method is more need hence if the ECG is compressed without any loss in the
efficient than existing ASCII character encoding as well as other information then it is said to be lossless data compression.
ECG data compression methods. In past years, several ECG data compression for mobile
telemedicine using different approaches are proposed to
Index Terms—ASCII character encoding, Biomedical Signal
Processing, Lossless ECG compression, Telecadiology. achieve maximum compression with minimum error. Kumar et
al. [9] proposed modified AZTEC algorithm in which
I. INTRODUCTION statistical parameters of the signal are calculated and these
parameters change themselves according to the nature of the
In telemedicine ECG is the most commonly recorded signal
signal by recalculating the threshold value. Hilton [10]
in the patient monitoring because it has great clinical
proposed two algorithms for compressing one-dimensional
significance in diagnosing heart diseases. In order to monitor
signals which are based on wavelets and wavelet packets. In
different physiological states of the patient, ECG should be
this algorithm the ECG signal is split into non-overlapping
record and store for long time of duration, so the amount of
blocks of some samples. Fira et al. [11] presented a new
recorded ECG data grows. Hence the necessity of efficient data
method for ECG signal compression which is based on local
compression methods for biomedical signals is currently
extreme extraction, adaptive hysteretic filtering and LZW
widely recognized. The transmission speed of the real-time
coding. In [11] some of the skeleton samples are discarded
ECG signal is also enhanced and becomes economical due to
while a few others are added to improve compression rate. S.K.
ECG signal compression.
Mukhopadhyay et al. [12] proposed ASCII character encoding
With help of the literature in the ECG compression area it
based ECG compression technique. In this algorithm input
can be conclude that ECG data compression techniques can be
ECG data is grouped and these grouped values along with
divided into three domains. In direct data compression
some extra information is converted into their corresponding
methods, compression as well as analysis of the ECG signal is
ASCII characters and then stored. The disadvantage of this
done directly in time domain. All the basic algorithms such as
method is less compression ratio. Detail explanation along with
amplitude zone time epoch coding (AZTEC) [1], Turning point
examples is also discussed in proposed method.
(TP) [2] and Fan algorithm [3] are the examples of the direct
A linear prediction based approach is proposed by
data compression. Transform method is the second category for
Ruttimanm et al. [13] in which the ECG data is compressed by
data compression in which firstly the recorded time domain
removing redundant information with help of the second-order
ECG signal is transformed in frequency or other domain and
prediction or interpolation and entropy encoding of the
then all the compression operations is performed. Some ECG
respective is also done. Similar method discussed by Al-
data compression using transform domain is discussed in
Shrouf et al. in [14] which is also a linear prediction approach
wavelet transform [4], Fourier transform, Fourier descriptor [5]
978-1-4673-9338-6/16/$31.00 2016
c IEEE 758
This full-text paper was peer-reviewed and accepted to be presented at the IEEE WiSPNET 2016 conference.
but this linear prediction is based on wavelet coefficients. 2). Difference array generation
Wang et al. [15] proposed two-dimensional wavelet-based In order to achieve maximum possible groupings (grouping
approach. In this algorithm a 1-D ECG data is first segmented discussed in 2.1.6), ‘p’ should have small values. Hence a
and converted in to 2-D data array, so that the utilization of difference array (say d) can be generates by subtracting each
two kinds of correlation of heartbeat signals can be done value of array p by its previous value; whereas first voltage
efficiently. value kept unchanged. Hence the difference array become
Problems associated with existing ASCII character
encoding ECG compression. 0.011 0.002 0.001 0.008 -0.004 0.010 0.007 -0.002
x To avoid the problem of program termination by
‘Turbo C++ IDE’ compiler the critical numbers (10, d(1) d(2) d(3) p(4) d(5) d(6) d(7) d(8)
13, 26 and 255) are replaced by some other suitable
numbers. Further some variables have been taken to 3). Sign-bit generation
denote the position of those critical numbers and send It is necessary to convert all negative numbers in to positive for
along with grouped ECG. Hence in order to transmit ASCII transmission, but at the time of reconstruction of ECG
these variable same numbers of ASCII character data the sign of each value will be required. To do so a sign bit
required for proper reconstruction of ECG signal, due is generated for each d array by taking all positive values as
to these extra ASCII characters, compression ratio zeros ‘0s’ and all negative values as ones ‘1s’.
decreases.
x In existing method author considered one more 0 0 0 0 1 0 0 1
variable ‘u’, which stores the location of ‘No
0.011 0.002 0.001 0.008 -0.004 0.010 0.007 -0.002
groping’. This new variable ‘u’ required an additional
ASCII character for storage or transmission, due to
this extra ASCII characters, compression ratio Now, the string of sign bit is converted in its decimal
decreases. . equivalent. Further these decimal numbers again converted in
In proposed method discussed extra ASCII characters are its ASCII equivalent and store in to an array (say s). here in
eliminated by proper programing logic, whereas the quality of given example decimal equivalent of 00001001 is 9.
the constructed signal is remain same. This paper is organized
in following manner: In section-II, proposed method is
discussed in detail. In section ‘A’ programing logic for ECG
data compression is explain with the suitable examples,
similarly in ‘B’ programing logic ECG data reconstruction is
discussed. In section-III evaluation strategy for obtained results
are discussed, in which the formula for calculation of CR, PRD As ASCII charters available only for positive integer, hence for
and QS are given. Section-IV dedicated to simulation and further processing all negative numbers are converted in to
results, in which graphical results of proposed method as well positive numbers by multiplying with -1 and again store in to d
as existing method [12] are shown. Quantitative results of array. So now difference array (d) contains only positive
proposed method are also compared with other methods in this numbers.
section. Finally section-V provides the conclusion of the
proposed work. 0.011 0.002 0.001 0.008 0.004 0.010 0.007 0.002
II. PROPOSED METHOD d(1) d(2) d(3) p(4) d(5) d(6) d(7) d(8)
759
This full-text paper was peer-reviewed and accepted to be presented at the IEEE WiSPNET 2016 conference.
4). Amplification up-to three decimal [16]. Now amplified array (a) contains only
In order convert fractional numbers in to integers each number positive integers.
of difference array (d) are multiplied by 1000 and stored in
11 2 1 8 4 10 7 2
some other array (say ‘a’). The reason behind multiplying with
1000 is that, in standard ECG database, voltages are recorded a(1) a(2) a(3) a(4) a(5) a(6) a(7) a(8)
Example: location of ‘m’ is stored in new variable (say ‘z’). This means
‘z’ is the variable which contains locations of possible reverse
groupings in each ‘a’ array.
6.3) No grouping
If at any position of none of the above grouping possible in
such case a(m) and a(m+1) is taken as it is.
For all three type of grouping initially m is taken as 1 and then
incremented by 2. Now after all possible groupings, the
grouping locations (‘k’ and ‘z’) are converted in equivalent
ASCII characters and stored in new variable (say ‘g’).
Example for all grouping in single ‘a’ array is shown bellow
Here the same problem-1 discussed in section-2 may repeat in
new ‘a’ array. In order to handle this problem author of [12]
consider three more variable ‘q’, ‘r’ and ‘s’ and replaced each 11 2 1 8 4 10 7 2
critical number with some other suitable numbers. Now the
location of each replaced 10, 13, and 26 are stored in ‘q’, ‘r’ RG FB NG RG
and‘s’ respectively. These variables are sent along with the
message for proper reconstruction of compressed signal. But
the in proposed method no replacement of critical numbers are 211 108 4 10 207
take place so there is no need to send any location of replaced
number hence the improvement in compression ratio is
Where;
achieved.
FG-Forward Grouping
5). Normalization of amplified array RG-Reverse Grouping
The first value d(1) of each difference array may have higher NG-No Grouping
amplitude then 0.255 because d(1) was not subtracted from any In the case of same grouping occur two or three times then all
value. So in such case after multiplying d(1) with 1000 the position numbers are concatenated and at the time
amplified value a(1) exceed then 255, but ASCII characters are reconstruction de-concatenated back. For example reverse
available only for integers less than 255. In order to handle this grouping occur at position 1 and 7, so z is written as 17 and at
problem a(1) of each array is divided by 255 and then then time of reconstruction from 17, z again written as 1 and 7
each a(1) is replaced by reminder of the division. Again on separately. Finally the grouped array ‘g’ is the array which
extra bit (say f) that contain rounded quotient (calculated using contain ECG data in compressed form but in order to recover
‘floor function’ in MATLAB) of each division is sent along ECG data from this compressed file addition information such
with the ECG data for proper reconstruction of a(1) value. as; sign bit (s) to recover sign, location of forward (k) and
6). Grouping reverse (z) grouping and rounded quotient (f) are required. So
all this information converted in equivalent ASCII characters
In all the previous steps there is no compression logic involved
and stored in final file format.
but primary aim of the proposed algorithm is data compression,
so in this step main compression logic is discussed. The In existing method, author considered one more variable ‘u’,
voltage values of new ‘a’ array is grouped according to the which stores the location of ‘No groping’. This new variable
following grouping scheme ‘u’ required an additional ASCII character for storage or
transmission. In proposed method there is no need to send any
extra information for ‘No grouping’, because it can be possible
6.1)Forward grouping
to recover location of ‘No grouping’ (i.e. ‘u’), directly at the
Forward grouping is done on the basis of that at which location
reconstruction side, hence compression ratio increases.
‘(a(m)*100)+a(m+1)) ≤ 255’ condition satisfy. If this condition
Generation of ‘u’ using ‘k’ and ‘z’ discussed in decompression
satisfy a(m) is replaced by (a(m)*100)+a(m+1)) and the
section.
location of ‘m’ is stored in new variable (say ‘k’).
6.2) Reverse grouping
If at any location ‘(a(m+1)*100)+a(m)) < 255’ condition
satisfy a(m) is replaced by (a(m+1)*100)+a(m)) and the
760
This full-text paper was peer-reviewed and accepted to be presented at the IEEE WiSPNET 2016 conference.
761
This full-text paper was peer-reviewed and accepted to be presented at the IEEE WiSPNET 2016 conference.
Fig 3. (a) Error signal for ‘s0282lre’ with PRD=0.0003 (b) Error signal
for ‘s0015lre’ with PRD=0.00.
762
This full-text paper was peer-reviewed and accepted to be presented at the IEEE WiSPNET 2016 conference.
is zero which means both method compress ECG data in But as we discussed earlier the main advantage of the proposed
lossless manner. Again from Table-I the improvement in CRs method is that it gives improved CR while keeping PRD as
can be observe clearly, this improvement in CR is achieved minimum as in [12]. The average CR obtained using proposed
because initially in existing method the minimum number of method is 11.1225 which is better than method proposed in
ASCII character to store one ‘p’ was 12 but in proposed [12]. Although CR achieved in [4] and [11] are higher than
method it is reduced to 8. proposed method but this method has high PRD as well. Hence
The proposed compression method is compared on the basis on overall performance of the all methods, are evaluated by
parameters discussed in Section-3 (i.e. PRD, CR and QS) with considering quality score of each method. Proposed method
existing ECG data compression method in Table II. From provides maximum QS then other existing data compression
Table-II it is clear that proposed method gives minimumPRD method which is also shown in Table II
=0.0208, which is almost equal to PRD obtained using [12].
s0015lre v1, v2, v3, v4, v5, v6 0.0000 0.0000 6.95 10.51
s0020are i, ii, iii, v1, v2, v3 0.0000 0.0000 6.59 10.41
s0021are i, ii, iii, avr, avl, avf 0.0000 0.0000 6.46 10.90
s0022lre avr, avl, avf, v1, v2, v3 0.0000 0.0002 6.77 11.01
s0045lre i, ii, v1, v2, v4, v5 0.0110 0.0310 7.31 11.23
s0282lre i, ii, iii, v3, v4, v5 0.0061 0.0003 6.93 10.19
s0301lre iii, avr, avf, v1, v5, v6 0.0090 0.0011 7.80 11.90
s0304lre iii, avf, v1, v4, v5, v6 0.0000 0.0000 7.69 11.78
s0305lre iii, v1, v2, v4, v5, v6 0.1281 0.1012 7.46 11.56
s0401lre i, ii, avr, avf, v4, v5 0.1055 0.1120 7.23 10.89
s0404lre avr, avf, v1, v2, v4, v5 0.0000 0.0000 7.85 11.87
s0415lre i, ii, iii, v1, v3, v5 0.0000 0.0000 7.67 11.22
763
This full-text paper was peer-reviewed and accepted to be presented at the IEEE WiSPNET 2016 conference.
[6] L. V. Batista, E. U. Kurt Melcher, and L. C. [14] A. Al-Shrouf,M. Abo-Zahhad, and Sabah M. Ahmed,
Carvalho, “Compression of ECG signals by “A novel compression algorithm for electrocardiogram
optimized quantization of discrete cosine transform signals based on the linear prediction of the wavelet
coefficients,” Med. Eng. Phys., vol. 23, pp. 127–134, coefficients,” Digital signal Processing., vol. 13, pp.
2001. 604–622, 2003.
[7] Shin-Chi Lai; Chien-Sheng Lan; Sheau-Fang Lei "An [15] X. Wang, J. Meng, “A 2-D ECG compression algorithm
efficient method of ECG signal compression by using based on wavelet transform and vector quantization”,
a DCT-IV spectrum", Communications, Circuits and Digital Signal Processing 18, pp. 179–188, 2008.
Systems (ICCCAS), 2013 International Conference [16] http://www.physionet.org/
on, pp.: 46 - 49 Volume: 1, 15-17 Nov. 2013 [17] HosseinMamaghanian, , Nadia Khaled, David Atienza,
[8] Iwata, Y. Nagasaka, and N. Suzumura, “Data and Pierre Vandergheynst, “Compressed Sensing for
compression of the ECG using neural network for Real-Time Energy-Efficient ECG Compression on
digital Holter monitor,” IEEE Eng. Med. Bio1. Mag., Wireless Body Sensor Nodes”, IEEE Trans Biomed Eng
vol. 9, no. 3, pp. 53–57, Sep. 1990. Vol.58, No. 9, Sept-2011.
[9] Kumar V, Saxena SC, Giri VK, Singh D. “Improved [18] SangJoon Lee, Jungkuk Kim, and Myoungho Lee, “A
modified AZTEC technique for ECG data Real-Time ECG Data Compression and Transmission
compression: effect of length of parabolic filter on Algorithm for an e-Health Device”, IEEE Trans Biomed
reconstructed signal”. Computer Elect. Eng. 31(4–5), Eng Vol.58, No. 9, Sept-2011.
pp.334–44, 2005. [19] Djohan, T.Q. Nguyen, W.J. Tompkins, “ECG
[10] Hilton ML. “Wavelet and wavelet packet compression using discrete symmetric wavelet
compression of electrocardiograms”, IEEE Trans transform”, IEEE International Conference on
Biomed Eng, 44(5), pp. 394–402, 1997. Engineering in Medicine and Biology Society, vol. 1,
[11] M. Fira and L. Goras, “An ECG signals compression Montreal, Que., Canada, pp.167–168, 1995.
method and its validation using NNs,” IEEE Trans. [20] Lu Z, Kim DY, Pearlman WA. “Wavelet compression of
Biomed. Eng., vol. 55, no. 4, pp. 1319–1326, Apr. ECG signals by the set partitioning in hierarchical trees
2008. (SPIHT) algorithm”, IEEE Trans Biomed Eng., 47, pp.
[12] S.K. Mukhopadhyay, S. Mitra, M. Mitra, “A lossless 849–56. 2000.
ECG data compression technique using ASCII [21] M.S. Manikandan, S. Dandapat, “Wavelet threshold
character encoding”, Computers and Electrical based ECG compression using USZZQ and Huffman
Engineering 37, pp. 486–497, 2011. coding of DSM”, Biomedical Signal Processing and
[13] U.E. Ruttimann, H.V. Pipberger, “Compression of Control 1, pp.261–270, 2006.
the ECG by prediction or interpolation and entropy [22] C.M.D. Rodrigo, M.M. Fabrizia, V.B. Leonardo, ”Near-
coding”, IEEE Trans. Biomed. Eng.26, pp. 613–623, lossless compression of ECG signals using perceptual
Nov.-1979. masks in the DCT domain”, IFMBE Proceedings, vol.
18, Margarita Island, Venezuela, 2007, pp. 229–231,
2007.
764