Savitzky-Golay Filter for Denoising Lung Sound

Nishi Shahnaj Haider R Periyasamy Deepak Joshi B K Singh About the authors

ABSTRACT

For computerized analysis of respiratory sounds to be effective, the acquired signal must be free from all the interfering elements. Different forms of noise which can degrade the quality of lung sounds are recording artifacts, power line/Radio Frequency (RF) interferences, ambient acoustic interferences, heart sound interference etc. Such interferences adversely affect the diagnostic interpretations. Powerful denoising techniques are necessary to resolve this issue. A denoising scheme for lung sounds, based on Savitzky-Golay (S-G) filter is proposed in this paper. The order and frame length of the SG filter is determined objectively using the Signal to Noise Ratio (SNR) and computational time as objective function. Maximum SNR is observed when the frame length is nearest to the value just higher than the polynomial order. This observation holds good for different levels of simulated addictive Gaussian noise. The polynomial order of 8 and frame size of 9 are found to be promising with SNR of 10.401db at computation time of 2.1ms.

Keywords:
Denoising; Frame length; Lung sound; Polynomial order; Savitzky-Golay filter

INTRODUCTION

Lung sounds are generated due to the aggravated flow of inspired air inside the lungs. Throughout its journey from inhale to exhale, the airflow remains turbulent.This turbulent airflow presses the respiratory walls until its passage through the distal airways [11 Pasterkamp, H, Kraman, S.S., Wodicka, G. R. Respiratory sounds advances beyond the stethoscope. Am J Respir Crit Care Med, 156:974-987,(1997).]. These generated lung sounds can be heard over chest walls through stethoscopes [22 Jones, A. A brief overview of the analysis of lung sounds. Physiotherapy, 81: 37-42(1995).] or can be recorded through electronic stethoscopes [33 Leng, S, Tan, RS, Chai, KTC, Wang, C, Ghista, D, Zhong, L. The electronic stethoscope. Bio Medical Engineering Online, 14:66, (2015).]. Lung sounds are observed to get vital information about diseases and respiratory health. Continuous monitoring of lung is extremely important in the situation in case of patients with severe lung disorder. Also, to recognize critical conditions during surgeries, the regular lung and heart observation is desired. Advanced computerized based lung sound analysis methods have paced its acceptance in clinical practice to do the observation and continuous monitoring of lung functioning [55 Haider, N. S., Joseph, J, Periyasamy, R. An investigation on the statistical significance of spectral signatures of lung sounds.Biomedical Research, 28 (4): 2801-2810, (2017).]. Typically, the lung sound recording is done in a clinical environment where different sources of ambient noises may be present. Lung sound signal is usually corrupted with different forms of contaminations which include background noises,power line/Radio Frequency (RF) interferences, environmental noises, heart sound interferences and recording artifacts[44 Mondal, A, Bhattacharya, P, Saha,G. Detection of lungs status using morphological complexities of respiratory sounds. The Scientific World Journal, 182938:1-9, (2014).]. Such sounds are automatically recorded while recording lung sound signal. Different diagnostic interpretations are made based on the computerized lung sound analysis. Therefore, for a successful automated lung sound based disease observation, the recorded lung sound signal should be free from any interference. However,noises are the unpreventable factors which interfere and pollutes lung sound signal. Therefore, noise interferes with its ability to bring effective diagnostic inferences[66 Wang, H, Wang, L.Y. Multi-sensor adaptive heart and lung sound extraction. Proceedings of IEEE Sensors,2: 1096-1099, (2003).

7 Wang, Z, Nuno, da Cruz J, Wan, F. Adaptive fourier decomposition approach for lung-heart sound separation.IEEE International Conference on Computational Intelligence and Virtual Environments for Measurement Systems and Applications (CIVEMSA), Shenzhen, 1-5, (2015).

8 Gnitecki, Moussavi, M.K.Z. Separating heart sounds from lung sounds-accurate diagnosis of respiratory disease depends on understanding noises. IEEE Engineering in Medicine and Biology Magazine,26(1):20-29, (2007).
-99 Iyer, V.K., Ramamoorthy, P. A., Fan, H, Ploysongsang, Y. Reduction of Heart Sounds from Lung sounds by Adaptive Filtering. IEEE Transactions on Biomedical Engineering, 33(12):1141-1148, (1986).].

