Heart cardiac’s sounds signals segmentation by using the discrete wavelet transform (DWT)

The presence of abnormal sounds in one cardiac cycle, provide valuable information on various diseases.Early detection of various diseases is necessary; it is done by a simple technique known as: phonocardiography. The phonocardiography, based on registration of vibrations or oscillations of different frequencies, audible or not, that correspond to normal and abnormal heart sounds. It provides the clinician with a complementary tool to record the heart sounds heard during auscultation. The advancement of intracardiac phonocardiography, combined with signal processing techniques, has strongly renewed researchers’ interest in studying heart sounds and murmurs. This paper presents an algorithm based on the denoising by wavelet transform (DWT) and the Shannon energy of the PCG signal, for the detection of heart sounds (the first and second sounds, S1 and S2) and heart murmurs. This algorithm makes it possible to isolate individual sounds (S1 or S2) and murmurs to give an assessment of their average duration.


Introduction
Noninvasive diagnosis, such as phonocardiogram (PCG), offers useful information of functioning heart. The heart produces four sounds for each cardiac cycle. However, most often only two sounds appear essential: S1: corresponding to the beginning of ventricular systole is due to the closure of atrioventricular valves.
This sound is composed of two internal components: the mitral component (M1) associated with the closure of the mitral valve, and the tricuspid component (T1) associated with the closing of the tricuspid valve [1]and S2: marking the end of ventricular systole and signifying the beginning of diastole, is made up of two main components: the aorticcomponent (A2) corresponding to the closure of the aortic valve, and the pulmonary component (P2), corresponding to the closure of the pulmonary valve [2]. Two other sounds: S3 and S4, with lower amplitude than S1 or S2 [3], appear occasionally in the cardiac cycle by the effect of disease or age.
In auscultation, the listener tries to analyze the heart sound components separately and then synthesize the heard features.Heart sound analysis by auscultation highly depends on the skills and experience of the listener [4].
Therefore the recording of heart sounds and analyzing them by a computerized and objective way would be most desirable. Several techniques had been used to analysis the PCG signal components. Before any analysis, the PCG signal needs to be segmented into components (sounds or murmurs), and then the components are analyzed separately. The oldest ones are based on the Fourier Transform (FT), which produces an average spectrum over time. This is can be suitable for signals whose statistical properties are invariant over time "stationary".
The physiological signals spectral content; such as the PCG cases; evolves with time. Consequently, the techniques of temporal averaging amplitudes are incapable to describe transients and no stationary events [5]. As a result, time-frequency approaches have been proposed. Indeed, the Short-term Fourier transform (STFT) is one of the oldest methods that are used to analysis biomedical signal. Unfortunately, it may not allow good resolution in time andfrequencysimultaneously [6]. Other techniques such as wavelet transform are proposed. In the next section, a detailed description of this technique will be done.

Materials and Methods
In this paper the denoising by wavelet transform (DWT) will be used in the analysis of various signals PCG. Several statistical parameters are deduced from the results of applying the wavelet transform which can give more in the understanding of cardiac activity and at the same provide a valuable aid to clinicians [7].
The wavelet transform is based on the use of special function called mother transform. This special function will be undergoing to a translation and contraction or dilatation operations to give a set of functions called wavelets. These functions are a constant shape but variable size. When the studied signal is analyzed by wavelets, a set of coefficients are obtained. Those coefficients represent the correlation between the wavelet and the studied signal. They are given by equation Where, a represents the scale and b the translation coefficient. The wavelet transform (WT), applies a multi-resolution analysis on the signal studied. This analysis might be called time-scale, uses a wide range of scales to analyze the signal. When the a and b factor are continuous, the wavelet transform is a continuous wavelet transform (CWT) (equation 2). The CWT is used when no reconstruction of the original signal from the obtained coefficients is needed. By contrary, when the original signal is needed to be reconstructed, a discretization of the a and b factors must be done. The obtained wavelet is named the discrete wavelet transform (DWT). The discretization can be done by equation 3 In fact, the wavelet transform is also interpreted as a process of filtering the signal analyzed by a pair of low and high pass filters with variable bandwidth.

