Optimal Wavelets for Electrogastrography
Matching a wavelet to class of signals can be of interest in feature detection and classification based on wavelet representation. The aim of this work is to provide a quantitative approach to the problem of matching a wavelet to electrogastrographic (EGG) signals. Visually inspected EGG recordings from sixteen dogs and six volunteers were submitted to wavelet analysis. Approximated waveletbased versions of EGG signals were calculated using Pollen parameterization of 6tap wavelet filters and wavelet compression techniques. Wavelet parameterization values that minimize the approximation error of compressed EGG signals were sought and considered optimal. The wavelets generated from the optimal parameterization values were remarkably similar to the standard Daubechies3 wavelet.
Keywords Electrogastrography, gastric electrical activity, matching wavelets, optimization techniques.
1 Introduction
Cutaneous recordings of gastric electrical activity (GEA) known as electrogastrography (EGG), can play a major role in the diagnosis of gastric motility disorders [1]. Because of its lowcost and noninvasiveness, the EGG technique has great appeal as a clinical tool and has been related to various gastric motility abnormalities [2]. Multiple studies have been conducted in other to analyze EGG recordings. Although signal processing of EGG signals has been considered essential for extracting clinically relevant information, various traditional methods have been utilized with limited success [3].
Recently, advanced signal processing techniques, such as wavelets, have been employed to analyze electrogastrograms [4, 5, 6, 7, 8]. This approach has been used to (i) propose new wavelets that can offer a better timefrequency localization of EGG recordings [4, 5]; (ii) perform noise detection in EGG signals [6]; (iii) cancel artifacts related to stimulation [7]; and (iv) characterize global gastric electrical dysrhythmias [8]. An important aspect of wavelet analysis is related to designing a wavelet that matches a class of signals. Although wavelet matching can be of great importance for detection and classification [9], wavelets that match EGG signals have not been systematically sought.
The present study addresses the problem of finding a wavelet that best “matches” the waveshape of EGG signals in basal state. Although there are numerous issues concerning the choice of wavelet for signal analysis [9], generally, a wavelet can be regarded as best suited to a class of signals if the latter can be represented by as few wavelet coefficients as possible [10, 11]. Thus, wavelets which resemble the waveshape of the signal under analysis are often selected.
In the framework of the proposed research methodology, an optimal wavelet is sought that can adequately represent a waveletcompressed EGG signal at a given compression ratio. The optimality is detected by minimizing an error measure between the original signal and its compressed version, subject to the choice of wavelet. If, for a given wavelet, the error associated with the compressed signal were minimal, then its wavelet coefficients were considered to best represent the original signal. Therefore, the selected wavelet would more effectively “match” the signal under analysis when compared to other wavelets in consideration [12].
Consequently, the ultimate aim of this study is to quantitatively determine a wavelet suitable for the analysis of basal EGG recordings in canine and human models.
2 Methods
2.1 Experimental Setup
2.1.1 Canine Experiments
After a laparotomy and the installment of six pairs of internal subserosal stainless steel wire electrodes into the antral gastric wall of sixteen acute dogs (seven female and nine male), the abdominal wall was closed and five neonatal electrodes (Conmed, Andover Medical, Haverhill, MA, USA) were placed cutaneously along the projection of the gastric axis. These five electrodes were grouped to form eight EGG channels. In addition, the setup provided six internal GEA channels. However, in the present study only the EGG channels were processed, while the internal GEA recordings were used as a visual reference only to verify that normal electrical activity was present. The electrode combination set and a diagram of the physical location of the electrodes are depicted in Figure 1.


