Introduction

Medical expenditures are on the all-time surge and high with the fast growth in world population. Healthcare became an important agenda of both individuals and governments. The latest reports from World Health Organization purport that dealing with aging population is the important thing today [1]. The present healthcare structures and approaches are facing more significant challenges of dealing with the healthcare problems of aging population. Accordingly, spotting human diseases in a cost-effective, well timed and in a precise fashion has taken center stage [2,3,4,5]. Electrocardiogram (ECG) monitoring became ubiquitous because of its supremacy in the diagnosis of heart-related diseases and is also making its way both in hospitals and research areas [6].

The present medical fraternities are dependent on the usage of large conventional ECG equipment with multiple electrodes for ECG data acquisition. ECG equipment having twelve electrodes is the norm of the day and suffers from the capabilities of efficient data handling even on a short-term basis. As the equipment has portability limitations, the activities of the patient are measured only during data collection, thus making continuous patient monitoring a tedious task. As ECG acquisition devices are not only costly but need training for home use, patients need to visit hospital frequently. The frequent visits to the hospital have severe limitations like irregular health monitoring, increase in hospital ‘s burden and causing physical hardship to the patients. Hence, the need of the day is a cheap, simple, portable, reliable and long-term ECG signal monitoring system [7].

Many long-term ECG signal monitoring approaches have been proposed during last few decades. First ECG signal monitoring system based on system-on-chip was introduced in [8], but this system consumes significant amounts of energy as it transmits raw data. Hence, a joint system for both ECG detection and data compression is highly required. An ECG monitoring system used in processing ECG signal for wireless transmission is shown in Fig. 1 [9].

Fig. 1
figure 1

Block diagram of ECG monitoring system [9]

The ECG monitoring system has three main functions namely, ECG signal analysis, data compression and wireless transmission. An ECG is a life-saving diagnostic tool in the heart care segment and is the most important feature amongst all ECG features is its QRS complex. A typical ECG signal is shown in Fig. 2. Hence, automatic detection of a QRS complex is the most important aspect of ECG signal processing and analysis. The performance of any ECG detection algorithm mainly relies on the QRS complex (R-peak) detector’s accuracy [10, 11]. Many algorithms are presented in the literature to detect QRS complex. Some of the QRS complex detection algorithms, namely are time domain [12], ECG morphology [13], time-frequency domain (Wavelet) [14,15,16,17,18,19], and combined algorithms [20]. The wireless transmission of raw ECG data consumes high power, and use of local storage increases the device cost. So, data compression is required to reduce the power consumption and device cost.

Fig. 2
figure 2

Typical ECG waveform of a single heartbeat

Several lossy and lossless ECG data compression techniques have been reported in [21,22,23,24]. A comprehensive review of existing ECG signal denoising and R-peak detection is reported in [25]. Increasing detection accuracy with the help of complex signal processing techniques is the aim of most of the reported approaches. Low power consumption and less hardware complexity are the two crucial attributes of mobile ECG equipment. Low power implementation of many ECG detection and data compression techniques are reported in [21,22,23,24,25]. Until now, most of the existing work separately concentrates either on QRS complex detection or data compression techniques. There are few techniques which use a single algorithm to detect QRS complex as well compress ECG signal data [9, 26]. However, the techniques which use the same algorithm to detect QRS complex and compress ECG signal data possess high system complexity. Efforts are made to find an efficient algorithm which can be used to detect QRS complex and compress ECG signal data with low system complexity.

In this work, an algorithm based on bi-orthogonal wavelet transform is used to design the proposed QRS complex detection and to compress the ECG signal data. Here, run-length encoding technique is proposed for lossless data compression. The proposed design reduces the overall circuit complexity by reducing the number of delay elements, adders, and multiplexers. Sensitivity, positive predictivity, data error rate, compression ratio are the performance measures considered to evaluate the performance of the proposed design.