Several studies have been proposed to solve noise issues to upgrade the performance of healthcare devices. Hadjileontiadis et al. [1010 Hadjileontiadis, L. J. A novel technique for denoising explosive lung sounds empirical mode decomposition and fractal dimension filter. IEEE Engineering in Medicine and Biology Magazine, 26(1): 30-39, (2007).] showed the combination of fractal dimension and empirical mode decomposition method to suppress noise from explosive lung sounds. This method decomposes the data into a series of intrinsic mode functions and then rejects the noisy portions for estimation of lung sound. Molaie et al. [1111 Molaie, M, Jafar, S, Moradi, M. H., Sprott, J. C., Golpayegani, S.M.R.H. A chaotic viewpoint on noise reduction from respiratory sounds. Biomedical Signal Processing and Control, 10:245-249, (2014).] demonstrated new method based on modified local projection algorithm to reduce noise. Considering the chaotic nature of respiratory sounds, stretching and folding features were evaluated for appropriate curve selection out of the trajectory. This method was found superior in contrast to adaptive line enhancement filter and frequency filtration method in 50-2500Hz bandwidth at whole ranges of SNR. Emmanouilidou et al. [1212 Emmanouilidou, D, McCollum, E.D., Park, D.E., Elhilali, M. Adaptive noise suppression of pediatric lung auscultations with real applications to noisy clinical settings in developing countries. IEEE Transactions on Biomedical Engineering, 62(9): 2279-2288, (2015).] reported an automated multiband denoising scheme for suppressing noise contaminations to upgrade the quality of pediatric auscultation signal. Heavy noises were suppressed using adaptive subtraction scheme. It operated in short time windows and used present frame’s signal to noise information to relax or strengthen the noise suppression. The algorithm operated in spectral domain and required prior information regarding signal of interest. This proposed algorithm was found effective in suppressing environmental noise and preserving the original lung sound, also validated by expert panel.

S-G filter is widely acceptable for multiple applications from the field of chemistry to biomedical signal processing [1313 Rivolo, S, Patterson, T, Asrress, K.N., Marber, M, Redwood, S, Smith, N.P., Lee, J. Accurate and standardized coronary wave intensity analysis.IEEE Transactions on Biomedical Engineering, 64(5):1187-1196, (2017).]. Baba et al. [1414 Baba, K, Bahi, L, Quadif, L. Enhancing geophysical signals through the use of Savitzky-Golay filtering method. Geofísica Internacional,53(4):399-409, (2014).] introduced S-G filter to denoise geophysical signals. This filter was more appropriate as filter designing was done in accordance with the noisy signal. It preserved the height and width of the original signal. Therefore, noise reduction efficiency was significantly better using this filter. Acharya et al. [1515 Acharya, D, Rani, A, Agarwal, S, Singh, V. Application of adaptive Savitzky-Golay filter for EEG signal processing.Perspectives in Science,8: 677-679,(2016).] showed the application of adaptive S-G filter in EEG signal processing. It was the self evaluative and iterative process, which replaced the lengthy trial and error process. This method supported for easy selection of optimal parameter values. Liu et al. [1616 Liu, Y, Dang, B, Li, Y, Lin, H, and Ma, H. Applications of Savitzky-Golay Filter for Seismic Random Noise Reduction. Acta Geo physica, 64(1):101-124, (2016).] presented the S-G filter to remove noise from the seismic signal. With this study, good performance was obtained in contrast to wavelet and wiener methods. Hargittai et al. [1717 Hargittai, S. Savitzky-Golay least-squares polynomial filters in ECG signal processing. Computers in Cardiology, 32:763−766, (2005).] proposed S-G filter for decreasing the undesired noise signal from electrocardiographic (ECG) signal and got significant response. Liu et al. [1818 Liu, J., Li, S., Li, X., Klein, C., Rymer, W. Z., Zhou, P. Suppression of stimulus artifact contaminating electrically evoked electromyography. Neuro Rehabilitation, 34(2): 381-389, (2014).] demonstrated the stimulus artifact suppression from electromyography (EMG) signal or M wave signal using S-G filter. Increased correlation coefficient and reduced root mean square error between clean and reconstructed M wave was obtained which indicated good performance.

