A Pipeline for Adaptive Filtering and Transformation of Noisy Left-Arm ECG to Its Surrogate Chest Signal

: The performance of a low-power single-lead armband in generating electrocardiogram (ECG) signals from the chest and left arm was validated against a BIOPAC MP160 benchtop system in real-time. The ﬁltering performance of three adaptive ﬁltering algorithms, namely least mean squares (LMS), recursive least squares (RLS), and extended kernel RLS (EKRLS) in removing white (W), power line interference (PLI), electrode movement (EM), muscle artifact (MA), and baseline wandering (BLW) noises from the chest and left-arm ECG was evaluated with respect to the mean squared error (MSE). Filter parameters of the used algorithms were adjusted to ensure optimal ﬁltering performance. LMS was found to be the most e ﬀ ective adaptive ﬁltering algorithm in removing all noises with minimum MSE. However, for removing PLI with a maximal signal-to-noise ratio (SNR), RLS showed lower MSE values than LMS when the step size was set to 1 × 10 − 5 . We proposed a transformation framework to convert the denoised left-arm and chest ECG signals to their low-MSE and high-SNR surrogate chest signals. With wide applications in wearable technologies, the proposed pipeline was found to be capable of establishing a baseline for comparing left-arm signals with original chest signals, getting one step closer to making use of the left-arm ECG in clinical cardiac evaluations.


Introduction
U.S. national health expenditure accounts for 17.9% of the GDP with a projected annual growth of 5.5% per year between 2018 and 2027, reaching $6.0 trillion by 2027 [1][2][3]. Only in 2017, the share of the U.S. medical devices market was $156 billion, accounting for 40% of the global market [4]. The main reason for this boom is the high demand for portable, affordable, and IoT-compatible health monitoring devices capable of preventing the U.S. number one killer, cardiovascular diseases [5].
Electrocardiogram (ECG) is a reliable reference for the evaluation of cardiac activity and has been adopted by the health industry as a standard method since 1954 [6]. Common types of ECG include 12-lead [7], 3-lead [8], 2-lead [9], and single-lead [10] systems. Due to the close vicinity to the heart, the chest is the most conventional location for ECG evaluations, enabling ECG mapping with high precision and signal-to-noise ratio (SNR) [11]. However, conventional one-off chest-ECG (C-ECG) tests are cumbersome, costly, interrupted, and non-user friendly, making it an unattractive option for both intermittent and continual cardiac monitoring.

