Keywords

These keywords were added by machine and not by the authors. This process is experimental and the keywords may be updated as the learning algorithm improves.

1 Introduction to GI Analysis

High resolution (HR) electrical mapping is an essential research and clinical tool that has advanced our knowledge of the electrophysiology of the major organs in our body. HR electrical mapping techniques have been used successfully to study the heart and the brain, both on the surface of the organ and on the body surface. This has led to develop diagnostic capabilities and treatment options in the field of neuroscience and cardiology. In recent years HR electrical mapping has been used to understand the gastrointestinal (GI) tract in greater detail and elucidate the mechanisms and differences between normal and abnormal activity [26, 38].

There is an underlying bio-electrical activity present in the GI tract, termed slow waves, which coordinates motility. Slow waves are generated and propagated through a specialized network of cells known as ‘Interstitial Cells of Cajal (ICCs)’, which are present in the musculature of the GI tract [13]. In canines, gastric slow waves recur around 5 cycles per minute (cpm) [27], and intestinal slow waves recur from around 10–17 cpm depending on the location [23]. Along with slow waves, electrical spike activity and migrating motor complexes are known to occur during motility [17] (see Angeli et al. “The Electrical Regulation of GI Motility at the Whole-Organ Level” of this volume for further information). In order to study the underlying GI electrical activity in a robust and reliable manner qualitative and quantitative techniques are required.

This chapter will focus on the methods and approaches that have been used in HR GI electrical mapping, and their application to clinical mapping. With HR electrical mapping there is an enormous amount of information which needs to be analysed and visualized using effective approaches. A brief overview of signal processing in relation to GI electrical signals is given, after which event detection and clustering methods are discussed. Methods to estimate the velocity and amplitude of the slow wave propagation are presented with their applications to clinical experimental recordings. This chapter concludes by exploring potential methodologies that are aimed at studying the electrical activity in the GI tract in a qualitative and quantitative manner.

2 Gastrointestinal Electrical Recording Techniques

Electrical recording of the GI tract was first attempted by Alvarez et al. [1], where he probed the stomach and intestine using Einthoven’s and D’Arsonval’s galvanometers to record electrical activity. Since then, and over the years researchers have recorded electrical activity from the GI tract intracellular (see Beyder et al.  “Role of Ion Channel Mechanosensitivity in the Gut: Mechano-Electrical Feedback Exemplified by Stretch-Dependence of Nav1.5” of this volume) and extracellularly from the mucosal and serosal surface of the organ and from the body surface (see Bradshaw et al. “Biomagnetic Signatures of Gastrointestinal Electrical Activity” in this volume), which is commonly referred to as cutaneous electrogastrograms (EGG). The signal morphology of intracellular recordings approximately matches the morphology of serosal extracellular recordings via a temporal second derivative [4, 46]. Intracellular signals provide the most detailed identifiable current movements from and into the cell, leading to the electrical activity present in the GI tract. Extracellular recordings provide a summed and distributed view of the intracellular recordings, while EGG recordings provide a summed and smoothed representation of the electrical activity present in the GI tract and body surface.

Initially few electrodes (around 4–8) were used to record the electrical activity on the surface of the gut [6, 19, 44]. This provided a valuable insight into the electrophysiology of the GI tract, and began to elucidate and generate hypotheses about the mechanisms present in the GI tract. However spatial information about the electrical activity was not addressed adequately (see Fig.1), thus motivating the development of high resolution electrical recording techniques by Lammers et al. and Du et al. [8, 25].

Fig. 1
figure 1

Identification of gastric slow wave spatial propagation using high resolution and sparse electrodes. Slow wave events are marked by a cross, and dotted arrow marks the mapping of the spatial propagation of slow waves. All of the signal traces (in gray and black) are from a high resolution electrode array [8], but the top and bottom signal traces have been shown in black to represent sparse recordings. High resolution mapping facilitates a more certain tracking and identification of the slow wave. The dashed arrows suggest possible slow wave tracking interpretations; both could be valid interpretations given only the first and last channels, but the right hand arrow is selected as correct of the slow wave given the extra information provided by the intermediate electrodes

