Mathematical Morphology and the Heart Signals

*Taouli Sidi Ahmed*

### **Abstract**

Nowadays, signal processing is integrated into most systems for analyzing and interpreting ECG and PCG signals. Its objectives are multiple and mainly include compensating for the addition of artifacts to the signals of interest, and extracting information that is not visible by direct visual analysis. Considering that useful clinical information is found in the characteristic waves of the ECG, in particular, the P wave, the QRS complex, the T wave and the heart sounds of the PCG signal. These signals provide important indicators for the diagnosis of heart disease because they reflect physiological processes. These are non-stationary signals that are very sensitive to noise, hence the need to have optimal conditions to record them. It is necessary to use appropriate signal processing tools for noise suppression and wave detection of the ECG signal. Our method uses Morphological filtering, multi-scale morphological and the other by top-hat transform, which are based on mathematical morphology. The latter is based on mathematical operators called opening and closing morphology operators. These methods are also tested, with the aim of removing the noise and detection of the waves of the ECG signal and of the pathological sounds of the PCG signal.

**Keywords:** ECG signal, PCG signal, morphological filtering, multi-scale morphological, top-hat transform

### **1. Introduction**

In the Western world, the leading cause of death is cardiovascular diseases. Even if the knowledge acquired in cardiology is great, the heart has not yet revealed all its secrets. However, doctors have many ways to study and verify its proper functioning. In particular, they use cardiac signals, the electrocardiogram (ECG) and the phonocardiogram (PCG) which are an important tools in the diagnosis of cardiac pathologies.

The ECG is the signal reflecting the recording of the bioelectrical activities of the cardiac system. It is rich in information on the functional aspects of the heart and the cardiovascular system.

The electrocardiogram includes three important waves called the P wave, complex QRS and T wave which translate respectively the atrial activity, the ventricular

activity and ventricular repolarization. From these waves are determined intervals known by the PR interval which defines the atrioventricular conduction time, the ST segment which corresponds to the ventricular repolarization phase, a phase during which the ventricular cells are all depolarized, and the RR interval which indicates the cardiac period, i.e. the time between two successive beats. Inverting it, we get then the heart rate commonly expressed in beats per minute.

The QT interval reflects all ventricular activity, i.e. phases of depolarization and repolarization. The time intervals between these different ECG waves provide important indicators for the diagnosis of heart disease because they reflect physiological processes of the heart and autonomic nervous system [1–3].

The analysis of these different intervals often involves the study of their variability.

At the level of the PCG signal, this signal produces two noises (S1 and S2) during the opening and closing of the valves under normal conditions. Two other noises (S3 and S4) with significantly lower amplitudes than the first two sometimes appear at the level of the cardiac cycle due to the effect of pathology or age [4].

The S1 sound occurs just after the onset of systole and is preferentially due to the closure of the atrioventricular valves. The S2 sound is produced at the beginning of diastole and is due to the closure of the aortic and pulmonary valves. However, doctors use heart auscultation to hear two normal sounds S1 and S2 using a medical instrument called a stethoscope. Also, cardiac synchronization can simultaneously gives the two physiological signals ECG and PCG, such that the S1 noise appears at the end of the R peak and the S2 noise at the end of the ECG segment, as for the S3 and S4 noises, they originate respectively at the end of the P wave and in the middle of the diastolic phase of the electrocardiogram (**Figure 1**).

Generally, the recording conditions of the ECG and PCG make that the signals are necessarily noisy by processes other than cardiac. These artifacts can be of physiological origin (skin, muscle, breathing … ) or environmental (mains current, electromagnetic artifacts, placement of the electrode … ).

The practitioner who analyses the ECG can then be discomfort by the presence of noise: in the case where, for example, he looks for the existence of a normal sinus rhythm and he is looking for the presence of the P wave preceding the R wave, the P wave, which is of low amplitude, can be drowned in noise. In the same way, a strong variation of the base line can prevent discerning an anomaly of the over- or undershift type of the S-T segment, for example. To be able effectively segment heartbeats without altering clinical information, a certain number of pre-treatments are necessary. The purpose of this step is attenuate, or at by eliminates noises present in the raw ECG signal such as baseline variations or sector the interference at 50 Hz. Also, the

**Figure 1.** *Synchronization between ECG and PCG signal.*

#### *Mathematical Morphology and the Heart Signals DOI: http://dx.doi.org/10.5772/intechopen.104113*

doctor finds it difficult to listen to the S1 and S2 heart sounds due to the presence of heart murmurs and this prevents the doctor from diagnosing the patient.

These heart murmurs are an additional noise; it was produced by a turbulent circulation of blood toward the heart. In fact the objective is to filter the nonstationary ECG and PCG signals and the extraction useful clinical information is found in the time intervals defined by the ECG waves characteristic, including the P wave, QRS complex, T wave, PR interval, ST segment, and interval QT, the defined time intervals between two characteristics ECG waves provide important indicators for the diagnosis of heart disease because they reflect physiological processes.

However, it is clear that to achieve this study, it is essential to perform a preprocessing of the ECG and PCG signals in order to then detect the different waves of the ECG signal.

In this article the morphological transform is used to remove noise and to detect the characteristics of the ECG and PCG signal.

This transformation uses mathematical morphology to realize, in particular the morphological filtering and the top hat transform. Mathematical morphology, based on set operations, provides an approach to developing nonlinear signal processing methods in which the shape of a signal's information is incorporated [5]. In these operations, the result of one set of data transformed by another set depends on the shapes of the two sets involved. A structuring element must be designed according to the shape characteristics of the signal that must be extracted. There are two basic morphological operators: erosion and dilation. Opening and closing are derived operators defined in terms of erosion and dilation [6].

Dilation reduces the peaks in a signal and to widen the valleys, erosion fills in the valleys and thickens the peaks in the signal; opening removes the peaks but preserves the valleys, and closing fills in the valleys, removes the wells (or valleys). The "closing" and "opening" operators behave like filters; we will speak of "Morphological Filter" [7].

An important number of researches work using different tools and methods of noise filtering have been presented in the literature. The methods often based on classical linear high-pass filtering, low-pass or band-pass [8–10], linear adaptive filtering [11], filtering based on neural networks [12–15], have been proposed to eliminate noise affecting the line of basis of the ECG signal. The major disadvantage of these methods is the distortion of the signal due to the overlapping of the spectra of the ECG, PCG and their noises. On the other hand, a large number of methods have been proposed for the detection of ECG signal waves [12–20]. The majority of these methods are based on adaptive filtering or thresholding, which shows the limitation of the application. The emergence of treatment method in the non-stationary case has helped the researchers to develop new tools better suited to filtering. Techniques based on the wavelet theory have already proved their worth for the filtering of noise from the ECG signal. Donoho and Johnston proposed a denoising method by thresholding of wavelet [21, 22]. The denoising method by wavelet thresholding was treated the wavelet coefficients by a threshold which must be chosen in advance. Approaches for estimate the value of this threshold can be found in [23, 24].

In this chapter, the pre-processing is realized in two stages, a stage of the correction of the line base by Morphological filtering and the top-hat transform for remove noises that are based on mathematical operators called derivation operators opening and closing morphology. Followed by the second step which is consisted of detecting the waves of the ECG signal and the cardiac murmurs of the PCG signal by morphology operators and a multi-scale structuring element.