Thirtyminute EGG recordings were performed in the basal state. The captured EGG signals were conditioned by a 0.02–0.2 \hertz lowpass first order Butterworth active filter. After amplification, 12bit analogtodigital conversion was performed using a sampling frequency of 10 \hertz and Labmaster 20009 16channel analogtodigital converter (Scientific Solutions, Vancouver, BC, Canada).
2.1.2 Human Experiments
Using a similar 8channel EGG configuration, onehour recordings from six normal volunteers (two female, four male) in postprandial state (500 Kcal, 52% carbohydrates, 19% proteins, and 29% fat) were obtained. The average body mass index for the volunteers was 22.2 \kilogram⋅\rpsquare\metre (SD 3.0 \kilogram⋅\rpsquare\metre). Signal conditioning, amplification and digitization process similar to the ones utilized in the canine experiments were implemented.
All experiments were approved by the Animal Welfare Committee and the Ethics Committee at the Faculty of Medicine, University of Alberta.
2.1.3 Signal Preprocessing
Since both canine and human recordings were of significant duration, the raw EGG data were intermittently contaminated with a multitude of artifacts, including: (i) motion artifacts; (ii) spontaneous variations in electrode potentials; (iii) respiration; (iv) signal saturation during recording; (v) electrocardiac activity; and (vi) loss of signal during recording. Usually these artifacts appeared simultaneously in all recording channels. Some of these noisy patterns were visually evident (e.g., iv and vi) and could be easily identified and discarded [3]. This practice has been recommended before in order to obtain a more reliable signal for subsequent analysis [13].
Therefore, for each subject, a 10minute time interval of channelsynchronized data was manually selected. These data were considered to be free from identifiable noise patterns.
2.2 Signal Analysis
2.2.1 Wavelet Compression
In a discretetime formalism wavelet transforms are performed via the Fast Wavelet Transform using Mallat’s pyramid algorithm for decomposition (forward transform) and reconstruction (inverse transform) [10].
Let be a discrete signal with points (a sampled version of the analog signal ). The discrete wavelet transform (DWT) of is computed in a recursive cascade structure consisting of decimators and complementing filters (lowpass) and (highpass), which are uniquely associated with a wavelet [14]. Fig. 2 depicts a diagram of the filter bank structure.
At the end of the algorithm computation, a set of vectors is obtained , where is the number of decomposition scales of the DWT. This set of approximation and detail vectors represents the DWT of the original signal. Vectors contain the DWT detail coefficients of the signal in each scale . As varies from 1 to , a finer or coarser detail coefficient vector is obtained. On the other hand, the vector contains the approximation coefficients of the signal at scale . It should be noted that this recursive procedure can be iterated times at most. Usually, the procedure is iterated times. Depending on the choice of , a different set of coefficients can be obtained. Observe that the discrete signal and its DWT have the same length . The inverse transform can be performed using a similar recursive approach [10]. Generally, a signal can be subject to various wavelet decompositions. The analysis depends on (i) the choice of wavelet (filters and ); and (ii) the number of decomposition levels (scales) .
A waveletbased compression scheme aims to satisfactorily represent an original discrete signal with as few DWT coefficients as possible [11, 15, 16]. One simple and effective way of doing that is to discard the coefficients that, under certain criteria, are considered insignificant. Consequently, the signal reconstruction is based on a reduced set of coefficients [11, 17].
In the present work the classic scheme for nonlinear compression was used [11]. This procedure considers an a posteriori adaptive set, which keeps wavelet transform coefficients that have the largest absolute values. A hard thresholding was used to set the remaining coefficients to zero. The number of coefficients to be retained was determined according to the desired compression ratio , which was defined by
(1) 
where and are the number of wavelet transform coefficients of the original and the compressed signals, respectively.
2.2.2 Measurement of Distortion
To further the analysis, it is necessary to introduce an error measure to compare the original discrete signal with its reconstruction . Several measures that allow the evaluation of the effect of compression schemes have been suggested [18]. However, one of the most commonly used is the Percent Rootmeansquare Difference () [15, 18, 16], which was utilized in the present study as a measure of distortion in the compression scheme. The of two signals, and , both of length , is defined by:
(2) 
2.3 Choice of Parameters
2.3.1 Number of Scales
In order to select the number of scales of the wavelet transform decomposition, the following criterion was introduced: was chosen so that the coarsest approximation scale had a pseudofrequency close to the EGG dominant frequency of 4–6 cycles per minute for the canine subjects [19] and 3 cycles per minute for the humans.
The pseudofrequency of a given scale is
(3) 
where is the sampling period (0.1 \second) and is the center frequency of a wavelet (the frequency that maximizes the magnitude of the Fourier transform of the wavelet) [14]. Consequently, a scale was selected which minimized the difference . Table 1 shows the number of decomposition levels for some common wavelets.
Wavelet  

