Detection of a and b waves in the acceleration photoplethysmogram

Background Analyzing acceleration photoplethysmogram (APG) signals measured after exercise is challenging. In this paper, a novel algorithm that can detect a waves and consequently b waves under these conditions is proposed. Accurate a and b wave detection is an important first step for the assessment of arterial stiffness and other cardiovascular parameters. Methods Nine algorithms based on fixed thresholding are compared, and a new algorithm is introduced to improve the detection rate using a testing set of heat stressed APG signals containing a total of 1,540 heart beats. Results The new a detection algorithm demonstrates the highest overall detection accuracy—99.78% sensitivity, 100% positive predictivity—over signals that suffer from 1) non-stationary effects, 2) irregular heartbeats, and 3) low amplitude waves. In addition, the proposed b detection algorithm achieved an overall sensitivity of 99.78% and a positive predictivity of 99.95%. Conclusions The proposed algorithm presents an advantage for real-time applications by avoiding human intervention in threshold determination.


Introduction
Although the clinical significance of Accelerated Plethysmograph (APG) measurement has been well-investigated [1][2][3][4], there are still a lack of studies focusing on the automatic detection of a and b waves in APG signals. However, Matsuyama [5] attempted to determine which of the nine QRS algorithms of Friesen's ECG algorithms [6] suit the detection of a waves in APG signals-this is because the morphology of the R peak in ECG signal is similar to the a wave in the APG signal. The detection rate was below 63% for all nine algorithms, even after modifying the thresholds with different values. Matsuyama [5] recommended that a new robust algorithm be developed for both APG and ECG signals. Therefore, our investigation herein is aimed at developing a robust algorithm to detect a waves in APG signals and to compare its performance with the prior nine a detection algorithms [5]. Up to the present there has been no attempt to detect b waves in APG signals; and therefore a new method for detecting the b wave is now introduced. To validate the robustness of the developed algorithms, noisy APG signals-measured at rest and after exercise-were tested. http://www.biomedical-engineering-online.com/content/13 /1/139 Photoelectric plethysmography is the most commonly used method for pulse-wave analysis-it is also know as photoplethysmography (PTG/PPG) or digital volume pulse (DVP) analysis. In this paper, the acronym PPG will be used throughout, as recommended by [7]. Fingertip PPG mainly reflects the pulsatile volume changes in the finger arterioles, as shown in Figure 1. Application of the second derivative is typically applied to accentuate subtle changes in the PPG contour [1]. It is the second derivative of the PPG signal that is the APG, also known as SDPPG [7].
As depicted in Figure 1, the APG waveform comprises four systolic waves (a, b, c, and d waves) and one diastolic wave (e wave) [2]. In our study, the height of detected a and b waves was measured from the baseline-the values of a waves are positive (above the baseline), while the values of b waves are negative (under the baseline). The main focus of this study is to provide a robust detection algorithm for a and b that can be used in clinical studies, e.g., carotid distensibility and ageing [9].

Ethics statement
There is one annotated APG database available at Charles Darwin University. The data were collected during rest (before exercise) and after one hour of exercise (walking) on a treadmill in the climate control chamber at Northern Territory Institution of Sport (Darwin, Australia). The speed of treadmill was set to 5 km/h with a one percent incline increment corresponding to the effort required to walk with 8 kg of webbing. The exercise was considered to be of moderate intensity, and the background of the entire project can be found in [5]. All subjects provided written informed consent before participation, which was approved by the Charles Darwin University Ethics Committee. The database is available upon request at Charles Darwin University: http://www.cdu.edu.au/ehse.

Data used
The PPGs of 27 healthy volunteers (males) with a mean ± SD age of 27 ± 6.9 were measured using a photoplethysmography device (Salus APG, Japan), with the sensor located at the cuticle of the second digit of the left hand, in which all subjects were included. Measurements were taken while the subject was at rest on a chair. The PPG data were collected at a sampling rate of 200 Hz and the duration of each recording was 20 seconds. The PPG recordings of 20 seconds are intentionally much shorter than is usual for ECG recordings to exclude motion artefacts and other noise [10]. This also serves as a preliminary test of feasibility, where the ease of shorter recording lengths is desirable in a clinical setting.
The annotations were carried out by only one PPG specialist, which is sufficient for this preliminary proof-of-concept study. The signals measured during rest, before exercise, contained a total of 584 heartbeats, whilst the PPG signals collected after one hour of exercise with a total of 885 heartbeats, and two hours of exercise with total of 956 heart beats; the background of the entire project can be found in [5]. For signal analysis and wave detection, MATLAB 2010b (The MathWorks, Inc., Natick, MA, USA) was used.