There are many gaps in the existing literature in terms of algorithmic complexity and issues in accurate noise segregation from lung sound signal. Hence, there is a need to developsuch a method which could accurately denoise lung sound signal to improve its ability to aid a reliable computerized lung sound analysis. This article introduces lung sound noise cancellation using S-G filter method. This filter can be better described as finite impulse response filter, obtained during smoothening operation with the help of approximation of local least-square polynomial [1919 Krishnan, S. R., Seelamantula, C.S. On the selection of optimum Savitzky-Golay Filters. IEEE Transactions on Signal Processing, 61(2): 380-391, (2013).]. The noise rejection ability of this filter is tested by conducting several experiments on lung sound signal by adjusting the S-G filter parameter values. The SNR and computation time are calculated for each parameter setting. Following this, optimal parameter values are identified based on the performance analyzing factors. Contributions of this study are summarized as follows:

The application of Savitzky-Golay filter for Lung sound denoising.

A significant result is obtained at certain parameter tuning of Savitzky-Golay filter.

The rest of the paper is organized as follows: Section 2 presents materials and methods used in this study, section 3 presents results followed by discussion and conclusions in section 4 and 5 respectively..

MATERIALS AND METHODS

Data Recording

Lung sound recording obtained from 30 healthy subjects in the age group of 18-45 years were included in this study. Informed consent was obtained from the subjects before conducting the study. Electronic stethoscope model 3200 was used to record the breath sound signal of subjects. Recoding was done from the thorax position of each subject in sitting position. Subjects were instructed to first relax so that recording could be done at normal breathing rate. Each subject’s tidal breath was recorded for 20 seconds. All the signals were recorded in .wav file format. The sounds format was mono, 32 bits with 8000 samples per second.

Savitzky-Golay filter

The Saviztky-Golay (S-G) filtering can be considered as a generalized moving average filter. It is a low pass filter whose structure is similar to a finite impulse response (FIR) filter. It is well suited for its signal smoothening operation, thereby increasing the signal-to-noise ratio without altering the signal. This is accomplished with a process called convolution, by placing a low degree polynomial in place of successive adjacent data points by the linear least squares method.

The S-G filters are designed to fit a specific polynomial to a signal frame using least squares method. The central point of the window is replaced with that of the polynomial to produce the smoothened signal output. The polynomial can be expressed as:

ρ ( r i ) = c 0 + c 1 r . . + c p r p (1)

Where ρ’ indicates the related apparent resistivity data vector, ‘ri shows the north coordinate point of resistivity map. The designing of S-G filter can be done by first deciding the length of filter ‘k’, order of derivative n order of polynomial ‘p’ and the smoothing window size ‘N’.

N value is taken as odd with N≥p+1. The polynomial is substituted to points N=Nr+ Nl+1 of the signal when the coefficients of SG filter are applied to the signal. Here, Nl and Nr indicate the left and right signal point of a present signal point.

The polynomial coefficients can be estimated as:

M c = d (2)

Where M can be expressed as,

M = | 1 1 1 1 ( ( k 1 ) / 2 ) 1 0 1 ( ( k 1 ) / 2 ) 2 ( 1 ) 2 0 1 2 ( ( k 1 ) / 2 ) p ( 1 ) p 0 ( 1 ) p ( ( k 1 ) / 2 ) p | (3)

Vector of polynomial coefficient ‘c’ can be represented as:

c = | c 0 c 1 c 2 c p | (4)

‘ρ’ is the vector of data values of size k.

ρ = | ρ ( k 1 ) / 2 ρ ( k 2 ) / 2 ρ 0 ρ ( k 1 ) / 2 | (5)

Using least squares of the matrix, the vector of polynomial coefficients could be obtained as

c = ( M t M ) 1 M t ρ (6)

The polynomial coefficients of ‘c’ could be represented as a linear combination of row values of (MtM)-1Mtρ. The polynomial value at ρ0 can be equal to c0 as other values of polynomial are zero. At derivative order 0, the Savitzky-Golay can be showed as the coefficients of central row of matrix (MtM)-1Mtρ.

