Sunteți pe pagina 1din 6

ISSC 2010, UCC, Cork, June 2324

Ecient EEG Compression using JPEG2000 with


Coecient Thresholding
Garry Higgins, Brian McGinley, Edward Jones and Martin Glavin

Electrical & Electronic Engineering,


National Centre for Biomedical Engineering Science (NCBES)
National University of Ireland, Galway
E-mail: g.higgins1@nuigalway.ie

Abstract This paper outlines a scheme for compressing EEG signals based on the
JPEG2000 image compression algorithm. Such a scheme could be used to compress
signals in an ambulatory system, where low-power operation is important to conserve
battery life; therefore, a high compression ratio is desirable to reduce the amount of data
that needs to be transmitted. The JPEG2000 specication makes use of the wavelet
transform, which can be eciently implemented in embedded systems. In this research,
the JPEG2000 standard was broken down to its core components and adapted for use
on EEG signals with additional compression steps added. Variations on the compres-
sion architecture were tested to maximize compression ratio (CR) while minimizing re-
constructed percentage root-mean- squared dierence (PRD) and power requirements.
Tests indicate that the algorithm performs well in eciently compressing EEG data,
without signicant loss in signal delity.

Keywords EEG compression; Wavelets; JPEG2000; Low power

I Introduction is a method of recording a patients EEG signals


using a portable device that can be worn as the
Recent advances in health care have seen an in- patient goes about their everyday lives. Such a de-
creased focus on ambulatory monitoring of pa- vice allows the patient to remain at home in com-
tients. Portable devices allow patients to be mon- fort, without the need for frequent visits to a clinic.
itored at home on an out-patient basis, thus ad- Furthermore, wireless transmission of data from an
vancing the goal of providing ubiquitous and per- ambulatory unit to a central server e.g. located in
vasive healthcare. This remote observation conse- a clinic, allows for the possibility of near-constant
quently relieves pressure on over-burdened hospi- remote monitoring of the patient by a clinical ex-
tal systems, and allows the patient remain in an pert. Due to the nature of EEG signals however,
environment in which they are comfortable. It even a short period of capture can result in large
also allows more comprehensive monitoring with amounts of data being recorded. Therefore, di-
patients involved in a variety of activities in their culties in data storage and transmission arise, par-
day-to-day lives. However, for a device to be truly ticularly in a wireless monitoring scenario. This is
portable, a reasonable battery is essential. As a because wireless communications are a signicant
result, a principle factor in designing a portable contributor to power consumption in a portable
health care device is ensuring that power consump- system [2],[3]. Eective compression of data is
tion is minimised. therefore important to minimize the amount of in-
Multichannel electroencephalogram (EEG) is formation that needs to be transmitted wirelessly.
commonly used for measuring the electrical activ- A coexisting goal is that the compression itself
ity of the brain. The application of EEG to di- needs to be carried out in an ecient manner so
agnose a variety of neurological conditions such as as not to unduly add to the power consumption of
Epilepsy and Alzheimers disease [1] has long been the device.
established. Diagnosis of these conditions how- Compression of EEG signals is the focus of this
ever, often requires long-term monitoring of the paper. In comparison to other measures of biomed-
patients EEG activity. Ambulatory EEG (AEEG) ical electrical activity, such as
Original
Image Discrete Wavelet
Pre-Processing
Transform (DWT)

Compressed
Data Adaptive Binary
Quantization
Arithmetic Coder

F igure 1: Core components of JP E G2000 Part 1 F igure 2: 3-Level D W T of signal x(n)