Hardware
The multi-sensor system was entirely developed with commercial off-the-shelf (COTS) components and a custom printed circuit board (PCB) design. The hardware provides signal acquisition of integrated sensors on the body including ECG, electro-dermal activity (EDA), and photoplethysmography (PPG). The microcontroller interfaces with an external 16-bit analog-to-digital converter (ADC), which samples the ECG signal. An AD8232 specialized analog frontend was chosen for ECG readings due to its capability of providing high gain (1000), high output impedance (10 GΩ), and filter customization. The AD8232 has two input electrodes (RA and LA) and a driven electrode that senses the common mode noise at the inputs and attempts to cancel it by injecting the signal back into the user. To reduce motion artifacts, a narrow band-pass characteristic is required to separate the heart signal from the interferers. Therefore, the customized filter network for the ECG frontend is implemented such that a two-pole low-pass filter and a two-pole high-pass filter are set to 27 Hz and 7 Hz, respectively.
The analog output of the AD8232 is connected to an ADC (ADS1114). The ADS114 chip is a 16-bit ADC to sample the analog signal and feed it into a Nordic NRF51822 microcontroller via inter-integrated circuit (I 2 C) communication. The internal ADC in the microcontroller samples an analog signal from electro-dermal activity sensing. The microcontroller unit (MCU, Nordic nRF51822, Nordic Semiconductor, Trondheim, Norway) incorporates an ARM Cortex M0 (ARM Developer, Cambridge, UK) with 32 KB of RAM, 256 KB of non-volatile flash memory, and an internal ADC. The unit also has an integrated BLE radio. In order to increase the antenna performance and the BLE range, a Raytac MDBT40 carrier board comprising a microcontroller, antenna, balun, and high-frequency crystal was used. The nRF51822 (Nordic Semiconductor, Trondheim, Norway) has flexible General Purpose Input/Output (GPIO) ports that support communication protocols including I 2 C, Synchronous Peripheral Interface (SPI), and Universal Asynchronous Receiver/Transmitter (UART). An ADXL345 accelerometer is interfaced over SPI to the nRF51822. The ADXL345 (Analog Devices, Norwood, MA, USA) is an ultra-low-powered tri-axial accelerometer with 13-bit resolution and supports measurement ranges up to ±16 g. In order to store the sensor data for continuous measurement, a high-volume external flash memory (128 Mb) was also implemented. The Winbond W25Q128 SpiFlash series (Winbond, Taichung City, Taiwan) is also communicated through SPI to the MCU. The entire system is powered with a 3.3 V supply regulated from a battery. A JST-type connector is used for connecting to a typical lithium polymer battery. The Microchip MCP73831 (Microchip Technology, Chandler, AZ, USA) charge management controller is implemented for charging the battery via microUSB. The TI TLV710 dual-voltage low-dropout (LDO) regulator (Texas Instruments, Dallas, TX, USA) is used to provide both 3.3 V and 1.8 V supplies. All of the hardware components take advantage of advanced surface mount technology for a minimal footprint of 1.0" × 1.5". The images of the developed armband, the system hardware, and the positions of the electrodes LA (+), RA (−), and ground that resulted in the closest match to the C-ECG obtained from an ISO1001-certified BIOPAC MP160 benchtop system are shown in Figure 1. All of the hardware components take advantage of advanced surface mount technology for a minimal footprint of 1.0″ × 1.5″. The images of the developed armband, the system hardware, and the positions of the electrodes LA (+), RA (−), and ground that resulted in the closest match to the C-ECG obtained from an ISO1001-certified BIOPAC MP160 benchtop system are shown in Figure 1.  Figure 2 shows a block diagram of our wearable system with data transmission. The ECG signal can be transmitted through a wire to the computer or through a BLE communication, as seen in Figure 2. Minimal power consumption is expected with serial communication between the wearable device and a computer with the BLE off, and the flash has become inaccessible. The total power consumption for this case is calculated to be 3 mW. The system can also be used for wireless transmission through BLE. When the continuous BLE mode is engaged, the total power consumption is to be 57 mW. For extended measurement, on-chip storing of the data is required while the BLE is off. For this scenario, the maximum power consumption is about 70 mW. It should be noted that these power consumptions can be greatly reduced with data compression and optimization of data transmission time. The 150 mAh, 3.7 V lithium-ion polymer battery cell used in this can run the ECG module of the armband system for 7 h continuously.  Figure 2 shows a block diagram of our wearable system with data transmission. The ECG signal can be transmitted through a wire to the computer or through a BLE communication, as seen in Figure 2. Minimal power consumption is expected with serial communication between the wearable device and a computer with the BLE off, and the flash has become inaccessible. The total power consumption for this case is calculated to be 3 mW. The system can also be used for wireless transmission through BLE. When the continuous BLE mode is engaged, the total power consumption is to be 57 mW. For extended measurement, on-chip storing of the data is required while the BLE is off. For this scenario, the maximum power consumption is about 70 mW. It should be noted that these power consumptions can be greatly reduced with data compression and optimization of data transmission time. The 150 mAh, 3.7 V lithium-ion polymer battery cell used in this can run the ECG module of the armband system for 7 h continuously.

ECG Data Acquisitions
The accuracy of the armband LA-ECG and C-ECG signals was tested against the C-ECG signals obtained by a bench-top MP160 BIOPAC system at the same sampling frequency (100 Hz) and in real-time. As shown in Figure 3, both the position of the PQRST complex and the heart rate (65 bpm) of the ECG signals collected by the armband systems matched those of the BIOPAC system. As anticipated, the mean amplitude range associated with the armband C-ECG was found to be over six times larger than that of LA-ECG. The V-out value of the armband baseline was kept at its original value (3.3 V) and without any modification.

Modeling of ECG Noises
Sensor-based non-medical ECG recordings are vulnerable to different types of noise and should be cleaned and checked for major components before further evaluation. Realistic ECG noise models can be used to identify the effect of noise on ECG signals and, thus, to remove those artifacts from the corrupted ECG. However, the denoising process for a particular noise model could be limited by the validity of the model assumptions [26] or the computational complexity of the selected algorithm [27]. In the selection of a proper noise model, the following assumptions must be considered: (1) The operating frequencies in the used model must match the ECG frequencies, and (2) the spatial variation in the noise must be statistically meaningful when compared to that of the ECG signal [28]. In natural noise modeling, the main issue is to recognize a realistic noise source [29]. Nonstationary noises like EM, BLW, and MA have complex natures and cannot be removed from ECG signals using simple filters. These noises are normally nonstationary in time and highly colored in the spectrum and, hence, are generally inadequate for ECG noise modeling. The main reason for using real ECG noises with a varying noise level is to develop a realistic noise model. We adopted the MIT-BIH database [30] to obtain real ECG noises for generating realistic noise templates.

