Lossy compression of EEG signals using SPIHT G. Higgins, B. McGinley, N. Walsh, M. Glavin and E. Jones A method of compressing electroencephalographic signals using the set partitioning in hierarchical trees (SPIHT) algorithm is described. The signals were compressed at a variety of different compression ratios (CRs), with the loss of signal integrity at each CR determined using the percentage root-mean squared difference between the recon- structed signal and the original. An analysis of the computational com- plexity of the SPIHT algorithm is also presented, using the Blackfin processor as an example implementation target. Introduction: The multichannel electroencephalogram (EEG) is a tool commonly used for diagnosing a variety of neurological conditions. Diagnosis of these conditions often requires long-term monitoring of the patient’s EEG activity, which necessitates storage of large amounts of data [1]. This causes both storage and wireless transmission problems for potential portable ambulatory EEG systems, since wireless communication is a significant contributor to power consumption [2]. Therefore, effective data compression is important to minimise the infor- mation needed to be transmitted and stored. A coexisting goal is that it be performed in an efficient manner so as not to unduly add to the power consumption of the device. To minimise the amount of data to be transmitted or stored in a por- table device, the amount of compression, expressed as compression ratio (CR), needs to be maximised. Lossy compression can attain higher CRs than lossless, but with a loss in signal fidelity. It is desirable to use a compression algorithm that maximises CR, while also maximising signal fidelity and minimising computation. In this Letter, the SPIHT algorithm is investigated for the task of ambulatory EEG compression. Compression method: Set partitioning in hierarchical trees (SPIHT) is an image compression method proposed by Said and Pearlman in [3]. In this application, the CDF 9/7 biorthogonal discrete wavelet transform (DWT) was used owing to its widespread use in a variety of compression applications. A seven-level DWT decomposition was performed as this was found to give the best compression performance. The DWT coeffi- cients are quantised using a standard integer quantisation method and passed to the SPIHT encoder. As SPIHT’s output bit stream is ordered by importance, the encoder can terminate encoding at any point. Testing: For lossy compression, a standard measure of compression per- formance is the percentage RMS distortion (PRD) between the original and reconstructed signals, defined as: PRD = x ˆ x x (1) where x and ˆ x are the original and reconstructed signals, respectively, and ‖‖ represents the Euclidean or L 2 norm. Compression ratio (CR) represents the ratio between the bit rate of the original signal and the bit rate of the compressed signal. The EEG dataset used was provided by the University of Freiburg, Germany [4, 5]. This contains a mixture of both seizure and non- seizure data for 21 patients. The database was chosen because of its public availability, and contains six-channel EEG signals. While clinical systems typically use 64 or 128 channels, six channels are more likely to be feasible for a real-world implementation of an AEEG seizure detec- tion device [6]. The EEG signals were compressed and reconstructed at CRs ranging from 2 to 50. The PRD of each reconstructed signal was then calculated. No prefiltering was applied to the signals prior to com- pression, and each channel was compressed and decompressed independently. The complexity of the SPIHT algorithm was also analysed by deter- mining the average number of operations required to compress one frame of the EEG for each of the CRs considered. The SPIHT algorithm is composed of two arithmetic and two list operations. The arithmetic operations are subtracts and compares. SPIHT employs lists to maintain track of insignificant sets and significant and insignificant coefficients. These lists dynamically vary in size. A linked list is an efficient dynamic data structure implementation which, for SPIHT, requires two core operations: (i) a push operation and (ii) a list erase operation. The number of machine cycles for each of these operations was obtained for the Analog Devices Blackfin BF537 DSP processor using the ADI Visual DSP ++ profiling tool; these are given in Table 1. Table 1: Average numbers of machine cycles per operation on Analog Devices Blackfin BF537 DSP processor Instruction Number of clock cycles Integer compares 2 Sign compare 2 Integer subtract 2 Linked-list insert 67 Linked-list erase 62 Results: Fig. 1 plots the average PRD for the full database against CR. The authors in [7] suggested that a PRD of 7% is sufficient for clinical evaluation of reconstructed EEG signals; for this PRD, it can be seen that a CR of about 5:1 is achievable. A further application of interest for compressed EEG is automated seizure detection. Based on the results found in [8], a PRD of up to 30% was found to have no signifi- cant impact on seizure detection in EEG signals. For this level of PRD, a CR of about 30:1 was achieved. Fig. 2 illustrates a segment of EEG alongside the same signal reconstructed with PRD values of 7 and 30%. 50 40 30 20 10 0 0 5 10 15 percentage root-mean-squared distortion, % 20 25 30 35 40 compression ratio Fig. 1 Average CR against PRD for all records in Freiburg database 5000 0 –5000 100 200 300 400 500 600 700 800 900 1000 5000 0 –5000 100 amplitude 200 300 400 500 600 700 800 900 1000 2000 1000 –2000 100 –1000 0 200 300 400 500 time 600 700 800 900 1000 Fig. 2 Original EEG signal (top plot), and after being reconstructed with PRD of 7% (middle plot) and PRD of 30% (lower plot) Table 2 details the execution count of each operation used to compress one frame of EEG signal, as well as the total number of cycles required. Assuming a clock speed of 50 MHz for the Blackfin DSP, the corre- sponding processor load factor can be estimated in the rightmost column of Table 2. Even allowing for an additional scaling factor to take additional processor overhead into account, it can be seen that the algorithm does not significantly load the processor. Comparison with similar work: In [8], JPEG2000 is used to compress EEG signals at a variety of levels of fidelity loss. Using 7% PRD as the allowed loss, the results are very close to what is obtained by SPIHT. However, the paper also suggests that a PRD of 30% is allow- able in order to maintain a detection rate of over 90%. For SPIHT, a PRD of 30% corresponds to approximately a 30:1 CR, which is higher than the results obtained in [8]. A wavelet packet-based method for compressing EEG signals was presented in [7]. As noted above, this paper suggested a 7% PRD as the maximum allowable loss, in order to maintain clinically relevant information in EEG signals. Generally speaking, results for PRDs above 12% have not been reported in the literature so it is not known what CRs are achievable for the higher PRD limit of 30% suggested in [8]. ELECTRONICS LETTERS 1st September 2011 Vol. 47 No. 18