*3.2. The Error Metrics*

In order to make our results comparable with existing methods, we use the PRD (Equation (9)) and data compression ratio CR as a first-step approach to the assessment of transparency of proposed adaptive ECG sampling:

$$PRD = \sqrt{\frac{\sum\_{i=1}^{n} \left[x\_1(i) - x\_2(i)\right]^2}{\sum\_{i=1}^{n} \left[x\_1(i)\right]^2}} \cdot 100\% \tag{9}$$

However, due to intrinsic inadequacy of PRD that averages all errors in time without consideration of their position with regard to medical information, we also calculated its values separately for each ECG wave, as suggested in [1]. This method is reported as a local distortion measure that depends on estimated ECG sections and possible weighting of their significance [41]. The distortion level was also provided in microvolts as an average peak-to-peak error value, for the reason of compatibility with performance requirements for interpretive electrocardiographs [26].

To avoid the abovementioned flaw of the PRD, we applied a more comprehensive error metric based on diagnostic features to reveal differences of primary diagnostic outcomes derived from the original and adaptively sampled ECG record. A widely discussed, but yet recently applied global quality estimate based on comparing the PQRST complex features of the two ECG signals is the weighted diagnostic distortion (WDD) introduced in [5]. It was defined as

$$\text{WDD}(\beta, \hat{\beta}) = \Delta \beta^T \frac{\Lambda}{\text{tr}(\Lambda)} \Delta \beta \cdot 100 \tag{10}$$

where Δβ is the normalized difference vector between original and processed PQRST features, where β and βˆ represent two vectors of 18 diagnostic features (RRint., QRSdur., QTint., QTpint., Pdur., PRint., QRSpeaks\_no., Qwave\_exsist., Δwave\_exsist., Tshape, Pshape, STshape, QRS(+)amp., QRS(−)amp., Pamp., Tamp., STelevation, STslope) of compared beats and Λ is a diagonal matrix of weights heuristically set to [42],

$$
\Lambda = \text{diag}\left\{ 2.5 \, 2.5 \, 1 \, 1 \, 2 \, 2 \, 1 \, 0.5 \, 0.1 \, 1.5 \, 1 \, 3 \, 1.5 \, 1 \, 1 \, 3 \, 3 \right\} \tag{11}
$$

This ECG-specific error metric, although requiring interpretive calculation of diagnostic outcomes, yields results related to medical findings equivalence rather than to signal representation accuracy. Therefore it is more adequate to evaluate the medical content preservation in signals with irregular distribution of information. Since the definition of WDD roughly reflects the local density of medical data in the ECG, expressed by diagnostic parameters, we consider it as the principal quality estimator of proposed adaptive ECG sampling. Moreover, the use of WDD shifts the evaluation of our adaptive sampling method from the signal domain to the parameter domain and thus reliably reflects the possible alteration of medical content. A serious cost of this is the necessity of using an interpretive software, of which none shows a 100% accuracy.

#### *3.3. Performance Assessment*

With the aim of exploring the possible flexibility of the adaptive ECG sampling, we applied two different ranges of sampling frequency adaptation: (1) 100 Hz ... 500 Hz and (2) 50 Hz ... 500 Hz. We also used two different medical relevance functions. Besides the original gMRF, obtained directly from scanpath studies (see Figure 2b), we simulated a specific medical relevance function (sMRF) with a purpose-oriented region of interest (ROI) focused on the end of QRS complex (e.g., for the investigation of an infarct or a conduction defect [29]). This variant of sMRF emphasizes the relevance and increases the accuracy of QT section at the price of saving samples mostly in P-wave vicinity (Figure 6).

**Figure 6.** Comparison of bar graphs for scanpath-determined gMRF (blue) and example infarct or a conduction defect-oriented sMRF (red). Wave borders are: P-onset: 106, P-end: 196, QRS-onset 246, QRS-end: 338 and T-end 672.

Results of experiments for compression, distortions and medical parameter differences are presented in Table 1.


**Table 1.** Data compression, distortions and medical parameter differences for adaptive ECG sampling.

\* acceptable value specified in IEC 60601-2-51 is 25 μV or 5% for amplitudes above 500 μV. \*\* acceptable value of standard deviation with reference to CSE Database results specified in IEC 60601-2-51.

#### **4. Discussion**

The presented adaptive ECG sampling algorithm, although not bit-accurate, shows interesting compression efficiency, making it worth considering in clinical applications. It may be classified as an alternative to bit-accurate methods yielding the compression ratio in the order of 3 at the price of high computational complexity [10] to the quality-on-demand (lossy-to-lossless) algorithms [3,43] and to recently proposed compressed sensing [13,15] or adaptive sensing [16,17] methods. The main advantage of the newly proposed algorithm is that unlike methods in the last two categories, the temporal distribution of distortions is based on medical rather than on statistical features of the signal (Table 1). For this reason, the quality estimate based on primary ECG diagnostic parameters (WDD) shows only little difference caused by the transformation.