Proposed Methodology

The recorded signals were filtered by passing them through S-G filter to suppress the noise contaminants. Polynomial order and window size were the two filter parameters which were optimized to obtain good SNR values. SNR was computed by varying one parameter while keeping another as fixed and vice versa. Good SNR values were observed by simulating at many different parameter settings. Since, for each experiment SNR computation took different time hence computation time was also estimated along with calculation of SNR.

Performance Evaluation

Signal to noise ratio (SNR) and computation time were used as performance measures. SNRis estimated after filtering the lung sound signal. SNR is calculated by determining the ratio of root mean squareof signal to root mean square of noise which is further multiplied by 20× log10to obtain SNR in decibels.The input and output spectrum were analyzed based on these performance analyzing factors.

RESULTS

This section presents the results of experiments conducted. The noisy lung sound and the corresponding filtered signal using S-G filter is shown in Figure 1(a) and 1(b) respectively.

Figure 1
Lung sound signal before and after filtering: (a) noisy signal and, (b) filtered signal using S-G filter

The noise suppression can be controlled with two parameters; window size and polynomial degree. To optimizethese filter parameters, one parameter is kept constant while varying another one. While varying the parameters it was assured that the order should be smaller than frame length and frame length should be always chosen as odd. It is observed that at constant polynomial degree, if the window length is increased, the output signal gets smoothened as shown in Fig. 1(b).

Filter performance is tested for all the possible combination of parameter values. Table1 shows the maximum SNR value obtained for different combination of filter parameters along with corresponding computation time. Here, SNR1 and SNR2 are corresponding signal to noise ratio with T1 and T2 their respective computation time while denoising two different lung sound signals.

Table1
SNR values with their computation time.

The filter performance was evaluated by calculating Signal to noise ratio(SNR) and computation time. Figure 1(c) and 1(d) showed SNR plot against polynomial order keeping frame length as constant. Figure 2 shows SNR plot against frame length keeping polynomial order as constant. Figure 3 shows SNR plot against frame length keeping polynomial order as constant.

Figure 2
Plot of SNR against polynomial degree with frame length as constant.

Figure 3
Plot of SNR against frame length with polynomial order as constant.

As a result, SNR was found to maximum when frame length was selected nearest to the value just higher than polynomial order. This observation holds good for different noise levels as well.Though for an effective response good SNR is expected, but on the other hand it is also expected that high SNR should be obtained in less computation time.Therefore, computation time was also estimated after each filtration. The selection of optimum parameter was necessary to obtain the best filtered output signal. That parameter was selected as the optimalthatyields better SNR at minimum computation time.Maximum SNR values were estimated after closely observing the filter performance by adjusting the various parameter values. Referring Table 1, the polynomial order 8 and frame length 9 produced significant SNR of 10.401db in small computation time of 2.1ms. Also, the polynomial order 14 and frame length 15 produced SNR value of 10.385db at computation time of 3ms. On the other hand, the polynomial order 32 and frame length 33 resultedinto highest SNR value of 15.928db with very high computation time of86.7ms. Though very high SNR was obtained but performance was unreliable as computation time also was high. With parameter setting of polynomial order 8 and frame size 9, good SNR is obtained at low computation time. This performance is found to be better than outcomes of all other parameter settings. Figure 4 shows the single sided amplitude spectrum of noisy and filtered lung sound signal at parameter tuning of polynomial order 8 and frame size 9. With this spectrum analysis, it is clear that this filter successfully attenuates all the high frequency components present in the signal. S-G is a kind of low pass filter which attenuates the high frequency components present in the noisy lung sound signal as shown in Figure 4.Therefore, the results hold more promising at polynomial order 8 and frame length 9.

Figure 4
Single-Sided Amplitude Spectrum of: (a) noisy lung sound signal and, (b) filtered lung sound signal.

DISCUSSION