Currently high resolution mapping electrodes which were developed for use in the GI tract have an inter-electrode distance spacing ranging from 2 to 7.62 mm, with the number of electrodes ranging from 192 to 256 [7, 8, 27]. These configurations have provided adequate coverage to map the stomach [27], intestines [23], and recently the ureter [16] of many species, including humans [34] (see O’Grady et al. “The Principles and Practice of Gastrointestinal High-Resolution Electrical Mapping” of this volume). HR mapping is attractive for mapping and tracking the electrophysiological propagation, but produces large amounts of data which require effective methods to analyse in a quantitative and qualitative manner.

3 Signal Processing

GI mapping recordings—like all bioelectric recordings—are often contaminated by various sources of noise, and noise removal is, therefore, an essential first step of signal (pre-)processing. Noise in the raw recordings can be eliminated or minimized by shielding the cables and using effective electrodes to improve signal to noise ratio (see O’Grady et al. “The Principles and Practice of Gastrointestinal High-Resolution Electrical Mapping” of this volume). In this section a brief overview of potential noise sources in gastric HR electrical mapping is given along with approaches used to eliminate them. Noise is omnipresent and its sources include: power line interference (at 50 or 60 Hz), thermally generated (Johnson) noise, other nearby electrical devices, and physiological artefacts. The commonly observed physiological artefacts for GI electrical recordings come in the form of respiration from the subject, and electrical and mechanical activity from the heart and other organs.

Noise components in bio-electrical recordings can span the entire relevant frequency range, from essentially DC to several hundred cycles per second. The low frequency noise mainly manifests as baseline wander in the signals, which is due to the time-varying electrode-serosa impedance.

Respiration typically occurs at about 8–15 cpm, which can be particularly problematic due to the large degree of spectral overlap with the small intestine slow wave frequency range.

Power line interference and other noise artefacts (frequency above 15 cpm) are classified as high frequency noise. Noise removal primarily depends on three factors: type of analysis to be performed, which frequencies of the bio-signal are of interest, and the recording hardware. With in-vivo gastric slow wave recordings, the signals have both slow (frequency below 15 cpm) and fast (frequency above 15 cpm) components. We shall examine some of the filters that have been used in sparse and HR GI mapping to eliminate noise.

With sparse gastric serosal recording, Sarna et al. [44] recorded the electrical data using analog filters with a passband of 0.35–22 Hz, while Chen et al. [6] recorded the data using analog filters with a passband of 0.05–35 Hz.

Lammers et al. [25] was among the first to start recording and analysing slow waves using HR, and applied a 20 point moving average filter. Such a filter acts as a low pass filter and eliminates power line interference (at 50 Hz) and other higher frequency components without distorting the morphology of the signal, provided its components are much less than 50 Hz. Baseline wander was not present in these studies as the recording hardware was band limited from 2 to 400 Hz.

Following on, Du et al. [8] developed HR flexible printed circuit board electrode arrays to analyse electrical activity in the GI tract. Different second order low pass Bessel filters with cut-off frequencies ranging from 2 to 10 Hz were applied in various studies to study slow waves in the stomach [8, 10, 34, 35]. Butterworth filters were also to study slow wave activity in the stomach, offline (passband 1–60 cpm) [11, 12], and in real time (passband 0.5–4 Hz) [5] using these flexible PCB electrodes. Time domain filters were also applied to the flexible PCBs, which were the moving median filter for baseline removal and a Savitzky Golay filter for high frequency noise removal, and were shown to outperform the Butterworth filter (passband 1–60 cpm) [40]. One of the advantages of time domain filters such as a Savitzky Golay filter over a frequency domain filter such as a Butterworth filter is that they can maintain the peaks and do not distort the morphology of the signal.

With GI electrical recordings, there can be both slow wave and spike activity at varying frequencies. Thus, depending on the type of analysis to be performed, appropriate filtering techniques must be used. In HR GI mapping, the common analytical tool is the use of slow wave isochronal activation time maps where the signals are marked at the point of most negative deflection. For this purpose, the signal does not need to have all of its morphological characteristics (e.g. the slow return to baseline), and a ‘harsh’ filter setting may be used. A ‘harsh’ filter is one which distorts the morphology of the slow wave (mainly eliminating the slow return to baseline component of the slow wave) and reduces its signal amplitude from the raw recording, while a ‘soft’ filter better maintains these features but is not as effective at removing unwanted signals. If the amplitude or morphology of the slow waves are to be analysed, ‘soft’ filter settings can be used, so the amplitude of the signal does not erode and also the morphology would not get distorted. Examples of ‘soft’ and ‘harsh’ filtering on a slow wave signal obtained from the serosal surface of the stomach are shown in Fig. 2. With the ‘soft’ filtering approach the baseline is removed via a moving median filter (20 second window), while with the ‘harsh’ filtering approach a high pass butterworth filter with a cut-off frequency of 20 cpm is used.

