Keywords

1 Introduction

Heart comprises of four chambers—the right & left atrium and the right & left ventricle. The automatic pacemaker in the heart is known as the sinoatrial (SA) node which is located in the right atrium [1]. It presents its activity in the form of electrical signal known as Electrocardiogram (ECG) signal. ECG is a non-invasive process of heart diagnosing during which action potentials are generated and combined in the form of three waves known as P-QRS-T waves [2, 3]. ECG is mostly used for diagnosing arrhythmias, coronary heart disease, heart attacks and cardiomyopathy [4, 5].

Over the last two decades, cardiac arrhythmia seeks huge attention in health care due to availability of ECG diagnostic tool which has great reproducibility [6]. During cardiac arrhythmias, heart’s blood supply is blocked or interrupted during coronary heart disease and is completely blocked suddenly [7, 8]. And heart walls get thickened or enlarged during cardiomyopathy.

Other important ECG features are estimation of optimal trajectory of P-QRS-T wave in case of normal and highly noisy environment, spectral components estimation, etc. [9, 10]. In past literature, various techniques have already been incorporated in ECG signal analysis such as maximum mean minimum (MaMeMi) filter [11], autoregressive time-frequency analysis (ARTFA) [12, 13], chaos analysis [14,15,16], fractional Fourier transform (FrFT) [17], wavelet-based techniques [18,19,20], signal entropy [21], K-means algorithm [22], support vector machine (SVM) [23], principal component analysis (PCA) [24, 25], savitzky golay digital filtering (SGDF) [26], autoregressive (AR) modelling [27] and Stockwell transform (S-transform) [28]. Unfortunately, these proposed techniques have not universally accepted due to its operating limitations. Moreover, these techniques were resulted into large FNs and FPs. These issues are motivated to propose an emerging tool in biomedical digital signal processing (BDSP). In this paper, a spectrogram-based feature extraction is proposed which is squared magnitude of the short-time Fourier transform (STFT) presenting a signal in joint time-frequency domain [29,30,31].

2 Related Work

Every new research work is initiated in the context of shortcomings of the previous methodologies. Therefore, this section contains the diverse literature survey on ECG signal analysis [32,33,34,35,36,37,38,39].

In [32], M. Mortezaee et al. proposed a singular spectrum analysis (SSA)-based denoising the ECG signals. They used the following steps—(i) embedding, (ii) singular value decomposition, (iii) grouping and (iv) diagonal averaging. But the execution of these steps is not easy even requires special attention. In [33], S. Chandra et al. used cosine modulated filter bank for data compression of ECG datasets. It requires the involvement of interpolated finite impulse response prototype filter, linear iteration technique, thresholding and run length encoding for its smooth conduction. In [34], S. S. Mehta and N. S. Lingayat proposed the detection of QRS complexes using support vector machine (SVM). They used two techniques for pre-processing of raw ECG datasets—(i) digital filtering and (ii) entropy criterion and presented detection rate (DR) of 99.79%. In [35], P. Marwaha and R. K. Sunkaria proposed sample entropy for investigation of ECG datasets. They used physiologic and pathologic time series with multiscale entropy for classifying different types of cardiac arrhythmias.

3 Materials and Methods

Electrical signals are recorded using electrodes from the surface of the body. Electrodes convert the ionic current energy into electrical current energy. In this paper, 23 real-time datasets are used obtained by BIOPAC machinery MP35 at 360 Hz sampling rate. Figure 1 shows proposed methodology.

Fig. 1
figure 1

Proposed methodology

3.1 Pre-processing Using DBPF

Digital band pass filtering (DBPF) is obtained by cascading of high pass and low pass filtering sections [40]. To get the smooth conduction of DBPF, proper selection of cut-off frequencies of high pass and low pass sections is so important.

3.2 Spectrogram