usually undergoes compression prior to transmission.
Crdenas-Barrera et al. propose a method of EEG
electrocardiogram (ECG), there has been relatively
compression based on the Wavelet Packet Transform
little work done in the field of EEG compression. Of
[4]. The signals are compressed using lossy
the work that has been done, most researchers have
compression, and a maximum PRD of 7% is
focused on lossless compression, with only a few
suggested as the maximum allowable [4]. The
having tested some form of lossy compression
algorithm is designed to be low-power, and thus, the
[4],[5]. Lossless compression maintains complete
authors suggest it could potentially be used on
signal integrity in the reconstructed signal, but this
portable devices. However, the impact of choosing a
limits the compression ratio (CR) that can be
7%, or higher PRD on the diagnostically relevant
achieved. Lossy compression can achieve much
information is not tested in [4]. Casson et al. propose
higher CRs but results in a loss of some signal
a compression method based on discontinuous
fidelity.
recording of EEG, with only diagnostically
This paper proposes a scheme for efficient significant information being recorded [8]. This
lossy EEG compression, based on the JPEG2000 reduces the amount of data to be transmitted as only
image compression standard, targeted at the epileptiform data is recorded. This compression
implementation on an ambulatory device. JPEG2000 scheme relies on the ambulatory system being able to
was chosen as it offers efficient compression correctly identify epileptiform data. This method
performance in both lossless and lossy suffers from the fact that not all of the data is stored,
configurations. This algorithmic flexibility allows and thus is not available for review by clinicians.
exploration of the trade-offs between compression
ratio, signal fidelity, and computational complexity.
Work has already been performed on low-powered III. DESCRIPTION OF THE JPEG2000 ALGORITHM
implementations of this algorithm for portable JPEG2000 is a compression algorithm
hardware [6],[7], thus indicating that an efficient designed for both lossless and lossy compression of
implementation of the %/+25-7,0A6 core elements is image files. JPEG2000 Part 1 was ratified by the
feasible. The compression of EEG will become Joint Photographic Experts Group in 2000 [9]. It was
increasingly important as AEEG devices become designed to replace the older JPEG file format with
more prevalent. The work here sets to propose one more advanced features such as superior low bit-rate
potential method of efficiently compressing EEG performance, lossless and lossy compression and
while maintaining low power consumption. good error resilience [10]. Part 1 contains the
Section II of the paper describes some other specifications for the core image coding system.
proposed methods of EEG compression for These core components include, Discrete Wavelet
ambulatory devices. In particular those that use lossy Transform (DWT), quantisation and an Arithmetic
compression. Section III describes the JPEG2000 Coder (AC) (Figure 1). Aside from the image
algorithm, in particular the wavelet transform and specific modifications in the Pre-Processing and
arithmetic coder used in the algorithm. Section IV Quantisation stages, the main areas of divergence
describes the implementation of the algorithm and with previous JPEG standards are in the use of the
Section V outlines the methods of performance DWT and AC.
evaluation and the dataset used. It also details the The DWT replaces the Discrete Cosine
modifications made to the JPEG2000 algorithm and Transform (DCT) of the original JPEG format.
the results obtained, while Section VI presents While DCT performs well at low compression ratios,
conclusions. it deteriorates quickly as compression ratios increase
above 30:1. DWT meanwhile, has a much more
gradual degradation [11]. The JPEG2000 Part 1
II. EEG COMPRESSION standard includes two types of DWT. The first is the
Recent years have seen an increase in research into Le Gall 5/3 integer-to-integer DWT. This DWT is
EEG compression for use in AEEG devices. When used for lossless compression of images due to its
wireless communication is employed, the EEG signal
T able 1: Probabilities and ranges for symbols an
for example in text
Symbol Probability Range
a1 0.5 [0,0.5)
a2 0.25 [0.5,0.75)
a3 0.125 [0.75,0.875)
a4 0.125 [0.875,1)
F igure 3: E xample of arithmetic coder for
encoding a four symbol long message
fixed-point implementation. This allows faster
a factor of 2 by inserting zeros between samples and
transforms with a true lossless reconstruction, at the
filtering each resulting sequence by the
expense of some loss in CR. A floating-point version
corresponding low or high-pass synthesis filter bank.
of the CDF 9/7 DWT is used for lossy image
Finally the filtered sequences are added together to
compression to achieve a higher CR. This DWT has
form an approximation of the original sequence. The
already achieved wide-spread use in a variety of
complexity of the DWT depends on a number of
compression algorithms. The Adaptive Binary
factors such as the filter size, the use of floating point
Arithmetic Coder replaces the Huffman coder as the
or fixed-point arithmetic, and the method used to
entropy coder for the JPEG2000 compression
compute the wavelet coefficients. The use of fixed-
standard. The AC can perform near optimum entropy
point instead of floating-point filters reduces
coding on a given data set [12] and avoids some
complexity of the operation and allows for truly
of the limitations of Huffman encoding [13]. The
lossless integer to integer based compression,
adaptive arithmetic coder allows the message to be
because there are no approximations in the forward
coded with no prior knowledge of the 0)66%+)A6
or inverse transform operation. However, integer
Probability Distribution Function (PDF) by either the
implementations also reduce the CR achievable by
encoder or the decoder.
the transform.
a) Wavelets The lifting scheme is an alternative method of
The Wavelet Transform (WT) decomposes a computing wavelet coefficients. Proposed by
signal into a set of basis functions known as wavelets Sweldens et al. [17], it has a number of advantages
[14-16]. The initial wavelet, also known as the over traditional methods. Its implementation requires
mother wavelet, is used to construct the other fewer computations and memory and is better suited
wavelets by means of dilation and shifting, according for ambulatory applications where low
to the following equation: computational complexity is important. The inverse
transform has the same complexity as the forward
transform and no signal extension is required at the

     (1) boundaries. It can also easily be expanded to use
  integer-to-integer WT for lossless compression.