4 Slow Wave Event Detection: The FEVT Algorithm

One of the key features in GI electrical recordings is the slow wave. The onset (activation time, AT) of the slow wave defines when the traveling slow wave has arrived at a particular electrode location. Once activation times are detected across the entire array, isochronal maps depicting the spatiotemporal wave activity can be generated (see Sect. 5).

Fig. 2
figure 2

Illustration of baseline removal using two filtering techniques on serosal gastric slow waves in a porcine subject. a Gastric slow wave recording where high frequency noise has been eliminated using a Savitzky Golay filter with a polynomial order of 9 and a window size of 1.7 s. b Removal of baseline wander using a moving median window (20 s window). c Removal of baseline wander using a high pass butterworth filter with a cut-off frequency of 20 cpm. As can be seen the morphology and amplitude of the slow is altered when using a ‘harsh’ filter, but might be able to provide a more accurate fiducial point for the point of activation

In gastric serosal electrical recordings, the onset of the slow wave is typically manifested by a relatively large amplitude with a fast time-scale (high frequency) and a negative deflection in the signal. This is followed by a relatively slow recovery to baseline (Fig. 3a). The fiducial point of interest to be detected is the fast initial large transient.

Several automated methods have been developed to perform this task which vary in complexity and performance. The most basic method is simple thresholding. In this method an AT is detected when the amplitude of the recorded voltage signal (\(V(t)\)) crosses a constant threshold, which is usually set equal to the estimated noise in the signal (\(\sigma \)) multiplied by a constant (\(k\))—i.e., where \(\left| V(t)\right| \ge k \sigma \). A more sophisticated method developed by Lammers et al. detects ATs based on an “amplitude sensitive differentiator” (\(ASD\)) transform of the recorded signal: \(ASD = \left| V(t)\right| \frac{dV}{dt}\) [24]. A constant threshold was similarly used. More recently, the Falling Edge-Variable Threshold (FEVT) algorithm was designed to improve the accuracy of an automated analysis.

In brief, FEVT works by emphasizing the large amplitude, high frequency content of the original signal via a 2nd-order non-linear energy operator (NEO) transform [31] (also commonly referred to as the Teager Energy Transform [18]). Sharp downward transients are additionally emphasized by applying an edge-detector kernel [45]. Thus, the falling edge (FE) signal used to detect ATs is given by:

$$\begin{aligned} FE(t) = \left( V(t+1)V(t-1)-V(t)V(t)\right) \times \left( V(t) *d_{N_{edge}}\right) \end{aligned}$$
(1)

where \(t\) denotes an integer time index, and \(d_{N_{edge}}\) is the edge-detector kernel defined in [45], and \(\times \) indicates an element-wise multiplication and \(*\) indicates a convolution.

A time-varying threshold, which is used to identify slow wave events, is computed to account for the fact that even small variations in the slow wave waveform can produce relatively large changes in the amplitude of FE signal. Figure 3 illustrates the key steps of the algorithm. Full mathematical details of the FEVT algorithm can be found in Erickson et al. [12].

Fig. 3
figure 3

Illustration of signal processing sequence for falling-edge-detector method with variable detection threshold. a Example serosal electrode recording. Red vertical dashes denote hand-marked TOAs, while filled red circles indicate ATs detected with the Falling-Edge, Variable-Threshold algorithm. b SNEO signal computed from a. c Edge-detector signal computed from a. The horizontal dashed line marks the value of 0. Local maxima in C correspond to a falling edge in a (and vice-versa). d The result of multiplying signals b and c. e Falling Edge (FE) signal, equal to Signal d with all negative-values set to 0. The red curve represents the detection threshold which varies over time. The four “pulses” corresponding to each AT are properly detected. Reproduced from Erickson et al. [12]