Denoising by wavelet
Our aim with thisdenoisingis to extractthe heart sounds (S1 and S2) of murmursthat are consideredin this stage as the noise.
The modelconsidered for thedenoisingis classic, the measured signal x is an additive mixture of signal informations and a measurement noise r: Denoising by thresholding the wavelet coefficients, as déffini in [8], is to extract a coherentstructure of the measured signal. The assumptionthat the noiserconsidersas notconsistent witha database ofpredefinedwaveform, that is to say notcorrelatedwith thesewaveforms.The coefficients ofthe decompositionof noise onthe base is low, this gives the possibility to remove them easily.
The most commonly used algorithm is the decomposition of a discrete wavelet orthonormal basis of Mallat [7]:simple decomposition and reconstruction exact, the value of a projectionon an orthonormal basis is the factthatpermits conservation of energy from one representation to another.After thedecomposition of the signal on this basis, thesegmentsless correlatedwith the baseof the coefficientsarelow, andthey are attributedto noise.Asuitablethreshold, we can separate the noise (incoherent part), signal (coherent part).

Figure 2: The diagram of wavelet denoising (Thresholding)
In the literature, there are two types of thresholding: hard thresholding and the soft thresholding. [11] The first proposesthe can collation of all values below athreshold T, the higher values are unchanged.
(w j,k : Coefficients of the decomposition of the signal x).
The second methodoperatesin addition tothe cancellation, a subtractionof the threshold valuesremaining above the threshold, to reduce the number ofdiscontinuities in thedenoised signal.
The threshold T can be calculated in different ways. The method chosen in our algorithm was developed by Donoho and Johnstone [12], known by the universal thresholding.
Before applying a wavelet denoising, we must consider some parameters, such as the type of wavelet used, the decomposition level selected and the type of thresholding. Messer and al [10] proved that the universals thresholding give very satisfactory results.

The choice of the mother wavelet
The wavelet transform (WT) remains most appropriate for analysis of heart sounds (normal and pathological).This technique has shown its effectiveness in time-frequency analysis, which is due to its analysis window size adaptive and flexible allowing it to have a good time resolute on for high frequency components and good frequency resolution for lowfrequency components [6-13-14].
The analysis of PCG signals using wavelet transforms has shown that it is important to find out the appropriate wavelet. The study carried out on different types of orthogonal and bio-orthogonal wavelet at different levels using the standard deviation, and the error of rebuilding as a discrimination parameter has shown that the daubechies wavelet of the seventh level :db7 can be used in PCG signal analysis. In fact its morphology and duration are highly correlated to the different sounds in the PCG [15-16-17-18].

The decomposition level selected and the type thresholding
Messer and al. [8], found that the 10th level of decomposition is the best for denoising PCG signals sampled by 44:1 kHz, where they used the daubechies wavelet of the seventh level: db7.Moreover, they proved that the universal soft thresholding gives very satisfactory results.
The sampling frequency of the PCG signal has a great influence on the appropriate decomposition level for denoising.
To show the influence of sampling frequency on the optimal decomposition level. The following figure ( Figure.3-5) presents a PCG signal generated on two different sampling frequencies.
In the first case ( Figure.4), the optimal denoising is successful in the fifth level, beyond this level the signal begins to distort. For the second case ( Figure.5), the ideal denoising appears from the seventh level; however, few traces remain of murmurs.
Indeed the decrease in signal distortion relative to the increase in sampling rate can be explained as follows: Actually increase the sampling rate is an improvement in signal resolution: the number of samples will be higher and the sound quality will be better. of samples is quite sufficient for the resolution is still good; therefore, the signals are reconstructed slightly deformed. However, the high number of samples makes the process of denoising worse. In our work, and in order to have a good filtering, we chose 8000 Hz as the sampling frequency for all PCG signals that will be addressed. Changing the sampling frequency is performed by software sound processing (WAVEdit) The proposed approach to separate the components of the PCG signal, also based on the detection the envelope of the temporal energy of the heart sounds. Indeed the temporal lobes of the energy of the PCG signal are correlated with intracardiac events. Energy Shannon can better represent the oscillations of small amplitude, not just large amplitude oscillation. [19]

