Quick viewing(Text Mode)

Phonocardiogram Segmentation

Phonocardiogram Segmentation

UNIVERSITY OF HAWAII LIBRARY SEGMENTATION

A THESIS SUBMITTED TO THE GRADUATE DIVISION OF THE UNIVERSITY OF HAWAI'I IN PARTIAL FULFILLMENT OF THE REQUIREMENTS FOR THE DEGREE OF

MASTER OF

IN

ELECTRICAL ENGINEERING

December 2005

By TangChuLin

Thesis Committee: Todd Reed, Chairperson N.,Thomas Gaarder Anders Host-Madsen We certify that we have read this thesis and that, in our opinion, it is satisfactory in scope

and quality as a thesis for the degree of Master of Science in Electrical Engmeering.

11

I Qlll I .H3 no. 4028 THESIS COMMITTEE

Chairperson

ii Acknowledgement

I thank the committee members, Dr. Gaarder and Dr. Host-Madsen for all their support

and guidance for the past two years. I am deeply indebted to my advisor Dr. Reed for his L. excellent technical mentoring and support in steering my career path. Much thanks to my

Orincon friends for all their support and being so flexible with my schedule. I thank my

professors at Loyola Marymount - Dr. Page and Dr. Marino - for believing in me and

encouraging me to pursue a Graduate degree. Last be not least, I would like to thank my

family - Mom, Dad (Shawn), Ryan, Bu - and Jon. They have been with me at every step,

providing support, and encouragement.

111 Abstract

Heart (the interpretation of sounds) is the primary tool used in screening patients for heart . While advanced techniques such as electrocardiograms exist, they are costly and not available in many developing countries. Heart auscultation is a subjective skill that can takes years of experience to master. Unfortunately, despite the number of patients and years of experience, it is documented that primary care have poor auscultatory skills [10]. This work analyzes heart sound recordings known as phonocardiograms (PCG) uSing Wavelets and Principle Component Analysis (PCA). The primary goal is to segment key cardiac events in a heart sound signal. It is hoped that the results can be used in conjunction with other algorithms to provide a tool in heart auscultatory training and aid in automated heart diagnosis systems.

IV Table of Contents

ABSTRACT ...... IV

LIST OF TABLES ...... VIII

LIST OF FIGURES ...... IX

1 INTRODUCTION ...... 1

2 CARDIAC ANATOMY ...... 5

2.1 The ...... 5

2.2 The Primary ...... 7 2.2.1 Heart Sound Frequency Spectrum ...... 9 2.2.2 Other Heart Sound Components ...... 9

3 THEORY ...... 10

3.1 Fourier Transform ...... 10

3.2 Short Time Fourier Transform...... 12

3.3 Wavelet Analysis ...... 16 3.3.1 Continuous Wavelet Transform ...... 16 3.3.2 Discrete Wavelet Transform ...... 18 3.3.3 Wavelet Synthesis ...... 25

3.4 Principle Component Analysis ...... 28 3.4.1 Discussion and Properties of PC A ...... 29

4 PHONOCARDIOGRAM SEGMENTATION ...... 31

4.1 Segmentation Modules ...... 33 4.1.1 Decimation ...... 33

v 4.1.2 Wavelet Decomposition ...... 48 4.1.2.1 The "Mother" Wavelet ...... 48 4.1.2.2 Heart Sound Wavelet Decomposition ...... 50 4.1.2.3 Heart Sound Wavelet Synthesis ...... 60 4.1.3 Finding Feature Signals ...... 70 4.1.3.1 Finding the right PCs ...... 74 4.1.3.2 Summary of PCA Analyses ...... 77 4.1.4 Envelogram ...... 81 4.1.4.1 Primary Components ...... 81 4.1.4.2 "Other" Components ...... 87

5 RESULTS ...... 89

5.1 Performance Analysis: Sl and S2 Identification ...... 89

5.2 Performance Analysis: Component Boundaries ...... 90 5.2.1 Normal Heart Sound ...... 90 5.2.2 Diastolic Atrial Gallop ...... 91 5.2.3 Split S2 ...... 93 5.2.4 Early Aortic ...... 95 5.2.5 Ejection Click ...... 97 5.2.6 Late Systolic ...... 99 5.2.7 Pan-Systolic ...... 101 5.2.8 Systolic Mitral Prolapse ...... 103

5.3 Performance Analysis Summary ...... 106

6 CONCLUSION AND FUTURE WORK ...... 112

7 APPENDiX ...... 113

7.1 Main Function ...... ~ ...... 113

7.2 Wavelet Decomposition, Reconstruction, PCA ...... 113

7.3 Primary Component Segmentation ...... 115

7.4 "Other" Segmentation ...... 118

vi 7.S Primary Component Labeling ...... 120

8 REFERENCES ...... 126

vii List of Tables

TABLE 1: DETAIL LEVEL FREQUENCY BAND 23 TABLE 2: WAVELET DECOMPOSITION INFORMATION TABLE 50 TABLE 3: SUMMARY OF WAVELET DECOMPOSITION ANALYSIS 59 TABLE 4: ENERGY CAPTURED BY PRINCIPLE COMPONENTS 72 TABLE 5: PRINCIPLE COMPONENT ENERGY DISTRIBUTION FOR EARLY AORTIC STENOSIS 74 TABLE 6: COMPONENT ENERGY DISTRIBUTION FOR PAN SYSTOLIC 75 TABLE 7: SUMMARY OF ENERGY DISTRffiUTION THROUGH PRINCIPLE COMPONENTS 77 TABLE 8: STATISTICS OF IDENTIFICATION RESULTS 90 TABLE 9: COMPARISON OF THE DIFFERENT PARAMETERS 108

VIII List of Figures

FIGURE 2-1: THE HUMAN HEART [24] ...... 6 FIGURE 2-2: NORMAL HEART BEAT CyCLES ...... 7 FIGURE 3-1: NORMAL HEART SOUND SIGNAL AND ITS POWER SPECTRAL DENSITY ...... 12 FIGURE 3-2: SHORT-TIME FOURIER TRANSFORM METHOD [25] ...... I3 FIGURE 3-3: NORMAL HEART SOUND SIGNAL ...... 14 FIGURE 3-4: SHORT-TIME FOURIER TRANSFORM ...... 15 FIGURE 3-5: SIGNAL REPRESENTATION METHODS [23] ...... 16 FIGURE 3-6: WAVELET TRANSFORM CALCULATION [23] ...... 18 FIGURE 3-7: WAVELET FREQUENCY BAND COVERAGE ...... 19 FIGURE 3-8: IMPLEMENTATION OF DISCRETE WAVELET TRANSFORM ...... 20 FIGURE 3-9: WAVELET DECOMPOSITION USING A FILTER BANK ...... 22 FIGURE 3-10: NORMAL HEART SOUND SIGNAL (TOP), DWT COEFFICIENTS (BOTTOM) ...... 23 FIGURE 3-11: NORMAL HEART SOUND SIGNAL (BLACK), FILTERED NORMAL HEART SOUND SIGNAL (RED) ...... 25 FIGURE 3-12: ONE LEVEL DECOMPOSITION AND RECONSTRUCTION ...... 26 FIGURE 3-13: MODIFIED DECOMPOSITION COEFFICIENTS ...... 27 FIGURE 3-14: RECONSTRUCTION OF THE NORMAL HEART SOUND SIGNAL USING LEVEL 5 DETAILS ...... 28 FIGURE 4-1 : SEGMENTATION ALGORITHM ...... 32 FIGURE 4-2: NORMAL HEART SOUND SIGNAL (TOP), FREQUENCY SPECTRUM (MIDDLE AND BOTTOM) ...... 34 FIGURE 4-3: DIASTOLIC ATRIAL GALLOP SOUND SIGNAL (TOP), FREQUENCY SPECTRUM (MIDDLE AND BOTTOM) ...... 35 FIGURE 4-4 DIASTOLIC VENTRICULAR GALLOPS3 SOUND SIGNAL (TOP), FREQUENCY SPECTRUM (MIDDLE AND BOTTOM) ...... 36 FIGURE 4-5 SYSTOLIC MITRAL PROLAPSE SOUND SIGNAL (TOP), FREQUENCY SPECTRUM (MIDDLE AND BOTTOM) ...... 37 FIGURE 4-6 EARLY AORTIC STENOSIS SOUND SIGNAL (TOP), FREQUENCY SPECTRUM (MIDDLE AND BOTTOM) ...... 38 FIGURE 4-7: PAN SYSTOLIC SOUND SIGNAL (TOP), FREQUENCY SPECTRUM (MIDDLE AND BOTTOM) ...... 39 FIGURE 4-8: EJECTION CLICK SOUND SIGNAL (TOP), FREQUENCY SPECTRUM (MIDDLE AND BOTTOM) ...... 40

ix FIGURE 4-9: S3 SOUND SIGNAL (TOP), FREQUENCY SPECTRUM (MIDDLE AND BOTTOM) ,..... "".41 FIGURE 4-10: S4 SOUND SIGNAL (TOP), FREQUENCY SPECTRUM (MIDDLE AND BOTTOM) """ ..42 FIGURE 4-11: NORMAL SOUND SIGNAL (TOP), FREQUENCY SPECTRUM (BOTTOM) """""""""" ..43 FIGURE 4-12: DIASTOLIC ATRIAL GALLOP SOUND SIGNAL (TOP), FREQUENCY SPECTRUM

(BOTTOM)"""""""""""""""""""""""".""""""""""""""""""""""""""""""""""""""""""""""" ..44 FIGURE 4-13: DIASTOLIC VENTRICULAR GALLOP S3 SOUND SIGNAL (TOP), FREQUENCY

SPECTRUM (BOTTOM)""""""""""""""""""""""""""""""""""""""".,,,,,.,,,,,,"""""""""""""""..44 FIGURE 4-14: SYSTOLIC MITRAL PROLAPSE SOUND SIGNAL (TOP), FREQUENCY SPECTRUM

(BOTTOM)"""""""""""""""""""""""""""""""""""""""""""""""""""""""".""""""""""""""" ..45 FIGURE 4-15 EARLY AORTIC STENOSIS SOUND SIGNAL (TOP), FREQUENCY SPECTRUM

(BOTTOM)"."""""""""""""""""""""""""""""""""."""""""""".:"""""""""."""""""".""""."""..45 FIGURE 4-16: PAN SYSTOLIC SOUND SIGNAL (TOP), FREQUENCY SPECTRUM (BOTTOM)""."".,46 FIGURE 4-17: EJECTION CLICK SOUND SIGNAL (TOP), FREQUENCY SPECTRUM (BOTTOM)""",46 FIGURE 4-18: S, SOUND SIGNAL (TOP), FREQUENCY SPECTRUM BOTTOM) """""."""."""""""".,47 FIGURE 4-19: S4 SOUND SIGNAL (TOP), FREQUENCY SPECTRUM (BOTTOM)""""".""""""""""".,47 FIGURE 4-20: DBI5 WAVELET FUNCTION ".""""""""""""""""""."""""""""""""""".""""""""""" ..49 FIGURE 4-21: DBI5 SCALING FUNCTION .""""""""" ...... """""""""."""""""""" .. """""""""""""".",,49 FIGURE 4-22: DBI5 LOWPASS FILTER """"""" .. """ .... " .. """""""".""""""""" .. " .. """""."."""" .. """".49 FIGURE 4-23: DBI5 HIGHPASS FILTER""""""" .. """" .. " .. "" .. """""." .. """"""""" .. """"""""""""""".,,49 FIGURE 4-24: NORMAL HEART SOUND SIGNAL (TOP), WAVELET DECOMPOSITION (BOTTOM) 52 FIGURE 4-25: NORMAL WAVELET DECOMPOSITION COEFFICIENTS AT LEVELS 1,2,3,4,5""",,53 FIGURE 4-26: EARLY AORTIC STENOSIS SIGNAL (TOP), WAVELET DECOMPOSITION (BOTTOM)