where  is the scaling parameter, b is the shifting b) Arithmetic Coder


3%5%0)7)5%1(C7-67,)027,)5:%9)/)7#%9)/)76 Arithmetic coding is an entropy encoding
can be stretched or compressed to obtain low and algorithm used for lossless data compression. It
high-frequency basis functions to analyse a signal at encodes the required data stream into a single
different resolutions. fractional value between 0 and 1. Similar in
The DWT is used to perform a fast operation to Huffman coding, the coder converts the
computation of the WT of a discrete signal. It is symbols to be encoded into a form where the most
normally computed quite efficiently with a set of low frequently used symbols are encoded using the least
and high pass filters being recursively applied. After number of bits and the most infrequently used
the signals are filtered, they are down-sampled by a symbols using the most. The basic ideas of
factor of 2. The transformation is applied recursively arithmetic coding can be traced back to the 1960's
on the low-pass series until the desired number of with more efficient implementations of it appearing
iterations is reached (Figure 2). The high pass filter, later [18].
G0, produces detail coefficients, denoted by d[n], Arithmetic coding reduces the symbols to be
while the low pass filter, H0, produces approximation encoded to a single, unique binary fraction based on
coefficients, a [n]. the PDF of the symbols. In order to understand its
For the inverse DWT, the transform operates operation, consider the example of a source A that
in the opposite way. Each subband is interpolated by generates symbols ai from an alphabet of size 4,
A = { a 1, a 2, a 3, a 4}
Let these symbols have the following probabilities of ranges, as symbols are encountered and encoded.
occurrence: This introduces some slight inefficiencies in the
P(a1) = 0.5 , P(a2) = 0.25 , P(a3) = 0.125 , encoding, but does not require the PDF to be
P(a4) = 0.125 transmitted for use by the decoder.
which all lie on the interval [0,1) An additional thresholding step was added to
The encoder begins with the interval [0,1) the algorithm to increase the achievable CR with
which is divided up into ranges for each symbol minimal impact on PRD. All coefficients below the
based on the probability of them appearing, as seen selected threshold are deemed to be insignificant and
in Table 1. When the first symbol is passed to the set to zero. The greater the number of coefficients
encoder, the encoder updates the total range to with the same value, the more efficiently the AC can
correspond to the range of the symbol being encode them. By varying the threshold level, and
encoded. This range is again divided based on the therefore the number of coefficients being discarded,
probability of the symbolAs occurrence. The next we can increase or decrease the achieved CR, and in
symbol is passed to the encoder, which again updates conjunction, the PRD. The optimum placement of
the range depending on the symbol passed. This the thresholding step in the overall system was
continues until all the symbols in the sequence are determined through experimentation; this is
encoded (Figure 3). Any number within the final discussed in more detail in Section V.
range can be selected to represent the encoded
sequence. V. EXPERIMENTAL EVALUATION AND RESULTS
To decode the message, the decoder accepts a) Performance Measures
the fractional value as input and again compares it to
85-1+ 7,) %/+25-7,0A6 )9%/8%7-21 7:2
the range values from the table. In this case it sees
performance measures were employed. Firstly, the
that the value falls between the lower and upper
quality of the reconstructed signal is tested by
bound of a1 and so a symbol with value a1 is
comparing its similarity to the original input signal,
outputted. The decoder must then update the encoded
and expressing the difference relative to the original
value to remove the effects of the first symbol. A
6-+1%/A6 0)%1 ,-6 (-**)5)1') -6 );35)66)( %6 %
new range is calculated by taking the lower bound of
Percentage Root-mean squared Distortion (PRD)
the decoded symbol from the upper bound. The
measure, defined as follows:
encoded value is then calculated by taking the lower
bound of the first symbol from the initial encoded   
   (2)