Training set
The PPG signals collected after 1 hour of exercise were used for training as they includes different shapes of PPG waveforms and noise. Moreover, it contained fast rhythm PPG signals, with a total of 885 heart beats, which had an impact on the detection accuracy.

Test set
PPG signals were measured at rest (before the exercise), with a total of 584 heart beats, and after 2 hours of exercise, with a total of 956 heart beats, were used for testing.

Methodology
We discuss and evaluate nine algorithms that are used by Matsuyma [5] to detect a waves in APG signals, and introduce a new algorithm that demonstrates greater robustness and accuracy for the a wave detection under conditions of heat stress. All of the algorithms we evaluate are advantageous in that they do not impose an extensive computational overhead that is often required in biosignal analysis.
In describing the algorithms for a wave detection in this article, note that X[n] refers to the raw PPG signal; while S[n] refers to the filtered X[n] signal. Here, THR 1 , THR 2 , and THR 3 refer to the the first, second, and third threshold, consequently.

Nine algorithms
1. AF1: This algorithm is based on the algorithm developed by Morizet-Mahoudeaux [11]. The algorithm examines the amplitudes and slopes of the APG signals, which http://www.biomedical-engineering-online.com/content/13/1/139 form the distinctive feature of the a wave, exceed certain thresholds. The slope is the first derivative of the APG signal, S[n] = X[n + 1] −X[n − 1], followed by three fixed thresholds. The optimal values of these thresholds are defined by Matsuyama [5] as follows: THR 1 = 0.31 max(X[n]), THR 2 = 0.0001, and THR 3 = −0.001. 2. AF2: This algorithm is based on the algorithm developed by Fraden and Neuman [12]. The algorithm examines the amplitudes and the slopes of the APG signal. The optimal threshold values for the amplitudes and slopes (positive) are THR 1 = 0.21 max(X[n]) and THR 2 = 0.75 [5].  [19]. The algorithm uses digital filters, such as a moving average filter and a low-pass filter. http://www.biomedical-engineering-online.com/content/13/1/139 The first step is to smooth the APG signals with a three-point moving average filter Then pass X 1 through a low-pass filter as follows X 2 [n] = n+m k=n−m X 1 [k] /(2m + 1), where m = 3. The next step is squaring the difference between the input X 1 [n] and output X 2 [n] of the low-pass filter The last step is thresholding with THR 2 = 0.006 max(X 5 [n]) [5].

Proposed method
In this study, a novel algorithm, adapted from the framework proposed by Elgendi for detecting systolic waves in PPG signals [20], for detecting QRS complexes in ECG signals [21,22], and for detecting c, d, and e waves in APG signals [23], will be evaluated.
The same approach will be used here to detect the a waves. The method consists of three main stages: pre-processing (bandpass filtering and squaring), feature extraction (generating potential blocks using two moving averages), and classification (thresholding). The structure of the algorithm is given in Figure 2.

Bandpass filter
A zero-phase second-order Butterworth filter, with bandpass 0.5-15 Hz based on a brute force search that will be discussed later in the Parameter optimization section, was implemented to remove the baseline wander and high frequencies that do not contribute to the a wave (cf. Figure 3). The output of the zero-phase Butterworth filter applied to the PPG signal-at rest and after exercise-produced a filtered signal S[n], as shown in Figure 4. The code line of this step is line 2 in the pseudocode of the a detection algorithm (Algorithm 1), where F 1 = 0.5 Hz and F 2 = 15 Hz.

Second derivative
To obtain the APG signals, the second derivative was applied to the filtered PPG in order to analyze the APG signals. Equations 1 and 2 represent a non-causal filter; the threepoint centre derivative was created with a delay of only two samples.
where T is the sampling interval and equals the reciprocal of the sampling frequency and n is the number of data points. Figure 4 shows the second derivative of the filtered  PPG signal measured at rest and after exercise. The code line of this step is line 3 in the pseudocode of the a detection algorithm (Algorithm 1).