""""""""""""""""""""""""""""""""""""""""""""""""""""".""""""""""""""""."""""""."".",,55 FIGURE 4-27: EARLY AORTIC STENOSIS WAVELET DECOMPOSITION COEFFICIENTS AT LEVELS 2, 3, AND 4"""""""" .""""""" ""."""" """.""" """"""" .. """""""" """. """""""""""""""""""""""".56 FIGURE 4-28: PAN SYSTOLIC SIGNAL (TOP), WAVELET DECOMPOSITION (BOTTOM) """"""""" 57 FIGURE 4-29: PAN SYSTOLIC WAVELET DECOMPOSITION COEFFICIENTS AT LEVELS 2, 3, 4, 5.58 FIGURE 4-30: RECONSTRUCTION LOWPASS FILTER " .. """""""""""."""".".""" .. """"""""""""""".61 FIGURE 4-31: RECONSTRUCTION HIGHP ASS FILTER """"""""""""""."""""""""""""""""""""""" 61 FIGURE 4-32: NORMAL HEART SOUND MODIFIED WAVELET COEFFICIENTS"""""""""""""""".63 FIGURE 4-33: NORMAL HEART SOUND SIGNAL RECONSTRUCTIONS """"""""""""""""""""".",,64 FIGURE 4-34: NORMAL HEART SOUND OBSERVA TIONS""""""""""""""""""""""""""""""""""".65 FIGURE 4-35: NORMAL HEART SOUND OBSERVATIONS TIME EXPANDED""""""""""""."""""".66 FIGURE 4-36: EARLY AORTIC STENOSIS FEATURE SET """""""""""""""""".""""""""""""""""".68 FIGURE 4-37: PAN SYSTOLIC FEATURE SET """""""""""""""""""""""""""""""""""""""""""""".69 FIGURE 4-38: NORMAL HEART SOUND SIGNAL AND ITS PROJECTION ONTO PCS """""""""""". 73

x FIGURE 4-39: PROJECTION ON PRINCIPLE COMPONENTS FOR EARLY AORTIC STENOSIS ...... 75 FIGURE 4-40: PROJECTION ON PRINCIPLE COMPONENTS FOR PAN SYSTOLIC ...... 76 FIGURE 4-41: PAN SYSTOLIC PCG SIGNAL ...... 79 FIGURE 4-42: PROJECTION ONTO PRINCIPLE COMPONENTS OF PAN SYSTOLIC ...... 80 FIGURE 4-43: ENERGY CALCULATION COMPARISON ...... 83 FIGURE 4-44: ENVELOGRAMS OF COMPONENT FEATURE SIGNAL Zl (BLUE) AND Z, (RED) ...... 86 FIGURE 5-1: SEGMENTATION OF NORMAL HEART SOUND BY HAND (TOP), AUTOMATED (BOTTOM) ...... 91 FIGURE 5-2: SEGMENTATION OF DIASTOLIC ATRIAL GALLOP SOUND BY HAND (TOP), AUTOMATED (BOTTOM) ...... 92 FIGURE 5-3: AVERAGE SHANNON ENERGY OF FIRST FEATURE SIGNAL AND FIRST THRESHOLD

...... ~ ...... 93 FIGURE 5-4: SEGMENTATION OF SPLIT S, SOUND BY HAND (TOP), AUTOMATED (BOTTOM) .... 94 FIGURE 5-5: SEGMENTATION OF "OTHER" COMPONENTS IN SPLIT S2 ...... 95 FIGURE 5-6: SEGMENTATION OF EARLY AORTIC STENOSIS SOUND BY HAND (TOP), AUTOMATED (BOTTOM) ...... 96 FIGURE 5-7: SEGMENTATION OF "OTHER" COMPONENTS IN EARLY AORTIC STENOSIS ...... 97 FIGURE 5-8: SEGMENTATION OF EJECTION CLICK SOUND BY HAND (TOP), AUTOMATED (BOTTOM) ...... 98 FIGURE 5-9: SEGMENTATION OF "OTHER" COMPONENTS IN EJECTION CLICK ...... 99 FIGURE 5-10: SEGMENTATION OF LATE SYSTOLIC SOUND BY HAND (TOP), AUTOMATED (BOTTOM) ...... 100 FIGURE 5-11: SEGMENTATION OF "OTHER" COMPONENTS IN LATE SYSTOLIC ...... 101 FIGURE 5-12: SEGMENTATION OF PAN SYSTOLIC SOUND BY HAND (TOP), AUTOMATED (BOTTOM) ...... 102 FIGURE 5-13: SEGMENTATION OF "OTHER" COMPONENTS IN PAN SYSTOLIC ...... 103 FIGURE 5-14: SEGMENTATION OF SYSTOLIC MITRAL PROLAPSE SOUND BY HAND (TOP), AUTOMATED (BOTTOM) ...... 104 FIGURE 5-15: TIME EXPANDED SEGMENTATION BY HAND OF MITRAL PROLAPSE ...... 105 FIGURE 5-16: SEGMENTATION OF "OTHER" COMPONENTS IN SYSTOLIC MITRAL PROLAPSE. 105 FIGURE 5-17: HISTOGRAM OF ONSET ERROR ...... 106 FIGURE 5-18: HISTOGRAM OF TERMINATION ERROR ...... 107

FIGURE 5-19: HISTOGRAM OF ONSET ERROR (N=40, "t~8) ...... 109

FIGURE 5-20: HISTOGRAM OF TERMINATION ERROR (N=40, "t~8) ...... 109

FIGURE 5-21: HISTOGRAM OF ONSET ERROR (N~30, "t~8) ...... 110

FIGURE 5-22: HISTOGRAM OF TERMINATION ERROR (N~30, "t~8) ...... 110

Xl FIGURE 5-23: HISTOGRAM OF ONSET ERROR (N=40, 't~ 10) ...... III

FIGURE 5-24: HISTOGRAM OF TERMINATION ERROR (N=40, 't~1O) ...... 111

XIl 1 Introduction

Heart auscultation (the interpretation of heart sounds by a ) is a fundamental tool in cardiac diagnosis. Unfortunately, research has demonstrated poor auscultation skills among physicians with correct diagnosis rates to be as low 20% [10]. This results in unnecessary referrals to cardiologists, which is both costly and stressful. It has also been shown that auscultation .skills do not improve significantly with repeated application of standard training methods. Clearly, there is a need for diagnostic aids in this area, both for training and for clinical use. The first step in developing such a system is the segmentation of the heart sound into diagnostically relevant components. This is a challenging task, both due to the highly nonstationary nature of heart sounds and to the immense variability seen between patients (and even with a single patient over time).

Heart sound signals have been studied through various methods. A method for segmenting heart sound components proposed by H. Liang, S Lukkarinen, and 1. Hammo [5] provides a good basis for understanding the structure and characteristics of PCG signals. The algorithm development is based on the envelogram (envelope of the energy) of the PCG signal. It showed promising results, however, failed in the presence of high level interfering signals, such as large murmurs and/or ambient noise. Their work demonstrated that a simple envelograrn method is feasible under ideal conditions. To account for the complicated cases, different approaches have been considered.

Many have explored the application of the Short-Time Fourier Transform (STFT) as a way to account for the nonstationarity of the signal. A. Djebbari and F. Bereksi [3] showed that the STFT provided only acceptable results due to the trade-off between time and

1 frequency resolution. In addition, the fixed windowing function used in their work is incapable of adapting to different sets of data (e.g. exhibiting different heart rates).

Modeling methods are members of a broad class of techniques which promise to provide better estimates of spectral features. Parametric methods, such as the Burg and Marple algorithm [1], are common for the analysis and classification ofphonocardiograms. B. Ergen and Y. Tatar [1] investigated the resolution of the spectrum derived from modeling phonocardiograms. They showed that the application of a high order statistical autoregressive (AR-HOS) method produced a more accurate and higher resolution spectrum when compared to autoregressive (AR) modeling using linear prediction. A similar study done by M. Shen and L. Sun [18] investigated the application of a non-Gaussian AR model of PCG signals. Both efforts concluded that employing higher-order spectra for modeling

PCG signals is essential for extracting relevant features.

An interesting perspective on peG signals is obtained through relating the physiology of the heart and the sounds that are heard. 8ince the various sounds in a heart cycle are produced by different sources, one approach treats the components in the heart sounds independently via an algorithm based .on Independent Component Analysis (ICA). It was shown that while the sources are independent, the 8 I and 82 could not be completely separated [22]. Traces of the other component were present in each result, mainly due to the saturation of the 8 I and 82, and reverberations produced in the cavity.

Time-Frequency methods are probably the most widely used techniques for analyzing

PCG signals. As discussed in "Application of the matching pursuit method for structural decomposition and averaging of phonocardiographic signals," [17] many segmentation algorithms for locating key events in a PCG signal require the use of Electrocardiogram

(ECG) as a reference signal. In most cases, these algorithms provided accurate results.

2 However, they require storage and analysis of an extra signal (EeG). H. Sava, P. Pibarot,

and L. Durand presented a method that is solely based on the peG signal [17]. The method

utilizes the matching pursuit (MP) algorithm, which decomposes the PCG signal into waveforms selected from a dictionary of time-frequency atoms. Through the MP method, the repetitive structures in the PCG signal are extracted, giving accurate results in the detection of the onset of each cardiac cycle. However, the boundaries of key events within the heart cycle were not evaluated.

Many recent and ongoing studies ofPCG signals are extensively exploiting the relatively

new concept of Wavelets. The uses of Wavelet theory in analyzing peG signals range from

basic signal analysis, feature extraction, detection of specific events, classification,

and component segmentation. J. Lee compared the advantages of using the Wavelet transform as oppose to traditional techniques (i.e. the Fourier Transform) in analyzing

signals. It was shown that the resolution using Wavelet analysis is enhanced; pennitting the detection of key features [7] that cannot be identified using the Fourier Transform. In the

class of Wavelet transforms, there are numerous possible basis functions generated from

several mother wavelets. The choice of the mother wavelet depends on the type of analysis

and the structure of signal. Several wavelets with nice properties such as orthogonality have

been previously developed. M.A.R. Santos and M. Souza set out to detennine the most

appropriate classical wavelet for analyzing peG signals. They proposed that the most

suitable wavelet is one which presents a greater energy concentration in the smallest number

of coefficients. With this criterion, they found that the following wavelets are optimal:

Daubechies (4 to 19), Meyer, and Morlet [16]. Through these wavelets, the majority of the

energy is captured by four detail levels. S. Omran employed Wavelet analysis in developing a heart sound segmentation and pathology classification algorithm [13]. The heart sound

3 components are segmented using the envelogram calculated from the reconstructions of selected detail levels. Features are then extracted and used to train a Neural Network for classification. An identical component segmentation approach using Wavelets was proposed by L. Huiying, L. Sakari, and H. liro. They also selected decomposition levels, three to be exact, and performed Wavelet synthesis [6]. The normalized Shannon energy was calculated and used to segment key components. The results are promising, however the approach, fails in cases with high level interfering noise and/or when murmurs are present in the selected synthesized signals.

Thus far, previous studies employing Wavelet analysis required hand picked detail levels and disregarded all other coefficients. lt has been shown that for most cases, this provides accurate results. However, for conditions with relatively higher noise energy, the component boundaries are imprecise.

In this work, a robust segmentation algorithm capable of identifying key cardiac events under a broad range of conditions is developed. A method which is capable of selecting detail coefficients based on the statistics of a given PCG signal rather than relying on the presumption of cardiac component bandwidths is used for segmenting key events. The pres~nted segmentation algorithm defines and identifies the boundaries of the two primary components in a heart sound signal, S[ and S2. In addition, segmentation of other key events in the heart sound signal such as murmurs, splits, and clicks are provided. In the following chapter, cardiac anatomy and characteristics of heart sounds are described briefly to provide the foundation for understanding PCG signals. In preparation for the discussion on the algorithm development in Chapter 4, the background information and properties of the theories employed will be examined in Chapter 3. Application of various theories using PCG signals are shown where appropriate. Results demonstrating the success of the algorithm will

4 be provided in Chapter 5. Finally, the shortcomings and possible enhancements of the algorithm will be addressed.

2 Cardiac Anatomy

To develop a successful algorithm "for heart sound signal segmentation, it is essential to understand both the origins of the sounds and their characteristics from a mathematical standpoint. This chapter will encompass the information required to understand PCG signals from a medical and mathematical perspective.

2.1 The Cardiac Cycle

The heart is a muscle which pumps to circulate through the . There are four chambers in the heart for blood storage, see Figure 2-1. The two upper chambers are known as the left and right atria. Correspondingly, the lower chambers are called the left and right ventricles. Blood flow is transferred through four valves.

The cardiac cycle begins when the upper chambers (left and right atria) receive blood from the body. When the upper chambers are filled, both atria contract simultaneously to eject blood into the lower chambers (left and right ). The transfer of blood flow between the right and right ventricle is controlled by the tricuspid valve illustrated in

Figure 2-1. In the same way, the regulates the blood to pass from the left atrium to the left ventricle. Once blood fills up in the lower chambers, both ventricles contract to force blood out. The transfers the blood from the right ventricle to the

5 for oxygen. The opens to accept the oxygen-rich blood from the left ventricle into the which delivers the blood to the rest of the body. The sequence of events is repeated, regulating blood flow in the human body. One nOllnal complete cardiac cycle can be considered as a two step process, the contraction of the atria followed by the contraction ofthe ventricles.

S u perior Vena Cava Aorta

Rignt Atrium

Tne&apld VII' ....

Inferior VeneC8va

Figure 2-1: The Human Heart [241

6 2.2 The Primary Heart Sounds

Eacb cardiac cycle consists of transferring blood through four valves; tbe Tricuspid,

Mitral, Pulmonary, and Aortic. The closures of the valves are believed to be major contributors of the beart sounds [II]. The "Lup-Dupp" description of heart sounds demonstrates the two primary components in a heart sound signal. The "Lup" is known in the medical community as the SI and the "Dupp" is called the S2. The phonocardiogram of a

Normal heart sound signal, shown in Figure 2-2, consists of two primary components, SI and

S2. The fi rst heart sound, S 1, starts at the beginning of ventricular contraction and continues through the systolic period. The second heart sound, S2, bappens during ventricular relaxation, the diastolic period.

Amplitude I 1 I ,• I • 1

Time

I • • , I I Ventricular Ventricular • I Filling Filling • • • • • • • I I I Diastole Systole I Diastole I Systole

Figure 2-2: Normal Heart Beat Cycles

7 The onset of ventricular contraction causes the tricuspid and mitral valves to shut in order to prevent blood back flow. The sounds produced from the closure of the valves generate the first heart sound, S]. The S] consists of four sequential events [II). First, there is small low frequency vibration which is typically inaudible. Following that is a large high frequency vibration which is easily audible and is associated with the mitral valve closure.

This is followed by a· second high frequency component associated with the tricuspid valve closure. Finally, there are small vibrations in the conclusion of the first heart sound.

Typically, the four events within Sl cannot be distinguished and are recognized as a single sound.

When the lower chambers empty, the ventricles begin to relax and the aortic and pulmonary valves close. The closure of the two valves produces the second heart sound, S2.

Since the heart is divided into a "right side" and a "left side," the inconsistent timing of the two valve closures may be audible. In a normal heart, the right ventricular ejection precedes the left and has a longer duration. In other words, the pulmonary valve closes before the aortic valve, and when audible it is known as "split S2." The ability to distinguish these two components, A2 and P2 depends on the width of the split which varies during inhalation and exhalation [15). If the components are so close together that they cannot be distinguished it is known as a "single S2."

In a normal heart, it takes approximately twice as long to empty the blood out of the ventricles than filling them. This is the reason that the diastolic period is approximately twice as long as the systolic period. It is evident in Figure 2-2 that there is a longer pause between S2 and S] than the pause between Sj and S2. This fact is vital in terms of signal processing as it provides a method to identify components based on elapsed time.

8 There are two other components, S3 and S4, which are both caused by the sound of blood entering the chambers of the heart. Typically, SJ and S4 can only be heard with amplification.

The SJ is associated with the rapid filling of the ventricle and when present occurs shortly after S2. The S4 is associated with the late diastolic filling and occurs shortly before S, when it is audible. An audible S3 is often associated with an innocent munnur in children and young adults but should not be heard after age 35. An audible S4 is always considered abnonnal.

2.2.1 Heart Sound Frequency Spectrum

The frequency spectrum of the first heart sound, S" contains peaks in a low frequency range from 10·50 Hertz and a medium frequency range from 50-140 Hertz. The frequency spectrum of S2 contains peaks in three different ranges. There is a low frequency range from

10-80 Hertz, a medium frequency range from 80-200 Hertz, and a high frequency range from

220-400 Hertz [14]. The frequency band where the majority power of S, and S2 resides varies across different heart cycles. Therefore, it is not possible to eliminate noise in all samples using a fixed frequency band filter.

2.2.2 Other Heart Sound Components

One of the main challenges in heart sound segmentation is due to the presence of munnurs. Munnurs are blowing, whooshing, or rasping sounds caused by the vibrations of turbulent blood flow patterns. A munnur is described based on the phase of the heartbeat

9 when it is audible. Ejection munnurs have notable start and end points while Regurgitation munnurs fill the entire phase. 8 ystolic munnurs indicate that the munnur is between the first and second heart sound. Correspondingly, Diastolic murmurs occur between the 82 and 8 1.

Murmurs can have higher frequency contents than the normal heart sound components.

Murmurs may contain frequencies up to 600 Hertz [14].

3 Theory

Different classes of methods have been explored in the development of heart sound segmentation algorithms. In this work, an extension of time-frequency based methods will be investigated. In order to develop a successful heart sound segmentation algorithm using time-frequency techniques, it is necessary to examine the theory behind the techniques. This chapter will cover the background information required in the development of the segmentation algorithm. First, the fundamental method of signal analysis known as the

Fourier Transform (FT) will be discussed. Thereafter, extensions of the Fourier Transform, namely the 8hort-Time Fourier Transform and Wavelet Analysis will be detailed.

3.1 Fourier Transform

In the 19th century, Fourier showed that practically all periodic functions can be expressed as the sum of weighted sinusoids. This discovery changed the way mathematicians viewed functions, and the very well known method in signal analysis,

10 Fourier transfonn resulted. The Fourier transfonn breaks down a signal into constituent sinusoids of different frequencies. This characterization takes a function described in the time domain and transfonns it, presenting infonnation about its frequency contents. The relationship between the time and frequency domain expressions for a signal, s(t), is described by the following pair of equations.

(3.1 )

s(t) = - 1 fS(OJ)e J01. dOJ (3.2 ) 27r

This pair of equations is called the Fourier transfonn pair. Figure 3-1 is a plot of a'Nonnal heart sound signal and the magnitude of its Fourier Transfonn, called the power spectral density (PSD). The power spectral density reveals that the range of frequencies in the

Nonnal heart sound signal ranges from approximately 10-500 Hz. The transfonn provides the frequency infonnation, but loses time infonnation. Fourier analysis can only provide us with infonnation about what frequencies exist in the signal, but not when they occur. Heart sound signals contain numerous transitory events. These characteristics, such as abrupt changes, beginning and ending of events, and trends are crucial in the segmentation of key cardiac events which cannot be detected using Fourier analysis.

11 Amplitude

o .,

o .0 5 - , , 0 I-JI~ ~, r~ :i'l'iW.- . i!II'.I\~t , .0 .OS I -0 .1

-0 .1 5 -

_ 0 .2 o ., , , , 2 2 . , 3 , , 0 • Magnitude Time (seconds) o .1 6

o .1 ..

o .1 2

o . , -

o .0 8

o .0 6 , a . a 4 o .0 2 11 0 500 1 000 1 500 2 a 0 a 2 5 0 0 3 0 a 0 3 .5 0 0 4 0 a 0 FreQuency (Hz)

Figure 3-1: Normal heart sound signal and its power spectral density

3.2 Short Time Fourier Transform

To overcome the limitation of the Fourier transform, it can be modified by introducing a sliding window function. The revised transform maps a signal into a two-dimensional function of time and frequency. A finite segment of the signal is assumed to be stationary and analyzed using the Fourier transform. The STFT of a signal, s(t) , is calculated using the following equation.

12 S(T, OJ) = jS(t). W(t - T)e - JOX dt (3.3 )

The analyzing window function, w(t) , is of fixed width. The center of the window function

slides along the signal time axis byZ; and modulates the analyzing signal. This procedure is

demonstrated in Figure 3-2. The frequency content of the modulated signal is determined using the Fourier transfonn.

S(t)

W (t-'t)

't

S(t)w(t-'t)

Figure 3-2: Short-Time Fourier Transform Method [25]

The STFT provides infonnation about both the frequency contents of the windowed

signal and the locations of the centers of the windows. The task of selecting a proper

analysis window is application dependent. Notice that in equation 3.3, if the width of the

window is too small events may not be captured within the window, which will result in poor

frequency resolution. On the other hand, if the window width is too large, time resolution is

13 reduced. This predicament is known as the Heisenberg Uncertainty Principle. Simply stated, it is impossible to know the spectra! components at each instance in time. The Nonna! heart sound signal shown in Figure 3-3 is used to demonstrate the Heisenberg Uncertainty

Principle. The analysis window chosen is a Gaussian function of the fOIUI

(3.4 ) where b is proportional to the width of the window.

0 .6

0 .4

0 .2

o

· 0 .2

-0 .4

-0 .6

500 1000 1500 2000 2500 3000 3500 4000 4500 Samples

Figure 3-3: Normal heart sound signal

14 Figure 3-4: Short-Time Fourier Transform

As illustrated in Figure 3-4, for narrow windows, the frequency resolution is poor while the time resolution is good. As the window becomes wider, the effect reverses. The art of detelIIlining the best window to provide an acceptable resolution in both domains is signal dependent. For this reason, segmentation algorithms based on the STFT are very fragile and generally not suitable for automated methods.

15 3.3 Wavelet Analysis

Like the STFT, the Wavelet transform provides a time localized representation of the

signal. While the STFT is limited to a fixed resolution for all frequencies (a time-frequency representation), the Wavelet transform employs a windowing technique that is of variable width (a time-scale representation). The width variability allows for different' frequency resolutions within the representation. In this section, Wavelet analysis is introduced in the

continuous time domain. Subsequently, the Discrete Wavelet transform and the implementation of wavelet analysis for this study are examined.

3.3.1 Continuous Wavelet Transform

Thus far, four methods of signal representation have been discussed. The comparison of the various forms of signal representation is best illustrated through Figure 3-5.

u>- "0'" c .€ CD -e.. 0- E e « L1.. Time Amplitude Time Domain (Shannon) Frequency Domain (Fourier)

u>- c '" '":::> IB !if Ul ~ L1.. Time Time STFT (Gabor) Wavelet Analysis

Figure 3-5: Sigual Representation Methods [23)

16 The methods for studying signals as shown in Figure 3-5, provides different but valuable information about a signal. However, for the application of segmenting nonstationary signals, Wavelet Analysis offers the best representation, since it provides different frequency resolutions for each segment of time. As indicated in Figure 3-5, a wide window is used for low frequencies and narrow windows are used for high frequencies. This type of representation provides high temporal resolution for high frequencies and high frequency resolution for low frequencies providing a good method for analyzing signals that is composed of high frequency components of short duration and low frequency components oflong duration, which is the exact characteristics a of heart sound signal.

A wavelet is a waveform that is of finite duration and oscillates with an average value of zero. Recall that the Fourier transform breaks up a signal using sinusoids. Wavelet analysis is similar in the sense that it also breaks up the signal, but it is done using versions of a waveform called the mother wavelet, IJI(t}. A family of wavelets is created by translating

(shift) and scaling (dilating or compressing) the mother wavelet. The continuous wavelet transform, given in equation 3.5, represents a signal using two variables, time and scale.

c(r, a) = /IJ1 fs(t)· ~t-r}- t (3.5 ) vial a

The scale parameter, a, is inversely proportional to the frequency, defined as

1 a=- (3.6 ) f where/is the is the center frequency of the wavelet function in Hertz.

17 ----

I The factor in equation 3.5 nOllllalizes the energy across the different scales. The vfaI

calculation of the wavelet transfonn coefficients is realized in three steps, shown in Figure

3-6. Scaling either dilates or compresses the wavelet. Large scales dilate the wavelet and

highlight the slowly changing activity in the signal. Small scales compress the wavelet and

reveal the transient characteristics of the signal. The translation parameter, "t, defines the

location of the wavelet as it shifts along the signal and thus, represents the time infollIlation.

EI ~~and ·

• • • • • • s.g .. , ~ • • • • •

-to •• , ...

Figure 3-6: Wavelet Transform Calculation [231

3.3.2 Discrete Wavelet Transform

The CWT measures the similarity between the wavelet and the signal by continuously

shifting and scaling the mother wavelet providing a time-scale representation. Hence, an

infinite number of wavelets are required. This procedure is insightful but produces highly

redundant infOimation and is hence impractical.

18 From a signal processing perspective, equation 3.5, can be viewed as the convolution of the signal with a wavelet function. Hence, the wavelet transform can be realized using linear filters. Since compression in the time domain corresponds to stretching and shifting a function's speCtrum, each wavelet is equivalent to a bandpass filter. Thus, the wavelet family, a series of scaled wavelets, can be formed using a series of filters. When the dilation of a wavelet is only considered for powers of two, it is known as dyadic. For the dyadic case, a time compression by a factor of 2 stretches the frequency spectrum of the wavelet by a

factor of 2 and also shifts the frequency components by a factor of 2. Accordingly, each wavelet covers a distinct range of frequencies with a bandwidth reduction at each step as

shown in Figure 3-7. An infinite number of wavelets are required to cover the entire

spectrum in order to account for DC (0 Hz). To solve this problem, a scaling function is introduced which has a lowpass spectrum covering the frequency range centered at DC. The combination of the scaling functions and wavelets can thus cover the entire range of a signal's spectrum. ax x \

Fre

Figure 3-7: Wavelet Frequency Band Coverage

The Discrete Wavelet Transform (DWT) yields a fast computation of the Wavelet transform through a series of filters. The DWT is realized through successive lowpass and

19 - - - _.

highpass filtering of the discrete time signal, s[nl. Figure 3-8 is an example illustrating a

three-level wavelet decomposition.

d,~] H .J..2 S[n] d, [n] H .J..2 L .J..2 ~[n] a, [nJ H .l.2 L .J..2 a,[n] -I L .J..2 - a3[n] Level I Level 2 Level 3

Figure 3-8: Lmplementation of Discrete Wavelet Transform

From Figure 3-8, it is easy to see that the DWT effectively decomposes the signal into

different frequency bands by passing the original signal through a filter bank. The half band

lowpass filters denoted by L, corresponds to the scaling function and extracts the lower half

of the frequencies. This reduces the signal resolution, amount of infonnation in the signal,

by half. According to the Nyquist theorem, the output from the filter can by subsampled by a

factor of two without losing infolluation. Similarly, the half band highpass filter corresponds

to the wavelets and contains the detail, high frequency, infolll1ation of the signal. One level

of the decomposition can be expressed by the following equations.

Yh[k] = L s[n] · h[2k - n] (3.7) n

20 yl[kj= Ls[nj.I[2k-nj (3.8 ) n

where Yh[nj and yzlnj are the subsampled (by 2) outputs of the highpass and lowpass filters,

respectively. At every decomposition level, the filtering and subsampling results in half the number of samples and through successive levels, the entire discrete time signal can be

expressed solely in terms of the detail and approximation coefficients. This process is

illustrated through Figure 3-9, where s[ n j is the original discrete time signal sampled at a rate

of ft (samples/sec) , h[n) and len) are the highpass and lowpass filters, respectively. The

bandwidth at each decomposition level is denoted on the figure by "f."

21 SCt)

Sampler fs I r f = {O-fs/2}

I[n] h[n]

f= {O-fsl4} f = {fsl4-fsl2}

-1..2 al[n] "- ./ d l [n]

I[n] h[n] f = {O-fsI8 } f = {fsl8-fs /4}

-1..2 -1..2 ~ [ n] "- ./ d:z[n]

I[ n] h[n]

f = {O-fslI6} f = {fS/16-fs/8}

-1..2 a3[n] "- -I..~ d3[n] •••

Figure 3-9: Wavelet Decomposition Using a Filter Bank

As shown in the figure, the result of the DWT will contain the same number of coefficients as the original signal. The strongest frequency components in the original signal will produce high amplitudes in the coefficient vectors corresponding to basis functions that encompass those frequencies. Similarly, the frequencies which are not prominent in the original signal will lead to low amplitude coefficients. Using this approach, the temporal resolution is good at high frequencies while the frequency resolution becomes good at low

22 frequencies. Figure 3-10 is an example illustrating the decomposition of a Nonnal heart sound signal sampled at 1225 Hz using eight detail levels. The bandwidth covered by each detail level is li sted in Table I.

Amplitude

o . 6

0 . 4

o . 2

o

-0 . 2

- 0 . 4

- 0 . 6

o 0 . 5 1 1 . 5 2

1. 5

- 0 . 5

• 1

D5 D3 D2 D1 500 1 000 I 5 0 0 2000 Samples

Figure 3-10: Normal Heart Sound Signal (fop), DWT coefficients (Bottom)

Table 1: Detail Level Frequency Band

Detail Level Frequency Range (Hz)

23 01 334-668

02 167-334

03 83-167

04 42-83

05 21-42

06 10-21

07 5-10

08 2.5-5

The coefficients of the details, 03, 04, and 05 in Figure 3-10 have the highest amplitudes in the set. Thus, for this particular phonocardiogram, the significant frequencies are in the range of f = {21-167} Hz. The amplitudes in the frequency range of 334-668 Hz,

corresponding to 01, are very low. This suggests that frequencies in the range of {334-668}

Hz are faint in the original signal and may be omitted without a major loss of information.

This is demonstrated through Figure 3-11. The original signal is shown in black. The

filtered signal using a bandpass filters with cutoff frequencies at 334 Hz and 668 Hz is shown

in red. The difference is minor, and the activity of the entire signal is still well represented.

24 0 . 6

o . 4

o . 2

o

- 0 . 2

· 0 . "

- 0 . 6

o 0 . 2 0 .' 0 .' •• 1 1 . 2 1 . 4 1.

Figure 3-11: Normal Heart Sound Signal (Black), Filtered Normal Heart Sound Signal

(Red)

3.3.3 Wavelet Synthesis

In many applications, it is desired to modify the wavelet coefficients and reconstruct the signal for further analysis. The decomposition of a signal using filters involves two steps, filtering and downsampling. The reconstruction (synthesis) of the signal is detellnined using the inverse and similarly involves two steps, upsampling and filtering. A one level decomposition and reconstruction is shown in Figure 3-12.

25 lowyass downsample lowyass upsample LoD- ' 2 LoR- t 2 s s HiD- ' 2 HiR- t2 highyass downsample highyass upsample

Decomposition Reconstruction

Figure 3-12: One Level Decomposition and Reconstruction

Reconstruction for multi-level decomposition is done in a similar manner, by successively passing the coefficients through a series oflowpass and highpass filters and upsampling.

In order to obtain perfect reconstruction, the two equations must be satisfied:

1 F;(z)L(z)+ Fh (z)H(z) = 2z- (3.9 )

F;(z)L( -z)+ F;, (z)H( -z) = 0 (3.10 ) where L(z) is the decomposition lowpass filter,

H(z) is the decomposition highpass filter,

Flz) is the reconstruction lowpass filter,

Fh(z) is the reconstruction highpass filter.

The first equation ensures that the reconstructed signal is not distorted in amplitude. The second equation implies that the reconstruction filter must cancel out the aliasing introduced by the subsampling operators.

26 It is also possible to reconstruct only selected details using the corresponding coefficient vectors. As an example, consider the decomposition of the NOlmal heart sound signal given in the previous section. Suppose it is desired to reconstruct the details at level 5. This can be obtained through the same process used to reconstruct the original signal. The difference is that instead of combining the coefficient vector D5 with all the other level coefficients, the other level coefficients are forced to zero. The modified set of coefficients and the reconstruction of the details at level 5 of the NOImal heart sound signal are shown in Figure

3-13 and Figure 3-14, respectively.

1 .5

1 H

0 . 5 -

H-

-0 .5 -

- 1 -

05 D4 D3 0 2 01 ·1 .5 1 30'00

Figure 3-13: Modified Decomposition Coefficients

27 Am litude

o ,3 r ,., , .,

, I~, , A \i\ 1\1' V V I" -~ -0 .1 1IIIIi ~ "~~ - _0 .2 f-

_0 .3 '" 1 0 0 0 1 5 0 0 2 0 0 0 2 5 0 0 Samples

Figure 3-14: Reconstruction ofthe Normal heart sound signal using LevelS details

This reconstructed signal is a true constituent of the original signal. It can be thought of as the components in the signal which are in the frequency range defined by the level, which is

21-42 Hz (Table 2) in this case. The reconstruction using the coefficient vector of each detail

level provides the best temporal resolution representation of the signal for each sub-band.

3.4 Principle Component Analysis

Principle Component Analysis (PCA) is a method for analyzing data sets of high dimension, revealing patterns and highlighting the similarities and differences. Although

peA can be used for various types of analysis, in this section the emphasis will be on data reduction and feature extraction.

In data sets with many variables, frequently more than one variable is measuring the same driving force. Principle Component Analysis generates a new set of variables called

28 principle components (PC). Each principle component is a linear combination of the original variables. The purpose is to remove the redundancy of information and replace a group of variables which measures the same information with a single new variable (PC). The

calculation of the principle components is essentially equivalent to performing the Singular

Eigenvalue Decomposition (SVD) on the data set, X. The process in outlined below.

1. Calculate the covariance matrix of the data set, X of dimension m x n. Here, the

rows denote the variable, and the columns are the observations for each variable.

2. Calculate the eigenvalues, A.; {i=l, ... , m} ofthe covariance matrix.

3. Calculate the corresponding eigenvectors, V;, {i=l, ... , m}.

4. Form the principle components and principle eigenvalues. This is done by ordering

the eigenvalues in descending order and similarly ordering the eigenvectors based

on the eigenvalues, also in descending order.

A=diag(al, ... , am), where al > ... > am

PC = [PCl ... PCm),

where PCi is the eigenvector that corresponds to the eigenvalue ai.

3.4.1 Discussion and Properties of peA

There are an infinite number of ways to determine an orthogonal basis for a particular set

of data. However, as listed below, properties of PCA provide great benefits for feature

extraction problems. The properties of the PCA are listed below to facilitate the discussion

on the benefits this method proyides.

29 1. Each principal component is a linear combination of the original variables.

2. All the principal components are orthogonal to each other so ~ere is no redundant

infonnation.

3. The principal components as a whole fonn an orthogonal basis for the space of the

data.

Each principle eigenvalue measures the amount of infonnation captured in the direction of the corresponding eigenvector. The first principle component is a single axis and when the data is projected onto this axis, the variance is maximal among all possible choices. The second principal component is another axis which is perpendicular to the first. The variance in this direction is the maximum among all possible choices of this second axis. Subsequent principle components are determined in the same manner. In this sense, the original data set is transfonned so that it is expressed in tenns of the patterns between the variables. The transfonnationlprojection can be expressed mathematically using the following equation.

y=pcTx (3.11 )

where

X is the original data set,

Y is the transfonned data set.

30 4 Phonocardiogram Segmentation

Segmentation algorithms based on time-frequency methods typically use pnon infonnation such as the bandwidth of the primary components, SI and S2, in the development of the algorithms. Heart sound signals are highly nonstationary and the frequency structure of heart cycles can vary within a single heart sound. Moreover, munnurs often consist of the same frequency contents as those of the SI and S2. In many cases, munnurs overlap the primary components making segmentation of the components a difficult task. For these reasons, the algorithms often produce poor results for complicated . However, it is the challenging heart sound signals that really need to be analyzed.

In this section, a segmentation algorithm is developed based on statistical analysis providing a robust algorithm which does not rely on the bandwidth of SI and S2. The segmentation algorithm presented here is based on techniques combining Wavelet analysis,

Principle Component Analysis (PCA), and Envelo'grams (envelope of energy calculation).

The Wavelet transfonn decomposes the heart sound into eight feature signals. Each one corresponds to passing the original PCG signal through a bandpass filter. Principle component analysis is perfonned on the set of filtered signals to obtain the best representation for key events in the heart sound. The segmentation of the S 1 and S2 are based on the envelogram calculated using the representative signals. The process is illustrated in

Figure 4-1.

31 " Dowu-sa!llp Ie ! " - Wavelet· Decomposition

Dl 02 03 04 05 06 D7 08

! J ! ! ! , ! ! Wavelet . Wavelet Wavelet Wavelet Wavelet . Wavelet Wavelet Wavelet Synthesis lSynthesis Synfuesis , Synthesis Synthesis Synthesis, Synthesis Synfuesis I I I . I I I

Principle+ Component Analysis I ~ ~ ~ Projection Projection Projection l"PC 2nd PC mlhpC ~ 1 1 Primary Primary ~'Other" Components Components Components 1 1 1 .. . Envelogram EnveJogram EnveJogram 1 l ~ Energy Energy Energy Detection Detection Detection I I t SI and S2 ''Other'' Segmentation Segmentation

Figure 4-1: Segmentation Algorithm

32 4.1 Segmentation Modules

The subsequent sections detail the modules of the segmentation algorithm. First, the

wavelet decomposition of phonocardiograms is investigated. In preparation for determining

the feature signals for key events, the wavelet coefficients at each detail level are used to

synthesize the signal. The set of reconstructed signals provides a feature set for the original

heart sound signal. Principle component analysis is performed to extract feature signals for key cardiac events. Finally, the procedure for segmenting key events in heart sound signals

is discussed.

4.1.1 Decimation

The phonocardiographic signals used in this study were sampled at 11025 Hz.

Studies have shown that the sounds associated with valve closures and turbulence of blood

flow (murmurs) are composed of frequencies in the range of 10-600 Hz (refer to section 2.3).

The following figures validate the studies. In each figure, the phonocardiogram is shown on

the top. The power spectral density with the magnitude normalized to its maximum value is

shown in the middle figure. The bottom figure is the normalized spectrum with the

frequency axis expanded to provide a better visualization of the frequency contents.

33 Amplitude__ ~_ ~ __~~_~ _~ __~ __~ __~ __~

06

04

02

o

-0 2

-04

-06

_OB L-____~ ____~ ____~ ____~ __~ ~----~~~~----~----" o 05 1 15 2 25 3 Time (seconds) Amplitude 1 ------r------r------~------,_------~--~

0 .9 OB

07

06

05

0.4

03

02

01

o , 000 2000 3000 4000 5000 Frequency (Hz) Amplitude

1 ~- --~----~---,_---_r---~----

09 OB

07

06

05

0.4

03

02

01

100 Frequency (Hz)

Figure 4-2: Normal Heart Sound Signal (top), Frequency Spectrum (middle and

bottom)

34 Amplitude

05

04

03

02

0'

-0 ,

-02

-03

-0 4

, 4 4 Time (seconds) Amplitude '~------~ __ ------'------~------~------r----, 09

08

0 .7

0 .6

0 .5

04

03

02 o ,

Frequency (Hz) Amplitude

, ~- --_----_---_----r---_-----, 09

08

0 .7

0 .6

0 . 5

04

03

02 o. ,

o '00 2 0 0 300 4 00 500 600 Frequency (H z)

Figure 4-3: Diastolic Atrial Gallop Sound Signal (top), Frequency Spectrum (middle

and bottom)

35 Amplitude --- 0 6

04

02

0 -

-04

-0 6

o 1 2 3 4 5 Time (seconds) Amplitude 1 ------__------~------_.------~------__----

09

06

0 .7

06

0 .5

04

0 .3

02

0 . 1

o 3000 4000 Frequency (Hz) Amplitude

1 - --~---~----~---~---~----

09

06

0 .7

06

0 .5

04

0 .3

02

o 1

o Frequency (Hz)

Figure 4-4 Diastolic Ventricular GallopS3 Sound Signal (top), Frequency Spectrum

(middle and bottom)

36 Amplitude

03 02 01

o

-0 1

-0 2

-0 3

0 05 1 15 2 25 3 35 4 5 Time (seco nd s) Amplitude 1 09 08 07 06 05 04 03 02 01

o 1000 2000 3000 4000 5000 Amplitude Frequency (Hz)

1 ---,---,------,------.------.r------r------09 08 07 06 05 04 03 02 01

o 100 2~equency

Figure 4-5 Systolic Mitral Prolapse Sound Signal (top), Frequency Spectrum (middle

and bottom)

37 Amplitude

-~--

06

04

02

o

-02

-0 4

-0 6

1 5 2 25 3 3 .5 4 4 .5 Time (second s) Amplitude 1 ------~------~------~------~------r_---

09

08

07

06

0 .5

04

03

0 .2

01

o 1000 2000 3000 4000 5000 Frequency (Hz) Amplitude 1,--y--____------__------__------__------__------

09

08

07

0 .6

0 .5

04

03

0.2

0,

Frequency (Hz)

Figure 4-6 Early Aortic Stenosis Sound Signal (top), Frequency Spectrum (middle and

bottom)

38 Amplitude --- 06

04

02

o

_02

-04

-06 o , Time (second s) Amplitude , ------~------~------~------~------~---. 0 _9

08 07

06

05 0 4

03

02

0'

o 1000 2000 3000 4000 5000 Amplitude Frequency (Hz) , ~- ---~------~------~------~------.------09

08

07

06 05

0 4

03

02 o ,

600 Frequency (Hz)

Figure 4-7: Pan Systolic Sound Signal (top), Frequency Spectrum (middle and bottom)

39 Amplitud ::-e_~_~_ ~_~ _~_ ~_~ _~~_--,

06

04

02

o

-02

-04

-06

T ime (second s) Amplitude 1~------~------~------~------~------~----, 09

08

07

0 .6

0 .5

04

03

02

o 1

o 1000 2000 "",000 5000 Amplitude Frequency (H z)

1r--.'---~------~------~------~------~------,

09

08

0 .7

06

05

0 4

03

02

o 1

Frequency (Hz)

Figure 4-8: Ejection Click Sound Signal (top), Frequency Spectrum (middle and

bottom)

40 Amplitude

06 ,------~- ~-~-,----~-,~-~ ~-~cr------,

04

02

o

-02

-04

0 05 , '5 5 5 45 Time (seconds) Amplitud, e

09 08

07 06 05

04 03

02

0 '

Frequency (H z) Amplitude

, ,------~--~---~---~--~---, 09 08 0 7 06

05 04 03

02

0 '

o , 0 0 200 300 400 500 600 Frequency (Hz)

Figure 4-9: S3 Sound Signal (top), Frequency Spectrum (middle and bottom)

41 Amplitude

06

04

02

o

-02

-0.4

-06

Time (seconds) Amp litude , ------,------~------~------~--~ 09

06

07

06 05

04

0 3

02 o ,

Ampl itude Frequency (Hz)

, --- --~---~---~------~------, 09

08

07 OB 05 04

0 .3

0 .2 o ,

300 400 500 BOO Frequency (Hz)

Figure 4-10: S4 Sound Signal (top), Frequency Spectrum (middle and bottom)

42 As illustrated in the figures, the important events in a heart sound consist of frequencies below 600Hz. This fact pemlits the decimation of the heart sound signals without losing the important key events in a heart sound signal. All the phonocardograhic signals were decimated by a factor of nine in Matlab. Matlab employs an eighth-order lowpass

Chebyshev for decimation and filters the signal in both the forward and reverse directions to remove phase distortion. The following figures show the decimated signals and its corresponding nOlillalized frequency spectrum.

Amplitude

------.----~

02 o

- 0 2

. 0

Time (seconds) Amplitude . --~------., 0" 08 07

0"'

O ~ 03 02 o.

Frequency (Hz)

Figure 4-11: Normal Sound Signal (top), Frequency Spectrum (bottom)

43 Amplitude • •

03 02 o , o _0' _0 2

_ 0 ~

T ime (seconds) Amplitude , ------, 00

08 07 00

03

o ,

Frequency (Hz)

Figure 4-12: Diastolic Atrial Gallop Sound Signal (top), Frequency Spectrum (bottom)

Amplitude ,-----,------,---.---,------,------

02 o J--

_0 2

Time (seconds) Amplitude , r--,-----~------. ------.------.,

00 07 oe

o. 03 02

Frequency (Hz)

Figure 4-13: Diastolic Ventricular Gallop S3 Sonnd Signal (top), Frequency Spectrum

(bottom)

44 Amplitude

~~--

_0 ,

Time (seconds) Amplitude

, ~~~~--~------OQ 08 07 oe 05

03 0" 0 '

'V (Hz)

Figure 4-14: Systolic Mitral Prolapse Sound Signal (top), Frequency Spectrum (bottom)

Amplitude

nn

o

_De

A mpli,t ude

OQ OR 07

00

03 02

0 ' ency (Hz)

Figure 4-15 Early Aortic Stenosis Sound Signal (top), Frequency Spectrum (bottom)

45 Amplitude

0"

02

o

02

0"

AmPli!U:.::d -=-e ~_~ ____T _im_ e_(_sec_ o_nd_S_) ______~

00 08 07 0 .. 06 0<

03

0 ,

Frequency (Hz)

Figure 4-16: Pan Systolic Sound Signal (top), Frequency Spectrum (bottom)

Amplitude

00

02

o

_0 2

_0" ~- Time (seconds) Amplitude , OD 08 07 08

0< 03 02 0 ,

Frequency (Hz)

Figure 4-17: Ejection Click Sound Signal (top), Frequency Spectrum (bottom)

46 Amplitude

0&,------,--.-~ ------,---r---

02

o

_02

_0 ~

Time (seconds) Amplitude ,r--n----~------OQ 08 07 08

03 02 o ,

Frequency (Hz)

Figure 4-18: S3 Sound Signal (top), Frequency Spectrum bottom)

Amplitud-=-e ___ ~ ____~ _____- ___- ____

0&

0" o

_0 "

Time (seconds) Amplitude , ,------' ------~------~------.-, 0" 08 07 08

03 02 0 ' Frequency (Hz)

Figure 4-19: S4 Sound Signal (top), Frequency Spectrum (bottom)

47 4.1.2 Wavelet Decomposition

In this section, the wavelet decomposition of phonocardiograms will be analyze~. The

focus of this analysis is the structure of the coefficients during key cardiac events. Due to the nonstationary characteristics of heart sounds and the results of previous studies, it is unlikely that a siJ;1gle fixed decomposition level can accurately capture the energy of the primary

components for various types of pathologies. In some cases, two detail levels are required to properly represent the heart sound. The result of the wavelet decomposition analysis serves as a motivation for resorting to a non-heuristic approach, namely Principle Component

Analysis, in determining the combination of the detail coefficients for each point in the

phonocardiogram.

4.1.2.1 The "Mother" Wavelet

Determining the ''best'' wavelet for a particular application can be an overwhelming

task. In the two major classes of wavelet transforms- continuous and discrete- there are

numerous possibilities, such as orthogonal, biorthogonal, and redundant. The search of the

''best'' wavelet for an application is a non-trivial task. In this work the selection of a wavelet

basis is based on previous studies done by M.A.R. Santos and M. Souza [16]. They showed that the Meyer and Daubechies wavelets are good candidates for analyzing heart sound

sigmils.

48 The "mother" wavelet chosen for decomposing the signals is the Daubechies-15 (db).

The db wavelet was chosen for its property of orthogonality and its strong resemblance with the primary heart sound components. The wavelet and the scaling function are shown in

Figure 4-20 and Figure 4-21 , respectively.

• - • • • • • • 0.8

0.5 0.6

• Q.4

01-----"0 0.2

01.../

-0.5 .0.2 .0.4

o 5 10 15 25 o 5 10 15

Figure 4-20: DBIS Wavelet Function Figure 4-21: DBIS Scaling Function

The equivalent lowpass and highpass filters Matlab implements are shown in Figure

4-22 and Figure 4-23, respectively.

" •• " •, " •2 •1 " ,V\ " " 1 o1 2 • " , •1 • .2 ,5 , 5 1Q 15 20 25 15 20 • " "

Figure 4-22: DBIS Lowpass Filter Figure 4-23: DBIS Eligbpass Filter

49 4.1.2.2 Heart Sound Wavelet Decomposition

The wavelet decomposition is I?ssentially a scale breakdown of the heart sound signal.

The level parameter j, is related to the scale, a, through the following equation.

The resolution is defined as 1 . r==-==2-J • a Therefore, the resolution increases as the scale decreases. The, greater the resolution, the fmer are the details that are accessible. In this way, each detail level covers a range of frequencies with a different resolution. Table 2 lists the frequency range, resolution, and scale at each detail level that is used in this analysis.

Table 2: Wavelet Decomposition Information Table

Detail Level Frequency Range Scale Resolution

. 1 D1 334-668 2 - 2 1 D2 167-334 4 - 4 1 D3 83-167 8 - 8 1 D4 42-83 16 - 1 16 1 • D5 21-42 32 - 32

50 I D6 10-21 64 - , 64 1 D7 5-10 128 - 128 I D8 2.5-5 256 - 256

To understand the structure of the coefficients for key cardiac events, the decomposition coefficients for different types of pathologies are compared. Pathologies with murmurs in different locations are chosen for this analysis to represent a broad range of heart sound signals. The heart sound signal being analyzed is decomposed at (different scales using different resolutions) and displayed as an image where the intensity signifies the magnitude of the coefficient. The rows indicate the detail level with frequency range and resolution defmed in Table 2.

t •

51 Figure 4-24: Normal Heart Sound Signal (Top), Wavelet Decomposition (Bottom)

The magnitudes of the coefficients for a NOlmal heart sound signal are shown in Figure

4-24. The image reveals the relative importance of the coefficient vectors. Since the

coefficients at levels 6, 7, and 8 have low amplitudes, they can be dismissed without serious

consequences. The coefficients at the remaining five levels are plotted superimposed on the heart sound signal as shown in Figure 4-25.

52 Amp lit;;:u:::d:::e__ ------.,------.,--_------,- - _ _ -----,,-____,-- ____r- • • • • • • Levell . • • • • • •

• • • • • • Level 2 • • • • • •• • • • • • • • Level 3 . • • • • • • • • • • • • Level 4 . • • • • • •

• • • • • • Level 5. • • •• • • • Time (samples)

Figure 4-25: Normal Wavelet Decomposition Coefficients at Levels 1,2,3,4,5

This representation reveals the insignificance of the level I coefficients. At level 2, majority of the activity of the S, is captured but overlooks the S2. The level 3 coefficients capture most of the key events. However, the last S, is not represented well at this level. Due to the poor temporal resolution at level four, the onset of the events are poorly represented.

Similarly, the resolution at level five fails to provide an adequate representation of the events.

53 According to Table 2, the interesting events of this phonocardiogram• consist of frequencies in the range of 2l-334Hz. This example demonstrates that even in the simplest case, namely the Normal, an accurate representation requires a combination of the coefficients.

In the next four examples, the wavelet coefficients of heart sounds with murmurs at

various locations will be analyzed to ;ilustrate that a predetermined subset of coefficients is not appropriate in providing a good representation of the S I and S2.

Figure 4-26 is the phonocardiogram of the Early Aortic Stenosis and its wavelet decomposition. The murmur staTts immediately following the S I and ends before the onset of

·the S2. The coefficient image shows that four details levels - 2, 3, 4, and 5- are prominent.

These coefficients are superimposed on the peG signal as illustrated in Figure 4-27.

54 Amp litud e , , , . , , , ., ,

·0 . •

· 0 . •

• , •

-~ . u ..J • , , ,

Sample (Time)

Figure 4-26: Early Aortic Stenosis Signal (Top), Wavelet Decomposition (Bottom)

55 • • • • • • 2· • • • • • •

• • • • • • I 3 . • •

• • • •

• • • • • • 4 ' • • • • • •

Time )

Figure 4-27: Early Aortic Stenosis Wavelet Decomposition Coefficients at Levels 2, 3,

and4

The two primary components, S) and S2, are captured by several detail levels. The onset of

the components is best observed at level 3. However, notice that the murmur is also captured

at this level. The level 4 coefficients accentuate the tellllination of the two primary

components, S) and S2 at a coarse resolution. Level 2 highlight the murmur as well as the

onset of the S).

The phonocardiogram of a Pan systolic heart sound and its wavelet decomposition are

shown in Figure 4-28. The murmur starts with the S) and terminates before or at the onset of the S2. The coefficient image clearly illustrates the four prominent details levels - 2, 3, 4,

56 and 5. Detail coefficients superimposed on the heart sound signal for these levels are shown in Figure 4-29.

A mplitud e • • • • · , • -. , •• • -. .

• , •

• , , ,

Sa mple (T im e)

Figure 4-28: Pan Systolic Signal (fop), Wavelet Decomposition (Bottom)

57 Amplitude

• • • • • • Level 2 . •• • • • •• • • • • • • • Level 3 • •• • •• • • • • • • • · , Level 4 . • • , . . , . • • , . , ,

Level 5 • •• • •• • • • • Time (Samples)

Figure 4-29: Pan Systolic Wavelet Decomposition Coefficients at Levels 2, 3, 4, 5

The structure of the mmmur is best captured by the level 2 coefficients. The two primary components, S 1 and S2, are represented by several levels. Notice that the coefficients at

levels 3 and 4 are necessary to accurately capture the structure of the primary components.

Coefficients at level 3 compensate for the inadequacies of coefficients at level 4 and vice versa.

58 '.

Table 3 summarizes the wavelet decomposition analysis of the various types of heart sound signals.

Table 3: Summary of Wavelet Decomposition Analysis.

Characteristics

Level(s) Level(s) Level(s) Location

Heart Sound reflecting reflecting reflecting of

S] S2 murmurs Murmur

Normal 4 4 N/A N/A

Systolic Mitral 4 4 2 After S2 Prolapse

Early Aortic Stenosis 4,5 4' 4 After SI

Late Systolic 4 4 4 Before SI

Ejection Click 4 4 4 After S2

Ope~ngSnap 4 4 2 After S2

The same analyses for phonocardiograms of various pathologies are done in the same manner. The results of the findings are summarized below.

The majority of the activity in a heart sound signal is captured by detail levels

2, 3,4, and 5. This corresponds to the frequency range of 21-334Hz . •

59 An adequate structure of the primary components requires a weighted

combination of the coefficients of at least two detail levels. This is due to the

fact that in a single heart sound signal the structure of the components may be

different over time.

4.1.2.3 Heart Sound Wavelet Synthesis

The amiiysis of heart sound signals usmg wavelet decompositions illustrated the information captured in each detail level. In order to obtain the best temporal resolution, each coefficient vector must be used to synthesize the original heart sound signal. The accuracy in segmenting events in a signal depends on the representation of the components in the signal. If components are well represented in a signal, naturally, the components can be segmented with greater accuracy. Another attribute of the signal which plays a role in the performance are the unwanted elements in the signal. These can be due to noise andlor murmurs. If the amplitudes of the unwanted elements are high, the accuracy of the segmented c0!llponents is compromised. The purpose of wavelet synthesis to obtain a set of feature signals for key cardiac events at the highest temporal resolution.

The reconstruction filters associated with the 'dbI5' wavelet computed by Matlab are shown in the following figures.

60 o. •

0 • o. ., 0 /\ /\1 o. .., 0 ' (\ - .. ,

, , • " " "

Figure 4-30: Reconstruction Lowpass Figure 4-31: Reconstruction Highpass

Filter Filter

Notice that the reconstruction filters are equivalent to the decomposition filters except for the time reversal. The construction of a feature set for each peG signal consists of three steps described below.

61 I. Figure 4-32 shows the modified coefficients for the Normal heart sound

decomposition. The coefficients, Ci, are obtained by forcing all coefficients to the

value zero except those which correspond to the coefficients at detail level i.

2. Reconstruct the signal using each modified set of coefficients Ci (i=I, ... 8). The

reconstructed heart sound signal, Rk corresponds to the reconstruction using the

coefficients Ck. Each reconstruction provides the best temporal resolution for each

sub-band. The reconstructed signals using the modified coefficients for a Nonnal

heart sound signal is shown in Figure 4-33.

3. Form the feature set using the reconstructed signals. Each point in the original heart

sound signal can now be viewed as a point in an 8-dimensional space where each

dimension corresponds to a detail' level. A different perspective is to view each

sample point in the heart sound signal as a random variable. From this standpoint

there are eight observations per variable. Figure 4-34 illustrates the feature set

through the latter perspective. Each color symbolizes a realization of the random

variables. A time expanded version of the feature set is shown in Figure 4-35.

62 Amplitude Amplitude • ~~~C l ~------r----' • • • •

• • .. .. . f------• • • • .. C3 .. "

C8

Sample Sample

Figure 4-32: Normal heart sound modified wavelet coefficients

63 RI R5

R2 R6

•.- .

..f R3 R7

R4 R8

Figure 4-33: Normal heart sound signal reconstructions

64 o

-0 .2

•• •• ... J -0 .4 ~ i ~ • • t Observati on 2 • I •• 1C t • Observati on 3 • t • Observati on 4 -0 .6 • • • Observati on 5 • • Observati on 6 • -0 8 • Observati on 7 • Observati on 8 500 1000 1500 2000 2500 3000 3500 4000 4500 5000

Figure 4-34: Normal Heart Sound Observations

65 Amp~

0.6 f-

0.4 C-

O2 C- • • • 0 ~ • • • • • • • • • • • • • • • • -02 f- • • • • • • ~1 -0.4 f- Observation 2 • Observation 3 • Observation 4 -0.6 C- • Observation 5 Observati on 6 -0.8 Observation 7 - • Observation 8 1994 1995 1996 1997 1998 1999 2000 2001 2002

• Sam.l!!e

Figure 4-35: Normal Heart Sound Observations Time Expanded

4.1.2.3.1 Heart Sound Wavelet Synthesis Results

The eight synthesized signals generate a feature set for the original heart sound signal.

This set of features is not the "final" set of features used to segment the heart sound signal.

As discussed in section 4.1.3 Finding Feature Signals, the final feature set used to segment

key cardiac events is a linear combination of the feature set fOlmed using the eight

synthesized signals and are determined by peA.

The feature sets for Early Aortic Stenosis and Pan systolic heart sounds are shown in

Figure 4-36 and Figure 4-37, respectively. From the two figures, it is evident that the

reconstructed signals provides a representation of the heart sound signal that separates the

primary components from murmurs. The main objective of the segmentation algorithm is to

66 segment the primary componentsSI and Sz. For this reason, two classes of signals are

extracted. from the feature set. The first consists of tIie primary components, S I and S2. The

second class, called "others" may be comprised of murmurs, clicks, opening snaps, and/or , noise. It is essentially anything that is not Sl or S2 .

••

67 ..f RI • • -

• R2 R6 • •

• R3 R7

R4 R8

Sample Sample

Figure 4-36: Early Aortic Stenosis Feature Set

68 Amplitude Amplitude --~~~~--~~~~~--~~ RI R5

R2 R6

R3 R7

--

R4 R8

Figure 4-37: Pan Systolic Feature Set

69 4.1.3 Finding Feature Signals

Through Wavelet methods (analysis and synthesis) a feature set is generated for a peG.

The feature set presents the heart sound signal in a way such that the primary components are

separated from "other" components. Recall from section 3.3.3 Wavelet Synthesis, that each

sample point can be viewed as a random variable. III this way, the eight reconstructed signals

are interpreted as observations for each sample point. The goal is to obtain the "best" feature

signal for, two classes of cardiac events, primary components and "others". Here, ''best'' refers to the maximal extraction of desired components while minimizing the interfering

components. The orthogonality property of peA makes it a desirable method in developing

these features signals.

The feature set, X, IS formed so that each row corresponds to a selected detail

reconstruction. In this way, a point at t=to in the original peG signal can be represented as a

linear combination of the eight synthesized signals at 1=1:0 which can be computed using

equation 4.1

8 S(to) = Lk;R;(to) (4.1 ) ;=1

, where

S is the original signal;

70 • Ri is the ith synthesized signal using only the coefficients at level i; ,

kj is a scaling constant.

To obtain perfect reconstruction, it is required that the scaling constant kj=l, i=I, ... ,8.

However, it is desired to determine a set of coefficients to provide a signal which will highlight the desired components and soften the undesired events. Principle Component

Analysis is a linear transform of the original feature set to highlight the variability in the data. The. new set of features, called principle components (PC), is a linear combination of the original features [7]. The principle components are calculated using the following equations:

(4.2 )

(4.3 )

-. where

X is the original feature set consisting of the eight synthesized signais;

K is the correlation matrix ofX;

V(i) is the eigenvector that corresponds to the ith largest eigenvalue.

Projecting X onto· the PCs captures the amount of energy in the direction specified by the • corresponding eigenvector and is calculated using equation 4.4.

71 z=PCT .XT (4.4 )

where PC is a matrix containing the ordered eigenvectors in each column and Z'is a matrix where row i corresponds to the projection of the original oata set onto the i'h principle component. •

Since the eigenvectors 'are ordered according to the eigenvalue, in a descending order, information captured in the higher order eigenvectors may be relatively minute, which may be discarded without a signifiCant loss of information. Figure 4-38 shows the heart sound signal and the feature signal set projected on the eight principle components which are labeled as Zi {i=l, ... , 8}. The amount of energy captured by the principle components is listed in Table 4.

Table 4: 'Energy Captured By Principle Components

PCI PC2 PC3 PC4 PCs PC6 PC7 PCs

Energy(%) 73.163 15.03 10.05 1.'44 0.29 0.0147 0.0006 0.00036

72 Amplitude • • · , · , • .. , · , • •

Time (seconds)

, , ,

., , ,

, , ,

., ., , , , Zg ,

., • , , , Time (seconds) Time (seconds)

Figure 4-38: Normal Heart Sound Signal and its projection onto pes

73 4.1.3.1 Finding the right pes

, r It is desired to determine the PC( s) that will provide the most information about the

desired events while minimizing the energy of the disturbing events. Notice the dilemma

that is presented; too many PCs will capture all the events (primary components and

murmurs), while too few will not capture enough information. To find a compromise,

several different pathologies must be exWtined.

In this section only the principle components required to capture 90% of the energy will

be shown. The emphasis is in the extraction of the primary components, so we determine the

PCs that can describe the activity of the primary components. Therefore, the analysis is

based on the comparison of a Normal heart' sound signal and the projections of abnormal

heart sound features onto various PCs.

Table 5: Principle CompOJient Energy Distribution for Early Aortic Stenosis

PCI PC2 PC3 PC4 PCs PC6 PC7 PCs

• Energy(%) 69.39 17.53 10.28 2.52 0.26 0.026 0.0001 0.0001

74 , Amplitude • • • • • • • ~ '. , '. •• •• ;¢===

• • Time (seconds)

Figure 4-39: Projection On Principle Components for Early Aortic Stenosis

Table 5 and Figure 4-39 show the energy captured by the principle components and the plots of the Early Aortic Stenosis PCG signal along with the feature set projected onto the first three principle components. As shown in Figure 4-39, the first three PCs encapsulate the Sl and S2 events. However, the third PC picks up the mUlmur activity.

Table 6: Component Energy Distribution for Pan Systolic

PC I PC2 PCl PC4 PCs PC6 PC? PCg

Energy(%) 70.80 13 .84 10.98 3.56 0.80 0.02 0.00 0.00

75 • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • •

Figure 4-40: Projection On Principle Components for Pan systolic

The energy explained by each principle component for the Pan Systolic PCG signal is listed in Table 6. The PCG signal and the projection onto the first three PCs are shown in Figure

4-40. Like the Early Aortic Stenosis, the first two principle components capture the SI and S2 events without a noticeable amount of murmur while the third PC highlight the murmur activity.

76 f 4;1.3.2 Summary of PCAAnalyses

The same visual analysis is performed on several other pathologies and the results are summarized in the table below. To. represent a broad range of signals, differing characteristics of the murmUr such as the energy level and location are chosen.

t

Table 7: Summary of Energy Dist~ibution through Principle Components

PC that capture PC that capture

Primary components 1 % of energy Murmurl % of energy

Normal 1-5/99.69 -/0

Early Aortic Stenosis 1-2/86.92 3110.28

Pan systolic 1-2/84.64 3/10.98 . Diastolic Atrial Gallop 1-3/99.02 4/0.88 Early systolic. 1-3/97.11 4/2.60 Early systolic murmur 1-3/97.11 4/2.60

Ejection Click 1-2/85.45 3-4/14.05

Late Systolic 1-2/83.73 3-4/15.75

Opening Snap 1-2/80.07 3-4/19.15

The first thing to notice is that the S1 and S2 have similar time-frequency characteristics and are therefore captured by the same principle components. Secondly, the principle components that capture the S1 and S2 vary between different heart sounds. As shown in

77 Table 7, for the Nonnal heart sound signal, the majority of the energy in the primary

components, 81 and 82, are captured by the first five PCs. The Ejection Click heart sound

contains a relatively high level of energy in the munnur. In this case, the primary

components are observed best by the first two PCs. Based on the study, the first and second

principle components capture the 8 1 and 82 events well and can be used as a basis for

segmenting the two components.

Principle component analysis offers supplementary valuable infonnation. It tells· us

where the munnur in the heart sound signal is located. Recall that the principle components , are all orthogonal to one another and ordered, so as we traverse through the principle

" components, at one point the activity of munnur will be highlighted more than the primary

components. Hence, a feature signal for the munnur or other disturbing events can be

constructed, permitting segmentation of these events as well. Figure 4-41 is a plot of a Pan " systolic PCG signal. It is clear that a murmur exists between the 81 lI!ld the 82. However,

pinpointing the location of the onset is difficult and is a subjective matter. The feature set

projected on the principle components are shown in Figure 4-42, starting with the first PC

down to the eighth PC. As demonstrated in the figure, the first and second PC captures the

primary components, 8 1 and 82• As we proceed to the higher PCs, they begin to capture

munnur activity, starting with the third PC. It is the fourth and fifth principle components

that really highlight the location of the munnur. Looking at these signals, it is easy to see

that the munnur actually begins with the 8[ and ends before the onset of the 8 2•

78 , .•

-0.4

Time (seconds)

Figure 4-41: Pan systolic peG signal

• 79 Amplitude

- -. - ~ -

Time (seconds)

Figure 4-42: Projection onto Principle Components of Pan systolic

80 The principle Component that best captures the "other" events varies for different heart

sound signals; ho~ever, it was found that the principle component such that the previous PCs

captured at least 90% of the total energy, provides a good representation for the munnur.

This method provides signals that can best separate the original PCG signal into two

categories: primary coinponents and "others". Not only does it provide a much cleaner

signal for segm,enting the primary components, murmur can also be segmented using their respective feature si~al. The segmentation of primary components and "other" events can now be conducted independently.

4.1.4 Envelogram

Principle componenLanalysis provided two classes of signal(s), one for the primary

components and the other for "other" components. The envelograms (envelopes of the energy) for the "two classes of signal are used to segment the components in each class independently. In this section, the envelogram for the component feature signals and the threshold calculations will be detailed.

4.1.4.1 Primary Components

The segmentation of the primary components is based on the energy of the two feature

signals, ZI and Z2 which are computed as follows:

.. 81 ·. •

(4.5 )

(4.6 )

where

Zt, Z2 are the feature signals,

X is the feature set fonned by the eight synthesized signals,

pei (i=I,2) are the first and second principle components.

There are various methods for calculating the energy in a signal as shown in Figure 4-43.

The relationship between the amplitude of the energy and nonnalized magnitudes are shown for three different methods. The first plot shows that the square energy conceals the low intensity sounds by increasing the high/low intensity ratio. The second figure indicates that the absolute energy weighs all intensities in a signal equally. The Shannon energy shown in the last plot emphasizes the medium intensities within a signal.

r

82 ,

o • - o • - o , - - - - - , , - o , - - , • o • - , . -

>. 0' - ODC~ o 0 - Ul o • - o • - o ,

o , - o , - ,

o • - o • -

>. 0 7 -

tc: 0 e Ul ::: 0 to - 8 ::: 0 4 - - -"'" - '" 0' o , "- - o , -

o 0 o , O. , , 0.' " o • " o 7 , . , . Normalized Signal Magnitude

Figure 4-43: Energy Calculation Comparison

In this algorithm we have chosen to use the average Shannon energy for its proficiency in accentuating low intensity sounds while attenuating effects of low energy noise. The

83 , average 8hannon energy is calculated using the experimentally derived values of 0.026-

second segments with 0.0065~second overlapping using the following equation: •

1 N E = - N I S\norm(i) . log S\norm (i) (4.7 ) i=1

where

S~norm is the kth (k=l ,2) feature signal nonnalized to its maximum absolute, value which is expressed mathematically as

s _ Zk k,norm - {Z } (4.8 ) max k

and N is the number of samples in the window, here N=32.

The amount of infonnation captured by the first feature signal is completely dependent

on the audibility of the sequential events within a component. Recall, that the S 1 contains

four sequential events, low frequency, high frequency, high frequency, and low frequency.

Moreover, the infonnation captured by the second feature signal is completely dependent on

the amount of infonnation captured by the first feature signal, which is a direct consequence

of principle component analysis. Typically, the feature signal Z" captures majority of the

energy of the components, 81 and 82. In this case, the segmentation is based on the first

feature signal. It was also found that ZI provides a good representation of the onset activity

84 'f

so it is defined to be the point where Z, first exceeds the threshold T,. In some cases, however, when the sequential events in the component are audible, the conclusion of the

component is highlighted in the feature signal Z2. Therefore, for every primary component,

S, and S2, the feature signal used to locate the termination point requires a decision making

procedure outlined below.

I. Two thresholds are calculated as follows:

(4.9 )

( 4.10)

where

M is the length of the feature signal;

R is the total number of segments used in calculating the envelogram; • d is the variance of Z2.

The first threshold, T" calculates the expected average amount of energy in each

segment of the signal. Similarly, the second threshold, T 2, determines the .expected

average amount of energy in each segment of the second feature signal summed with

a term reflecting the vanance in the signal.

85 2. The telmination point is temporarily assumed to be the point where the envelogram of

ZI drops below the threshold T 1• The threshold T2 detelll1ines whether the

tel mination of a component is captured by the 2nd principle component. If the

envelogram calculated based on 'Z-}. exceed T 2, the tellllination point of a component

corresponds to the point where Z2 drops below the threshold T I.

Figure 4-44 is an example illustrating the decision process in locating the tellnination of a

primary component. The envelogram of the feature signal ZI is shown in the blue solid line

and the envelogram of Z2 is shown in the red dotted line. The two thresholds T 1 and T 2 are marked in the figure. From the figure, it can be seen that the termination point, marked by a circle, of the component on the left is detellnined using the envelogram of Z2 since it

surpasses both thresholds. The component on the right uses the envelogram of ZI because the envelogram of Z2 falls below T2. This decision making procedure utilizes the feature

signal that best characterizes the telluination activity of a component.

• • • • • • • • • • •• • •• •• •• JV •• • •• • • • • • •• • •• • •• • , • )\ •• • • • ,• •• T2 • • • , : r • • - • •• '" •• • ,• • • • • • • •• • • •• •• • •• • T • 1 • , • •• • •• • • , ' • • • '. • •, " • . •, •, • .. • • • '. c • ~ .?{ • "-

Figure 4-44: Envelograms of Component Feature Signal ZI (blue) and 'Z-}. (red)

86 4.1.4.2 "Other" Components

The "other" components in a heart sound signal are typically murmurs; clicks, and snaps.

The feature signal for the "other" components is obtained by projecting the original feature

set, X, onto the principle component that is required so that along with the previous PCs 90%

of,the total variation is captured. For example, if the first three principle components capture

85% of the signal energy and. the fourth principle component captures. 10%, then only the fourth principle component is used to obtain the "others" feature signal. The core energy of the feature signal consists of the "other" component that exists but may also capture artifacts

of the primary components that are not explained by the previous PCs. For this reason, the

.segmentation is based on the squared energy which will bury the low intensity sounds

(artifacts of primary components) under the high intensity ones (murmurs) by enlarging the highllow intensity ratio [8]. The envelogram is calculated using the same widths asrthose for

the primary components (0.026,second segments with 0.0065-second overlapping) using the

following equation:

w E= LMm~(i) ( 4.11 ) i=l

where

W is the number of samples in th~ window, here W=32;

87 Mrn is the projection onto the PC such that the energy captured by principle

components I - m explains at least 90% of the total energy in the heart sound

sjgnal.

The boundaries for the components are determined by finding the locations where the enve10gram exceeds the threshold calculated using the following formula:

( 4.12 )

where mm and crm are the mean and standard deviation of the first quartile of the "other" feature signal, Mm. The threshold is calculated using the first quartile of the feature signal since the feature signal results in low amplitudes. The reason for the low amplitude is because the feature signal in this class is determined by projecting the original feature set, X, onto a higher order the principle component in order to minimize ~e artifacts of the primary components, S1 and S2, in this feature signal.

88 ,

5 Results

The perfonnance evaluation of segmenta!ioil algoritJuns is difficult, since defining the

boundary of a component is subjective. For this study, the perforniance is evaluated using

two measures. The first penonnance analysis is based on the correctness in the identification . of Sf and S2. The second method of quantifYing perfonnance is through the comparison of

the components segmented by the algorithm ahd by hand. The hand segmented components

are obtained by visually estimating the start 'and end location for each component.

5.1 Performance Analysis: S1 and S2 Identification

The ideritification of the S] and Sz are based on the following fact: the longest time

• interval between two adjacent peaks is the diastolic period. In this perfonnance analysis, th~ identification process assumes that only the SI and S2 exist, i.e. the other two heart sounds S3

and S4 are not considered.

The identification process starts with the calculation of the time intervals between

adjacent components. The component that occurs following the longest time interval is

labeled as the S]. The component following the labeled 81 is then identified as an S2.

Remaining components are labeled based on the duration of the component as well as

elapsed time. The results, Table 8, indicate 98.2% correctness in the automatic identification

of the S 1 and S2. The errors are due to a single audible S4 in a heart sound signal . . 89 ,

..

Table 8: Statistics ofIdentification Results

Number of Cycles Percen!age (%)

Correct 160 98.2

Missed/Incorrect 3 1.80

Total 163 100

• 5.2 Performance Analysis: Component Boundaries

In this section, two figures will be presented for each heart sound signal. The top figure

will contain the phonocardiogram with the hand segmented components. The onset of each

component is denoted by the color pink and the termination by the color blue. Similarly, the

bottom figure plots the signal with the onset for each component denoted by the color red and

the termination is shown in black as determined by the segmentation algorithm.

5.2.1 Normal Heart Sound

The segmentation result for the Normal heart sound signal is shown in Figure 5-1. As

illustrated in the figure, the automated segmentation effectively locates the two primary

components, S1 and S2 .

90 , . , . """ ' , ."= -g. (I -< ., ,