This is a novel method to reduce the noise contaminations from the lung sound signal using S-G filter. The S-G found to be simple and versatile. The proposed work involved a simple algorithm in contrast to all the available studies. It involved selection of only two parameters and original signal structure is maintained during denoising operation. Existing studies has several drawbacks. The empirical mode decomposition and fractal dimension algorithm for noise suppression from lung sound is very complicated as demonstrated by Hadjileontiadis et al.[1010 Hadjileontiadis, L. J. A novel technique for denoising explosive lung sounds empirical mode decomposition and fractal dimension filter. IEEE Engineering in Medicine and Biology Magazine, 26(1): 30-39, (2007).]. Also, this method has mode mixing issues. This method improves the signal to noise ratio but at the same time degrades the original signal.Formulation of modified local projection algorithmwas difficult as discussed by Molaie et al. [1111 Molaie, M, Jafar, S, Moradi, M. H., Sprott, J. C., Golpayegani, S.M.R.H. A chaotic viewpoint on noise reduction from respiratory sounds. Biomedical Signal Processing and Control, 10:245-249, (2014).]. It involved complex stretching and folding procedure for curve selection from trajectory. Overall, the procedure was lengthy and complex.Prior knowledge of signal of interest was required for noise rejection operation using adaptive subtraction scheme method as per Emmanouilidouet al. [1212 Emmanouilidou, D, McCollum, E.D., Park, D.E., Elhilali, M. Adaptive noise suppression of pediatric lung auscultations with real applications to noisy clinical settings in developing countries. IEEE Transactions on Biomedical Engineering, 62(9): 2279-2288, (2015).]. Also, signal and noise are not clearly separated due to their spatial predictability. Only pediatric lung sound was assessed. Adaptive subtraction is not suitable when signal and noise arecorrelated.

In contrast to the existing noise reduction methods, this proposed work demonstrates improved performance in terms of both qualitative and quantitative measurements. This work produced good signal to noise ratio (SNR) for all noise levels. Suppression of noiseand the filter performance evaluation were conducted in MATLAB® on computer system with Intel® core ™ i3-4030U, 1.90GHz processor, 64 bit operating system and 4GB RAM. After analyzing the characteristics of the entire spectrum, the optimum parameters were found to be polynomial order 8 and frame length 9. Hence, S-G filter could successfully reduce noises from the lung sound signal.

CONCLUSION

SG filter has several benefits. It supports straightforward and easy way of running the least- squares polynomial fitting. It is easy to get filter coefficients. It involves easy implementation of convolution than least -squares calculation. This filter is entirely very simple, of will full lengths and involve low computation cost.

S-G filter has several advantages over the standard filtering methods. It surpasses moving average filter in valid signal preservation. Additionally, this filter is superior in contrast to wiener filter. Wiener is also another method based on least square estimation similar to S-G filter, but wiener filter working is limited only for input characterized with wide sense stationary, and required prior information of statistical characteristics of input signal. Performance of wiener filter is affected as the existence of these two criteria’s are practically very difficult. Wavelet based denoising is also widely acceptable in denoising the seismic signal. S-G filter is better than wavelet as it has better signal perseverance quality. Though the results of proposed study are promising, there are certain limitations of this study: (i) several experiments were conducted to obtain optimal parameters of filter; (ii) the proposed approach was evaluated on limited database consisting of healthy subjects. In future, an automated parameter optimization technique can be incorporated to improve the performance of proposed methodology. Further, the method can be evaluated on larger database.

In this paper, S-G filter was used to suppress noise to improve the quality of lung soundby varying polynomial degree and frame size. SNR and computation time was taken as a performance analyzing factor. From simulation outcomes, better result is found when frame length is nearest to the value just higher than the polynomial order.With this method,lung sound noise removal was done without deforming the original signal structure.Thus, the proposed method is a significant approach for denoising lung sound signal.

