WAVELET-CONVERSION IN ELECTROCARDIO SIGNAL PROCESSING

2021, vol. 21, no. 1, pp. 70–79 70 Introduction The increase in the number of diseases and deaths associated with functional disorders of the cardiovascular system is one of the most important problems of modern medicine. The urgency of solving the problem of improving the quality of life of people with the help of early diagnosis and timely treatment of various cardiac diseases is obvious. The process of automated analysis of a huge database of electrocardiographic data is especially important. In recent years, a number of new noise reduction techniques have emerged. One of the first works in this area was devoted to cleaning the ECG signal from additive filter noise [1–9]. In the literature in the field of ECG research, a large number of noise reduction methods are currently described, for example, wavelet transform [10, 11], adaptive filter [12], fuzzy threshold [10], band rejection filter, nonlinear filter, Kalman filter [13] stationary wavelet transform [11] and Fourier transform. However, the approach based on the wavelet transform gives the most promising results [12]. Wavelet analysis can be successfully used to smooth and remove noise in the ECG signal. Electrocardiogram signal, stripped of noise components, looks clearer, while its volume is from 10 to 5% of the original signal, which to a large extent solves the problem of storing cardiac records. DOI: 10.14529/ctcr210107


Introduction
The increase in the number of diseases and deaths associated with functional disorders of the cardiovascular system is one of the most important problems of modern medicine. The urgency of solving the problem of improving the quality of life of people with the help of early diagnosis and timely treatment of various cardiac diseases is obvious. The process of automated analysis of a huge database of electrocardiographic data is especially important.
In recent years, a number of new noise reduction techniques have emerged. One of the first works in this area was devoted to cleaning the ECG signal from additive filter noise [1][2][3][4][5][6][7][8][9]. In the literature in In the present work, processing of an electro cardio signal using a wavelet transform is considered. In electrocardiography, various digital signal-processing techniques are used to detect, extract, and analyze the various components of an electrocardiogram. Among them, the wavelet transform technique gives promising results in the analysis of the time-frequency characteristics of the electrocardiogram components. The urgency of solving the problem of improving the quality of life of people with the help of early diagnosis and timely treatment of various cardiac diseases is obvious. The process of automated analysis of a huge database of electrocardiographic data is especially important. Wavelet analysis can be successfully used to smooth and remove noise in the ECG signal. Electrocardiogram signal, cleaned from noise components, looks clearer, while its volume is from 10 to 5% of the original signal, which largely solves the problem of storing cardiac records. Aim. Development of an algorithm for threshold processing of wavelet coefficients and filtering of an electrocardiography signal. Materials and methods. Cardiograms were taken for analysis. Then they were digitized and entered into a computer for processing. A program was written in the MATLAB environment that implements continuous and discrete wavelet transform. Results. The work shows the result of filtering the ECG signal with the addition of noise with a signal-to-noise ratio of 35 and 45 dB using the decomposition levels N = 2, N = 3, N = 4. Conclusion. Based on the analysis of the data obtained, it can be concluded that the second level of decomposition is the most optimal for filtering the ECG signal. With an increase in the level of decomposition, the output ratio decreases, at the level N = 4 the output signal-to-noise almost does not exceed the input one, therefore, the filtering becomes ineffective. The correlation coefficient to the fourth level is significantly reduced, which means a significant increase in the distortion introduced by the filtering algorithm.
Keywords: electro cardio signal, wavelet transform, filtering algorithm, development of an algorithm.
The electrocardiogram signal, ECG, plays a critical role in the diagnosis of human heart disease. The primary processing of the ECG signal data and its subsequent study becomes much more efficient if the signal has no noise component, therefore, noise removal is a task of paramount importance [14].
When recording an ECG, the signal is inevitably more or less distorted by various noises. For example, network high-frequency interference of the electrical network (network noise), noise of electrocardiograph amplifiers, muscle tremor, low-frequency swimming of the isoline due to breathing. Fast discrete wavelet transform effectively removes the noise present in the digitized signal. The purpose of this work is to develop an algorithm for threshold processing of wavelet coefficients [1].
To implement the procedure for wavelet filtering of the CS, the method of threshold processing of coefficients was chosen. In the course of the work, an algorithm for the wavelet filtering of the CS by the thresholding method was developed and implemented [15]. There is a wide choice of wavelet bases used for filtering signals by the thresholding method, the choice of the wavelet function and noise reduction parameters, such as the type of threshold, the level of decomposition, etc., plays a decisive role in the method's operation. To implement the algorithm and conduct modeling, software was written in the language programming MATLAB.