Some noteworthy points on the FEVT algorithm are as follows:

  1. 1.

    The NEO transform, which is computed in the first step of the FEVT algorithm, belongs to a class of differential energy operators [29]. Its original intended usage was for radio signal detection. It was first adapted and adopted into the biomedical realm for detecting spikes in extracellular neural recordings [31].

  2. 2.

    The edge detector kernel which is convolved with the gastric serosal recording was originally used for edge detection in digital images by Sezan [45]. Explicitly zeroing out regions of the FE signal that are negative focuses the algorithm to look for downward deflections only.

  3. 3.

    The threshold signal varies in time (hence the “VT” in the algorithm’s name), and is set to a constant factor multiplied by the median of the absolute deviation. The latter is essentially a robust statistic for estimating the noise in a signal, thereby allowing for robust detection of peaks in the FE signal, which correspond to the negative deflection of the respective slow waves. This noise estimator was originally proposed and implemented by Nenadic and Burdick with application to detecting spikes in neural recordings [32]. It is beneficial in our context because the FE transform can have large peaks whose amplitude can vary from one event to the next due to small variations in the recorded signal, whether due to noise, or due to slight changes in underlying electrical signal or changing electrode impedance.

Optimizing the performance of FEVT involves judicious selection of three parameters:

  1. 1.

    Smoothing window size. The outcome is not particularly sensitive to this parameter, and generally the smoothing window size is in the range of 0–1 s for best performance.

  2. 2.

    Moving median window length. The outcome is dependent on this parameter. It should be made long enough such that the median is not strongly affected by any peaks (slow wave events) in the FE signal. It should also be made short enough that it avoids “washing out” the fine detail of peaks which could possibly vary in magnitude. In general, it should be chosen to be about 1.5 times the period at which slow waves occur. For example, for gastric slow waves occurring at 3 cpm, this parameter is usually set to about 30 s (1.5 cycles).

  3. 3.

    Detection threshold multiplier, \(\eta \). The outcome is dependent on this parameter. For higher sensitivity, \(\eta \) should be kept low; for greater specificity (avoidance of false positives), \(\eta \) should be set higher. Typically recommended values are \(\eta \) = 4–7.

The FEVT algorithm has been found to robustly detect slow waves from gastric recordings [12]. Already, it has been utilized to accelerate the analyses of slow wave spatiotemporal dynamics during normal and dysrhythmic pacemaking activity [36, 38]. It has also proven useful, though slightly less effective, at detecting slow waves in small intestine [2].

The current shortcomings of the algorithm are:

  1. 1.

    Computational expense: The computational overhead is fairly intensive, mostly due to computing the running median, but not prohibitively so. A real-time implementation [5] requires that the user wait an initial \(\approx \)20 s for the first marks to be made, but there is no additional delay in automated marking thereafter.

  2. 2.

    Improperly marking artifacts: Large transient artifacts which are not of biological origin can be marked as false positives (see Fig. 4, channel 7). This issue is not particularly problematic because actual slow wave ATs can be validated based on the magnitude of the signal: false positive artifacts are almost always much larger in magnitude than an actual slow wave signal.

  3. 3.

    Generally difficult signals: Fractionated waveforms, or signals with a “wandering baseline” (see Fig. 4, channel 27) are still difficult to properly analyze. Future research directions will explore whether machine learning algorithms such as support vector machines can aid in properly classifying a putative AT as an artifact, or an actual slow wave. The main idea is to send a window of data centered on the (putative) AT mark to the classifier for rendering the final decision.

5 Clustering of Propagating Waves: The REGROUPS Algorithm

In order to analyze slow-wave propagation patterns over multiple cycles, it is often highly beneficial and/or necessary to create a sequence of isochronal activation time (AT) maps (see Fig. 5b and d). These maps can be utilized to assess the spatiotemporal dynamics of slow wave conduction, i.e., direction and speed of propagation (see Sect. 6). A prerequisite for generating AT maps is to properly group or cluster all of the identified slow wave event activation times corresponding to an individual wave. The Region Growing utilizing Polynomial Stabilization (REGROUPS) method was designed expressly for this purpose. Full details of this algorithm can be found in Erickson et al. [11].

Fig. 4
figure 4

Signals recorded with PCB electrodes, with the results illustrating outcome of automated AT detection using the FEVT method. Each of 20 panels shows a 180 s long signal recorded with a PCB electrode. Automarking results are marked as true positives (TPs, filled red circles), false positives (FPs, filled blue squares), and false negatives (FNs, filled green triangles). For most electrodes, the FEVT detection algorithm succeeding in finding all ATs without finding any FPs. However, some electrodes (23 and 27, for example) show a significant fraction of FPs and FNs due to their relatively complex waveforms. Adapted from [14]