In spectrogram, sequences of spectra are shown [41,42,43] in which one axis is dedicated to time, and second axis is dedicated to frequency. And brightness or colour shows strength of a frequency component at each time frame [42]. It is given as [44,45,46]

$$X_{f} \left( {t,f;s} \right) = \mathop \int \limits_{ - \infty }^{ + \infty } f\left( \alpha \right) \cdot s^{*} \left( {\alpha - t} \right) \cdot {\text{e}}^{ - j2\pi f\alpha } \cdot {\text{d}}\alpha$$
(1)

where s, t and f are the window function, time variable and frequency variable, respectively.

3.3 K-Nearest Neighbour (KNN) Classifier

KNN is used in classification problem due to three main reasons such as easy to interpret output, accuracy and predictive power. These are the main motivations to apply KNN in this paper. For achieving it, the distance between test data and each row of training data is estimated [47,48,49].

3.4 Figures-of-Merit (FoM)

In this paper, two figures-of-merit (FoM) are considered which are duplicity (D) and detection rate (DR) [49, 50].

$${\text{Duplicity}}\left(D\right) = \frac{{{\text{No}}{.}\,{\text{of}}\,\left( {{\text{TP}} + {\text{FP}} + {\text{FN}}} \right) - {\text{Actual}}\,{\text{beats}}}}{{{\text{Actual}}\,{\text{beats}}}} \times 100\%$$
(2)
$${\text{Detection}}\,{\text{Rate}}\,\left( {{\text{DR}}} \right) = \frac{{{\text{Total}}\,{\text{True}}\,{\text{Positive}}\,\left( {{\text{TP}}} \right)}}{{{\text{Total}}\,{\text{actual}}\,{\text{beats}}}} \times 100\%$$
(3)

4 Results and Discussion

Baseline wander (BLW) and power line noises (PLNs) are very annoying problem in ECG signal which makes its interpretation/classification problem very tedious [51]. After digital band pass filtering, these are effectively removed, and feature extraction step starts. It is achieved by selecting different window functions which is selected according to the condition of ECG datasets/minimum spectral leakage effect [12]. Figure 2 shows spectrogram plot in which wave components of ECG dataset is not making any loop which indicates the presence of cardiac and non-cardiac components. For verification of frequency components, contour plot is shown in Fig. 3. In Fig. 3, it is clearly revealed that noise components are shown by red colour. Here it is not clearly mentioned the noise components according the P-Q-R-S-T wave components (cardiac components shown by sky blue, blue, green, orange, light green colour) of the ECG signal.

Fig. 2
figure 2

Spectrogram of recorded ECG dataset

Fig. 3
figure 3

Contour plot of recorded ECG dataset

Figure 4 shows spectrogram plot in which ECG dataset of the patient is making loop which indicates the removal of non-cardiac components (BLW, PLNs, etc.). Figure 5 shows cardiac components shown by sky blue, blue, green, orange and light green colour with corresponding noise components (shown by small red circles).

Fig. 4
figure 4

Spectrogram of filtered ECG dataset using hamming window

Fig. 5
figure 5

Contour plot of filtered ECG dataset using hamming window

It has been observed that the proposed work achieves DR of 99.48%, whereas Mehta and Lingayat [34] achieved DR of 99.79%. In this paper, KNN classifier is used which can handle new data seamlessly; whereas in Mehta and Lingayat [34], SVM classifier was used which is not suitable for large datasets.

5 Conclusion

This paper sketches the landscape of the raw and filtered ECG datasets and verifies using contour plot. Spectrogram effectively showcases the time-frequency-intensity spectrum using contour and trajectory plot with hamming window. It may cover various important applications and features related to computational medicine of ECG signal. The proposed technique has been tested on 23 real-time datasets and obtained D of 0.4% and DR of 99.48%.

As STFT relies on window length for better time and frequency resolution. In future, this technique may be replaced by—(i) Fractional S-transform and (ii) short-time fractional Fourier transform (STFrFT).