**2. Materials and Methods**

#### *2.1. The Idea and Processing Scheme*

The key idea of proposed adaptive ECG sampling consists of allocating space in the output data stream accordingly to the information density in the input series (i.e., uniformly sampled ECG). Unlike in many signal compression methods or compressed sensing based on statistical description of information density, in our method the local information distribution is estimated on the background of perceptual studies [19,20]. Although an inverse transform does not bit-accurately reconstruct the regularly sampled ECG, the adaptive sampling preserves the most important sections of the heartbeat and maintains all diagnostic features of the original signal. Moreover, the method accepts various (e.g.,

application-specific) information distribution models arbitrarily specifying parts of the heart cycle as more or less important. Both scenarios have been experimentally proven and results are described in the later part of this paper.

The adaptive sampling scheme (Figure 1) uses two procedures typical for the ECG interpretation-oriented processing chain: detection of heart beats (QRS complex) [25] and detection of ECG wave borders [21,22]. Both algorithms comply with the performance requirements for interpretive electrocardiographs [26], which guarantees high precision of wave borders delineation. Since both algorithms are designed to work with regular ECG signals, the proposed adaptive coding assumes uniformly sampled discrete time series at the input. Direct non-uniform sampling of analog signals (such as [17] or [27]) falls beyond the scope of this paper.

**Figure 1.** Block diagrams of the proposed adaptive sampling method (**a**) encoder, (**b**) decoder.

The second step of the coding scheme is the local projection of gMRF to the ECG waves i.e., adaptation to the actual duration of consecutive electrocardiogram sections. The heart cycle rhythmicity is influenced by many factors of physiological origin: escape and premature discharges, conduction abnormalities, P-wave absence or multitude, simultaneous multi-center discharges, etc. [28]. Consequently, even if the wave order within a beat is predictable, the length of individual sections may vary independently in a broad range. As the description of expected data density is based on wave-related progression of the heart cycle, the gMRF has to be projected individually on each heartbeat. This operation described in detail in Section 2.4 yields the adapted medical relevance function (aMRF).

The third step of the adaptive sampling scheme is the individual aMRF-based calculation of consecutive sampling intervals in the target irregular ECG. We used linear relationship (see Equation (4)), however other functions can also be employed. The sequence of sampling intervals determines the

time points in which the ECG values are actually sampled (i.e., interpolated from the original discrete signal). Usually the number of intervals in the irregularly sampled representation is significantly lower than the number of original samples in the equivalent recording time. The sampling interval can be expressed by any real number, but for practical reasons we had to quantize the interval value. A high quantization step yields a concise representation of sampling rate at the price of spectral discontinuities causing signal distortions. A low quantization step guarantees good signal reproduction, but the sampling description consumes extra space. In the case of a multilead ECG record, the wave borders are determined jointly for all leads and stored in a single interval sequence.

## *2.2. The ECG Trace Conspicuity as an Estimate of Local Information Density*

The proposed adaptive sampling scheme uses the gMRF as a quantitative estimate of local wave-related density of medical information. As it was proven with different scenes, visual interpretation of their content by a human observer involves alternating perception-cognition processes. Based on the relationship between the gaze time and the information amount, visual tasks are widely applied for objective assessment of preferences in graphic interfaces, advertising and many others [29,30]. Following these examples we studied ECG trace conspicuity and perceptual strategies of human experts for visual interpretation of records on display. The research presented in detail in [19] was focused on following the human expert reasoning and revealed different strategies of visual ECG interpretation for people with different degrees of expertise. Recorded eyeball trajectories were analyzed in the context of medical features represented in the displayed ECG traces (i.e., the wave borders were known but not displayed, Figure 2a).

**Figure 2.** (**a**) The example of expert's eyeglobe trajectory over a 12-lead ECG plot (CSE-Mo-001); (**b**) Corresponding bar graph of the attention density (each bar collects gaze time in a 32 ms interval in ECG record)—the background for gMRF (modified from [20]).

First, the ECG traces were section-wise normalized so as to equalize the length of corresponding waves from different records. Respective scanpaths were contracted or dilated accordingly. Next, gaze points were detected in the scanpaths and their center point horizontal coordinates were discretized with a step of 0.78 mm on display, corresponding to 32 ms of the ECG trace (at 25 mm/s). Finally, the time of gazing was collected in each ECG time slot separately and normalized to reveal interesting information about diagnostic data distribution (Figure 2b). As the histogram of the visual attention density was collected with respect to wave-dependent progression of the heart cycle, reference wave borders played a role of landmarks in the resulting gMRF.

The scanpath-based gMRF benefits from oculomotoric habits gathered by experts in their everyday practice, unconscious mutual perception-recognition interactions not affected by human intention, memory or verbalization limits. For these reasons the perceptual quantitative description of medical data distribution provides more objective assessment than any other method willingly controlled by the human. The perceptual model of the ECG proposed here as gMRF is universal since it was built from scanpaths of experts interpreting a wide range of normal and pathological records. Nevertheless, disease-specific models (i.e., specific medical relevance functions, sMRF) may also be built and applied accordingly to the status of particular patient.

#### *2.3. ECG Waves Delineation*

The positions of wave borders are a background for individual calculations of the Medical Relevance Function for each heartbeat. As particular segments of a heartbeat independently vary in time, a piecewise projection of the gMRF does the necessary local stretching or contracting of the gMRF in order to fit its landmarks to the actual duration of consecutive cardiac events.

Moreover, calculation of diagnostic parameters and comparing them between the original ECG and its counterpart reconstructed from the adaptive sampling, as well as the use of weighted diagnostic distortion (WDD) [5] (see Section 3.2) as a measure of signal reconstruction error, requires calculation of 18 diagnostic features by an ECG interpretive software.

To this point we used a development version of Ascard 6 (® by Aspel S.A., Zabierzow, Poland) software that meets the performance requirements of international IEC standard [26] and on the other hand allows for access to interpretation of metadata. The wave delimitation procedure embedded in Ascard 6 software uses the first and second derivatives of various versions of filtered signal in order to determine the point where the wave energy emerges from the background noise [31]. The algorithm also uses wave-specific features individual for each wave's onset and endpoint.

The Common Standard for Quantitative Electrocardiography (CSE) database, used in the experimental part for local adaptation of gMRF, provides reference wave border points of a representative heartbeat of each record [32] (see Section 3.1). The opportunity was taken to check whether substituting the values calculated with Ascard 6 software by their reference counterparts influences the adaptive ECG sampling result.