Study of Energy
In the literature, various approaches can be found to extract the envelope E (t). One such approach is an analytical method based on Hilbert transform. However, there are other methods to extract the envelope as the calculation of the square of the signal or absolute the Value [Eq. (7)- (8)].
The square of the samples of a given signal [Eq. (7)] makes it possible to evaluate its energy in the temporal field. However, and as illustrated in Figure. 10)] proves the median approach, making it possible to generate a representation that takes account of the physiological attenuation of heart sounds as well as artifacts of large amplitude while recording the PCG signal.


The square of energy:  Absolute value of the energy: Shannon entropy : (9)  Shannon Energy: (10)

Figure 6: Temporal energy representation of the signal s (t).
The PCG signal energy representations [ Figures. 7(b, c, d and e)] highlight the interest of the Shannon energy. According to these figures, we can see that only the Shannon entropy and the Shannon energy can absorb the magnitude of oscillations of high intensity as well as those in low amplitudes. The shape of the curve of the Shannon energy promotes weak oscillations, which will give energy representations that take into account the unit of the heart sounds and heart murmurs.
Indeed, as illustrated in Figures. 7 (b, c, d and e), we can see the value of the Shannon energy [ Figure. 7(e)] compared to the other methods used. The Shannon energy places more emphasis on oscillations of low amplitude while also representing those of high amplitude. Thus, the Shannon energy is used in PCG segmentation.

Detection of the Envelope of the Energy Signal
The algorithm of separation depends primarily on the detection of the envelope of Shannon energy for the identification of the beginnings and ends of the cardiac sounds S1 and S2. This envelope detection extracted by applying a low-pass filter, with a cut-off frequency f0 of 20Hz chosen empirically. This filtering is reinforced by an algorithm to remove low energies below 90% of max.

The proposed algorithm
The aim of this section is to develop an algorithm for heart sound and heart murmur location and separation, and to measure the various time  Valvular heart diseases induce considerable changes on the morphology of the phonocardiogram signal. These changes can be seen as a change in duration, amplitude or the frequency content of sound S1 and S2 or systolic and diastolic murmurs.These parameters must be calculatedin a precise mannerto allowa proper assessmentof severity. Therefore, the segmentation of the PCG signal appears important to facilitate this task.
The proposed algorithm is based on envelope detection PCG signal. This latter may give us much information about the signal, how it can help us separate the sound S1 and S2 and the different murmurs. For this, severalapproaches can be used, among them the energy envelope detection.
Several algorithms based on envelope energy detection have been proposed [20-21-22].These approaches are effective in cases where the power of sound S1 and S2 is much higher than the murmurs, but they quickly find their limit when the power of murmur is almost the same or higher than the sound. Therefore, applying the discrete wavelet decomposition in our algorithm is very important to solve this problem. In fact, as the frequency content of murmurs is more important than those sounds, DWT can be separated easily by technique of the denoising by thresholding (wavelet denoising).
6. Treatment of sounds and murmur, such as measurement: the duration of heart sounds and murmur, cardiac cycle (s), Heart rate (bmp) and energy (joule).
All these parameters will be considered to analyze the PCG signals.