ECG Data Acquisitions
The accuracy of the armband LA-ECG and C-ECG signals was tested against the C-ECG signals obtained by a bench-top MP160 BIOPAC system at the same sampling frequency (100 Hz) and in real-time. As shown in Figure 3, both the position of the PQRST complex and the heart rate (65 bpm) of the ECG signals collected by the armband systems matched those of the BIOPAC system. As anticipated, the mean amplitude range associated with the armband C-ECG was found to be over six times larger than that of LA-ECG. The V-out value of the armband baseline was kept at its original value (3.3 V) and without any modification.

ECG Data Acquisitions
The accuracy of the armband LA-ECG and C-ECG signals was tested against the C-ECG signals obtained by a bench-top MP160 BIOPAC system at the same sampling frequency (100 Hz) and in real-time. As shown in Figure 3, both the position of the PQRST complex and the heart rate (65 bpm) of the ECG signals collected by the armband systems matched those of the BIOPAC system. As anticipated, the mean amplitude range associated with the armband C-ECG was found to be over six times larger than that of LA-ECG. The V-out value of the armband baseline was kept at its original value (3.3 V) and without any modification.

Modeling of ECG Noises
Sensor-based non-medical ECG recordings are vulnerable to different types of noise and should be cleaned and checked for major components before further evaluation. Realistic ECG noise models can be used to identify the effect of noise on ECG signals and, thus, to remove those artifacts from the corrupted ECG. However, the denoising process for a particular noise model could be limited by the validity of the model assumptions [26] or the computational complexity of the selected algorithm [27]. In the selection of a proper noise model, the following assumptions must be considered: (1) The operating frequencies in the used model must match the ECG frequencies, and (2) the spatial variation in the noise must be statistically meaningful when compared to that of the ECG signal [28]. In natural noise modeling, the main issue is to recognize a realistic noise source [29]. Nonstationary noises like EM, BLW, and MA have complex natures and cannot be removed from ECG signals using simple filters. These noises are normally nonstationary in time and highly colored in the spectrum and, hence, are generally inadequate for ECG noise modeling. The main reason for using real ECG noises with a varying noise level is to develop a realistic noise model. We adopted the MIT-BIH database [30] to obtain real ECG noises for generating realistic noise templates.

Modeling of ECG Noises
Sensor-based non-medical ECG recordings are vulnerable to different types of noise and should be cleaned and checked for major components before further evaluation. Realistic ECG noise models can be used to identify the effect of noise on ECG signals and, thus, to remove those artifacts from the corrupted ECG. However, the denoising process for a particular noise model could be limited by the validity of the model assumptions [26] or the computational complexity of the selected algorithm [27]. In the selection of a proper noise model, the following assumptions must be considered: (1) The operating frequencies in the used model must match the ECG frequencies, and (2) the spatial variation in the noise must be statistically meaningful when compared to that of the ECG signal [28]. In natural noise modeling, the main issue is to recognize a realistic noise source [29]. Nonstationary noises like EM, BLW, and MA have complex natures and cannot be removed from ECG signals using simple filters. These noises are normally nonstationary in time and highly colored in the spectrum and, hence, are generally inadequate for ECG noise modeling. The main reason for using real ECG noises with a varying noise level is to develop a realistic noise model. We adopted the MIT-BIH database [30] to obtain real ECG noises for generating realistic noise templates.
In our study, we assessed the performance of three adaptive filtering algorithms, i.e., RLS, LMS, and EKRLS, in removing W, BLW, MA, EM, and PLI noises from the corrupted chest and left-arm ECG signals. For modeling the BLW, MA, and EM noises, we benefited from Sameni et al.'s algorithm [31]. We reduced the BLW noise of no cardiac origin and with a frequency range below 0.5 Hz to minimize variations in the beat structure [32]. It is crucial to minimize the variations in the low-frequency segments that are usually caused by body movement. Parametric time-varying models were used to generate non-stationarity noises. To converge the spectral shape of the used noises with respect to the desired signal power, we assigned SNR values of 5 dB, −0.3 dB, −10 dB and −20 dB to W, PLI, BLW, EM, and MA, respectively.