We do not follow the example of several authors [3,7,42,44–48] using the MIT-BIH database [49] for tests of adaptive ECG sampling technique. The reason is threefold:

The sampling frequency of the MIT-BIH database is too low; following the paradigm typical for long-term recording, sampling at 360 Hz avoids oversampling in low-frequency components, limits the bandwidth of the high-frequency sections, and reduces the interval range (*fs–fm*) available for adaptive sampling.

The CSE Database provides reference positions of wave border points that enable evaluation of whether the proposed algorithm is robust to possible inaccuracy of wave delimitation.

The proposed algorithm uses the aMRF commonly calculated and stored for all leads in a multidimensional signal, therefore its efficiency decreases with the leads number.

A broad discussion was held with collaborators and experts in the field whether to apply the proposed method to the MIT-BIH standards, namely arrhythmia and compression databases. This would allow us to compare the proposed method to the values reported by Sayadi et al. [42] on that dataset or to compare the compression efficiency to the variety of algorithms like the ones proposed by Fira et al. [45] or Kim et al. [50] who reported the quality score (QS) above 15 for the MIT-BIH database. For three reasons we decided not to follow this thinking.

The proposed method is not yet another data compression algorithm—its novelty consists in the use of a priori knowledge about the ECG content derived from the human perception instead of local statistics of the signal.

The use of reference wave border points provided by the CSE database makes it possible to prove the robustness of the coding method to the inexact performance of the delineation software.

The QS proposed as a ratio of CR to PRD [45] inherits the principal drawback of the PRD that is the negligence of local variations of ECG signal relevance.

Additionally, as we are skeptical of the PRD as a medically-justified measure of distortion and propose using the WDD instead, we need a diagnostic software in order to calculate all 18 heartbeat features given in Equations (10) and (11). Following [51] we also did preliminary tests with the European QT Database providing reference wave borders available from Physionet at no charge. The database consists of 2-lead ECG signals, and we tried to simulate the missing leads in order to feed them to Ascard 6 12-lead diagnostic software. At this point we had to give up since the results we got for wave delineation were significantly different from the values given in the database.

Parkale and Nalbalwar give a complete survey of the CS techniques in [52]. The main performance results of the most significant methods are summarized in Table 2 for two scenarios: Scenario 1, distortion-optimized (with reasonable compression ratio), and Scenario 2, compression-optimized (with acceptable distortion level).


**Table 2.** Performance of the proposed adaptive sampling method compared to recent landmark systems for ECG compressed sensing; NB authors use different data sets for testing.

Comparing our work to the CS algorithms one should note different approaches to testing the quality of the output ECG. Mamaghanian et al. [14] and other followers refer to the paper by Zigel et al. [5] in specifying the 'quality class' as 'very good' for PRD < 2% or 'good' for 2% < PRD < 9%. For Luo et al. [55] the ECGs recovered with PRD < 6% are 'essentially undistorted' and Craven et al. [13] allow for PRD > 5% for 'clinically relevant metrics' but, despite the title, they focus on heart rate variability (HRV) parameters, more tolerant to amplitude distortion.

In works by Rieger et al. [16], Kim et al. [56], and Yazicioglu et al. [17], the bi-frequency sampling is controlled by the algorithm recognizing high activity and low activity sections. In [16] the ECG trace has to meet given peak and curvature conditions (i.e., first and second derivatives are calculated) to switch basic sampling frequency 50 Hz to the fast rate of 400 Hz. The threshold was set to effectively recognize the QRS beginning, maximum and end points in normal heartbeats. As a result, the data compression ratio of 1.6 was achieved. In [56], following the wavelet-based detection of QRS the basic sampling frequency of 64 Hz is stepwise raised to 512 Hz. As a result the data compression ratio of 4.5 was achieved. In [17] the activity detector circuit senses the rate of change of the input signal by using a switching capacitance differentiator. As the activity passes a given threshold, the basic sampling frequency of 64 Hz is stepwise raised to 1024 Hz. The data compression ratio depends on the duty cycle controlled by the value of activity threshold. For duty cycles in the range of 4–12%, the compression ratios of 9.94–5.72 are expected respectively. In all these works authors focus on the circuitry design and power efficiency rather than on ECG signal diagnostability, and thus do not provide information on the ECG distortion level. Despite a quantitative comparison of these methods with our work not being possible, they share a common concept of non-uniform distribution of medical information in the ECG. Therefore, the gMRF proposed in this paper can be seen as an advanced version of 'activity detector' controlling the actual ECG sampling in 64 steps instead of 2, which allows us to preserve best signal quality within the ECG waves.