Fig. 5
figure 5

Cycle partitioning result and corresponding AT maps for manual and REGROUPS methods. a Approximate placement of electrode array on stomach. b Isochronal AT map generated via manual clustering. c Clustering of points defining each wave cycle using the REGROUPS method, and d corresponding AT maps. The wave spreads from regions colored red (earliest activation times) to blue (latest activation times). The results of manual and REGROUPS cycle partitioning are highly similar, both illustrating the slow wave conducting radially away from a pacemaker site. Adapted from [11]

Similar to previously described wave-mapping algorithms by Lammers et al. [21], and Rogers and Ideker [42, 43], one key step in REGROUPS involves clustering points by starting at a seed point and searching neighboring electrodes for an AT that is temporally “close enough”. A “point” refers to a spatiotemporal 3-element coordinate (\(x_i\), \(y_i\), \(t_i^{(k)}\)) where \(x_i\) and \(y_i\) specify the position of the of the \(i\)th electrode in the array, and \(t_i^{(k)}\) is the \(k\)th AT at that site. All neighboring electrode sites of a point just added to the cluster are also searched to see if they are temporally close.

The REGROUPS method was designed to handle two issues commonly encountered during routine measurement:

  1. 1.

    Missing data or bad electrodes: Electrode sites with no marked ATs, mainly due to insufficient contact or erosion of electrode tips due to the sterilization [39]. This algorithm is not hindered by a small amount of missing data by design, as described below.

  2. 2.

    Velocity gradient: REGROUPS takes into account any changes in wavefront propagation velocity by utilizing a second-order model to describe its spatiotemporal dynamics (see Eq. 2).

This method explicitly utilizes a continuously updating spatiotemporal filter to estimate the ATs at a given location. The filter is essentially a second-order polynomial surface of the form:

$$\begin{aligned} AT(x,y) = p_1 x^2 + p_2 y^2 + p_3 xy + p_4 x + p_5 y + p_6 \end{aligned}$$
(2)

where \(x\) and \(y\) denote spatial coordinates, and the coefficients \(p_1\) through \(p_6\) define the exact shape of the surface. The coefficients, \(p_i\), are updated each time a point is added to the cluster defining the waveform. The estimate of an AT at a nearby electrode site \((x_n, y_n)\) not yet included in the cluster is computed simply by extending the surface to that spatial coordinate, i.e, \(AT(x_n, y_n)\). The REGROUPS temporal closeness criterion stipulates that a point at a nearby site be added to the cluster if:

$$\begin{aligned} \delta T\, =\, | AT(x_n, y_n) \,-\, \text{ marked} \text{ ATs} \text{ at} (x_n, y_n)| \,\le\, \text{ time} \text{ tolerance}. \end{aligned}$$
(3)

The value of \(\delta T\) should be chosen as a compromise between keeping it large enough to not be too stringent on the estimate for \(AT(x,y)\), while also keeping it small enough so as to discriminate which points are properly clustered. REGROUPS terminates clustering of an individual wave when all electrode sites have been considered.

Figure 6 shows the polynomial surface updating as more points are continually added to the cluster. Notice how the curvature, slope, and twist of the surface change as more points are added. Thus, this data-driven model utilizes an updating spatiotemporal filter that takes into account any velocity gradients or non-uniformities in the wavefront propagation.

Fig. 6
figure 6

The second order surface \(AT(x,y)\) updating according to the points already in the cluster. Filled circles represent points which, at the end of clustering, are clustered into the cycle; unfilled diamonds represent points which were rejected during clustering (orphans). The subpanels (top to bottom) show the second-order surface when clustering is approximately 1/4, 1/2, 3/4, and fully complete. Time is represented on the vertical axis (units of seconds). The \((x,y)\) coordinates represent the electrode site positions (units of mm). Reproduced from Erickson et al. [11]

By incorporating a model of the wavefront propagation, the REGROUPS method is able to “jump” across bad electrode sites, in order to prevent early or inappropriate termination of the algorithm. It is also capable of properly clustering points that represent a clashing slow wave pattern [11]. Recently O’Grady et al. have employed the algorithm to investigate circumferential slow wave conduction [37]; to compare slow wave initiation and conduction during normal and dysrhythmic behavior in a porcine model [38]; and to slow wave activity in human patients suffering from gastroparesis [33].