Adaptive Filtering Algorithms
Adaptive filtering of a corrupted ECG signal is based on closed-loop subtraction of an estimated noise from the corrupted signal. The goal of adaptive filtering is to minimize the noise power, thus maximizing the SNR of the desired ECG signal. In noise removal using an adaptive noise canceller, two input signals are required: (a) Corrupted ECG signal, d k , comprising the desired noise-free signal, S 1 , and an embedded noise signal, n 1 , and (b) reference noise signal, n 2 . To ensure the efficient filtering, the type of the reference noise signal must match that of the real noise felt by the ECG signal [33]. Reference noise, n 2, can be simulated by a suitable noise-generating function to create a noise-estimate signal, Y k , provided the function coefficients (tap weights) are finely tuned. Figure 4 shows the diagram of an adaptive noise-cancelling system with respect to the reference noise [19].
Electronics 2020, 9, x FOR PEER REVIEW 5 of 17 In our study, we assessed the performance of three adaptive filtering algorithms, i.e., RLS, LMS, and EKRLS, in removing W, BLW, MA, EM, and PLI noises from the corrupted chest and left-arm ECG signals. For modeling the BLW, MA, and EM noises, we benefited from Sameni et al.'s algorithm [31]. We reduced the BLW noise of no cardiac origin and with a frequency range below 0.5 Hz to minimize variations in the beat structure [32]. It is crucial to minimize the variations in the low-frequency segments that are usually caused by body movement. Parametric time-varying models were used to generate non-stationarity noises. To converge the spectral shape of the used noises with respect to the desired signal power, we assigned SNR values of 5 dB, −0.3 dB, −10 dB and −20 dB to W, PLI, BLW, EM, and MA, respectively.

Adaptive Filtering Algorithms
Adaptive filtering of a corrupted ECG signal is based on closed-loop subtraction of an estimated noise from the corrupted signal. The goal of adaptive filtering is to minimize the noise power, thus maximizing the SNR of the desired ECG signal. In noise removal using an adaptive noise canceller, two input signals are required: (a) Corrupted ECG signal, , comprising the desired noise-free signal, , and an embedded noise signal, , and (b) reference noise signal, . To ensure the efficient filtering, the type of the reference noise signal must match that of the real noise felt by the ECG signal [33]. Reference noise, , can be simulated by a suitable noise-generating function to create a noise-estimate signal, , provided the function coefficients (tap weights) are finely tuned. Figure 4 shows the diagram of an adaptive noise-cancelling system with respect to the reference noise [19].

LMS Algorithm
The least-mean-squares (LMS) adaptive filtering algorithm is a basic and memory-less iterative model based on the steepest descent method commonly used for minimizing the mean squared error (MSE) between the corrupted ECG, , and the reference noise, , signals [34,35]. LMS is highly sensitive to the input statistics, as well as the eigenvalue spread present on it; thus, convergence is encouraged to small values of step size to avoid the estimated error increase indefinitely [36,37]. LMS benefits from low computational complexity, stable behavior, and unbiased convolution during the signal integration process [38]. To eliminate the effect of embedded ECG noise, , the generic noise estimating function, ( ), must be defined for , Equation (1) [18,39].
where is the definition of a vector of filter coefficients at time and can be calculated using Equation (2).
The updated after each time step can be calculated using Equation (3).

LMS Algorithm
The least-mean-squares (LMS) adaptive filtering algorithm is a basic and memory-less iterative model based on the steepest descent method commonly used for minimizing the mean squared error (MSE) between the corrupted ECG, d k , and the reference noise, n 2 , signals [34,35]. LMS is highly sensitive to the input statistics, as well as the eigenvalue spread present on it; thus, convergence is encouraged to small values of step size to avoid the estimated error increase indefinitely [36,37]. LMS benefits from low computational complexity, stable behavior, and unbiased convolution during the signal integration process [38]. To eliminate the effect of embedded ECG noise, n 1 , the generic noise estimating function, Y(k), must be defined for n 2 , Equation (1) [18,39].
where w k is the definition of a vector of filter coefficients at time k and can be calculated using Equation (2).
The updated w k after each time step can be calculated using Equation (3).
where variable µ is the step size and is chosen empirically. The higher the value of µ, the faster the convergence. X k is the input vector at time k of the samples from the reference signal, Equation (4) [32].
To denoise the ECG signal using LMS, the filter error output, k , is initially calculated by subtracting the instantaneous estimate of the noise signal, Y k , from the corrupted ECG signal, d k , Equation (5).
By adjusting the filter coefficient, µ, of the estimated noise signal, Y(n), the MSE or E k 2 will be minimized, Equation (6). This will result in the maximum reduction of the average power of the unknown embedded noise, n 1 .
For achieving this, the term E[(n 1 − Y) 2 ] in Equation (7) that is the MSE of the unknown embedded noise subtracted by the noise estimate signals should be eliminated, making the minimized E 2 the best least-squares estimate of the noise-free ECG signal, S 1 [33,38].