Noises arising from registration of ECG signals
When recording an ECG, the signal is inevitably more or less distorted by various noises. The high-frequency components of the cardiac signal are considered to be noise. To smooth the cardiogram, high-frequency components are usually removed using various filters. It is clear that some of the information recorded by the cardiograph is lost. The origin of the high frequencies of the cardiac signal is not fully understood. The network high-frequency interference of the electrical network (network noise), due to the inclusion of a large number of electrical appliances in the electrical network, and the electronic noise of the electrocardiograph amplifiers have some influence. The frequency of this interference is 50 or 60 Hz [11].
It is assumed that physiological high-frequency noises are to a large extent a consequence of the electrical activity of the heart, since they are recorded by sensors located near the heart. Also, the noise causes the baseline to float, the baseline drift is a low-frequency interference with a frequency of less than 1 Hz, due to the influence of respiration and high skin resistance. The volatility of the isoline affects the accuracy of measuring the amplitude parameters of the electrocardiosignal, since it is from it that the count is taken. Traffic disturbances appear as single or cyclical bursts. The frequency of such interference is in the range from 1 to 40 Hz. They arise as a result of a change in the position of the patient or the electrode, hiccups, coughing, etc. In modern technical equipment with appropriate grounding, the hardware noise is practically insignificant in comparison with physiological noise. Effective separation of high-frequency noise components is possible using wavelet transform of the signal [3].

Noisy signal model
Wavelet analysis is effectively used to remove noise in a signal. Let's consider the simplest model, where the noisy signal looks like: where   S t -useful signal;  -noise level;   n t -gaussian white noise. Gaussian white noise is a stationary random sequence that is absolutely uncorrelated, with a mathematical expectation of zero and a variance of one. The signal n(t) is called white noise, because it has a constant spectrum at all frequencies, by analogy with white light, which has a uniform continuous spectrum in the visible part [13].
The essence of noise removal, in other words, signal filtering, consists in suppressing the noise part n(t) of the signal and restoring the useful signal S(t). In this paper, a threshold filtering algorithm with one-parameter threshold functions is used.

Threshold processing of wavelet coefficients
Wavelet transform of signals is one of the types of spectral analysis, the most famous representative of which is the Fourier transform. The English word wavelet (from the French "ondelette") literally translates as "short wave". In various translations of foreign articles, there are also terms such as: "burst", "burst function", "low-wave function" and others [1][2][3][4].
Continuous wavelet transform is carried out according to the formula: where t is the time axis; x is the time instant; s is the parameter inverse to the frequency (scale); *  means the complex conjugate;   f t is the signal under study;

 
, W x s is the result of the wavelet transform for 2 values x and s;  is the wavelet function. Expression [7] is used for discrete transformation.
where d is the coefficient for the scale j (j = 0, 1, -n) and point k. Scaled and offset versions of the parent wavelet: The result of the Wavelet transform of the signal is the decomposition of the signal into approximating coefficients A mk , which represent the smoothed signal, and detailing coefficients D mk , which describe the oscillations.
It is known that the noise component is more reflected in the detailing coefficients D mk . Therefore, for noise removal, usually only detail coefficients are processed.
The second assumption is that the noise component is a signal that is less in magnitude than the main one. Therefore, the simplest way to remove noise is to zero the coefficient values that are less than a certain threshold value [2].
This procedure is called coefficient thresholding and, ideally, allows you to get rid of the coefficients due only to the noise component and preserve the decomposition coefficients of the main signal. In foreign literature, the threshold processing of coefficients is called thresholding.
There are such thresholding methods as hard tresholding and soft thresholding. With strict thresholding, all coefficients exceeding a certain threshold value τ are considered to belong to the original signal, and the smaller ones are referred to as noise and are zeroed out. With soft thresholding, the modulus coefficients smaller than τ vanish, the remaining coefficients decrease in modulus by the value of τ.
The value of the threshold value τ plays the role of a control parameter that affects the filtering error. The choice of the threshold value determines the quality of the signal noise reduction, estimated as the signal-to-noise ratio.
With an underestimated value of τ, some of the noise expansion coefficients do not vanish, which leads to poor filtering, the signal-to-noise ratio increases only by an insignificant amount. When the threshold τ is overestimated, some of the informative coefficients vanish, the filtered signal is distorted [5].
Searching for the optimal value of τ means finding such a threshold that, with the smallest change in the reconstructed signal, provides the highest value of the signal-to-noise ratio [3].
The quality of signal noise reduction and, consequently, the degree of increase in the signal-to-noise ratio depends not only on the type of the trasholding function, but also on the method of its application. Distinguish: • general trasholding, carried out using a fixed value of the threshold τ -a value that is the same for all levels of decomposition and signal detail coefficients; • multilevel trasholding, carried out using the threshold τ, the values of which vary from level to level; • local trasholding, implying the use of the threshold τ, variable not only in terms of the level of decomposition, but also depending on the position of the detail coefficients at a given level.