Cancellation of b wave
At this stage, the a wave of the APG needs to be emphasized to distinguish it clearly for detection. This can be done by clipping the negative parts of the APG signal (Z

Squaring
Squaring emphasizes the large differences resulting from the a wave, which suppress the small differences arising from the diastolic wave and noise, as shown in Figure 4. This step results in the output which is important for improving the accuracy in distinguishing the a wave segment in APG signals. The code line of this step is line 5 in the pseudocode of the a detection algorithm (Algorithm 1). http://www.biomedical-engineering-online.com/content/13/1/139

Generating blocks of interest
Blocks of interest are generated using two event-related moving averages that demarcate the a wave and heartbeat areas. The particular method used to generate blocks of interest has been mathematically shown to detect systolic waves [20] and QRS complexes [21]. In this procedure, the first moving average (MA peak ) is used to emphasize the a wave area, as the dotted signal shows in Figure 5, and is given by where W 1 represents the window size of the systolic-peak duration. The resulting value is rounded to the nearest odd integer. The exact value for W 1 of 175 ms is determined after a brute force search, which will be discussed later in the Parameter optimization section. The second moving average (MA beat ) is used to emphasize the beat area to be used as a threshold for the first moving average, shown as a dashed signal in Figure 5, and is given by where W 2 represents a window size of approximately one beat duration. Its value is rounded to the nearest odd integer. The exact value for W 2 of 1000 ms is determined after a brute force search, which will be discussed later in the Parameter optimization section.
The code lines of this step are lines 6-7 in the pseudocode of the a detection algorithm (Algorithm 1).

Thresholding
The equation that determines the offset level (α) is βz, where β = 0 based on a brute force search that will be discussed later in the Parameter optimization section, whilez is the statistical mean of the squared filtered PPG signal. The first dynamic threshold value was calculated by shifting the MA beat signal with an offset level α, as follows: In this stage, the blocks of interest were generated by comparing the MA peak signal with THR 1 , in accordance with the lines 10-17 the code lines shown in the pseudocode of Algorithm 1. Many blocks of interest will be generated, some of which will contain the APG feature (a wave), while others will primarily contain noise. Therefore, the next step is to reject blocks that result from noise. Rejection is based on the anticipated systolicpeak width. In this paper, the undesired blocks are rejected using a threshold called THR 2 , which rejects the blocks that contain diastolic wave and noise. By applying the THR 2 threshold, the accepted blocks will contain a waves only, As discussed, the threshold THR 2 corresponds to the anticipated a wave duration. If a block is wider than or equal to THR 2 , it is classified as an a wave. If not, it will be classified as noise. The last stage is to find the maximum absolute value within each block to detect the a wave; the code lines of this step are lines 19-26 in the pseudocode of the a detection algorithm (Algorithm 1). Consecutive a waves are shown in Figure 5 to demonstrate the idea of using two moving averages to generate blocks of interest. Not all the blocks contain potential a waves; some blocks are caused by noise and need to be eliminated. Blocks that are smaller than the expected width for the a wave duration are rejected. The rejected blocks are considered to be noisy blocks and the accepted blocks are considered to contain http://www.biomedical-engineering-online.com/content/13/1/139 an a wave. The detected a waves are compared to the annotated a waves to determine whether they were detected correctly. The search range for the true a wave was fixed to ± 50 ms for all algorithms to ensure consistency of comparison.

Detection of b waves
Figure 6(a) shows the b wave as a global minimum in a subject with good circulation, while Figure 6(b) shows the d wave as a global minimum in a subject with poor circulationblood flow becomes restricted to certain parts of the body such as the fingers [24]. However, in both cases, the b wave is the first minimum after the a wave. The b wave can therefore be detected by finding the local minimum, as follows: where APG is the second derivative of the PPG signal (calculated in line 3 in Algorithm 1), i is a counter for the detected a waves, k is the search interval for the b waves, and ∧ is logical AND operator. To reduce the computational complexity for finding b waves, the interval k has been set to vary from 8 ms to 136 ms.

Parameter optimization
Performance of a wave detection algorithms is typically evaluated using two statistical measures: sensitivity (SE) and positive predictivity (+P); whereas SE=TP/(TP+FN) and +P=TP/(TP+FP). Here, TP is the number of true positives (a wave detected as an a wave), FN is the number of false negatives (a wave has not been detected), and FP is the number of false positives (non-a wave detected as an a wave). The SE reported the percentage of true a waves that were correctly detected by the algorithm. The +P reports the percentage of the detected a waves that were true a waves. Similarly, the same statistical measures were used for evaluating the b waves.
The function of the a wave detector (cf. pseudocode of Algorithm 1) has five inputs: the PPG signal (PPG signal ), frequency band (F 1 -F 2 ), event-related durations W 1 , W 2 , and the offset (β). Any change in these parameters will affect the overall performance of the proposed algorithm. These parameters are interrelated and cannot be optimized in isolation. A rigorous optimization via brute-force search, over all parameters, was conducted (cf. Table 1). This is a time-consuming process, but it is required before making definitive claims. The data used in this training phase were the PPG signals measured at after http://www.biomedical-engineering-online.com/content/13/1/139 All possible combinations of parameters (5,610 iterations) have been investigated and sorted in descending order according to their overall accuracy. The data used in this training phase were PPG measured after 1 hour of exercise, with 885 heartbeats. The overall accuracy is the average value of SE and +P.
1 hour of exercise. Optimization of the beat detector's spectral window for the lower frequency resulted in a value within 0.5-1 Hz with the higher frequency within 7-15 Hz. The window size of the first moving average (W 1 ) varied from 100 ms to 200 ms, whereas the window size of the second moving average (W 2 ) varied from 1000 ms to 1.250 s. The offset α was tested over the range 0-10% of the mean value of the squared filtered PPG signal. The QRS complex corresponds roughly to the systolic duration (a wave duration) in APG, which is 100 ± 20 ms in healthy adults [25]. Interestingly, the algorithm uses an optimal value of W 1 (175 ms) corresponded to the a wave duration, and an optimal value of W 2 (1000 ms) for the heartbeat duration. It is clear from Table 1 that the optimal frequency range for the systolic detection algorithm over the database was 0.5-15 Hz. Moreover, the optimal values for the moving-average window sizes and offset are W 1 = 175 ms, W 2 = 1000 ms, and α = 0. The systolic algorithm was adjusted with these optimal parameters. Then, the detector was tested on two PPG datasets (PPG measured at rest and after 2 hours of exercise) without any further adjustment. http://www.biomedical-engineering-online.com/content/13/1/139

Results and discussion
Based on the parameter optimization step, the value of α = 0, which means there is no need for an offset to improve the detection rate, as it was required in detecting QRS in ECG signals [21] and systolic peaks in PPG signals [20]. This is perhaps because of the sharp clear peak (high amplitude) of the a wave compared to the other APG waves (c, d, and e waves). The a wave detection algorithms were tested on 27 subjects, with the APG signals measured before exercise and after 2 hours of exercise; with a total of 54 recordings, as shown in Table 2. The main objective was to evaluate the robustness of the algorithms against the non-stationary effects, low SNR, and high heart rate exhibited after exercise in conditions of heat stress. Under normal conditions, analyzing stationary APG signals is straightforward; as a waves have similar amplitudes, the statistical characteristics of the Table 2 Performance of the proposed a wave detection algorithm on the testing dataset (APG signals measured at rest and after 2 hours of exercise)

Before exercise
After 2 hours of exercise The PPG signals were collected from 27 subjects for 20 seconds during the 5 minutes break between each exercise [5]. To compare the performance of the proposed algorithm with the nine algorithms [5], two statistical measures were used: SE=TP/(TP+FN) and +P=TP/(TP+FP), where TP is the number of true positives (a wave detected as a wave), FN is the number of false negatives (a wave has not been detected), and FP is the number of false positives (non-a wave detected as a wave). http://www.biomedical-engineering-online.com/content/13/1/139 signals (i.e., mean and standard deviation) do not change appreciably with time, and a simple threshold level can effectively detect a waves. Figures 7(a) and 8(a) represent the APG signals with stationarity effects for volunteer G2 (before exercise) and L3 (after 2 hours of exercise)-all a waves are almost straight-lined. By contrast, under stress, APG signals become non-stationary, which makes analysis difficult since the standard deviation changes with time-note that a wave amplitudes vary with time and simple level thresholds cannot optimally detect a waves. This has a negative effect on detection algorithm performance, which is clearly seen in Table 3 when the nine amplitude-dependent algorithms were applied to the APG signals. Moreover, Matsuyama [5] reported that none of the nine amplitude-dependent algorithms achieved acceptable a wave detection rates even after optimizing the threshold values. Most of these nine algorithms, such as AF2, AF3, FD1, FD2, DF1, and FS1, strictly followed the morphology of the QRS complex. However, it is clear that amplitude-dependent algorithms are not optimal methodologies for detecting a waves in APG signals under varying conditions. The proposed algorithm scored the highest sensitivity and positive predictivity rates when compared to the nine algorithms. The proposed algorithm appears to be more robust against effects of post-exercise measurement non-stationarity. The results show that the proposed method was able to detect a waves correctly in non-stationary APG signals before exercise, as shown in Figure 7(b), and after 2 hours of exercise, as in Figure 8(b). Moreover, the proposed algorithm was also able to detect a waves correctly in low amplitude APG signals (small voltage), as shown in Figure 7(c), and after 2 hours  The PPG signals were collected from 27 subjects for 20 seconds during the 5 minutes break between each exercise [5]. To compare the performance of the proposed algorithm with the nine algorithms [5], two statistical measures were used: SE=TP/(TP+FN) and +P=TP/(TP+FP), where TP is the number of true positives (a wave detected as a wave), FN is the number of false negatives (a wave has not been detected), and FP is the number of false positives (non-a wave detected as a wave).

Record No of beats TP FP FN SE (%) +P(%) No of beats TP FP FN SE (%) +P(%)
Here, NA stands for Not Applied, while NaN stands for Not-a-Number. http://www.biomedical-engineering-online.com/content/13/1/139 of exercise, as in Figure 8(c). However, the algorithm did incur a few instances of failure, with exactly five FNs, as shown in Table 3. The cause of the failure was due to the sudden drop in amplitude of the a waves in heat-stressed APG signals (cf. Figure 9). The proposed method, however, handled varying amplitudes well compared to the other nine algorithms. In fact, it is clear that the proposed algorithm is more amplitude-independent and was able to detect the a waves in various voltage ranges. The analysis of a regular heart rhythm is simple, as the a waves are repeated with an equally spaced pattern. This regularity helps the time-domain threshold methodologies to detect a waves successfully. The regular heart rhythm is called the normal sinus rhythm in APG signals [24], which means the rhythm is constant and the occurrence of the next beat is predictable. The proposed algorithm easily detects a waves correctly in APG signals with a regular heart rhythm, as shown in Figure 7(a,b,c). The sensation of an irregular heart rhythm is usually related to either premature beats or atrial fibrillation. The proposed algorithm also successfully detected the a waves with premature beats in both conditions at rest and after exercise, as shown in Figures 7(d) and 8(d).
As the detection of b waves depends on the detection of a waves, the performance of the b wave detection scored almost the same result as the a detection algorithm. Because the proposed b detection incurred only one instance of failure, which is a TP shown in Figure 9, the +P becomes 99.95%. This result reflects the robustness of the proposed b detection algorithm against noisy APG signals.   Figure 9 Instances of failure occurring with the proposed algorithm (subject: A1 after 2 hours of exercise). Here, 'red asterisk' represents the detected a wave and 'black plus sign' represents the detected b wave by the proposed algorithm. The purple pentagon represents a false negative for the a wave, while purple circle represents the false negative for the b wave. The green square represents the false positive of the b wave, which was the only false positive inccurred by the proposed b detection algorithm in the testing dataset. http://www.biomedical-engineering-online.com/content/13/1/139

Limitations of the study and future work
One of the next steps regarding the results of this study is to examine the correlation of the a/b ratio-based on the accurately detected a and b waves-using APG signals with age, body mass index, and core temperature. Moreover, there is a need for developing an algorithm that detects the c, d, and e waves.
The proposed algorithm was only tested on normotensive young subjects. The physiology of the photoplethysmogram significantly changes according to health status. As such, the robustness of the proposed algorithm needs to be verified by a study in unhealthy subjects-to diagnose and monitor abnormalities such as arrhythmia, hypertension, diabetes and hyperlipidemia.
It is important to note that the number of PPG records (total of 27) used in the training was modest. A larger sample size and a more diverse data set are needed in order to generalize the findings of this study. Moreover, sampling the PPG signals at a higher rate (above 200 Hz) is required to capture the b waves with greater fidelity. The evaluation of a wave detection was challenging in this study because the number of annotated beats did not allow all possible morphologies found in APG signals under conditions of heat stress to be well represented. To our knowledge, there is no available APG database measured after heat stress that would allow a more thorough assessment and comparison of the tested algorithms.

Conclusion
For all nine QRS algorithms, the detection errors arose from a variety of factors including the existence of irregular heartbeats, low-amplitude peaks, and signals with nonstationary effects. The application of an event-related dual moving average would allow the accurate, computationally simple algorithm we propose to be used for real-time applications and the processing of large databases. A detection algorithm for a waves in APG signals measured after exercise has not been previously addressed in the literature, with the exception of the work of Matsuyama. However, it has been demonstrated that a robust algorithm can be developed for detecting a waves in APG signals collected in a noisy environment with high-frequency noise, low amplitude, non-stationary effects, irregular heartbeats, and high heart rates. The a wave detection algorithm was evaluated using 27 records, containing 1,540 heartbeats (584 heartbeats measured at rest and 956 heartbeats measured after 2 hours of exercise), with an overall sensitivity of 99.78%, and the positive predictivity was 100%, while the b detection algorithm scored an overall sensitivity of 99.78% and a positive predictivity of 99.95%.