The remaining paper is organized as follows: Section II provides information about proposed design including wavelet selection, ECG signal denoising, ECG detection, ECG data compression and the complete architecture of the proposed method. The performance evaluation and the simulation results of the proposed technique are detailed in Section III. Finally, Section IV concludes the paper.

Proposed design

The methodology used to implement the proposed joint QRS complex detector and data compression design is presented in this section. Flowchart of the proposed R-peak detector with data compression technique is shown in Fig. 3.

Fig. 3
figure 3

Flowchart of the proposed R-peak detector and data compression technique

Different steps shown in the flowchart are as follows. Input ECG signal is taken from Massachusetts Institute of Technology Boston’s Beth Israel Hospital (MIT-BIH) arrhythmia database [27] in .mat format. ECG signal from MIT-BIH may be or may not be corrupted with different noises, but in reality, ECG signals get corrupted due to the presence of various types of noises. In practice, Electrosurgical noise, muscle contraction, instrumentation noise, baseline drift, 60 Hz power line interference are different noise sources which corrupt the ECG signal. A corrupted ECG signal is realized by adding random noise to ECG signal from MIT-BIH arrhythmia database. Adding random noise to the signal helps measure the efficiency of the proposed algorithm to reject noise from the signal. It is highly desirable to select a suitable denoising algorithm form the existing ECG signal denoising and QRS complex detection approaches available in the literature [25]. Reduced hardware complexity and a better detection accuracy make the wavelet transform based denoising, and QRS complex detection approaches as a most suitable technique when compared to the other techniques time domain, ECG morphology, and combined approaches [2].

The biorthogonal wavelet transform with four levels of decomposition is used to analyze a noisy ECG signal. The typical frequency range of an ECG signal is from 0.5 Hz to 150 Hz, and that of QRS complex is from 8 Hz to 20 Hz [28]. After the third level of decomposition, the frequency components that are left behind are in the 45 Hz range. The output of the third level wavelet filter bank is used as input to the fourth level wavelet filter bank whose output contains signals in the frequency range which matches with the frequency range of QRS complex. These signals from the fourth level wavelet filter bank are used for further processing as their frequency component matches with that of the QRS complex. After denoising, a QRS complex detector is designed in which incoming denoised ECG signal (A) is compared with a predetermined threshold value (Vth). The most critical criterion in fixing Vth value is that, neither an R-peak in the QRS complex is missed, nor a false R-peak is detected. The reasons for selecting a suitable value of Vth are as follows. If the value of Vth is very small, a lot of false R-peaks are detected thus reducing the detection accuracy and also the computational efforts are increased. A large value of Vth may fail to detect a true R-peak, thus affecting the detection accuracy. To minimize the computational efforts and to improve the detection accuracy, selection of Vth plays a very crucial role. An R-peak is only detected if the value of A is greater than the set threshold. After identifying the R-peaks, the time interval between two consecutive R-peaks is computed. The detected data is compressed using lossless data compression technique which is RLE in this case, further utilized for the wireless transmission for medical assistance.

Dataset

ECG signal from various databases like MIT-BIH arrhythmia database (MITDB), QT database (QTDB) [29] are used to evaluate the proposed design. MITDB contains 47 half-hour recordings of annotated ECG signals with a sampling frequency of 360 Hz and QTDB contains 105 records with a sampling frequency of 250 Hz.

Selection of wavelet transform and wavelet architecture

ECG signals exhibit slowly changing trends or oscillations punctuated with transients. To accurately analyze an ECG signal with abrupt changes, a new class of well-localized functions in time and frequency are needed. Wavelet transform which is a rapidly decaying wave-like oscillation that has zero mean and exists for a finite duration satisfies this condition. Continuous wavelet transform (CWT) and discrete wavelet transform (DWT) are thus useful to analyze ECG signals. DWT is ideally used to denoise and compresses signals and images and useful in representing many naturally occurring signals with fewer coefficients.