While REGROUPS has proven useful for studying (relatively) simple gastric slow wave activity patterns, it cannot properly group ATs when an electrical activity pattern is too chaotic, or when there is no sensible notion of coherent wavefront propagation of individual slow waves as has been occasionally observed in small intestine. In such instances, a second-order polynomial surface proves inadequate to describe the details of wave propagation, hence the predicted activation times are not accurate, and the points can not be clustered properly. Future research will investigate ways of extending the REGROUPS method or developing an alternate method for complex gastric or intestine slow wave patterns, where the spatiotemporal nature of the slow wave propagation is more variable from one wave to the next.

6 Velocity and Amplitude Estimation

6.1 Velocity

Once the slow waves events have been grouped into its respective propagating waves, an isochronal activation time map can be created (see Fig. 7a). This will show the general direction of slow waves propagation across the serosal surface of where the electrode array has been placed. From the activation time map, velocity vectors can be computed which will give a complimentary qualitative and quantitative view of slow wave propagation. A brief definition of velocity in GI slow wave mapping will be provided along with a discussion on methods to estimate velocity.

Velocity in simple terms is defined as the speed of an object in a specified direction. In GI slow wave mapping, it is the speed and direction of a propagating slow wave as mapped on the serosal surface on the stomach or other organs in the GI tract. In the cardiac field, velocities are defined with respect to fibre orientations [20]. In extracellular serosal mapping studies it is assumed the ICC layers are a 2D plane along the serosal surface of the stomach, and that there are no transmural components, although in reality, the ICC layers are a complex 3D structure [28]. When transmural mapping studies are done, and fibre orientations can be accurately identified in the GI tract, velocity estimates could be reported accordingly.

Velocity in two dimensions is defined as follows,

$$\begin{aligned} \left[ \begin{array}{c} V_x\\ V_y \end{array} \right] = \left[ \begin{array}{c} \frac{T_x}{T_x^2 + T_y^2} \\ \frac{T_y}{T_x^2 + T_y^2} \end{array} \right] \end{aligned}$$
(4)

where \(T_{x} = \partial T / \partial x \) and \(T_{y} = \partial T / \partial y\) are the gradients of the isochronal time map with respect to the \(x\) and \(y\) directions of the recording array.

One approach to estimate velocities is to take a simple finite difference of the time array, and estimate the velocities. This method has been used in clinical mapping studies [22, 23, 34] in both stomach and small intestine. However this method has two disadvantages which has been observed in practice. One is that any noise in the activation time map would be amplified by taking a difference in time values. Secondly as mentioned by Bayly et al. [3], any missing activation time value in the map would lead to missing velocity estimates around that electrode. To eliminate this problem, the activation time map or the difference in time values can be interpolated based on the values around it.

The latter technique was used with smoothing applied to it in a method called the “smoothed finite difference” [41]. In this method, once \(\partial T/ \partial x \) and \(\partial T/ \partial y \) were found, an inverse distance weighting scheme was used to interpolate missing data points. \(V_x\) and \(V_y\) were then smoothed using a Gaussian filter to reduce any noise due to noise amplification. In Fig. 7, the velocity of a porcine gastric propagating wavefront is estimated using the method.

Fig. 7
figure 7

Porcine gastric slow wave propagation. a Activation time map with isochrones at two second intervals. b Velocity field estimated using smoothed finite difference and plotted as a magnitude colormap with velocity directions overlaid. c Amplitude estimates of slow waves during the slow wave propagation

Another approach to estimating velocities is via the use of polynomial fitting as introduced by Bayly et al. [3]. In this method, a second order polynomial of the form Eq. (2) was fitted to the 2D activation time map. The same polynomial model described in Sect. 5 was applied, with a different application. The polynomial fit acts as an interpolant and smoothing function while estimating velocities. Ideally a window size of four or five times the sampling interval is chosen to estimate velocities in an overlapping manner. One disadvantage with this method is that there can be overshoots at the edges of the electrode array, leading to misleading velocity estimates. In some GI mapping studies for normal slow wave propagation this method of velocity estimation has been used to estimate velocity vector directions with the polynomial fit applied to the whole array [10, 34].

There are other approaches to velocity estimation as seen in HR cardiac electrical mapping. Some of the methods include the use of wavelets [15] and the use of radial basis functions to estimate velocity [30], but have not been validated for use in gastric HR mapping. With velocity vectors, further analysis can be performed which may be able to provide vital information about slow wave propagation patterns. Recently a method utilising the change in direction of the velocity vectors was used to differentiate between normal and abnormal slow wave propagation patterns [9].