Development of an algorithm for threshold processing of wavelet coefficients
Based on the generalized wavelet filtering algorithm, we will compose a wavelet filtering algorithm using the thresholding method of coefficients: 1) Decomposition (Direct wavelet transform): a) Choosing a wavelet function; b) Choice of the decomposition level N; c) Calculation of the wavelet decomposition of the original signal to the level N; 2) Thresholding of detail coefficients: a) Choice of thresholding method (hard / soft); b) For each level from 1 to N, a threshold is selected and soft (and in the case of images, hard) thresholding of the detail coefficients is applied; 3) Reconstruction. An inverse wavelet transform is performed based on the original N level approximating coefficients and the filtered detail level coefficients from 1 to N.
The block diagram of the wavelet filtering algorithm using the coefficient thresholding method is shown in Fig. 1.  To assess the efficiency of the algorithm and identify the optimal set of filtering parameters, the output signal-to-noise ratio will be used as a measure. The calculation of the correlation coefficient between the original and cleaned signal will also be carried out. The result of calculations will be displayed in text form for m variants of signal-to-noise mixtures S1 , S2 , , Sm     . For the filtered signal obtained at the output, the signal-to-noise ratio will be determined: 10 , 20log

Noisy signal S`(t) = S(t) + σ n(t)
where f A is the average amplitude of the filtered signal; n A is the average amplitude of the noise present in the signal after filtering. The noise component of the filtered signal is determined from the following relationship: where   n i is the sample of the noise component;   Correlation is understood as the relationship of some quantities represented by data -vectors or matrices. The generally accepted measure of linear correlation is the correlation coefficient. Its closeness to unity indicates a high degree of linear dependence. The degree of signal coupling is expressed in normalized units of the correlation coefficient, i.e. in the cosine of the angle between the vectors of the signals, and, accordingly, will take values from 1 (complete coincidence of signals) to -1 (complete opposite).
The calculation of the cross-correlation coefficient between the original S and the cleaned f S signals of length L will be performed according to the formula: where S is the initial ECG signal; f S -filtered signal; the samples for S and f S , respectively. Let us determine the optimal level of decomposition N, to which it is advisable to carry out the decomposition in subsequent studies.
We act on the initial ECG signal S with white Gaussian noise nσ with a given signal-to-noise ratio. Table 1 shows the results of comparing the decomposition levels N = 2, N = 3, N = 4 for the Simlet 4 wavelet. The type of the threshold function is soft, using an adaptive method for choosing the threshold value.

Conclusion
Based on the analysis of the data obtained, it can be concluded that the second level of decomposition is the most optimal for filtering the ECG signal.
With an increase in the level of decomposition, the output ratio decreases, at the level N = 4 the output signal-to-noise almost does not exceed the input one, therefore, the filtering becomes ineffective.
The correlation coefficient to the fourth level is significantly reduced, which means a significant increase in the distortion introduced by the filtering algorithm.