REFERENCES

  • 1
    Pasterkamp, H, Kraman, S.S., Wodicka, G. R. Respiratory sounds advances beyond the stethoscope. Am J Respir Crit Care Med, 156:974-987,(1997).
  • 2
    Jones, A. A brief overview of the analysis of lung sounds. Physiotherapy, 81: 37-42(1995).
  • 3
    Leng, S, Tan, RS, Chai, KTC, Wang, C, Ghista, D, Zhong, L. The electronic stethoscope. Bio Medical Engineering Online, 14:66, (2015).
  • 4
    Mondal, A, Bhattacharya, P, Saha,G. Detection of lungs status using morphological complexities of respiratory sounds. The Scientific World Journal, 182938:1-9, (2014).
  • 5
    Haider, N. S., Joseph, J, Periyasamy, R. An investigation on the statistical significance of spectral signatures of lung sounds.Biomedical Research, 28 (4): 2801-2810, (2017).
  • 6
    Wang, H, Wang, L.Y. Multi-sensor adaptive heart and lung sound extraction. Proceedings of IEEE Sensors,2: 1096-1099, (2003).
  • 7
    Wang, Z, Nuno, da Cruz J, Wan, F. Adaptive fourier decomposition approach for lung-heart sound separation.IEEE International Conference on Computational Intelligence and Virtual Environments for Measurement Systems and Applications (CIVEMSA), Shenzhen, 1-5, (2015).
  • 8
    Gnitecki, Moussavi, M.K.Z. Separating heart sounds from lung sounds-accurate diagnosis of respiratory disease depends on understanding noises. IEEE Engineering in Medicine and Biology Magazine,26(1):20-29, (2007).
  • 9
    Iyer, V.K., Ramamoorthy, P. A., Fan, H, Ploysongsang, Y. Reduction of Heart Sounds from Lung sounds by Adaptive Filtering. IEEE Transactions on Biomedical Engineering, 33(12):1141-1148, (1986).
  • 10
    Hadjileontiadis, L. J. A novel technique for denoising explosive lung sounds empirical mode decomposition and fractal dimension filter. IEEE Engineering in Medicine and Biology Magazine, 26(1): 30-39, (2007).
  • 11
    Molaie, M, Jafar, S, Moradi, M. H., Sprott, J. C., Golpayegani, S.M.R.H. A chaotic viewpoint on noise reduction from respiratory sounds. Biomedical Signal Processing and Control, 10:245-249, (2014).
  • 12
    Emmanouilidou, D, McCollum, E.D., Park, D.E., Elhilali, M. Adaptive noise suppression of pediatric lung auscultations with real applications to noisy clinical settings in developing countries. IEEE Transactions on Biomedical Engineering, 62(9): 2279-2288, (2015).
  • 13
    Rivolo, S, Patterson, T, Asrress, K.N., Marber, M, Redwood, S, Smith, N.P., Lee, J. Accurate and standardized coronary wave intensity analysis.IEEE Transactions on Biomedical Engineering, 64(5):1187-1196, (2017).
  • 14
    Baba, K, Bahi, L, Quadif, L. Enhancing geophysical signals through the use of Savitzky-Golay filtering method. Geofísica Internacional,53(4):399-409, (2014).
  • 15
    Acharya, D, Rani, A, Agarwal, S, Singh, V. Application of adaptive Savitzky-Golay filter for EEG signal processing.Perspectives in Science,8: 677-679,(2016).
  • 16
    Liu, Y, Dang, B, Li, Y, Lin, H, and Ma, H. Applications of Savitzky-Golay Filter for Seismic Random Noise Reduction. Acta Geo physica, 64(1):101-124, (2016).
  • 17
    Hargittai, S. Savitzky-Golay least-squares polynomial filters in ECG signal processing. Computers in Cardiology, 32:763−766, (2005).
  • 18
    Liu, J., Li, S., Li, X., Klein, C., Rymer, W. Z., Zhou, P. Suppression of stimulus artifact contaminating electrically evoked electromyography. Neuro Rehabilitation, 34(2): 381-389, (2014).
  • 19
    Krishnan, S. R., Seelamantula, C.S. On the selection of optimum Savitzky-Golay Filters. IEEE Transactions on Signal Processing, 61(2): 380-391, (2013).

Publication Dates

  • Publication in this collection
    2018

History

  • Received
    27 Apr 2018
  • Accepted
    22 Aug 2018
Instituto de Tecnologia do Paraná - Tecpar Rua Prof. Algacyr Munhoz Mader, 3775 - CIC, 81350-010 Curitiba PR Brazil, Tel.: +55 41 3316-3052/3054, Fax: +55 41 3346-2872 - Curitiba - PR - Brazil
E-mail: babt@tecpar.br