6.2 Amplitude

Signal amplitude can reveal information about the strength of the underlying activity. With sparse gastric electrical recordings, signal amplitude would reveal the strength of slow waves at a particular site, and most often an average value is quoted. This is also possible with high resolution mapping, but it also offers information in the spatial domain allowing signal amplitude of the slow wave propagation to be estimated and viewed as a map. Two approaches of amplitude estimation are discussed.

The first approach works by placing a window of specified width around detected slow wave, and taking the difference between the maximum and minimum values. This approach works extremely well when the morphology of the slow wave is static and well defined, and the window size can be specified as 1 s. The downside with this method is that slow wave morphologies can be varied and dynamic.

Another approach is to identify the peak and troughs of the slow wave event and then take the difference between the peak signal value and the trough signal value. The roots of the derivatives of a function provide its maxima, minima and inflection points, and this can assist in finding the peak and trough of the slow wave. In signal processing terms, it translates as the zero crossings of the derivatives of the slow waves signal provides us with its peak, trough and point of inflections on the slow wave (Fig. 8). The points of inflection can be found via the use of second derivatives as in some slow wave signals there are double potentials, where the peak or trough positions could be misleading. The main reason for adopting this approach is because there is a recovery component in the gastric slow wave morphology which falls below the trough of the slow waves, leading to misleading estimates of the amplitude of the slow wave. One of the limiting factors of this method is that it can be sensitive to noise, and thus a smoothing function needs to be applied on the derivative signals. A Savitzky Golay derivative filter can used to obtain a smooth derivative signal if the signal is noisy [40]. One of the downside with this implementation is that a prescribed set of parameters for different set of noise levels are required. However, in practice only one set of parameters are used.

Fig. 8
figure 8

Estimation of slow wave amplitude via detection of the peak and trough of the slow wave. The zero crossing positions (marked as cross) on the first derivative of the slow wave gives the location of the peak and trough of the signal. The zero crossing position closest to the fiducial marked slow waves are chosen as the time positions for the peak and trough of the slow wave

When comparing amplitude across experimental studies, certain aspects should be taken into account such as type of hardware used for bio-electrical recordings, software processing techniques, and experimental set-up. Based on the recording hardware used, and weather the electrodes are passive or active, the recorded amplitude could have different signal values and morphology. Also the use of digital or analog filters to eliminate noise, may dampen the amplitude of the slow wave.

7 Software Packages

The previously described methods and techniques have been incorporated into two software packages.

The Gastrointestinal Electrical Mapping Suite (GEMS) provides a user interface supported by implementations of the FEVT and REGROUPS algorithms as well as filtering procedures and algorithms for calculating amplitudes and velocities [47]. GEMS allows users to analyse high resolution serosal recordings in a mostly automated way while still giving users the opportunity to manually intervene by changing parameters or manually marking and grouping slow waves.

An online package analyses data recorded by from the Biosemi system during recordings, displaying wave propagation as the signals are being recorded, facilitating the checking of electrode placement and the monitoring of experimental effects.

7.1 GEMS

The Gastrointestinal Electrical Mapping Suite is a software package developed for analysing gastrointestinal signals primarily from the stomach and small intestine [47]. GEMS gives users the ability to analyse the large quantities of data recorded from HR recording arrays in an efficient manner, with as little manual intervention as possible.

GEMS is designed to be used by operators who may not be completely familiar with signal processing concepts. It leads users through a fixed set of steps to load data, orient the electrodes, filter the data and create output images and animations. The key features of GEMS are:

  1. 1.

    The ability to load data and rotate it to match the orientation of electrodes on the stomach.

  2. 2.

    The ability to filter data using the predetermined “best” parameters, select from one of several good set of options, or define a completely custom filtering configuration.

  3. 3.

    The ability to automatically mark large quantities of data using FEVT (Sect. 4) and REGROUPS (Sect. 5).

  4. 4.

    The ability to produce publication-ready map images, such as Fig. 7.

As the rectangular electrode patch can be placed in different orientations it is sometimes necessary to rotate it to understand the direction of propagation. GEMS presents users with various predefined filtering options which have been tuned for slow wave detection, but users are given more control over the filtering settings if they want it. Users may use the FEVT and REGROUPS algorithm to automatically mark slow wave activation times and group these into waves, though these marks and groups may be manually screened and grouped.