value and dividing by the upper bound. This process  
continues until all symbols are decoded. It should be
noted that the decoder will continue to decode unless where and  are the original and reconstructed
the length of the original signal is passed as an signals, respectively, and || || represents the
argument or a predetermined escape character is Euclidean or l2 norm.
received. The second performance measure used
describes the efficiency of the compression process.
IV. SYSTEM IMPLEMENTATION The Compression Ratio (CR) for each EEG frame is
For this research, a number of modifications calculated as
were made to the JPEG2000 algorithm for


implementing an EEG compression algorithm. The   


EEG signal was processed in non-overlapping 
frames of size 1024. This window size was selected
based on (a) preliminary tests of compressing where  is the length of the input signal in samples,

varying sized signals and (b) previous findings in is the quantisation/bit resolution of each sample and
similar research [4].  is the number of bits representing the compressed
While the JPEG2000 Part 1 specification signal. The goal of this research is to achieve the best
allows use of a lossy and lossless WT, this research trade-off between PRD and CR.
focuses on the lossy CDF 9/7 WT. This choice
allows us to maximise the attainable CR for the EEG b) Dataset
signal with only a slight increase in computational
There is currently no freely available dataset
requirements.
of AEEG recordings. For this reason an EEG
The Arithmetic Coder implemented was
database provided by the University of Freiburg in
bas)( 21 %<22(A6 :25. [19]. This allowed for the
Germany was used. This database provides
PDF to either be calculated before encoding for the
recordings of adult EEG from patients suffering from
whole window, or to be updated adaptively as each
epilepsy. The database includes 24 hours of seizure
new symbol is encoded. In the case of the PDF being
(ictal), and non-seizure (inter-ictal) data for 21
pre-determined, it had to be transmitted as part of the
patients. The ictal data are composed of signals
message for use by the decoder. The adaptive coding
recorded during times when patients were
requires the encoder to continually update symbol
experiencing seizures. Due to the transient nature of
the seizures the majority of the data in this ictal set is 5 that an average CR of over 5:1 is achievable.. For
non-seizure, interspersed with seizure waveforms. even a low PRD of 3%, a CR of between 3.5:1 and
The inter-ictal subset is composed of the data that 4:1 is still achieved.
was recorded when no seizures were occurring. For
this research, the ictal data was examined as it VI. CONCLUSIONS AND FUTURE WORK
contains enough seizure and non-seizure data to be This paper has presented a method of
representative of both epileptic and regular compressing EEG signals using a JPEG2000-based
waveforms. compression algorithm. A high compression ratio
was achieved
c) Thresholding
Initial experimentation involved performing
the thresholding step directly after the DWT and
before Quantisation was performed. This
methodology of thresholding is similar to the
algorithm proposed in [4]. Because of the amplitude
variation of the EEG signal, initial tests indicated
that it was difficult to control the level of distortion
introduced across an entire EEG record from the
selection of a static threshold. For certain frames, the
recordings were of such low amplitude relative to the
entire EEG signal that the entire set of wavelet
coefficients for that frame fell below the selected
threshold. This resulted in the whole frame being
reconstructed as a stream of zeros. This varying
amplitude across frames and channels made it
unfeasible to employ fixed thresholds values for all
F igure 5: A verage PR D vs C R for all Patients
signals. A potential solution would require the
computation of an appropriate adaptive threshold
value for each EEG frame. However, performing While other proposed AEEG algorithms from the
such a computation would add a computational literature report achieving higher CRs [8],[21],[5], in
overhead to the algorithm, which would be many cases, this is possible only on seizure data, and
unsuitable for an ambulatory implementation. as such are only suitable for a single EEG
)'%86)2*%16-+1%/6A(<1%0-'1%785), a application. The algorithm proposed here has been
second architecture was explored whereby the tested with both seizure and non-seizure data, and
thresholding was performed after quantisation. In can be adapted for a variety of applications, with the
this case, quantised values below the threshold were amount of distortion increased or decreased as
deemed insignificant and consequently zeroed. As needed.
the coefficients are normalised and uniformly The method of performing thresholding after
quantised to within a predictable range, the impact of normalisation and quantisation provides more
thresholding (using a static value) on the signalA6 predictable CR and PRD results for a given
energy is more predictable and controllable. It is for threshold. The same threshold values can be used for
this reason that thresholding after quantisation was all recordings without having to take into the account
used for the results in this paper. the amplitude of the signal. This is useful if the
algorithm is to be implemented on a portable device,
d) Test Para meters and Results
where it could be impractical to adjust the threshold
The EEG records were compressed using a on a frame-by-frame, or channel-by-channel basis.
fixed wavelet decomposition and quantisation level. In terms of future work, analysis of the power
These values were based on the results found in [20] usage of the algorithm should be completed. It has
as they provided the best trade-off between CR and already been established by other researchers
maintaining signal integrity. Each signal was divided [6],[7],[22] that the main elements of JPEG-2000 can
into windows of size 1024. These windows were be efficiently implemented, while the addition of
compressed and reconstructed using 5 different thresholding proposed here will not add significantly
threshold values. These threshold values were chosen to the computational complexity.
to give a range of PRD values from very low (~2%) Expert clinical analysis of the decompressed
to high (>15%). The CR and PRD values were EEG signal in relation to the original signal, at a
averaged for each patient, and an overall average was variety of PRD levels, is desirable to ensure that
calculated for all patients in the database, at each signal integrity is maintained. Similarly, it is
threshold level. The overall results for average CR proposed to test the algorithm in conjunction with
versus PRD are plotted in Figure 5. established automated diagnosis algorithms to ensure
Using the 7% PRD as the maximum detection rates are maintained.
acceptable PRD we can see from the graph in Figure
VII. ACKNOWLEDGEMENTS Algorithms, Springer, 2002.
[19] K. Sayood, Introduction to Data Compression, Third
The authors would like to acknowledge the Edition, Morgan Kaufmann, 2005.
Albert-Ludwigs-Universitt, Freiburg, Germany, for [20] -++-16'-1/)</%9-1%1(21)6?2:
allowing access to their adult EEG database. Power 2035)66-21 2*  -+1%/6 !6-1+ 
@
4th International IC S T Conference on Pervasive
This research was supported by Science Computing Technologies for Healthcare 2010.
Foundation Ireland under grant number [21] A.J. Casson and E. Rodriguez-"-//)+%6 ?%7% 5)(8'7-21
SRC/07/I1169. techniques to facilitate wireless and long term AEEG
epilepsy 021-725-1+@ 3rd International IE E E/EMB S
Conference on Neural Engineering, 2007, pp. 298-301.
[22] M. Yicong, L.I.U. Leibo, L. Zhang, and W. Zhihua,
VIII. REFERENCES ?)6-+1 )7,2(2/2+< 2* 2: 2:)5 
 2()'
