Uploaded by Kithmin Wickremasinghe

A2 P2 Splitting

Heart Sound Segmentation using Stockwell Transform
and Shannon Energy
In this method, phonocardiogram (PCG) signals are segmented using the simultaneously
taken electrocardiogram (ECG) signals and envelopes of PCG signals obtained from Stockwell
transform and Shannon energy. Physionet 2016 challenge-Folder A dataset is utilized for this purpose.
At the initial stage, the temporal locations of the R peaks of ECG signals are extracted using a
modified version of the method proposed by Jiapu Pan and Willis J. Tompkins. R peak locations are
used as a reference to segment the PCG signals. As the pre-processing stage, the ECG signal is
filtered using a third order Butterworth bandpass filter with cutoff frequencies of 5 Hz and 15 Hz.
Then, a derivative filter is applied to the pre-processed ECG signal and the resulting signal is squared
point wise. As the next step, a moving average integrative filter is applied with a window of 150 ms.
R peak locations are detected by a double step thresholding process.
The PCG signal is filtered using a zero phase fifth order Chebyshev bandpass filter with
cutoff frequencies of 20 Hz and 100 Hz. The moving average filter applied to the ECG signal
introduces a delay of 150 samples (for 2000 Hz sampling frequency).and the two signals are aligned
by cropping both signals. Then, both ECG and PCG signals are normalized.
The Stockwell Transform is used to expand the PCG signal in time-frequency domains. The
envelope of the PCG signal is approximated using the maximum absolute Stockwell coefficients.
Then, the envelope is normalized and filtered using a moving average filter with a window size of 150
samples. In this work, threshold value is selected as the addition of the mean and the standard
deviation of the envelope. Then the locations of possible boundaries of S1 and S2 are detected by
thresholding the envelope.
Figure 1: The PCG signal envelope obtained using the Stockwell transform
Figure 2: Detected boundaries using Stockwell Transform (marked in red)
Among the detected boundaries, the boundaries of S1 are separated using the R peak
locations. First, the closest boundary to each R peak is located Then the gradient of the stockwell
envelope is used to determine whether that boundary corresponds to the start of S1 or the end of S1.
For the purposes of detecting S2 boundaries and S2 split, the second order Shannon energy of
the PCG signal is calculated using the following equation.
∑ π‘₯𝑖 π‘™π‘œπ‘”(π‘₯𝑖 )
A sliding window is used to calculate the Shannon energy with a length (N) of 20ms. The
window is shifted by one sample at a time to obtain the Shannon energy envelope of the same length
as the PCG signal. Then the Shannon energy envelope is normalized using the following equation
where the mean (πΈπ‘€π‘’π‘Žπ‘›) and the standard deviation (𝐸𝑆𝑑𝑑) of the envelope are calculated over a 1s
long sliding window.
𝐸 − πΈπ‘€π‘’π‘Žπ‘›
The negative values of the obtained Shannon energy envelope are set zero to obtain the
positive envelope. Further, S2 boundaries are detected minimizing the effects of murmurs using the
Shannon energy envelope by investigating the number of identified boundaries between two
consecutive S1 segments according to the following three conditions.
1. If there are no boundaries detected in the region by the Stockwell transform, then the Shannon
energy envelope of the corresponding region is compared with a threshold of 5% of the
maximum Shannon energy in the region to obtain new boundaries. Among those, the two
boundaries enclosing the maximum Shannon energy are considered as S2 boundaries.
2. If there are exactly two boundaries detected in the region, they are considered to be S2
3. If there are more than two boundaries detected by the Stockwell transform in the considered
region, then the two boundaries enclosing the maximum Shannon energy are selected as the
S2 boundaries.
Figure 3: Top - The PCG signal with identified S1 (black boundaries) and S2 (red boundaries),
Bottom - ECG signal with identified R peaks (marked in red)
Moreover, the point corresponding to the deepest local minimum in each segmented S2 is
identified as the A2-P2 split. A2 and P2 components in each S2 are identified as the maximum
Shannon energy respectively between the S2 starting point and the A2-P2 split and between the
A2-P2 split and the ending point of S2. The delay between A2 and P2 is calculated as the time
difference of those two peaks.
Figure 4: Shannon energy envelope of a segmented S2
1. In order to obtain better results using this algorithm, ECG and PCG signals must have a good
signal quality. But, when observing the Physionet 2016 challenge dataset, a significant
amount of those signals are noisy and lead to inaccurate results.
2. Since we were unable to find a dataset with proper annotations for S1 and S2, the
performance of the built algorithm is not calculated yet.
1. https://www.mdpi.com/1424-8220/19/8/1868
2. https://www.researchgate.net/profile/Samit_Ghosh6/publication/338005313_A_Novel
3. https://www.robots.ox.ac.uk/~gari/teaching/cdt/A3/readings/ECG/Pan+Tompkins.pdf