RLS Algorithm
Contrary to LMS that aims to reduce the MSE to reach optimal adaptation, the recursive least squares (RLS) repeatedly finds and updates the coefficients that minimize a weighted linear least-squares loss function of the input signals. RLS adaptation has infinite memory that can be tuned by a forgetting factor, λ, to de-emphasize the older error data compared to the newer ones [39]. Due to more computational complexity involved in RLS compared to LMS, the convergence speed associated with RLS is faster than all LMS algorithms, but this complexity may cause some overhead. The computational complexity for LMS and RLS are 2N + 1 and 4N 2 , respectively [40]. RLS denoises corrupted ECG signals using an inverse correlation matrix of the data with assumed zero mean. Besides, RLS simulates the noise-free signal via recursive minimization of the sum of least squares associated with the instantaneous error. This minimization is a recursive-gradient approach that accounts for the historical data up to the current data point [41]. Equation (8) is used to update RLS coefficients after each recurrence [40].
w(n + 1) = w(n) + e(n) k(n) where k(n) is the gain factor, which is defined by Equation (9).
where λ is the forgetting factor with the range of 0 < λ ≤ 1, and p(n) is the inverse correlation matrix of x(n) shown by Equation (10).
where ∂ is the initialization or regulation factor. The RLS algorithm uses Equation (11) to update the inverse correlation matrix.
where λ, ∂, and filter order, T, are adjustable parameters.

EKRLS Algorithm
Kernel adaptive filters are online machine learning algorithms, where their application to a data instance such as a corrupt ECG takes the original non-linear observations to a higher-dimensional space where they can be separated into their building signals, i.e., noise-free ECG and the embedded noise [42]. The extended-kernel recursive least-squares (EKRLS) algorithm is the kernelized version of the extended recursive least-squares algorithm (ExRLS) and relies on online machine learning algorithms. The same as RLS, EKRLS uses a forgetting factor, λ, to adjust the weighs of old error values compared to the new ones. The primary aim of this model is to reproduce the Kernel Hilbert Spaces sample via sample updating. This model is based on a functional analysis framework that involves solving a set of linear equations that is nonlinearly related to the input space and is, thus, not based on approximate estimation [42]. To denoise noisy LA-ECG and C-ECG by EKRLS, we used the Mugdha et al.'s platform [19] in which the tunable variables include λ, filter power, α, and β.

Transformation of Denoised ECG Signals
In-tandem use of adaptive filtering and the signal transformation was considered as a means to generate low-MSE and high-SNR surrogate C-ECG signals from noisy signals. To do this, we proposed a framework to transform filtered LA-ECG and C-ECG signals into a space similar to the original C-ECG. Let us call the transformed signal T-ECG. Comparing the populated T-ECG signals against the original C-ECG provides a common ground for evaluating the transformation performance in each of the following scenarios: a. Transformation of denoised LA-ECG into a T-ECG; b. Transformation of denoised C-ECG into a T-ECG.
The resulting T-ECG signals are replicas of the original C-ECG from either denoised LA-ECG or C-ECG signals. The main reason for transforming the denoised C-ECG into the original C-ECG (scenario b) was to have a baseline for evaluating the transformation of LA-ECG to T-ECG (scenario a). The steps involved in the transformation of the denoised LA-ECG to T-ECG can be summarized as follows: 1. Creation of the reference C-ECG template from the original C-ECG with an averaged RR interval ( Figure 5); 2. Creation of the LA-ECG template from the filtered LA-ECG with an averaged RR interval; 3. Resampling of the averaged RR interval of the filtered LA-ECG with respect to the reference C-ECG template (upsampling or downsampling is implemented if required); 4. Obtaining the transformation function through dividing the chest ECG template by the LA-ECG template; 5. Resampling of the transformation function according to individual RR intervals of the filtered LA-ECG; 6. Transformation of the filtered LA-ECG to C-ECG through multiplying the resampled transformation function by the original RR intervals of the filtered LA-ECG.
To evaluate the accuracy of the transformed signals against the original C-ECG, we calculated the customized MSE (MSE C ) values for transformed signals using Equation (17), to be presented later. SNR values of the denoised signals were also quantified before and after transformation and compared to the SNR of the original C-ECG. As a rule of thumb, the lower the MSE C and the closer the SNR values, the closer the match between the transformed signals and the original C-ECG.