• (I ••

. , .

, .. • • I ."-6" D2 \ -§- I - .- '" ' .., •• • •• •

Figure 5-1: Segmentation of Normal Heart Sound By Hand (fop), Automated (Bottom)

5.2.2 Diastolic Atrial Gallop

The result for a Diastolic Atrial Gallop heart sound signal is shown in Figure 5-2. The first component seen in the figure is an S4, which contains similar time frequency characteristics as the 8 I and 82 and is therefore picked up by the first principle component.

This 84 causes a relatively high level of energy which exceeds the threshold as shown in

Figure 5-3. The segmentation of the S4 however, is poor, not capturing the entire period of activity. This is due to its differentiating characteristics which are not captured through the

91 first principle component. The focus however, is on the segmentation results of the primary components, S I and S2. Comparing the hand with the automated segmentation, it is clear that the automated method is effective capturing the period of activity accurately. In some components the onset is delayed by an infinitesimal amount.

, , , , '0" .-"- , -Q. ~ ., ., .,

, , . , ., ' , '0" .B- -Q. E

·0 .4

Time(s)

Figure 5-2: Segmentation of Diastolic Atrial Gallop Sound By Hand (fop), Automated

(Bottom)

92 0,25 -

0.2 -

0,15 -

0,1 -

0,05 III , ' , 100 200 300 400 500 600 700 Window Number

Figure 5-3: Average Shannon Energy of First Feature Signal and First Threshold

5.2.3 S2

The segmentation result for the Split S2 is shown in Figure 5-4. In Split S2, the period of the S2 is longer and is structurally different from the NOlJnal S2. The result demonstrates the effectiveness of the algorithm. The algorithm is able to locate the primary components with the same precision as a human observer,

93 , . , ..

~ , , ." .-~ --"- ,

~ -0 .2

·0 .8

, . , .

"0" , , .-~ --0. , ~ ., , ., .

Time(s)

Figure 5-4: Segmentation of Split 8, Sound By Hand (fop), Automated (Bottom)

The segmentation of the supplemental infolillation for the Split S2 heart sound is shown in Figure 5-5 . This feature signal extracts the split in the S2 components. As illustrated, the gap of the split is minuscule and is considered as one component. This additional information is important since a certain width indicates abnormality.

94 ,

o

.'" -"­ 0 ..:E

.0

. , , , Time (s)

Figure 5-5: Segmentation of " Other" Components In Split S2

5.2.4 Early Aortic Stenosis

The segmentation results are shown in Figure 5-6. The accuracy in the hand segmentation shown in the top plot is compromised due to the interference of the murmur during the conclusion of the SI. For this reason, the termination of the SI is estimated by comparing it to the NOlmal SI components. To evaluate the performance, knowing the location of the mUlIllur is important. In Figure 5-7, the murmur feature signal, shown in blue, is superimposed on the original heart sound signal. The automated segmentation of the murmur locations shown are in the figure, with red and black denoting the onset and termination, respectively. It is evident that remnants of the SI are contained in the principle component defined for the murmur and consequently appear in the murmur feature signal.

Examining Figure 5-7, a logical estimate for the tellnination of the SI is at the midpoint of

95 the mW1Ilur. The automated component segmentation result is consistent with this observation.

GO ••• " . , -0 .B­ -0- - E -<

, , . , , , , , . • . ,

-0" • ."- --0- - • ~

" Time (s)

Figure 5-6: Segmentation of Early Aortic Stenosis Sound By Hand (fop), Automated

(Bottom)

96 , . , .

-g" " 1--- ' _0 .2

-0 .. .

Time (s)

Figure 5-7: Segmentation of "Other" Components In Early Aortic Stenosis

5.2.5 Ejection Click

The Ejection Click sounds like a click which occurs at the conclusion of the SI . The hand and automated segmentation results are shown in Figure 5-8. The primary components,

SI and S2 are segmented precisely by the algorithm when compared to the hand segmented results.

97 o 0

o _ " ""~ -"0- 0 S ~ -0 _

. 0 .0

o ,

o •

."" 0

---c. 0 .- ~ - 02

. 0 .4

·0 .11

Time

Figure 5-8: Segmentation of Ejection Click Sound By Hand (Top), Automated (Bottom)

The click in the signal is revealed in the "other" feature signal as shown in Figure 5-9.

Notice in the figure that tbe onset of the primary components are also captured by this principle component. In some cycles the onset of the S I and the click are considered as a single component while in other cycles tbe onset of the S I is detected as an "other" component and segmented by tbe algorithm.

98 ,

o •

o .•

o .•

u 0' ";: :.= 0 "- ~ ·02 I

·0 .8

-0 .8

--7-- --+',------,;-- .J...L--7'o---'-:'--:-';--'- -1----;:-';--'-' ., '---='!-05 \ 1 . 5 2 25 S 5 -4 -4 Time (s)

Figure 5-9: Segmentation of "Other" Components In Ejection Click

5.2.6 Late Systolic

The automated segmentation of the primary components, SI and S2, for a Late Systolic heart sound signal is shown in Figure 5-10. Comparing each of the hand and automated segmented components, it is clear that the start and end times are captured precisely, demonstrating the success of the algorithm.

The mUIlllur segmentation for the Late Systolic is shown in Figure 5-11. Here, the feature set is projected onto the fourth principle component, revealing the activity of the murmur. The beginning activity of the primary components SI and S2, are also exposed by the fourth principle component. However, the mUllnur segmentation is accurate and can be used in conjunction with the segmentation of the primary components for an in depth analysis of the heart sound signal.

99 o .,

0 . '

0 . ' ."" .--~ -0- 0 ~ . 0 .2

·0 .4

·0 .IS

0 . '

o •

0 . ' "0" .-"- 0 -0- • E <: -0 .2

·0 .• I -0 .0

o , T ime (s)

Figure 5-10: Segmentation of Late Systolic Sound By Hand (fop), Automated (Bottom)

100 , , .• , . , . ~ "'0 0 .2 .B -0- , E « . 0 2

." ."

Time (s)

Figure 5-11: Segmentation of "Other" Components In Late Systolic

5.2.7 Pan-Systolic

The Pan Systolic is a condition which consists of a munlIur that starts with the component SI and continues into the Systole period. The murmur ends before the onset of the second component, S2. The segmentation results for this heart sound signal again exhibit the effectiveness of the algorithm. It is challenging to locate the tellnination of the first component visually, because the munuur is overlapped. An educated estimate is detellnined by examining the structure of a Nonnal S I. The hand and automated segmentation results are equally accurate, as shown in Figure 5-12.

The murmur feature signal superimposed on the heart sound signal illustrates the strength of the algorithm. At first hand, looking at the PCG signal, it is nearly impossible for one to determine the starting location of the murmur. It is through combining methods of

Wavelet and PCA that an automated extraction of the mUlmur is obtained. The segmented

101 mUlInurs are shown in Figure 5-13. This supplemental infounation allows a complete segmentation of the heart sound cycle, suitable for further analysis.

, . , . , , ."" I .-:I , --Q, ~ ."

· 0 .•

. "

" , .

, , 1

:I" :.:"- , --,- 0.. - ~ ., , I ., .

. " • ,• . ,• ,• , •• Time (s)

Figure 5-12: Segmentation of Pan Systolic Sound By Band (fop), Automated (Bottom)

102 ,

o •

--.-.- -

Time (,)

Figure 5-13: Segmentation of "Other" Components In Pan Systolic

5.2.8 Systolic Mitral Prolapse

Figure 5-14 shows the hand and automated segmentation of the heart sound primary components. The location of the hand segmented components can be better explained through a time expansion on the peG as shown in Figure 5-15. Zooming in on the time axis shows that during the termination of the S2 there is a brief period of low level amplitude.

The automated method is incapable of detecting the brief period thereby presenting inaccurate locations for the termination of the event ofS2•

The murmur segmentation results are shown in Figure 5-16. The boundaries are defined accurately. This result can be used as an indicator for detailed analyses in the region to correct the inaccuracies of locating the terminations of the S2.

103 I o •

o ,

" 0 , ." .;:- e. o E

« · 0 , ."

-0 .3

o , , . ,

0 .3

o ,

~ 0 . 1 .--:0 -"- 0 - - - ~ ·0 .1 ." I [I ..,

Figure 5-14: Segmentation of Systolic Mitral Prolapse Sound By Hand (Top),

Automated (Bottom)

104 • .., 1 " . , .-'"--~ "­a ..: ·0 .1

••• ••

Time (s)

Figure 5-15: Time Expanded Segmentation By Hand of Mitral Prolapse

·. , • • · , ., ·. , ., ~ · .'"- --"- • - ~ •• , ·0 .2 .. , I ." • 0 .6

Time (s)

Figure 5-16: Segmentation of "Other" Components In Systolic Mitral Prolapse

105 5.3 Performance Analysis Summary

The automated segmentation algorithm was tested on a total of 220 heart sound components which consist of I lOS 1 and S2 components. A histogram denoting the error in the onset and teltllination are shown in Figure 5-1 7 and Figure 5-18, respectively.

Comparing the two histograms, we conclude that the onset segmentation is slightly more accurate than the tel1llination. The average error in the onset and termination timing are

0.008 seconds and 0.009 seconds, respectively. These values are essentially negligible.

Clearly, the algorithm is highly accurate.

2

2

,

,

Figure 5-17: Histogram of onset error

106 1

12

1

8

6

4

2

80

Figure 5-18: Histogram of termination error

In order to evaluate the robustness of the algorithm, parameters are varied and the perfollllance is examined. The envelogram of the two features signals along with the two thresholds are used to segment components. The thresholds, T1 and T2, are functions of the feature signal and are adaptive in nature. The calculation of the envelogram however, depends on the window width, N and the length of the overlap, 'to Accordingly, the performances of the segmentation algorithm with different sets of the parameters Nand 't are used to investigate the algorithm robustness. The results are shown in Table 9 with the histograms for each of the three cases shown in figures 4-19 through 4-24. Table 9 shows that varying the parameter set by 25% increases the average error in onset location by 0.000 I seconds and tellllination error by 0.003 seconds. The average errors for the three cases do

107 • not vary much which prove that the segmentation algorithm.is robust to fluctuations of these

parameters.

Table 9: Comparison of the different parameters

Parameters Average Error Average Error (# ofSampJes) of Onset (s) of termination (s) N 't

40 8 0.0076 0.011 . 30 8 0.0087 0.010

40 10 0.0081 0.012

.,

108 20 ,-----_,------,------,------_,------,------.------, ,.

16

14

12

10 •

6

4

2 ->L ,L IL 05'::-0 ---'--_--1. 0' -30 -20 -10 o 10 20

Figure 5-19: Histogram of onset error (N=40, -r-8)

12 ,---_.-----.----~--_,r_--_,_.-_.-----.----~----r_---.

10

6

2

0 '-0-- -120 -100

Figure 5-20: Histogram of termination error (N=40, -r-8)

109 2o r------r------r_-----r----~r_----_r_----~-----

' 8

' 8

14

' 2

'0

8

6

4

2

?6':-0-- --- ~50:- ---_47:,---- -30 - 0 -20 -'0 o '0

Figure 5-21: Histogram of onset error (N=30, 't=8)

'4

' 2

' 0

8

6

4

2 I I -80 -60 -40 -20 o 20 60 80

Figure 5-22: Histogram of termination error (N=30, 't=8)

110 1 5

10

III

5

_ U _LU , ~~ '~U I LI LLtl.!-lLU _LL ~50 -40 -30 -20 -10 o 10 20

Figure 5-23: Histogram of onset error (N=40, t=10)

1 4 .---~-----.----.-----.---~---~-----.----.-----.----,

1 2

10

6

6

4

2

40 60 60

Figure 5-24: Histogram of termination error (N=40, t=10)

111 '.

6 Conclusion and Future Work ,

The presented automatic segmentat~on algorithm which combines wavelet decomposition, reconstruction, and principle component analysis to construct feature signals

for calculating envelograms demonstrated effectiveness in segmenting key cardiac events in phonocardiogram signals. In addition to identifying and segmenting the primary components, we ~e also able to extract and segment the abnormalities in heart sounds. The algorithm has shown over 98 percent success for identifying the two primary components, SI • and S2, in 160 cycles of heart sounds with different types of murmurs. Moreover, in

comparison to hand segmentation, ilie algorithm demonstrated less than 10 milliseconds of error. The algorithm'is suitable both to provide diagnostic cues to a physician, and as the basis of a more comprehensive diagnostic system.

Currently, the. abnormalities are considered as supplemental information. However, as

discussed in the Results section, the abnormalities can be used in conjunction with the

segmentation of the primary components to obtain even better precision of the boundaries.

In addition, key information such as the width of the "Split S/' are identified which provides • valuable information regarding the condition of the heart .

112 7 Appendix

7.1 Main Function close all clear all wamingoff cd .. [filename]=uigetfileC .mat', 'select pathology') g=length(filename)-4; Name=load(filename(1 :g»; Real=getfield(Name,char(fieldnames(Name»); cd PCA3/decomp_coeff SigD=load(filename(1 :g»; coeff=SigD.coeff; lens=SigD.lens; cd .. [l,S l]=decomp_reconv3( coeff,lens); percent_explained = IOO*SlIsum(Sl) SigL=l(l,:);. SigR=l(2,:); bestwm=32·, besttau=8; [LT,R T] =segv3 _I (l(l ,: ),l(2,:),bestwin,besttau); [LTmur,RTmur,Flag,N~m _ e_ vector]=murmur2(S 1,Z); C=labelv3(LT,Rn

, 7.2 Wavelet Decomposition, Reconstruction, peA function [l,S I]=decomp_reconv3( coeff,lens); a=lens(l);

% f={306-612}

113 level_l_z=wthcoef('d',coeff,lens,[2:8]); level_l_z(1 :a)=O;

% f={153-306} level 2 z=wthco-ef('d',coeff,lens,[1,3,4,5,6,7,8]); level 2 z(1 :a)=O;

% f={77-153} level_3 _ z=wthcoef('d',coeff,lens,[ I ,2,4,5,6,7,8]); level_3 _ z(1 :a)=O; . %f={O-76} level 4 z=wthcoef(,d',coeff,lens;[1,2,3,5,6,7,8]); level 4 z(1 :a)=O;

%f={O-38} level_5 _ z=wthcoef('d',coeff,lens,[ I ,2,3,4,6,7,8]); level 5 z(l :a)=O;

level 6 z=wthcoef('d',coeff,lens,[1,2,3,4,5,7,8]); level 6 z(1 :a)=O; level 7 z=wthcoef(,d' ,coeff,lens,[ 1,2,3,4,5,6,8]); - -.. . level_7_z(! :a)=O; level_8_ z=wthcoef('d',coeff,lens,[1 :7]); , level-- 8 z(! :a)=O; .

reconl =waverec(level_l_z,lens,'db 15'); recon2=waverec(level_2_ z,lens,'db 15'); recon3=waverec(level_3 _ z,lens,'db 15'); recon4=waverec(level_4_ z,lens,'db 15'); recon5=waverec(level_5 _ z,lens,'db 15'); recon6=waverec(level 6 z,lens,'db IS');

114 ,

recon7=waverec(level 7 z,lens,'db IS'); recon8=waverec(level 8 z,lens,'db IS');

XI=[reconI recon2 recon3 recon4 recons recon6 recon7 recon8]; m=mean(XI); M=repmat(m', I ,lengtb(Xl »; M=M'; [pcs,newdata, var]=princomp(XI); • Z=newdata; SI=var; Z=Z'; return;

7.3 Primary Component Segmentation

function [LT,RT]=segv3 _1 (SigL,SigR,win,tau) count=O; VL energylog=[]; VR energylog=[]; • SigL=SigL./max(SigL); SigR=SigR.lmax(SigR); for c=1 :tau:(length(SigL)-win) sig=SigL(c:(win-tc); sigZ=SigR( c:( win+c»; count=counH I; y 1=-sum« sig.1\2). *log(sig.1\2»/win; y2=-sum«sigZ.1\2). *log(sigZ.1\2) )/win; VL_energylog=[VL_energylog yJ]; VR_ energylog=[VR_ energylog y2]; end

VL_ energylog=VL_ energylog;%.Ima,,;(VL_ energylog); • VR_ energylog=VR_ energylog;%.Imax(VR_ energylog);

115 , %SIGNAL LENGTH N=length(SigL);

xl=SigL; x2=SigR; Stdl ,:,std(x I); Std2=std(x2);

thresh! =-sum«x!."2). *log(xl."2»/(c);%-.25*(Stdl "2)*log(Std 1"2) thresh2=-sum( (x2."2). *log(x2. "2»)/(. c )-1 *(Std2"2)*log(Std2"2);

-- % FIND THE PLACES WHERE THE ENERGY IN THE FIRST RECONSTRUCTED SIGNAL IS % GREATER THAN THE THRESHOLD (USE THIS FOR DETECTING PRIMPARY COMPONENTS) ,. 11 =find(VL_ energylog>=threshl); I2=find(VR_ energylog>=thresh2); I3=find(VR energylog>=thresh 1);

% LEFT EDGE (RISING EDGE) LL=[]; LL(I )=11 (I);

% RIGHT EDGE (FALLING EDGE) R=[];

gap=4; for i=1 :(Iength(II)-I) if 11 (i+ 1»11 (i)+gap • R=[R 11 (i)]; LL=[LL 11 (i+ 1)]; end end R(length(R)+ 1)=11 (Iength(I 1»;

116

• % FINDING THE LEFT AND ,RIGHT EDGES OF COMPONENTS, % LEFT EDGE (RISING EDGE) L=[]; L(1 )=12(1);

% RIGHT EDGE (FALLING EDGE) RR=[]; gap=4; for i=l:(length(R)-I) ind=R(i); q=find(I2=ind);

if numel( q)~O q I =find(I3 ind); 1=0;

while 1=0 & ql~numel(I3)

ifI3(ql + 1»I3(ql)+gap RR=[RR I3(ql)]; ql=[]; t=1; disp('used 2nd') else • ql=ql+l; end end else RR=[RR R(i)]; end end

numR=numel(R); numRR=numel(RR); if numRR

117 end Lnew=LL; Rnew=RR; [y]=min(numel(R~), numel(LL»; • Lnew=Lnew(1 :y); Rnew=Rnew(1 :y);

Lnew=Lnew-l; Rnew=Rnew+ 1; L T= Lnew*tau+round( winl2 RT=Rnew*tau+win return

7.4 "Other" Segmentation

function [LTmur,RTmur,Flag;Num_e_vector]=murrnur2(Sl,Z); e_ vector=S 1; total_energy=sum( e_vector); % determine the number of eigenvectors required to get at least 90% of the total energy accum_ energy=O; Num_e_vector=l; , while accurri_energy<=90 accum_energy = accum_ energy+e_ vector(Num_ e_ vector)/total_ energy* 100; Num_ e_ vector=Num_ e _ vector+ 1; end count=O; VL_energylog=[]; win=32; tau=8; , SigL=Z(Num e vector,:); for i=l :tau:(1en~(SigL)-win) sig=SigL(i:(win+i»; count=count+ 1;

118 yl =sum«sig.1\2»; VL_energylog=[VL_energylog yl]; end N=length(SigL); fl =1.5; order 1=sort(SigL); • Meanl =mean(orderl (I :.25*N»; Std_devl =std(orderl (I :.25*N»; mthreshl=Meanl +fl * Std devi II =find(VL--,:energylog>=mthreshl);

% LE~T EDGE (RISING EDGE) LL=[]; LL(I )=11 (1);

% RIGHT EDGE (FALLING EDGE) R=[];

gap=8; • for i= 1 :(length(Il )-1) if Il (i+1 »I1 (i)+gap R=[R Il(i)]; LL=[LLI1(i+I)]; end end R(length(R)+ 1)=Il(length(Il »;

Lmur=LL-l; Rmur=R+1;

L Tmur=Lmur*tau+round(winl2)-round(taul2);%+(round«win-tau)I2»; %RTmur=Rmur*tau+win-round(taU/2); RTmur=Rmur*tau+round(winl2)-round(tau/2);

if length(LTmur)<2 Flag=O;

119 ,.

else Flag=l; end return

7.5 Primary Component Labeling

function C=labe1v3(LT,Rn Components=[]; for i= 1 :nume1(LT) " Components = [Components LT(i) RT(i)]; end

% FIND THE NUMBER OF SAMPLES IN EACH COMPONENT (each right - each left) % FIND THE NUMBER OF SAMPLES BETWEEN EACH COMPONENT (i.e. time between % components) (take the start of component - end of prior component) Ctime=[]; Cbetween=[]; for i=2:2:numel(Components) Ctime=[Ctime Components(i)-Components(i-l)]; if i-=numel(Components) Cbetween=[Cbetween Components(i+ 1)-Components(i)]; end end

% USE Cbetween to find the biggest gap between 2 components. The component % following this gap is either a S 1 or a S4. Here we assume that it is a % S 1, therefore the next component must be a S2. Since S 1 is always % followed by an S2.

[S 1_between,S _index ]=max(Cbetween); if S_index=length(Cbetween)

120 S2_between=Cbetween(Sjndex-l); S2_S=S_index; S2 _len=Ctime(S2 _ S); else , S2 _ between=Cbetween(S_index+ I); S2_S = S_index+2; % Component(S_index+2) = a S2 , f S2_len = Ctime(S2_S); end

SI_S = S_index+l; % Component(S_index+l) = a SI

S I - len = Ctime(S IS);-

ep I =30; % Number of samples that the pause between a' component and S I can vary Sltl=.5*SI_len; % Number of samples that the length ofSI can vary by •

ep2=30; S2tl =.45*S2_len; •

% FINDING ALL THE SI COMPONENTS S 1_starts(l )=S L... S; while length(SI_staits)<2 epl =epl *1.25; % Increase the allowed pause when you cannot find at least two Sl's for i = I :I ength( Cbetween) % Check ifCbetween(i»=SI_between-epl & Ctime(i+I»=SI_len - Sltl & Ctime(i+I)<=SUen + Sltl SI_S = [SI_S i+l]; end end % extract unique components (i.e. just find the ones that haven't been % indentified) S• l_starts=unique(S 1_S); end S l_starts"::'Unique(sort(S I_starts»;

121 %check 81 components (the indices must all be at least 2 apart). If they %afe not then mark the vector with a letter 'b' diff ind8 I =[]; for i=2:length(SI_starts) if 8 1_starts(i)-S 1_starts(i-I »=2 diff_indS 1=[ diff_indS I S I_starts(i)-S 1_starts(i-I )]; else > diff_indSI=[diffjndSI 'b']; end end S2 _starts(I)=S2_8; iflength(Cbetween)<=3 c=l; else c=2; end while length(S2_starts )=S2_1en - 82tl & Ctime(i+I)<=82_len + S2tl 82_8 = [82_8 i+I]; end end % extract unique components (i.e. just find the ones that haven't been % indentified) 82_starts=unique(82 _8); end

82_starts=sort(unique(S2 _starts»;

%check 82 components (the indices must all be at least 2 apart). If they %are not then mark the vector with a letter 'b' diff_ ind82=[];

122 '. for i=2:length(S2_starts) if S2_starts(i)-S2_ starts(i-l »=2 diff_indS2:=[ diff_indS2 S2_ starts(i)-S2 _starts(i-I )]; else difUndS2=[diff_indS2 'b']; end end

o/? Determine ifthere are any invalid components. Note invalid ones are % tagged with a character in the vector. S I valid=isnumeric(diff _indS I); ,< S2valid=isnumeric(diff _indS2);

%Determine the number of unique components in each of the difference %vector. diffS I =length(unique(diff_indS 1»; diffS2=length(unique(diff_indS2»; , .

if S 1valid= I ~ S2valid = 1 %Both are valid, then check to make sure that their difference are same , %check each to make sure that the difference are all equal C=zeros( I ,numel(Ctime»; num_ detected~length(S 1_starts)+length(S2 _starts); numcomp=unique(diff _ indS 1); if length(numcomp»1 numcomp,:!umcomp(2)-numcomp(1 ); end

%note: here diff_indSI or diff_indS2 tells you how many components there are C(SI starts)=I; C(S2 _starts )=2; z=find(C=O); %# of components detected is at least half the # of the total components just go ahead and label the rest for i=1 :Iength(z); ifz(i)+numcomp>length(Ctime)

123 C(z(i)=C(z(i)-numcomp); else C(z(i) )=C(z(i)+numcomp); end ,. • end • elseif S I valid=O & S2valid= 1 % S I has invalid components % check and see if S2 has all equal difference component indicies if diffS2=1 %ifthe difference vector for S2 only has 1 unique value then we can trust the labeling for S2 C=zeros( I ,length( Ctime»; • C(S2 starts)=2; end % we know for sure that Component(S_index+ 1)=S 1 C(S index+I)=l; numcomp=unique(diff_indS2);

for i=S _index+ I :numcomp:length(Ctime) C(i)=l; end for k=S _index+ 1:-Iiumcomp: 1 C(k)=l; end for i=S _index+2:numcomp:length(Ctime) C(i)=2; end fork=S _index+ 2:-numcomp: 1 C(k)=2; end elseif S I valid= 1 & S2valid=O ifdiffSl=1 C=zeros(1- ,length(Ctime»; C(SI_starts)=I; numcomp=unique(diff_indS 1); for i=S _ index+ I :numcomp:length(Ctime) C(i)=I;

124 end • for k=S jndex+ 1:-numcomp: 1 C(k)=l; end for i=S jndex+2:numcomp:length(Ctime) C(i)=2; end for k=S _index+2:-numcomp: 1 C(k)=2; end end end

% FIND ALL PLACES THAT ARE NOT LABELED z=find(C=O); difUnd_NON=[]; for'i=2:1ength(z) difCind_NON=[difUnd~NON z(i)-z(i-I)J; end 'diffNON=unique(difUnd_NON); ifnumel(diffNON)=1 & diffNON=numcomp C(z)=diffNON; end return

125 8 References

I. B. Ergen, Y. Tatar. The Analysis of Heart Sounds Based on Linear and High Order

Statistical Methods. Proc. 23rd EMBS Con! Istanbul, Turkey, 2001, 2139-2141.

2. S. Daliman, A. Sha'ameri. Time-Frequency Analysis of Heart Sounds and Murmurs.

Infonnation, Communications and Signal Processing, 2003 and the Fourth Pacific

Rim Conference on Multimedia 2003. Singapore, Volume 2, 840-843.

3. A. Djebbari, F. Bereksi Reguig. Short-time Fourier transform analysis of the

phonocardiogram signal. The 7th IEEE International Conference, 2000, Volume 2,

844-847.

4. B. Hubbard, The World According to Wavelets (Matick, MA: A K Peters, Ltd., 1998).

5. L. Huiying, L. Sakari, 1. Hartimo. Heart sound segmentation algorithm based on heart

sound envelogram. Computers in 1997, Lund, Sweden, 105-108. • . 6. L. Huiying, L. Sakari, 1. Hartimo. A Heart Sound Segmentation Algorithm Using

Wavelet Decomposition and Reconstruction. Computers in Cardiology, 1997, Lund,

Sweden, 105-108.

7. J. ~ee, S. Lee, 1. Kim, H. Min, S. Hong. Comparison between Short Time Fourier and

Wavelet Transform for Feature Extraction of Heart Sound. TENCON 99. , Proceedings of the IEEE Region 10 Coriference. Volume 2, 15-17 Sept. 1999 1547 -

1550.

8. H. Liang, S: Lukkarinen, 1. Hartimo. A Boundary Modification Method for Heart

Sound Segmentation Algorithm. Computers in Cardiology. 1998, Espoo, Finland,

593-595.

126 9. C. Mahnke, Cardiology (seminar), University of Hawaii at Manoa.

10. S. Mangione and L.Z. Nieman, Cardiac auscultatory skills of internal and

family practice trainees. A comparison of diagnostic proficiency, The Journal of the

American Medical Association, Vol. 278, No. 9, pp. 717-722, September 3, 1997.

II. R.I. Matthews, Cardiology (website). http://www.rjmatthewsmd.com.

12. J.H. Moller, Essentials ofP ediatric Cardiology, second ed. (F.A. Davis Company,

1978).

13. S. Omran, M. Tayel. A Heart Sound Segmentation and Feature Extraction Algorithm

Using Wavelets. Computers in Cardiology 1997, Lund, Sweden, 105-108.

14. R. M. Rangayyan and R. J. Lehner, Phonocardiogram Signal Analysis: A Review,

CRC Critical Reviews in . Vo1.l5, Issue 3, pp. 211-2236,

1998.

15. T.R. Reed, N.E. Reed and P. Fritzson, Heart sound analysis for symptom detection

and computer-aided diagnosis, Modeling Practice and Theory.

12(2004): 129-146.

16. M. A. R. Santos and M. N. Souza. Detection of First and Second Cardiac Sounds

Based on Time Frequency Analysis. Proc. 23rd EMBS Con! Istanbul, Turkey, 200 I ,

1915-1918.

17. H. Sava, P. Pibarot, L. Durand. Application of Matching Pursuit Method for

Structural Decomposition and Averaging of Phonocardiographic Signals. Medical

and Biological Engineering and Computing, 1998.

18. M. Shen, L. Sun. The Analysis and Classification of Phonocardiogram Based on

Higher-order Spectra. Proceedings of the IEEE Signal Processing Workshop, 1997,

29 - 33.

127 19. G. Strang, T. Nguyen, Multirate Wavelets and Filter Banks (Wellesley, MA:

Wellesley-Cambridge Press, 1996).

20. B. Suter, Multirate and Wavelet Signal Processing (Chestnut Hill, MA: Academic

Press, 1998).

21. M. M. Tatsuoka, Multivariate Analysis (New York, NY: Macmillan, 1988).

22. K. Usman, M. Sadiq, H. Juzoji, I. Nakajima. A Study of Heartbeat Sound Separation

Using Independent Component Analysis Technique. Enterprise Networking and

Computing in Healthcare Industry, 2004,92 - 95.

23. The MathWorks (website),

http://www.mathworks.comlaccesslhelpdesklhelp/toolboxlwaveletlwavelet.shtml.

24. Texas Heart Institute at St. Luke's Episcopal (website),

http://www.tmc.edulthi/anatomy2.html.

25. P. Schniter, Short Time Fourier Transform (website),

http://cnx.rice.edulcontentlmI0417Ilatestl.

128