Figure 9 shows a row of electrodes from the electrode array after having been automatically marked with the FEVT algorithm. The user may remove those that they believe to be incorrect or manually add any slow wave activations that may have been missed, before using REGROUPS to partition the marks into individual slow wave events.

GEMS is able to produce publication-ready maps of slow wave activation time, amplitude, velocity (Fig. 7), or activation animations that can in some cases give a clearer view of the activity than subsequent isochronal maps can.

Fig. 9
figure 9

A row of electrode traces from a pig stomach recording after being downsampled, filtered and having the FEVT algorithm applied. The red dots indicate the times identified as slow wave events by FEVT. This interface facilitates adding and removing activation time markings manually, or the removal of entire channels

GEMS has been used for a number of different studies, and is used for analysing all high-resolution data recorded in our lab. Du et al. [9] and O’Grady et al. [38] have both used GEMS extensively in studies of dysrhythmic gastric electrical activity in porcine studies. Angeli et al. [2] found appropriate FEVT and REGROUPS parameters for detecting small intestine slow waves and used GEMS for the analysis of high-resolution recordings from porcine intestinal studies.

7.2 Online Software Package

Some aspects of the analysis of slow wave activity have been incorporated into and online system running during experiments are performed [5]. This system filters the incoming data and processes it with the FEVT algorithm and is able to show show activation animation and isochronal maps as they are detection during recording. The isochronal maps are grouped with a simpler method than REGROUPS and is close to the wave mapping method [21]. Using the same methods as are used in offline analysis gives operators familiar with slow wave analysis the same parameters to alter for the best performance in different situations. In addition to FEVT, channels are classified as either being ‘good’ or ‘bad’ using a moving Kurtosis classifier. This helps in the interpretation of the activity by removing distracting false marks and also draws attention to recording problems such as poor electrode contact or placement by showing a majority of channels recording ‘bad’ signals. A screen capture showing the system being used is shown in Fig. 10, which shows it in a configuration that displays animations and isochronal maps similar to those used for offline analysis.

The online analysis does not replace offline analysis but rather gives operators better information about the information being recorded which can in many cases reduce time spent in the operating room. For example it is possible to move the electrode array to best cover objects of interest such as pacemakers or conduction blocks immediately where without any information it is possible that such features of the electrical will be missed or only partially recorded. It also allows allows new types of dynamic experiments where the effect of drugs, stimulation or other controlled influences on the propagation of slow waves can be monitored and responded to.

8 Future Work and Conclusions

This chapter presents a summary of the recent advances in the analysis of gastrointestinal electrical activity, with a focus on gastric serosal activity. Future approaches are discussed, along with its potential clinical application.

Fig. 10
figure 10

A screen capture of the online software detector being used in a gastric mapping study with the slow wave activity propagating from the top left to bottom right of the array. The top left panel shows the detection of a slow wave event in the electrode array. The green squares indicate electrodes where slow wave events have been detected and red square indicate where events have been detected but determined to artifacts. The bottom panel displays a column of electrode traces that continuously updates. The vertical green line on the signal shows the detection of the activation time for a slow wave event. The top right panel shows the most recently captured propagating slow-wave wavefront using an automated online method. The unshaded area of this map indicates the region where no slow-wave activity was captured

The techniques described in this chapter have aided in reducing the time spent on laborious tasks (e.g., slow wave marking), and has focused the analysis on the clinical implications of the recorded data. It has also served to provide a standardized framework for GI HR electrical mapping, so that comparison can be made across studies [40]. This framework can be applied to the study of other gastrointestinal organs such as the small and large intestines. Although the same methodologies can be applied, the algorithms may need to be optimized for proper use [2].

One other important aspect of the GI electrical activity are the spikes. They are known to propagate and its identification be can be time consuming and tedious. Methods to automate and track spike activity along with slow waves is an area currently under development.

Further, there are opportunities to quantitatively and qualitatively asses normal and abnormal GI activity. One potential area of development is the use of velocity vectors. Du et al. has recently developed a method of identifying regions of interest using a change in direction from normal activity [9]. Further, use of mathematical operators such as the curl and divergence may provide useful information about the characteristics of the underlying electrical activity [14].

These methods of analysis could potentially be used for diagnostic purposes and could one day could be useful in strategizing treatment plans.