A bi-frequency compression scheme based on local sub-sampling (decimation) of the signal is also recommended by the SCP-ECG communication protocol (ENV 1064) [57]. In our approach, the sampling interval is adjusted in a nearly continuous way without precisely distinguishing bordered zones. This provides a fair tolerance margin for the accuracy of waves delineation.

Aiming at future industrial implementation, we thoroughly checked the temporal distribution of distortions and their possible influence to the diagnostic result. The global PRD value (Table 1) seems to be high, but it is noteworthy that within the waves the distortion level in terms of wideband noise meets the requirements of industrial IEC standards [26] (25 μV, accordingly to 51.106.4) and is very close to quantization error requirements (5 μV, accordingly to 51.107.4). The duration of intervals is also little affected by the adaptive sampling, and extending the sampling frequency to as low as 50 Hz together with application of a QRS-focused region of interest still yields results acceptable by the IEC standard (marked by a double star in Table 1).

CS methods are often presented in the context of computational efficiency, particularly stressed in low-power wireless networks of sensing nodes. Although our primary goal is the quality of medical content, we estimated the computational complexity of the method by implementing the detection and wave delineation parts of the Ascard 6 software to a mobile platform with PXA-270 CPU running at 624 MHz with 64 MB of operation random access memory and 32 MB of flash memory under Linux OS. Additionally, tunable low-pass filters and cubic splines-based procedures for translation of uniform to non-uniform ECG representation were also implemented in the platform. All the evaluation procedures (e.g., WDD) were kept on the PC and used offline. Since the adaptive sampling is conceived as a continuously running procedure, the results on processing time are expressed as a percentage of real ECG duration as follows:


The gMRF is derived as a result of the pursuit for local conspicuity of the ECG trace and represents common perceptual habits of cardiology experts participating in our visual experiment [19]. This function generalizes the knowledge from cardiology expert perception of the ECG trace and reflects the local relevance of the signal that would be difficult to express in another way. This relationship can easily be modified in order to create various application-oriented or user-tailored profiles, differing by temporal allocation of regions of interest and the remaining zones where distortions are tolerable. An example of such approach was also tested (sMRF) and yielded a promising compromise of coding efficiency to distortion ratio (CR = 4.72, PRD = 4.88, WDD = 0.41).

The gMRF, being an experimental perception-derived relevance curve, has been applied to modulating the ECG sampling. For this task alternative sMRFs may be developed and used accordingly to a specific medical purpose. Since the shape of the sMRF is a principal factor imposing the compression efficiency, a question arose as to whether one could predict the CR from the sum of MRF bins (ΣMRF). In the particular case of CSE Database records, accompanied by reference specifications of the length of each particular heartbeat, thanks to the performed temporal normalization such a strict relationship can be proven. In this case the output data stream *d* may be approximated as

$$d = \left[f\_m + (f\_s - f\_m) \times bl \times \sum\_b MRF(b)\right] \times sr \tag{12}$$

where *bl* stands for bin length [s] (in our work being equal to 0.032 s), *b* is the bin number, and *sr* is the sample resolution (equal to 12 bits per sample).

In a general case, such a precise estimate cannot be calculated due to the presence of additional factors. Specifically, the CR will be higher than estimated by ΣMRF in case of slow rhythm (long T-P interval) due to prolonged use of *fs* between the adjacent heart beats. Otherwise, the CR will be lower than estimated by ΣMRF in the case of fast rhythms because main shortenings in the ECG pattern take place out of the waves (i.e., the accelerating heart first reduces its inactivity periods). A separate approach should be studied in cases of abnormal ECG when wave borders cannot be determined.

The proposed adaptive sampling technique makes sole use of local signal oversampling and therefore does not pretend to compete with existing ECG compression methods. In irregularly sampled ECG series, a significant short time (i.e., sample-to-sample), long time (i.e., heartbeat-to-heartbeat) and spatial (i.e., lead-to-lead) correlation is preserved. Therefore, further improvement of sampling efficiency is expected as a result of combining the adaptive sampling with long-term prediction technique (the use of beat-to-beat similarity of the ECG) and/or with ECG leads decorrelation (reduction of signal dimensionality) considered in future versions. In our opinion, this kind of sampling may have a similar impact on the telemedicine of tomorrow as the perceptual coding had on the audio and video broadcasting techniques of today.

**Funding:** This research was funded by AGH University of Science and Technology in 2019 as research project No. 16.16.120.773.

**Acknowledgments:** The author expresses their gratitude to the President of Aspel S.A. Zabierzów, Poland for his consent to use selected procedures of Ascard 6 interpretive software free of charge.

**Conflicts of Interest:** The author declares no conflict of interest. The funders had no role in the design of the study; in the collection, analyses, or interpretation of data; in the writing of the manuscript, and in the decision to publish the results.