Creating the Averaged Templates
We assume that the ECG signals had a constant resting heart rate, and the QRS complexes of C-ECG signals can be easily detected and synchronized with those of LA-ECG signals. In addition, we assume that the ECG signals are recorded with a constant heart rate. In reality, we had to synchronize and, if necessary, resample the signals manually by aligning R-peaks due to sampling from different devices. The implementation was done in Matlab, where the detection and resampling make use of standard functions. Let us define : [0, ] → and : [0, ] → as the C-ECG and LA-ECG, respectively, where is the length of our recording. The averaged template based on the clean C-ECG signals : [0,1] → was defined as: where is the LA/C-ECG signal, K the total number of RR-intervals, the time at the kth R-peak in the signal, the variable that parameterizes the function between 0 and 1, and ( − ) the difference between two consecutive R-peaks. Figure 5 shows what the built template looks like.

Constructing the Transformation Signal
To construct a transformation from LA/C-ECG signals to T-ECG, we defined the transformed LA/C-ECG signal ( ) : [0,1] → over an RR-interval and calculated it as follows: where is the averaged template of , and is T-ECG. Note that the domain for has been defined to be a normalized interval [0,1] . For our implementation, we used the same RR window size on this interval as per RR-interval in the original C-ECG signal. When necessary, the resampling function from Matlab (resample) was used to make sure that the RR-intervals for and have the same number of samples. This Matlab function implements upsampling and downsampling for fixed or variable rates. Our implementation of transformation is available at https://github.com/rafa-coding-projects/T-ECG. We assumed the heart rate and, thus, the resulting transformation to be constant; therefore, our current approach does not address varying heart rate scenarios. However, this part of our research can be further explored by taking advantage of PPG IBI data to create transformation signals without having the instantaneous RR intervals of the original C-ECG. In other words, it is anticipated to automatically update the RR intervals of the templates whenever the latest heart rate picked by PPG is significantly different from the previous reading.

Creating the Averaged Templates
We assume that the ECG signals had a constant resting heart rate, and the QRS complexes of C-ECG signals can be easily detected and synchronized with those of LA-ECG signals. In addition, we assume that the ECG signals are recorded with a constant heart rate. In reality, we had to synchronize and, if necessary, resample the signals manually by aligning R-peaks due to sampling from different devices. The implementation was done in Matlab, where the detection and resampling make use of standard functions. Let us define σ C : [0, L] → R and σ LA : [0, L] → R as the C-ECG and LA-ECG, respectively, where L is the length of our recording. The averaged template based on the clean C-ECG signalŝ σ T : [0, 1] → R was defined as:σ where σ is the LA/C-ECG signal, K the total number of RR-intervals, t k the time at the kth R-peak in the signal, s the variable that parameterizes the function between 0 and 1, and (t k − t k−1 ) the difference between two consecutive R-peaks. Figure 5 shows what the built template looks like.

Constructing the Transformation Signal
To construct a transformation from LA/C-ECG signals to T-ECG, we defined the transformed LA/C-ECG signal σ (k) T : [0, 1] → R over an RR-interval and calculated it as follows: whereσ is the averaged template of σ, and σ T is T-ECG. Note that the domain forσ T has been defined to be a normalized interval [0, 1]. For our implementation, we used the same RR window size on this interval as per RR-interval in the original C-ECG signal. When necessary, the resampling function from Matlab (resample) was used to make sure that the RR-intervals for σ C and σ LA have the same number of samples. This Matlab function implements upsampling and downsampling for fixed or variable rates. Our implementation of transformation is available at https://github.com/rafa-coding-projects/T-ECG. We assumed the heart rate and, thus, the resulting transformation to be constant; therefore, our current approach does not address varying heart rate scenarios. However, this part of our research can be further explored by taking advantage of PPG IBI data to create transformation signals without having the instantaneous RR intervals of the original C-ECG. In other words, it is anticipated to automatically update the RR intervals of the templates whenever the latest heart rate picked by PPG is significantly different from the previous reading.

Computing Customized MSE and SNR
The original C-ECG signals have some noise; thus, they cannot be used as a reference for SNR computation. Instead, one can use the proposed template built from the original C-ECG as a reference for calculating the SNR. The template represents an average chest signal with reduced variability, justifying its use. To calculate the SNR, we need to define the average power for the signal and the noise, as shown in Equations (14) and (15), respectively.
whereσ T is the template obtained from the C-ECG. The SNR can be calculated by Equation (15).
Note that for our analyses, we will have different SNR values for the original, noisy, and filtered LA and C-ECG signals.
We defined a customized MSE (MSE C ) between the LA/C-ECG and the C-ECG as a measure of adaptation:

Results and Discussion
Our developed prototype presented in Section 2 provides a low-noise signal, which we want to evaluate under distinct controlled noisy scenarios and examine its applicability for obtaining surrogate chest signals. In order to do that, we artificially added different noise types to the measured signals as described in Section 4. We then evaluated the denoising performance by the presented adaptive filters of Section 5 under a simulated environment. The denoised signals were finally processed by a transformation pipeline proposed in Section 6 to obtain the surrogate chest counterparts. In the following subsections, the observed results are explored. It is important to note that such studies under controlled scenarios are necessary to devise a primary means for assessing real noisy signals, which is intended for future work.

Optimization of Filter Parameters
For LMS, the optimum values of filter parameters including step size, µ, and filter order were determined empirically. Plugging different filter orders ranging from 1 to 10, the minimum MSE and maximum SNR values at a fixed µ were achieved when the filter order was set to 5. As both left arm and chest signals exhibited the same trend, only the chest data are presented. As shown in Figure 6, the MSE and SNR values of noisy C-ECG signals were plotted against µ after filtering by LMS. It was found that, except for EM with an optimal µ of 0.005, all noisy signals were optimally denoised (with reasonably low MSE and maximal SNR) when the µ value was set to 1 × 10 −5 . Using Equation (7)   EKRLS and RLS filter parameters were fine-tuned to reach optimal filtering performance. Agreeably, the parameters used by Mugdha et al. [19] were found to output the lowest MSE values for EKRLS and RLS when applied to the noisy signals.

Evaluation of Adaptive Filtering Algorithms
The MSE between the denoised and original LA-ECG and C-ECG signals were considered the main factor in determining the filtering performance of the used algorithms. Equation (7) was used to calculate the MSE between the denoised and original signals. Table 2 shows that LMS by exhibiting the lowest MSE values was the most effective adaptive filtering algorithm in removing all noises. However, it was found that where maximal SNR and reasonably low MSE were desired, the RLS removed the PLI with a lower MSE than LMS, provided was 1 × 10 −5 . Contrary to other noises, the non-stochastic nature of PLI noises with predictable frequencies (50/60 Hz) makes their patterns detectable and, thus, easy-to-remove by algorithms such as RLS and EKRLS [36]. As mentioned earlier, in situations where the noise is walking and exhibits varying patterns, the use of RLS and EKRLS with their intrinsic memorization aspect can hinder their use [36].  EKRLS and RLS filter parameters were fine-tuned to reach optimal filtering performance. Agreeably, the parameters used by Mugdha et al. [19] were found to output the lowest MSE values for EKRLS and RLS when applied to the noisy signals.

Evaluation of Adaptive Filtering Algorithms
The MSE between the denoised and original LA-ECG and C-ECG signals were considered the main factor in determining the filtering performance of the used algorithms. Equation (7) was used to calculate the MSE between the denoised and original signals. Table 2 shows that LMS by exhibiting the lowest MSE values was the most effective adaptive filtering algorithm in removing all noises. However, it was found that where maximal SNR and reasonably low MSE were desired, the RLS removed the PLI with a lower MSE than LMS, provided µ was 1 × 10 −5 . Contrary to other noises, the non-stochastic nature of PLI noises with predictable frequencies (50/60 Hz) makes their patterns detectable and, thus, easy-to-remove by algorithms such as RLS and EKRLS [36]. As mentioned earlier, in situations where the noise is walking and exhibits varying patterns, the use of RLS and EKRLS with their intrinsic memorization aspect can hinder their use [36].

Evaluation of Transformation
The transformation showed a reasonable approximation to the original C-ECG for several types of noise filtered by LMS and RLS. Figure 12 shows an example of visual matching of QRS complexes between the transformed LA-ECG that was previously contaminated with W noise and cleaned by LMS. In this example, the initial section of the original C-ECG is not covered in transformation, as the template can function when consecutive R peaks are available. The same happens for the end of the signal, in the case the signal terminates before an R peak. Electronics 2020, 9, x FOR PEER REVIEW 13 of 17

Evaluation of Transformation
The transformation showed a reasonable approximation to the original C-ECG for several types of noise filtered by LMS and RLS. Figure 12 shows an example of visual matching of QRS complexes between the transformed LA-ECG that was previously contaminated with W noise and cleaned by LMS. In this example, the initial section of the original C-ECG is not covered in transformation, as the template can function when consecutive R peaks are available. The same happens for the end of the signal, in the case the signal terminates before an R peak.