a. Separation algorithm
Due to the complexity of the phonocardiogram signal, our algorithm ( Figure.9) consists of a supervised manner: the user must adjust some parameters to achieve optimal segmentation (threshold, decomposition level …).The choice of threshold is very important in order to have interesting results.The duration of the heart sounds or heart murmurs may change if the choice ofthreshold is not taken into account (see Figure.  13). The choice of threshold is alsoimportant for detection of the heart murmurs. Thus, for each heart murmur or click, one chooses a precise threshold.After normalization of the PCG signal the user has the choice to perform discrete wavelet decomposition (DWT). This passage is necessary if the murmurs present a high intensity (Figure.10). The frequency content of murmurs is more important than those sounds, for that, the DWT can be used as a filtering means relatively simple and very effective to remove high frequency components. The sampling frequency of PCG signals is given by the following table.
Since the optimal denoising appeared in the fifth level of decomposition, there constructed signal in this level is used in the detection and identification of different sounds. The Shannon energy envelope is used in this detection. The algorithm of segmentation was applied here for the separation of the heart sounds S1 and S2 of various PCG signals (using the first part of the proposed algorithm).This identification of heart sounds is based essentially on detection of different peaks of the envelope. This is done by applying a threshold set manually.
It is known beforehand that the duration of systole is shorter than that of the diastole. Based on this reality, the identification of sound S1 and S2 can be performed.
The detection of the first and the second heart sound (S1, S2) can be done using the following conditions: In fact, in this step the energy envelope of Shannon ( figure: 11. (a)) can be a very effective parameter not only in identifying sounds S1 and S2 peaks ( figure: 11. (b)), but also in the detection of the beginning and end of the each heart sound.  Figure.14 Insulation of heart sound. (a) PCG signal: N (normal). (b) Energy envelope with a threshold of 90% for the maximum value. (c) Heart sounds S1 and S2 (d) Heart sound S1. (e) Heart sound S2.

Figure.15 Insulation of heart sound. (a) PCG signal: SG (summation gallop). (b) Energy envelope with a threshold of 70% for the maximum value. (c) Heart sounds S1 and S2
(d) Heart sound S1. (e) Heart sound S2.

Detection of heart murmurs and clicks
After the detection and identification of different heart sounds clicks and murmurs analysis becomes easier. It requires detection of the side minima of each peak of the energy envelope. For that, a threshold value is chosen. The murmurs and click separation is done with a same procedure applied to separate the first and the second heart sound. Figure.16 Insulation of heart murmurs. (a) PCG signal (DR,Drum Rumble). (b) Energy envelope with a threshold of 90% for the maximum value. (c) Heart sounds S1 and S2 and heart murmurs. (d) Heart sound S1 and heart murmurs. (e) Energy envelope with a threshold of 90% for the maximum value. (f) Diastolic murmurs. After applying our algorithm on different PCG signals, the results are very satisfactory. This shows the power of the approaches used in the detection of sound S1 and S2and extraction of murmurs. However, this algorithm is limited by the very complex cases, where the sounds are completely immersed in the murmurs. Figure.18(a ,b)  For facing this problem, we will use thecontinuous wavelet transform (CWT) to provide a graphical extraction of murmur. The latter has proven to be the best approach may well represent the time and frequency components of a signal. Figure 19: Time frequency analysis by using the continuous wavelet transforms. Table 1 gives the results of this segmentation of four PCG signals, Normal (N), Summation Gallop (SG) Drum Rumble (DR) and Aortic Stenosis (AS). Based on these results, it may be observed that the duration of the first heart sound S1 is longer than the duration of the second heart sound S2; the algorithm of separation thus gives satisfactory results. The systole phase is of shorter duration compared to the diastole phase. Thus we find that the cardiac cycle length and the energy, varies with the presence and type of heart murmur.

PCG signals
Duration of heart sound (s)  Table I. Summary of the average durations of heart sounds S1 and S2, heart murmurs, the cardiac cycle and energy for various PCG signals (N, normal; SG, summation gallop; AS, aortic stenosis ; Drum Rumble (DR)).

Conclusion
For the diagnosis of heart sounds and heart murmurs, heart segmentation should be done. This document present an algorithm for segmenting the phonocardiogram signal based on wavelet denoising.
This allowed us to locate the sound S1and S2, and to extract the different systolic and diastolic murmurs.
The results are very satisfactory; this is equivalent to the power tools used in our algorithm, such that the energy envelope of Shannon, denoising by thresholding.
The choice of threshold is important so as to have interesting results; the duration measure of heart sounds or heart murmurs may change if the choice of threshold is not taken into consideration.Compared with the work carried out by other authors, our algorithm is able to not only separate the fundamental heart sounds S1 and S2, but also separate heart clicks or murmurs. Thus we can easily extract the features of each component of the PCG signal.

Compliance with Ethical Standards
This study was not funded by any party: it is an academic PhD study

No conflict of interest
No animal or other used in this study