Accurate estimation of ECG signal parameters demands a suitable choice of basis function which is either symmetric or antisymmetric [30]. Peak detection is facilitated by detecting extrema in case of symmetric basis and by identifying zero crossing in case of antisymmetric basis. By reducing the number of steps, a basis function with minimal sign changes simplifies the parameter estimation algorithm. As listed in Table 1, biorthogonal wavelet transform satisfies the abovementioned requirements, hence used in this work.

Table 1 Properties of different wavelet transforms

Due to low computational complexity, the biorthogonal wavelet transform is considered to implement QRS complex detectors [30]. Biorthogonal wavelet transform requires decimator and undecimator based architectures with lowpass and highpass filters as presented in [14, 31, 32].

In biorthogonal wavelet transform technique, ECG signal is first filtered using a combination of lowpass and highpass filters to yield lowpass and highpass sub-bands. As per Nyquist criterion, after filtering, half the samples are thrust aside. While realizing the filters, due to the smaller number of coefficients, these filters result in reduced computational complexity. These filters can also be used to reconstruct the sub-bands while canceling any aliasing which occurs due to downsampling. In the next level of decomposition, the sub-bands are iteratively filtered by the technique above (combination of lowpass and highpass filters) to yield narrow sub-bands. However, the cascading of filters increases hardware complexity and power consumption in the circuit [33]. In this work, to reduce the hardware complexity and power consumption, a new demand-based wavelet filter bank architecture is proposed. Figure 4 shows the proposed wavelet filter bank architecture. In the proposed demand based wavelet filter bank architecture, ECG signal is first passed through a cascade connection of three lowpass filters and then through a highpass filter.

Fig. 4
figure 4

(a) Recursive application of wavelet filter bank. (b) Wavelet filter bank. (c) Schematic of the lowpass filter in wavelet filter bank. (d) Schematic of a highpass filter in wavelet filter bank

The proposed architecture only requires three lowpass filters, and a highpass filter when compared to the filter bank architectures used in [14]. Also, hardware cost, as well as power consumption of the proposed design, can be further reduced by realizing the filters using FIR types. The transfer function of lowpass and highpass filters are obtained as shown in Eq. (1) and Eq. (2)

$$ H(z)=0.125+0.375{z}^{-1}+0.375{z}^{-2}+0.125{z}^{-3} $$
(1)
$$ G(z)=-2+2{z}^{-1} $$
(2)

Comparison of proposed demand-based wavelet filter bank architecture with [14] is discussed in Table 2.

Table 2 Comparison of proposed architecture with existing methods