Evaluation of Transformation
The transformation showed a reasonable approximation to the original C-ECG for several types of noise filtered by LMS and RLS. Figure 12 shows an example of visual matching of QRS complexes between the transformed LA-ECG that was previously contaminated with W noise and cleaned by LMS. In this example, the initial section of the original C-ECG is not covered in transformation, as the template can function when consecutive R peaks are available. The same happens for the end of the signal, in the case the signal terminates before an R peak. All denoised LA-ECG and C-ECG signals were transformed into their chest surrogate signals as per Sections 6.1 and 6.2. Table 3 shows the SNR values of denoised signals before and after transformation. It was observed that the SNR of the transformed signals that were calculated by Equation (16) improved by up to 144% and 155% for LA-ECG and C-ECG, respectively. The values calculated by Equation (17) showed that the difference between the left arm T-ECG and the All denoised LA-ECG and C-ECG signals were transformed into their chest surrogate signals as per Sections 6.1 and 6.2. Table 3 shows the SNR values of denoised signals before and after transformation. It was observed that the SNR of the transformed signals that were calculated by Equation (16) improved by up to 144% and 155% for LA-ECG and C-ECG, respectively. The MSE C values calculated by Equation (17) showed that the difference between the left arm T-ECG and the original C-ECG was about twice as much as that between the chest T-ECG and the original C-ECG. This may be due to the bigger loss of information during templating the denoised LA-ECG compared to C-ECG. The MSE c values between the templates and the original C-ECG were the same within the chest and arm categories, showing that the transformation is capable of generating optimal T-ECG regardless of the type of noise involved and for as long as the major components of the signals are uncovered by filtering. T as the noisy signal. The used step size for denoising EM was µ = 0.005 and µ = 1 × 10 −5 for the rest of the artifacts. ** calculated using Equation (16). *** calculated using Equation (17).
It was observed in multiple cases that the SNR values of denoised signals were higher than those of the original signals. This is because, in order to create the template, the original signal with its embedded noise is first stripped from its noise and thus results in a higher SNR. Therefore, the transforming function can create high-SNR templates according to the new reference. Note that this does not guarantee that the filtered signal is "better," as the SNR is also capturing natural variations in the ECG waveform that may have been remoted by filtering and, hence, part of the signal information may have been lost during the transformation process. In general, one can observe that the transformed signals are a little biased toward the template as most SNR values are larger than that of the original C-ECG. This also allows one to conclude that the transformation also reduces variabilities present in the denoised signals. Although the generated transformation templates from the denoised left-arm ECG do not ignore the heart rate variations, further investigations are required to conclude its impact on waveform quality and the reproducibility of the data from one subject to another.

Conclusions
A new technique for in-tandem adaptive filtering and signal transformation was proposed to create C-ECG replicas from noisy LA-ECG with high accuracy and in a sedentary fashion. Initially, the accuracy of the LA-ECG and C-ECG signals obtained from a multi-metric armband system was validated against a BIOPAC benchtop system. Three adaptive filtering algorithms, namely LMS, RLS, and EKRLS, were optimized to denoise C-ECG and LA-ECG signals corrupted by different sources of noise. The adaptation performance of the used algorithms was determined according to MSE, and LMS was found to be the most effective algorithm in removing all noises from the arm and chest signals. However, for removing PLI with maximal SNR, RLS resulted in a lower MSE value than LMS, where the optimal step size was set to 1 × 10 −5 . In this study, we observed that the transformed LA-ECG has the potential to be used as a surrogate of C-ECG signals for ECG studies. The proposed method of transforming LA-ECG signals into their chest counterparts demonstrates the ability to reduce variability in the denoised signals and establishes a baseline for meaningful comparison between the transformed and clean chest signals. Although chest signals have been used in this study to calculate MSE and SNR, they are not required for transforming LA signals into the chest domain provided the transformation function has been obtained once. The heart rate variability of the transformed signals showed conformity with the signals they originated from and exhibited the main waveforms of the ECG signals with low MSE and high SNR. Building on the current pipeline, the accuracy and reproducibility of the chest templates can be further examined for non-sedentary ECG signals (signals affected by motion artifacts). In addition, this methodology can be improved by verifying how generalizable the proposed transformation is to different subjects and real sources of noise. Finally, to work around the issue of dealing with varying heart rates, one could recompute a transformation once the heart rate varies beyond a specific threshold value; we leave that for future work.