[1] G. Jacques, J. Frymiare, J. Kounios, C. Clark, and R. ;3/2-7-1+ 8%/ "2/7%+) '%/-1+@ 6th International
2/-.%5 ?8/7-5)62/87-21 :%9)/)7 %1%/<6-6 %1( )16)0&/) Conference On AS IC, 2005. AS IC ON 2005. , vol. 1, Oct.
2* '/%66-*-)56 *25 )%5/< (-%+126-6 2* /=,)-0)56 (-6)%6)@ 2005, pp. 183-186.
IE E E International Conference on Acoustics, Speech, and
S ignal Processing, 2005. Proceedings. (ICASSP '05),
2005, pp. v/389-v/392 Vol. 5.
[2]  ")5+%5- " 87)5-  256- %1(  %0&)57- ?
ZigBee-based ECG transmission for a low cost solution in
,20) '%5) 6)59-')6 ()/-9)5<@ Mediterranean Journal of
Pacing and Electrophysiology.
[3] C. Otto, A. Milenkovic, C. Sanders, and E. Jovanov,
?<67)0 %5',-7)'785) 2* % :-5)/)66 &2(< %5)% 6)1625
1)7:25. *25 8&-48-7286 ,)%/7, 021-725-1+@ Journal of
Mobile Multi media , vol. 1, 2006, pp. 307>326.
[4] J.L. Crdenas-Barrera, J.V. Lorenzo-Ginori, and E.
Rodrguez-"%/(-9-% ? :%9)/)7-packets based algorithm
*256-+1%/'2035)66-21@ Medical Informatics & The
Internet in Medicine , vol. 29, 2004, pp. 15-27.
[5] A.J. Casson, D.C. Yates, S. Patel, and E. Rodriguez-
Vill)+%6 ?/+25-7,0 *25  (%7% 6)/)'7-21 /)%(-1+ 72
:-5)/)66 %1( /21+ 7)50 )3-/)36< 021-725-1+@ Annual
International Conference of the IE E E Engineering in
Medicine and Biology Society, 2007, p. 2456.
[6] $ )1+ %1(  #%1+ ? 2: 2:)5 "
Implement%7-21 *25 
 2()'@ 6th International
Conference On AS IC, 2005. AS IC ON 2005, vol. 1, Oct.
2005, pp. 198-202.
[7] -1 8  8 %1( -1+ 8 ?2:-Power JPEG2000
Implementation on DSP-Based Camera Node in Wireless
8/7-0)(-% )1625 )7:25.6@ International Conference
on Networks Security, Wireless Communications and
Trusted Computing, 2009. N SWCTC '09. , 2009, pp. 300-
303.
[8] A.J. Casson and E. Rodriguez-"-//)+%6 ? 2:%5( 1/-1)
Data Reduction for Portable Electroencephalography
Systems in Epil)36<@ IE E E Transactions on Biomedical
Engineering, vol. 56, 2009, pp. 2816-2825.
[9] ? -1:2000 - Information technology -- JPEG
2000 image coding system -- %57 25)'2(-1+6<67)0@
[10]  (%06 ? ,) -2000 still image compression
s7%1(%5(@ IS O/IEC JTC 1/S C 29/WG 1 N 2412, 2001.
[11] M.L. Hilton, B.D. Jawerth, and A. Sengupta,
?2035)66-1+ 7-// %1( 29-1+ 0%+)6 :-7, #%9)/)76@
Multi media Systems, vol. 2, p. 1.
[12] P.G. Howard, P.G. Howard, J.S. Vitter, and J.S. Vitter,
?1%/<6-6 2* 5-7,0)7-' 2(-1+ *25 %7% 2035)66-21@
Information Processing and Management, vol. 28, 1992,
pp. 749--763.
[13]  #-77)1  )%/ %1(  /)%5< ?5-7,0)7-'
'2(-1+ *25 (%7% '2035)66-21@ Commun. ACM , vol. 30,
1987, pp. 520-540.
[14] S. Mallat, A Wavelet Tour of Signal Processing, 3rd ed.,
Third Edition: The Sparse Way, Academic Press, 2008.
[15] I. Daubechies, Ten Lectures on Wavelets, SIAM: Society
for Industrial and Applied Mathematics, 1992.
[16]  ")77)5/- %1(  )5/)< ?#%9)/)7s and filter banks:
,)25< %1( ()6-+1@ IEE E Transactions on Signal
Processing, vol. 40, 1992, pp. 2207>2232.
[17]  %8&)',-)6 %1( # :)/()16 ?%'725-1+ :%9)/)7
75%16*2506-172/-*7-1+67)36@ Journal of Fourier Analysis
and Applications, vol. 4, May. 1998, pp. 247-269.
[18] A. Moffat and A. Turpin, Compression and Coding

S-ar putea să vă placă și