A multiplier is a circuit element that requires more area and power as a minimum of the four adders are required to implement a multiplier. As listed in Table 2, the proposed work needs only seven multipliers against thirteen in [14] and twenty-six in [24. In addition, the proposed work requires only four adders as compared to sixteen in [14] and thirty-two in [31].

Hardware comparison in terms of area and power of the proposed wavelet filter bank with the existing methods are listed in Table 3. It is observed from Table 2 that the proposed wavelet filter bank architecture requires four adders, seven multipliers, and ten delay elements. Thus, the area needed to realize these adders and multipliers are 1160 μm2 and 15,109.92 μm2, respectively, which is comparatively lower than the existing reported methods [14, 31]. In the proposed wavelet filter bank architecture, the power consumed by adders and multipliers is 408 μW and 3047.17 μW, respectively, which is comparatively lower than the existing reported methods [14, 31]. A complete comparison between the proposed architecture and existing architectures is presented in Table 3.

Table 3 Area and power comparison of adders and multipliers of proposed wavelet filter bank with existing ones

QRS complex detection

The incoming peaks are compared with a threshold value. The threshold value is determined after passing the ECG signal through wavelet filter bank. Two types of threshold values namely hard threshold and soft threshold can be used to compare the peak. The peaks which are having a peak value less than the threshold are viewed to be zero in both hard and soft thresholds. Thus, the functionality of both hard and soft threshold values is same in the case of those peaks with peak value less than the set threshold. For the peaks with a peak value larger than a set threshold, both hard threshold, and the soft threshold result in different functionality. In case of the hard threshold, those peaks having a value larger than the set threshold are forced to approach towards one thus detecting the presence of a peak. In doing so, some features of the signal are lost and hence using hard threshold degrades the computational accuracy. In the soft threshold, the value of the peaks is retained if the value of the peak is larger than the threshold value. Hence, for the proposed QRS detector, using soft threshold is more advantageous than using the hard threshold. Eq. (3) defines the threshold value used in this work.

$$ {V}_{th}=0.8\times A\left(\max \right) $$
(3)

A peak having a value larger than the defined threshold value is considered to be an R-peak. Thus, by identifying the R-peaks, the time interval between two consecutive R-peaks is calculated.

The reason for selecting the above-said threshold values is as follows. Different values of the threshold are used to detect R peak. The threshold value neither should result in false peak detection nor should miss a peak. Further, setting a large value of threshold results in missed peaks thus increasing the detection error rate. Whereas, setting a small value of threshold results in increased computation complexity and false detection thus reducing the detection efficiency of the system. Different values of Vth ranging from 0.7 to 0.9 are considered. Vth close to 0.7 resulted in an increased false peak detection, whereas, Vth close to 0.9 resulted in R-peaks being discarded. Hence the threshold value is chosen to be 0.8 × A(maximum). Threshold values other than the proposed either detect an extra number of ECG peaks or detects less number of ECG peaks.

Data compression

Lossy and lossless are two types of compression techniques. Compression ratio (CR) of lossy compression techniques is high, but medical regulatory bodies do not approve these techniques in many countries [9], thus prohibiting the commercial use of lossy compression techniques is prohibited. In the lossless technique, as there is no chance of losing any information about potential diagnostic value, the lossless technique is the only option available and used in the proposed work. Many lossless ECG compression techniques presented in the literature [21,22,23,24] have focused on achieving high compression ratio. Here in the proposed work, various data compression techniques namely wavelet transform, Huffman coding/simple predictor, Huffman coding/adaptive, slope predictor/fixed length packaging and run-length encoding are tested, but run-length encoding is chosen based on its high compression ratio. In this method, the detected R-peaks are represented by “1” and “0” represents the rest of the data. This data is then compressed by replacing the zeros between two peaks by the number of zeros between the peaks. Run-length encoding (RLE) is a well-known, simple, and quick form of lossless data compression technique which offers a significant amount of compression for a specific type of data stream (in which the same data value occurs in many consecutive data elements). The run-length encoding decreases the size of a given signal, while at the same time not losing any information from the original. Each packet of Run-length encoding consists of two components, namely, run_count which denotes the number of characters in the run, and run_value which indicates the common value of the characters in the run. For example, using RLE, the string of datas 111,111,111,111,000,011,111,110,000,001,100 encoded after string compression results in 1,214,071,602,120. This can be interpreted as a sequence of twelve 1 s, four 0 s, seven 1 s, six 0 s, two 1 s and two 0 s. After that, RLE is applied to the binary matrix. Compression ratio is calculated using Eq. (4).

$$ CR=\frac{N_0}{N_1} $$
(4)

where, N0 = the number of uncompressed samples × bit width of uncompressed samples and N1 = the number of compressed samples × bit width of compressed samples.

Architecture

The block diagram of the complete architecture of proposed design is shown in Fig. 5. The proposed design mainly consists of three blocks. Namely, demand-based wavelet filter bank architecture with a linear phase structure realization for ECG signal denoising, modified soft threshold based QRS complex detector to detect R-peak, and data compression to compress the detected ECG data which is also used for the wireless transmission for medical assistance. In the existing wavelet filter banks, Mallet based wavelet filter bank architecture is used in which signal is decomposed into two parts namely into approximation and detail. Since all the peaks of ECG signal present in the frequency range of 10 to 100 Hz, a demand-based wavelet filter bank architecture with linear phase structure realization is proposed in the present work. The proposed wavelet filter bank consists of three lowpass filters namely FB1, FB2, FB3, and a highpass filter FB4.

Fig. 5
figure 5

Block diagram of proposed joint ECG detection and data compression scheme

It is found that the output of wavelet filter bank at fourth level is smooth and less noisy compared to other levels. Hence, fourth level wavelet filter bank is used for the proposed design. After that soft threshold with value 0.8× (max)A is chosen, which compares the output of wavelet filter bank four with the set threshold value and detects the peaks. After that, all detected peaks are considered as ‘1’ and undetected peaks are considered as ‘0,’ and a binary matrix is formed. Finally, data is compressed using RLE.

Performance results

The proposed work achieves an improved peak detection and higher data compression rate. These results were discussed in the following subsections.

QRS complex detection

ECG signal from various datasets namely MIT-BIH arrhythmia database (MITDB) and QTDB [30] are used to evaluate the proposed design. MIT-BIH arrhythmia database contains forty-seven half-hours recording of annotated ECG signals with a sampling frequency of 360 Hz. Whereas, the QT database contains 105 records with a sampling frequency of 250 Hz.

The proposed technique is tested with three different types of MIT-BIH arrhythmia database signals and QT database, namely short time data (10s. data from MIT-BIH and QT database), medium data (one-minute data from MIT-BIH and QT database) and full-length data (1-h data from MIT-BIH and QT database).

Further, false negative (FN) and false positive (FP) detections are used to evaluate the detection performance. FP is the number of extra detected peaks and FN is the number of missed peaks. Further, FN and FP are used to compute the sensitivity (Se %), positive predictivity (+P %), data error rate (DER %), the probability of missed detection (PD), and the probability of false alarms (PFA). Se%, +P%, DER, and PD are defined using Eq. (5) through Eq.

$$ Se\left(\%\right)=\frac{TP}{TP+ FN}\times 100 $$
(5)
$$ +P\left(\%\right)=\frac{TP}{TP+ FP}\times 100 $$
(6)
$$ DER=\frac{FP+ FN}{Total\kern0.17em number\kern0.17em of\; QRS\; peaks} $$
(7)
$$ PD=1-\frac{TP}{TP+ FN} $$
(8)

where true positive (TP) is the number of correctly detected R-peaks. R-peak detection results for all records and different size of data, namely ten seconds, one minute, and full-length ECG data of MIT-BIH arrhythmia database are shown in Tables 4, 5 and 6, respectively. Table 5 shows the results of 10 s ECG data; Table 5 shows results of 1-min ECG data and Table 6 shows the results of 1-h ECG data.

Table 4 Performance of the proposed technique using 10 Second MIT-BIH Database
Table 5 Performance of the proposed technique using 1-Minute MIT-BIH database
Table 6 Performance of the proposed technique using 1-h MIT-BIH database

As shown in Table 4, the proposed QRS complex detector achieves the highest sensitivity and positive predictivity of 99.31% and 99.65% with the MIT-BIH arrhythmia database of ten seconds. 108.mat and 214.mat signals from the MIT-BIH arrhythmia database contain maximum noise [25]. The proposed R-peak detector achieves the highest sensitivity and positive predictivity of 90.90% and 100% on 108.mat and 100% sensitivity and positive predictivity on 214.mat.

From Table 5, the proposed R-peak detector achieves the highest sensitivity and positive predictivity of 99.65% and 99.65% with the MIT-BIH arrhythmia database of one minute. Also, the proposed R-peak detector achieves the highest sensitivity and positive predictivity of 100% on 108.mat and 100% sensitivity and positive predictivity on 214.mat to existing detection algorithms.

Comparison chart of Se, +P, and DER of the proposed algorithm with different size of ECG dataset is shown in Fig. 6.

Fig. 6
figure 6

Comparison chart of Se, +P, and DER of the proposed algorithm with different size of ECG dataset

From Table 6, the proposed R-peak detector achieves the highest sensitivity and positive predictivity of 99.75% and 99.98% with the MIT-BIH arrhythmia database of full-length.

The performance of the proposed QRS complex detector under noisy conditions is shown in Fig. 7.

Fig. 7
figure 7

a 108 series of input ECG signal taken from MIT-BIH arrhythmia database, (b) randomly generated noise signal, (c) ECG signal contains noise, (d) wavelet filter bank-1 output, (e) Wavelet filter bank-2 output, (f) Wavelet filter bank-3 output, (g) Wavelet filter bank-4 output and (h) final output.

Figure 7(a) pictorially represents the 108.mat input ECG signal taken from MIT-BIH arrhythmia database. To evaluate the proposed QRS detection algorithm, a random noise source as shown in Fig. 7(b) is generated and added to ECG signal in Fig 6(c). Figure 7(c) shows a noisy input ECG signal. The noisy input ECG signal is first filtered using a wavelet transform based lowpass filter, wavelet filter bank 1(WFB1). The output of the WFB1 is shown in Fig. 7(d). The output of the WFB1 is further filtered using a wavelet transform based lowpass filter also known as wavelet filter bank 2 (WFB2). The output of WFB2 is shown in Fig. 7(e). The output of WFB2 is then filtered using a wavelet transform based lowpass filter known as wavelet filter bank 3 (WFB3). The output of WFB3 is shown in Fig. 7(f). The output of WFB3 is finally filtered using a wavelet transform based highpass filter known as wavelet filter bank 4 (WFB4). The output of WFB4 is shown in Fig. 7(g). Figure 7(h) shows the detected R-peaks. Figure 7(h) shows the 10 R-peaks in ten seconds of ECG data. Table 4 also shows the same number of R-peaks for the 108.mat ECG data.

Performance comparison of existing techniques with the proposed technique is shown in Table 7.

Table 7 Performance comparison of proposed technique with existing techniques

As shown in Table 7, the proposed technique has a better detection performance compared to existing techniques. Some methods like a genetic algorithm, filter bank also offer good performance, but their computational complexities are relatively high compared to proposed technique. The proposed technique requires less hardware when compared to the existing techniques like [14, 31] because of the use of modified demand based wavelet filter bank architecture, and linear phase structure realization. Hence, the proposed technique is better for both implantable as well as wearable cardiac pacemaker applications.

Data compression

The proposed ECG data compression technique is tested using QT database and MIT-BIH arrhythmia database. The bit compression ratio (BCR) is calculated using the formula in Eq. (9):

$$ BCR=\frac{BW_{uncomp}}{BW_{comp}} $$
(9)

Here, BW uncomp is the bit width of the uncompressed sample and BW comp is the bit width of the compressed sample. The proposed ECG data compression technique gains a high compression ratio of 17.1. The other existing data compression techniques have very less compression ratio which is 2.66 for statistical Huffman coding, 2.17 for selective Huffman coding and 2.28 for wavelet-based data compression technique. Comparison of proposed technique with existing techniques is shown in Fig. 8.

Fig. 8
figure 8

Comparison of proposed technique with existing techniques

Conclusion

In this work, a novel technique based on a biorthogonal wavelet transform that is jointly used for QRS complex detection and lossless ECG data compression aimed at implantable and wearable ECG devices is proposed. The R-peak detector achieves a high sensitivity of 99.75% and a positive predictivity of 99.98% with the MIT-BIH arrhythmia database and a sensitivity of 99.67% and positive predictivity of 99.9% with the QT database. The RLE -based ECG data compression technique provides a lossless compression ratio of 17.1The proposed technique requires approximately 50% less hardware compared to the existing techniques. The proposed methodology can be further extended to analyze other biomedical signals.