Canine  Human  
Haar  7  8 
Daubechies2  6  7 
Daubechies3  7  7 
Coiflet1  7  7 
2.3.2 Compression Ratio
A compression ratio set was selected and a matching procedure was carried out aiming at optimizing the choice of wavelet.
2.4 Optimization of the Wavelet Choice
In the context of the present study, a wavelet was sought that minimized the between the original EGG signal and its reconstruction for a given compression ratio.
However, the abundance of wavelets [10] makes such approach prohibitive. As a result, some constraints on the choice of wavelet were introduced.
It is well known that wavelets can be generated from discrete finite impulse response (FIR) filters [14]. In the present work, the analysis was limited to wavelets generated by FIR filters with length no greater than six coefficients. In this subset of wavelets one may find Haar, Daubechies2, Daubechies3, and Coiflet1 wavelets, to name the most popular ones [10].
This restriction is quite convenient, since all FIR filters of length up to six that can be utilized to generate wavelets have simple parameterizations of their coefficients [20]. For example, Pollen parameterization of 6tap wavelet filters [21] has two independent variables . Varying these two parameters, a filter that generates a new wavelet can be defined. Consequently, the Pollen parameterization defines a plane on which every point is connected to a wavelet [21].
Using the discussed compression scheme, one can compute a value for each wavelet generated from a point with coordinates on the parameterization plane. Doing so, a surface can be defined by the points . Thus, the minima of this surface correspond to the point coordinates that generate a wavelet with good “matching” properties, since the values at these minima are small.
As a result, a set of point coordinates could be determined on the parameterization plane, which minimizes the for each EGG recording . Fig. 3 shows typical surfaces generated for basal canine and human EGG signals.
Taking the mean value of the minima, the best wavelet parameterization could be defined. Thus, generates a wavelet that on average “matches” best the normal EGG recordings.
3 Results
The optimal values of the wavelet parameterization were determined for the selected compression ratios (Table 2). The values for compression ratio of 3 were associated with the wavelets depicted in Fig. 4. It is worth mentioning that the proposed wavelets were very similar to the classic Daubechies3 wavelet. The correlation coefficient between Daubechies3 and the optimal EGG wavelet was 0.996 and 0.965, for canine and human signals respectively. Since Daubechies3 is (i) very similar to the proposed wavelet; and (ii) easily available in many software packages (e.g., Matlab (The Mathworks, Inc., Natick, MA, USA)), it can be chosen instead of the proposed wavelets. Previous empirical findings [5] confirm this observation.
4 Conclusion
The problem of finding optimal wavelets to “match” EGG signals was quantitatively addressed. The proposed wavelets can be considered as tools to further EGG signal analysis. Moreover, the suggested methodology opens an avenue towards the classification of electrogastrograms based on the value of their wavelet compressed version, either applying the obtained optimal wavelets or the standard Daubechies3.
Acknowledgments
This work was partially supported by Natural Sciences and Engineering Research Council of Canada (NSERC) and the National Council for Scientific and Technological Development (CNPq, Brazil).
References
 [1] A. J. P. M. Smout, E. J. Van Der Schee, and J. L. Grashuis, “What is measured in electrogastrography?” Dig. Dis. Sci., vol. 25, no. 3, pp. 179–186, Mar. 1980.
 [2] M. Bortolotti, “Electrogastrography: A seductive promise, only partially kept,” Amer. J. Gastroenterol., vol. 93, no. 10, pp. 1791–1794, Oct. 1998.
 [3] M. A. M. T. Verhagen, L. J. Van Schelven, M. Samsom, and A. J. P. M. Smout, “Pitfalls in the analysis of electrogastrographic recordings,” Gastroenterology, vol. 117, no. 2, pp. 453–460, 1999.
 [4] X. Xie and H. H. Sun, “Sinusoidal timefrequency wavelet family and its application in electrogastrographic signal analysis,” in Proc. 20th Ann. Int. Conf. IEEE Eng. Med. Biol. Soc., vol. 3, Hong Kong, China, 1998, pp. 1450–1453.
 [5] C. Ryu, K. Nam, S. Kim, and D. Kim, “Comparison of digital filters with wavelet multiresolution filter for electrogastrogram,” in Proc. Second Joint BMES/EMBS Conf., Houston, USA, Oct. 2000, pp. 137–138.
 [6] J. Liang, J. C. Cheung, and J. D. Z. Chen, “Noise detection and denoising on electrogastrography using nonorthogonal multiresolution wavelet analysis,” in Proc. 18th Ann. Int. Conf. IEEE Eng. Med. Biol. Soc., vol. 3, Amsterdam, Netherlands, 1996, pp. 1039–1040.
 [7] H. Liang and Z. Lin, “Stimulus artifact cancellation in the serosal recordings of gastric myoelectric activity using wavelet transform,” IEEE Trans. Biomed. Eng., vol. 49, no. 7, pp. 681–688, Jul. 2002.
 [8] W. Qiao, H. H. Sun, W. Y. Chey, and K. Y. Lee, “Continuous wavelet analysis as an aid in the representation and interpretation of electrogastrographic signals,” in Proc. 15th Southern Biomed. Eng. Conf., Dayton, USA, Mar. 1996, pp. 140–141.
 [9] J. O. Chapa and R. M. Rao, “Algorithms for designing wavelets to match a specified signal,” IEEE Trans. Signal Processing, vol. 48, no. 12, pp. 3395–3406, Dec. 2000.
 [10] S. G. Mallat, A Wavelet Tour of Signal Processing, 2nd ed. Academic Press, 1999.
 [11] M. Vetterli, “Wavelets, approximation, and compression,” IEEE Signal Processing Mag., vol. 5, pp. 59–73, Sep. 2001.
 [12] R. A. Gopinath, J. E. Odegard, and C. S. Burrus, “Optimal wavelet representation of signals and the wavelet sampling theorem,” IEEE Trans. Circuits Syst. II, vol. 41, no. 4, pp. 262–277, Apr. 1994.
 [13] H. P. Parkman, W. L. Hasler, J. L. Barnett, and E. Y. Eaker, “Electrogastrography: a document prepared by the gastric section of the american motility society clinical GI motility testing task force,” Neurogastroenterology and Motility, vol. 15, pp. 89–102, 2003.
 [14] M. Misiti, Y. Misiti, G. Oppenheim, and J.M. Poggi, Wavelet Toolbox User’s Guide, 2nd ed. New York: The MathWorks, Inc., 2000.
 [15] A. Chagas, E. Da Silva, and J. Nadal, “ECG data compression using wavelets,” in Computers in Cardiology, Cambridge, USA, Sep. 2000, pp. 423–426.
 [16] Z. Lu, D. Y. Kim, and W. Pearlman, “ECG signal compression with a new wavelet method,” in Proc. First Joint BMES/EMBS Conf., Troy, USA, Oct. 1999, p. 955.
 [17] M. Unser and A. Aldroubi, “A review of wavelets in biomedical applications,” Proc. IEEE, vol. 84, no. 4, pp. 626–638, Apr. 1996.
 [18] R. Besar, C. Eswaran, S. Sahib, and R. J. Simpson, “On the choice of the wavelets for ECG data compression,” in Proc. Int. Conf. Acous., Speech, and Signal Processing, Jun. 2000, pp. 1011–1014.
 [19] M. P. Mintchev, A. Girard, and K. L. Bowes, “Nonlinear adaptive noise compensation in electrogastrograms recorded from healthy dogs,” IEEE Trans. Biomed. Eng., vol. 47, no. 2, pp. 239–248, Jan. 2000.
 [20] H. Zhou and A. H. Tewfik, “Parametrization of compactly supported orthonormal wavelets,” IEEE Trans. Signal Processing, vol. 41, no. 3, pp. 1428–1431, Mar. 1993.
 [21] A. H. Tewfik, D. Sinha, and P. Jorgensen, “On the optimal choice of a wavelet for signal representation,” IEEE Trans. Inform. Theory, vol. 38, no. 2, pp. 747–765, Mar. 1992.