SciELO - Scientific Electronic Library Online

 
vol.45 número3Desarrollo de Materiales Poliméricos como Hidrogeles con Curcumina para Regeneración de Tejidos de la Piel índice de autoresíndice de materiabúsqueda de artículos
Home Pagelista alfabética de revistas  

Servicios Personalizados

Revista

Articulo

Indicadores

Links relacionados

  • No hay artículos similaresSimilares en SciELO

Compartir


Revista mexicana de ingeniería biomédica

versión On-line ISSN 2395-9126versión impresa ISSN 0188-9532

Rev. mex. ing. bioméd vol.45 no.3 México sep./dic. 2024  Epub 02-Mayo-2025

https://doi.org/10.17488/rmib.45.3.7 

Review article

Development of a Frequent Exchange Coordinate Algorithm for Detection of Precordial Electrode Exchange during ECG based on Error and Correlation Parameters

Desarrollo de un Algoritmo de Coordenadas de Intercambio Frecuente para Detección del Intercambio de Electrodos Precordiales ECG basado en Parámetros de Error y Correlación

Edward Carello Figueroa Tejada1  * 
http://orcid.org/0000-0001-6258-9322

Carlos Esteban Mamani Huisa1 
http://orcid.org/0000-0002-0085-6234

Erasmo Sulla Espinoza1 
http://orcid.org/0000-0002-1223-1223

Jorge Rendulich1 
http://orcid.org/0000-0003-1302-547X

1Universidad Nacional de San Agustín de Arequipa, Arequipa - Perú


ABSTRACT

In order to develop a method for detecting precordial electrode exchange, a frequent exchange coordinate (FEC) algorithm was implemented, that identified the minimum correlation points necessary to detect a specific electrode exchange, and its performance was tested with error estimators (mean square error and percent mean square difference). Validation of the algorithm was performed using the k-fold cross-validation technique on the PTB, Chapman University and Shaoxing Hospital, PTB XL, and Georgia 12-lead ECG Challenge databases. The results indicate averages of Se= 99.16 % and Sp= 99.38 % (MSE), Se= 95.38 % and Sp= 99.47 % (PRD), Se= 98.44 % and Sp= 99.49 % (Pearson), Se= 98.45 % and Sp= 99.48 % (modified Pearson), Se= 95.39 % and Sp= 99.81 % (Bray Curtis), Se= 80.00 % and Sp= 97.84 % (correlation sign). MSE presents a significant improvement in execution time (61.49µs N=1000), representing, on average, 44.99 % of the execution time for Pearson correlation. The frequent exchange coordinates algorithm was then validated using signal analysis with the mean square error (MSE), representing a good alternative to detect electrode exchange in real time, easy to implement, and low computational cost.

KEYWORDS: 12-lead ECG; correlation; error estimators; electrode exchange

RESUMEN

Con objetivo de desarrollar un método de detección de intercambio de electrodos precordiales, se implementó un algoritmo de coordenadas de intercambio frecuentes (FEC) que identifica lo mínimos puntos de correlación necesarios para detectar un intercambio de electrodos específico y a su vez se probó su desempeño con estimadores de error (error cuadrático medio y diferencia cuadrática media porcentual). La validación del algoritmo se hizo mediante la técnica k-fold cross-validation en las bases de datos PTB, Chapman University and Shaoxing Hospital, PTB XL y Georgia 12-lead ECG Challenge. Los resultados indican promedios de Se= 99,16 % y Sp= 99,38 % (MSE), Se= 95,38 % y Sp= 99,47 % (PRD), Se= 98,44 % y Sp= 99,49 % (Pearson), Se= 98,45 % y Sp= 99,48 % (Pearson modificado), Se= 95,39 % y Sp= 99,81 % (Bray Curtis), Se= 80,00 % y Sp= 97,84 % (correlación signo). MSE presenta una mejora significativa en el tiempo de ejecución (61,49µs N=1000), representando en promedio el 44.99 % del tiempo de ejecución para correlación de Pearson. Se valida entonces el algoritmo de coordenadas de intercambio frecuente con análisis de señales con error cuadrático medio (MSE), representando una buena alternativa para detectar el intercambio de electrodos en tiempo real, de fácil implementación y bajo costo computacional.

PALABRAS CLAVE: ECG-12 derivaciones; correlación; estimadores de error; intercambio de electrodos

INTRODUCTION

The involuntary exchange of electrodes during electrocardiogram (ECG) testing is one of the most frequent technical errors in primary care health centers[1], producing erroneous diagnoses in up to 24 % of cases[2][3], some of which are severe medical conditions, such as acute ST-segment elevation myocardial infarction (STEMI), with an incidence of 11 %[3]. These exchanges occur more frequently with real-time biomedical devices, such as those intended for use in primary care health centers in remote areas using telemedicine, with reports of reversals in up to 50 % of cases caused mainly by medical personnel not specialized in cardiology[2].

Early electrode exchange detection algorithms used alterations in the P- QRS -T wave morphology of the electrocardiogram signal[4], signal reconstruction, and correlation[5][6] with low accuracy for specific detections. The following methods are based on the use of Machine Learning: Decision Trees[4][7][8][9][10], Artificial Neural Networks[6][11][12], Support Vector Machines[7][9][13], and amplitude thresholding[14], techniques of variable accuracy in terms of sensitivity and specificity, which, although they can reach high values, have the drawback of requiring high processing power and a high waiting time[15][16], which complicates their implementation in real-time embedded devices. Subsequently, Jekova[17] developed a method based on Pearson correlation coefficients distributed in an ordered manner in correlation matrices, achieving Se= 87 % - 97.8 % and Sp = 91 %, an improvement in the accuracy and processing of electrode detection algorithms.

The current research team intends to implement a method of automatic detection of electrode exchange in biomedical devices in real time, as part of the Think Health project, based on an edge computing model. This project, in turn, is part of the Biomedical Engineering at the “Universidad Nacional de San Agustín de Arequipa”[18][19][20][21][22] [23]. However, the current detection method is computationally expensive[24].

Some methods that correlate or quantify the morphological similarity between biological signals are the Bray- Curtis similarity (mBC) and signed correlation coefficient (SCC), with fewer operations during processing compared with the traditional Pearson correlation[25]. The study of [26] represented ECG precordial signals as a displacement of precordial V1, so it can be deduced that the precordial signs differ little. With this in mind, it is possible to compare this difference using error parameters. These error estimators, such as the mean squared error (MSE) or root mean square difference (PRD), have been widely used as performance parameters to determine filter quality[27], validate preprocessing techniques[28], and evaluators of ECG signal acquisition[29]; however, they may have potential in this detection algorithm.

This paper proposes a new precordial electrode exchange detection method based on error estimators (MSE and PRD) and improves the algorithm based on correlation coefficients using signal correlation methods with lower computational complexity (Bray Curtis, Pearson Correlation, Modified Pearson Correlation, and Signed Correlation). This research determines the most suitable electrode exchange detection algorithm for implementation in embedded biomedical systems, such as the Think Health project.

Databases

The databases used in this article are PTB (Physikalisch Technische Bundesanstalt)[30][31], with 549 conventional 12-lead and 3-lead Frank records from 290 subjects; the extended version of PTB: PTB XL, with 21837 clinical ECG records belonging to 18885 patients[32]; Georgia 12-Lead ECG Challenge Database (G12EC) from Emory University, Atlanta,[33] with 10344 records representing a demographic group from the southeastern United States; and the database created by Chapman University and Shaoxing People's Hospital (CUSPH),[34] with records from 10646 patients; whose main characteristics are summarized in Table 1.

Table 1 Databases used. 

Dataset Records Duration Leads Sampling
PTB 549 32-120 s I, II, II, aVR, aVL, aVF, V1-V6 1000 Hz
PTB-XL 21837 10s I, II, II, aVR, aVL, aVF, V1-V6 500 Hz
G12EC 10344 10s I, II, II, aVR, aVL, aVF, V1-V6 500 Hz
CUSPH 10 646 10s I, II, II, aVR, aVL, aVF, V1-V6 500 Hz

These databases were chosen because they are the only databases with 12-lead digital signals. The pathological signals present in some recordings make them ideal for testing detection algorithms, whereas databases such as PTB and PTB-XL have unmodified signals with different types of noise and artifacts and a realistic distribution of data quality in clinical practice and in the face of changes in environmental conditions or various imperfections in the input data[32].

MATERIALS AND METHODS

Precordial electrode exchange detection

The precordial electrode detection algorithm is based on the correlation between nearby precordial leads with a more significant similarity between the signals of adjacent electrodes[17]. The coefficients in a correlation matrix give the maximum correlation (with value 1) on the diagonal for a signal with itself and a descending numerical sequence of the other correlation coefficients, as shown in Figure 1.

Figure 1 Correlation coefficient matrix. Blue squares: Coefficients of maximum value (1) in signals correlated with themselves (am,m). Light blue squares: The coefficients are ordered in descending order. Gray boxes: Comparison of adjacent correlation coefficients. 

This article proposes new matrix based on the calculation of error coefficients by measuring the difference between adjacent leads. This may allow the creation of a matrix of error coefficients with characteristics opposite to those of the correlation matrix presented in Figure 1, having on the diagonal the comparison of a signal with itself, with difference 0, and an ascending numerical sequence as the other precordial leads are compared, as shown in Figure 2.

Figure 2 Matrix based on error estimators. Blue boxes: Coefficients of minimum value (0), error of signal with itself. Light blue boxes: Coefficients ordered in ascending order. Gray boxes: Comparison of adjacent correlation coefficients. 

To find the minimum number of coefficients needed to detect a specific electrode exchange, Frequent Exchange Coordinates (FECs) were established. These FECs can detect specific electrode exchanges without using the full correlation matrix or error matrix, thus minimizing the number of correlation or error estimation coefficients used during testing.

The FECs are determined through the change in the comparisons of a standard correlation matrix or error matrix and can be represented in a 6x5 matrix, as shown in Figure 3; this matrix is obtained from the comparisons between the coefficients in Figures 1 and 2. In Figure 3, r(XY) represents the comparison (higher or lower) of the correlation or error coefficients between V(X, Y) and V(X, Y+1). The coordinates found are presented in the results with a value of 1 if there is a reverse of the comparison between the pairs of coefficients and 0 if there is no change in contrast in most cases.

Figure 3 Matrix for comparing correlation coefficients or error estimators. 

Electrode exchange detection algorithm

Based on the behavior of the precordial signals described above, the algorithm summarized in Figure 4.

Figure 4 Summary of the Electrode Exchange Detection Algorithm. 

The algorithm begins by preprocessing the signal in its input records using a 1Hz - 30Hz FIR filter. The FIR filter designed in MATLAB uses the syntax b = fir1(n,[Wn1 Wn2]). This method uses a least squares approximation to calculate the filter coefficients and then smooths the signal using a window. This filter creates a row vector b containing the Hamming window filter coefficients of order n. Then, vector [Wn1 Wn2] contains two elements containing the pass-band edge frequencies, which, in turn, respond to the Nyquist frequency, half the sampling frequency.

The choice of the 1-30 Hz band was based on the work done by Jekova[17], who obtained good performance when preprocessing the signal for precordial signal correlation algorithms. In addition, preliminary tests showed that the noise in the signals and artifacts present in the evaluated databases evaluated were attenuated with this range of filters.

Likewise, another future objective of this work is to implement this algorithm in embedded systems for which the finite impulse digital filter (FIR) is an ideal candidate in this type of systems, presenting implementation advantages over other types of digital filters, such as the IIR infinite impulse response filter for real-time ECG signal processing applications, as described by Bui and Byun[35].

For the evaluation of this specific algorithm, 2 s of the 10 available samples in each record were taken for the PTB-XL, G12EC, and CUSPH databases, which have a sampling frequency of 500 Hz, and only 1 s in the PTB database with a sampling frequency of 1000 Hz, with the objective of having an equal number of samples to evaluate in each record; likewise, the full wave signal around the R peak was considered for this analysis. In the future, the application of this algorithm in an embedded system could take action at the time of starting to use the 12-lead ECG or continuously, remembering that this will only be an emergency system in case of a possible error in the placement of electrodes, and the filters applied here will not influence the signal recorded for diagnosis by health personnel.

Then, the verification of the frequent exchange coordinates (FECs) was performed in 2 approaches: correlation coefficients and error parameters, to determine the type of comparison with the best results.

In this test, the effectiveness of using the difference between the precordial lead signals was determined using error parameters, such as the mean square error (MSE) presented in Equation 1 and, the percent root mean square error (PRD), presented, in Equation 2:

Mean Squared Error (MSE)

MSE=1Ni=1N(xi-yi)2 (1)

Percent Root Mean Square Difference (PRD)

PRD=i=1Nxi-yi2i=1Nxi2x100 (2)

These methods are compared to the conventional Pearson correlation presented in Equation 3:

ρ=i=1N(xi-x¯)-(yi-y¯)i=1N(xi-x¯)2i=1N(yi-y¯)2 (3)

To improve the signal correlation method in terms of computational cost, a modified Pearson correlation method, (Equation 4) was used. Gembris et al. reported that this formula reduces the redundancy produced by pairwise correlations[36]. At the same time, the performance of other signal similarity assessment methods will be tested, such as the Bray-Curtis similarity coefficient (Equation 5) and the signed correlation coefficient (Equation 6) mentioned by Lian, Muessig, and Lang, because of their low computational requirements and sensitivity to amplitude difference[25]:

Modified Pearson Correlation

mρ=Ti=1T(xiyi)-i=1Txi.i=1Tyii=1Txi2-(i=1Txi)2.i=1Tyi2-(i=1Tyi)2 (4)

Bray-Curtis similarity coefficient (mBC)

mBC=1-i=1Nxi-yii=1Nxi+|yi| (5)

Correlation coefficient with sign (SCC)

SCC=i=1Nsgnxisgn(yi)N (6)

To further reduce the computational complexity and based on the symmetric property of the Pearson Correlation coefficient (corr(x,y) = corr(y,x)[36], reducing the number of coefficients from N^2=36 elements to N(N-1)/2=15, which corresponds to the upper triangle above the main diagonal part of the correlation matrix (Figure 5).

Figure 5 Simplification of the coefficients in the correlation matrix. 

The above-mentioned calculations for verifying frequent exchange coordinates were performed by simulating electrode exchanges in a training group. Finally, these FECs were tested in test groups (The determination of the training and test groups will be mentioned later).

Electrode exchange simulations

Simulations of precordial electrode exchange were performed to determine the frequent exchange points and to verify the sensitivity and specificity of the algorithm for detecting these simulated changes.

The simulation was performed by changing the data matrices of each lead in Matlab R2020a program. The electrode exchange simulation was performed assuming that the database records had no previous electrode exchanges.

Exchanges can be classified into hops; when the exchange is between 2 adjacent electrodes, it is a one-hop exchange; if the distance between the exchanged electrodes is two, it is a two-hop exchange, and for a distance of 3, it is a 3 hop exchange. In these cases, 12 simulated exchange shapes were obtained.

The precordial electrode exchange simulation results are presented in Table 2.

Table 2 Simulated exchanges in precordial electrodes. 

Hop Simulated swap Hop Simulated swap Hop Simulated swap
1 hop V1-V2 2 hop V1-V3 3 hop V1-V4
V2-V3 V2-V4 V2-V5
V3-V4 V3-V5
V4-V5 V4-V6 V3-V6
V5-V6

Validation of the proposed method in databases

The validation of the algorithms using each error and correlation method was performed using the block diagram presented in Figure 6.

Figure 6 Validation of algorithms in databases. 

Validation was performed using the k-fold cross-validation technique (Figure 7); the records of each database were randomly separated into eight groups of an equal number of data. In the first cycle, group 1 took the role of the test set, and the rest of the training set. Specific exchange points for 1, 2, and 3 hop electrode exchanges will be determined throughout training and tested in the test group. In the next cycle, group 2 is the test set, and the other records are the training set. The k-fold cross-validation method assumes that the test set iterates with the 8 groups created.

Figure 7 k-fold cross validation(k=8) in PTB-XL database. 

As mentioned above, to validate the method with K fold cross validation, 8 groups are separated from the total number of records in each database and placed in the Records column of Table 3, this table in turn presents the size of each group and the dynamic training and test sets. As can be seen, the number of records was less than the total number of records in the database because the total group size evaluated was required to be a multiple of k = 8.

Table 3 Group sizes for k-fold cross validation. 

Dataset Records k Group size Training set Test set
PTB 549 8 68 476 68
PTB-XL 21832 8 2729 19103 2729
G12EC 10344 8 1293 9051 1293
CUSPH 10640 8 1330 9310 1330
PTB 549 8 68 476 68

This process is performed iteratively to obtain the mean values of Sensitivity (Equation 7) and Specificity (Equation 8) for each database. These performance metrics were obtained from the confusion matrix shown in Figure 8.

Figure 8 Confusion Matrix. 

Where:

  • TP is the number of positive exchanges correctly classified as positive by the model.

  • TN is the number of negative exchanges correctly classified as negative by the model.

  • FN is the number of positive exchanges incorrectly classified as negative.

  • FP is the number of negative exchanges incorrectly classified as positive.

Se%=TPTP+FN*100 (7)

Sp%=TNTN+FP*100 (8)

where TP = true positive, TN = true negative, FN = false negative, and FP = false positive.

The FECs obtained during training in a more extensive database (PTB XL) were used to ensure that coordinates were valid in any database. Finally, these FECs from the more extensive database were tested on the other databases.

Determination of processing time

Additional tests were performed to determine processing time for each method (Table 4). The cputime function available in matlab was used in sets of N samples taken at random in each database (N=250, N=500, N=1000, N= 2000, N=3000, N=4000, N=5000). This function determines the time required by the central processing unit (CPU) to process program instructions. All formative and direct experiments were performed using Matlab R2020a software on a PC with a Windows 10 operating system, 2.4-GHz Intel Core i5 processor, and 4.096-GHz RAM.

Table 4 Execution times to find. 

Method Abbreviation
Mean squared error TMSE
PRD TPRD
Conventional Pearson Tρ
Modified Pearson Tmρ
Bray Curtis TmBC
Signed correlation TSCC

RESULTS AND DISCUSSION

Sensitivities and specificity of the algorithm

The methodology described above was used to obtain the average sensitivity and specificity of each database. The Frequent Exchange Coordinates algorithm was tested using correlation (p, mp, mBC, SCC) and error parameters (MSE and PRD). The average Se and Sp values are listed in Table 5. As can be seen, on average, the correlation methods were slightly more accurate in diagnosing electrode exchanges, with the Pearson and modified Pearson correlations being more accurate.

Table 5 Average Se and Sp values of the algorithm with own FECs. 

Database PTB PTB XL G12EC CUSPH Mean
Method Se (%) Sp (%) Se (%) Sp (%) Se (%) Sp (%) Se (%) Sp (%) Se (%) Sp (%)
MSE 96.29 % 97.52 % 99.96 % 98.26 % 98.23 % 99.93 % 99.96 % 98.91 % 98.61 % 98.66 %
PRD 96.26 % 97.57 % 99.95 % 98.96 % 94.62 % 99.74 % 93.89 % 99.62 % 96.18 % 98.97 %
p 99.52 % 99.60 % 98.99 % 99.01 % 98.93 % 98.41 % 99.29 % 98.89 % 99.18 % 98.98 %
mp 99.52 % 96.72 % 99.00 % 98.96 % 98.93 % 98.37 % 99.29 % 98.88 % 99.19 % 98.23 %
mBC 93.13 % 95.94 % 97.93 % 99.99 % 97.00 % 97.49 % 98.67 % 99.98 % 96.68 % 98.35 %
SCC 75.09 % 96.76 % 90.99 % 94.81 % 92.25 % 96.29 % 97.28 % 96.81 % 88.90 % 96.17 %

Table 6 shows the Frequent Exchange Coordinates (FEC) obtained from the training database of the more extensive database (PTB-XL). This table displays the highest percentage of exchange in the coordinates of the FEC columns (with exchange) and the percentage of exchange in coordinates that usually remain unchanged in the FEC (without exchange). For example, in the simulated exchange between V1 and V2, the coordinates r31 and r41 change in 99.23 % and 99.89 % of cases, respectively. For the same simulation, V1 and V2, the coordinates r42 and r53 were unchanged in 99.82 % and 99.94 % of the cases, respectively. Using the proposed algorithm, these FECs (r31 r41 r42 r53) can be coded as 1 if there is an exchange and 0 if there is no exchange. The proposed coding scheme is presented in Table 6.

Table 6 Average Se and Sp in the PTB-XL database. 

Swap FEC (With exchange) FEC (Without exchange)
N Leads Coord. % Coord. % Coord. % Coord. % Coord. %
1 V1-V2 r31 99.23 r41 99.89 - - r42 99.82 r53 99.94
2 V2-V3 r42 99.7 r52 99.47 - - r41 99.94 r53 99.98
3 V3-V4 r53 99.78 r63 99.41 - - r52 99.97 r64 99.96
4 V4-V5 r34 99.43 r64 99.63 - - r35 99.99 r23 99.99
5 V5-V6 r35 98.12 r45 97.7 - - r34 99.98 - -
6 V1-V3 r41 99.73 r42 98.89 - - r53 99.98 - -
7 V2-V4 r63 99.46 r52 99.63 - - r14 99.99 r51 99.98
8 V3-V5 r64 99.41 r63 99.34 r35 98.57 r12 99.99 - -
9 V4-V6 r34 99.43 r35 99.43 - - r23 99.99 - -
10 V1-V4 r51 99.92 r12 99.73 r53 99.73 r31 99.99 - -
11 V2-V5 r23 99.74 r62 99.82 r64 99.64 r15 99.99 r52 99.99
12 V3-V6 r25 99.6 r64 99.44 r23 98.94 r12 99.99 r63 99.99

As can be seen, it is only necessary to verify the code of the FEC specific to detect electrode exchange. That is, obtaining correlation or error coefficients to find the FECs and determine whether an exchange occurred at those points significantly minimizes computational cost. The frequent exchange coordinates listed in Table 7 were tested in the PTB, G12EC, and CUSPH databases.

Table 7 Frequent Exchange Coordinates codes for each hop. 

N Swap FEC Code
1 V1-V2 r31 r41 r42 r53 1100
2 V2-V3 r41 r42 r52 r53 110
3 V3-V4 r52 r53 r63 r64 110
4 V4-V5 r23 r34 r35 r64 101
5 V5-V6 r34 r35 r45 11
6 V1-V3 r41 r42 r53 110
7 V2-V4 r14 r51 r52 r63 11
8 V3-V5 r12 r35 r63 r64 111
9 V4-V6 r23 r34 r35 11
10 V1-V4 r12 r51 r53 r64 1110
11 V2-V5 r15 r23 r52 r62 r64 1011
12 V3-V6 r12 r23 r25 r63 r64 1101

The Sensitivities and Specificities of each exchange were then averaged and presented in Table 8.

Table 8 Average Se and Sp values in the test databases. 

Set Training set Test set 1 Test set 2 Test set 3 Mean
Database PTB XL PTB G12EC CUSPH
Method Se(%) Sp(%) Se(%) Sp(%) Se(%) Sp(%) Se(%) Sp(%) Se(%) Sp(%)
MSE 99.96 % 98.26 % 97.22 % 99.69 % 99.67 % 99.87 % 99.77 % 99.68 % 99.16 % 99.38 %
PRD 99.95 % 98.96 % 93.23 % 99.61 % 94.45 % 99.45 % 93.89 % 99.86 % 95.38 % 99.47 %
p 98.99 % 99.01 % 99.11 % 99.66 % 97.96 % 99.56 % 97.68 % 99.74 % 98.44 % 99.49 %
mp 99.01 % 98.96 % 99.11 % 99.66 % 97.95 % 99.56 % 97.74 % 99.74 % 98.45 % 99.48 %
mBC 97.93 % 99.99 % 92.05 % 99.45 % 97.12 % 99.94 % 94.45 % 99.86 % 95.39 % 99.81 %
SCC 90.99 % 94.81 % 60.69 % 98.78 % 83.36 % 98.76 % 84.96 % 99.01 % 80.00 % 97.84 %

Sensitivity is excellent, with values above 95 % and specificity greater than 99 %. However, the correlation by SCC is somewhat lower.

Determination of algorithm processing time

Table 9 presents the average processing time of the frequent exchange coordinate algorithm for each method (MSE, PRD, p, mp, mp, mBC, SCC) on a set of N samples (N=250, N=500, N=1000, N=2000, N=3000, N=4000, N=5000) taken at random in each database. The processing time was determined using the CPU time function (cputime).

Table 9 Processing time for each method and test database. 

Database N TMSE(us) TPRD(us) Tp(us) Tmp(us) TmBC(us) TSCC(us)
PTB 250 0.12 0.14 0.24 0.22 0.25 56.76
500 66.44 85.74 145.95 160.53 79.67 65.56
1000 77.08 106.84 177.22 250.47 107.03 84.06
2000 108.11 167.86 264.23 436.56 169.69 122.7
3000 161.65 241.82 331.53 653.49 250.25 171.18
4000 191.82 305.48 401.93 838.4 316.09 212.12
5000 226.93 371.71 480.14 1062.56 381.75 249.56
G12EC 250 0.04 0.06 0.1 0.33 0.06 38.76
500 42.13 60.18 99.63 134.3 58.36 47.2
1000 48.66 72.59 115.38 217.33 70.91 54.75
2000 55.92 86.58 129.84 398.19 85.71 63.31
3000 70.27 114.22 164.34 601.81 114.1 81.53
4000 86.24 143.24 197.9 783.24 143.41 99.52
5000 106.93 185.64 236.25 992.74 185.66 122.43
CUSPH 250 0.02 0.03 0.05 0.1 0.03 64.3
500 45.16 62.54 101.91 139.75 63.01 49.61
1000 58.73 89.92 131.59 225.5 88.66 66.73
2000 88.77 145 200.39 400.96 147.04 103.26
3000 139.08 233.47 280.31 656.81 245.93 153.69
4000 175.75 297.91 355.53 852.62 314.32 194.85
5000 221.48 379.4 444.28 1058.54 396 245.16

The MSE and SCC methods had the shortest processing times in all databases, with an average of 61.49us (MSE) and 68.51us (SCC) for N = 1000. In contrast, the Pearson and modified Pearson correlation methods had average processing times of 231.10 and 141.39 US for K = 1000. Comparing the MSE processing method with the Pearson evaluation method for all values of N, the average processing time with the MSE method represented 44.99 % of the processing time with the Pearson evaluation.

Discussion

The detection of electrode exchange using the error estimators presented an average accuracy of Se= 99.16 % and Sp=99.38 % for the MSE, compared to the correlation methods whose maximum was Se= 98.45 % and Sp=99.48 % = for mρ. This accuracy is comparable to the previous correlation method [17], with Se=. 93.8%-99.8% and Sp = 98.9 %, as well as methods based on Machine Learning: Decision Trees [4][8][9][10]: Se = 17.9 % - 99.3 % Sp= 86.6 % - 100 %, Neural Networks [6][11][12]: Se = 44.5 % - 99.9 % Sp= 99 %, SVM [9][13]: Se = 56.5 % - 93.7 % Sp = 86.6 % - 99.9 % and Amplitude Thresholds [14]: Se = 20 % - 90 % and Sp = 99.8 %.

Average processing times of 61.49µs for MSE (N=1000) and 89.78µs for PRD were obtained, thus achieving a reduction of up to 73.39 % compared with the conventional Pearson correlation method with 231.10µs [17]. These results allow us to deduce that this detection method can also be applied to the analysis of peripheral electrodes. Although the shortest processing times correspond to SCC and MSE, SCC is not highly accurate and is not recommended for use in this algorithm. On the other hand, MSE has a shorter processing time and adequate accuracy, with SE = 99.16 % and SP = 99.38 %, making it ideal for use in the Frequent Exchange Coordinate algorithm.

The use of coefficient reduction for pairwise comparisons performed by Gembris et al. [36] is validated and recommended, finding that only N(N-1)/2=15 correlation or error coefficients need to be obtained compared to the 36 coefficients described in the work of Jekova [17] to detect electrode inversions effectively. However, it method is not applicable when using the PRD error estimator because it excludes symmetric coefficients. In turn, the developed algorithms are effective for both standard and pathological or noisy signals; this is demonstrated when used in databases with these characteristics, such as G12EC, which has high accuracy values ranging from 94.45% to 99.67 % using the error estimators.

CONCLUSIONS

This article presents a novel method for automatically detecting precordial electrode exchange by replacing correlation coefficients with error estimators. This strategy significantly improves the algorithm execution time and dramatically reduces the amount of data processing, thereby reducing the computational cost while achieving test accuracy comparable to correlation-based algorithms. The experimental results demonstrated that the most efficient method in terms of execution time, memory, and accuracy was the MSE method, with an average processing time of 61.49µs for the MSE (N=1000), which is a reduction of 56. 51% compared to the conventional Pearson correlation method; in terms of accuracy, this method obtained Se= 99. 16% and Sp=99.38 comparable to high computational cost methods such as those based on Machine Learning previously mentioned and with results superior to correlation methods [17] with Se=. 93.8%-99.8% and Sp= 98.9%.

Algorithms based on correlation and error estimators, such as Bray-Curtis, modified Pearson, MSE, and PRD, are accurate methods for electrode exchange detection with high sensitivity and specificity. Among these, MSE has the shortest processing time, making it ideal for use in the Frequent Exchange Coordinates (FEC) algorithm. In turn, FEC coordinates increase the specificity of the algorithm, which is an advantage for algorithms intended for use in embedded systems because it reduces the percentage of false alarms. In other words, the use of the MSE-based FEC algorithm is an accurate and easy method to implement in any embedded system because it, is only necessary to find the coefficients of the codes presented in Table 7. However, it should be considered that it is possible that some diseases may alter electrical signals and therefore the correlation or difference between these signals. However, although this topic is beyond the scope of this research, it can be further explored in future work.

For all these reasons, MSE was determined to be the most suitable method for implementation in the Think Health Project biomedical kit.

ACKNOWLEDGMENTS

This work is part of the research project "Think Health - Development of a kit of Biomedical Instruments for basic health care centers and to assist in the study of chronic and congenital diseases" financed by the “Universidad Nacional de San Agustín de Arequipa” through contract number IBA-IB-44-2020-UNSA.

REFERENCES

[1] D. M. F. Palhares, M. S. Marcolino, T. M. M. Santos, J. L. P. da Silva, et al., “Normal limits of the electrocardiogram derived from a large database of Brazilian primary care patients,” BMC Cardiovasc. Disord., vol. 17, 2017, art. no. 152, doi: https://doi.org/10.1186/s12872-017-0572-8 [ Links ]

[2] A. Hadjiantoni, K. Oak, S. Mengi, J. Konya, T. Ungvari, “Is the Correct Anatomical Placement of the Electrocardiogram Electrodes Essential to Diagnosis in the Clinical Setting: a Systematic Review,” Cardiol. Cardiovasc. Med., vol. 5, no. 2, pp. 182-200, 2021, doi: https://www.doi.org/10.26502/fccm.92920192 [ Links ]

[3] R. R. Bond, D. D. Finlay, C. D. Nugent, C. Breen, D. Guldenring, and M. J. Daly, “The effects of electrode misplacement on clinicians’ interpretation of the standard 12-lead electrocardiogram,” Eur. J. Intern. Med., vol. 23, no. 7, pp. 610-615, 2012, doi: https://doi.org/10.1016/j.ejim.2012.03.011 [ Links ]

[4] C. Han, R. E. Gregg, and S. Babaeizadeh, “Automatic detection of ECG lead wire interchange for conventional and Mason-Likar lead systems,” in Computing in Cardiology 2014, Cambridge, MA, USA, 2014, pp. 145-148. [ Links ]

[5] H. Xia, G. A. Garcia, and X. Zhao, “Automatic detection of ECG electrode misplacement: a tale of two algorithms,” Physiol. Meas., vol. 33, 2012, art. no. 1549, doi: https://doi.org/10.1088/0967-3334/33/9/1549 [ Links ]

[6] J. A. Kors and G. van Herpen, “Accurate automatic detection of electrode interchange in the electrocardiogram,” The Am. J. Cardiol., vol. 88, no. 4, pp. 396-399, 2001, doi: https://doi.org/10.1016/S0002-9149(01)01686-1 [ Links ]

[7] K. Rjoob, R. Bond, D. Finlay, V. McGilligan, et al., “Machine learning techniques for detecting electrode misplacement and interchanges when recording ECGs: a systematic review and meta analysis,” J. Electrocardiol., vol. 62, pp. 116-123, 2020, doi: https://doi.org/10.1016/j.jelectrocard.2020.08.013 [ Links ]

[8] J. Kors and G. van Herpen , “A novel method to detect electrocardiographic electrode interchanges,” Journal of Electrocardiology, vol. 33, pp. 209-210, 2000, doi: https://doi.org/10.1054/jelc.2000.20352 [ Links ]

[9] K. Rjoob , R. Bond , D. Finlay , V. McGilligan , et al., “Data driven feature selection and machine learning to detect misplaced V1 and V2 chest electrodes when recording the 12-lead electrocardiogram,” J. Electrocardiol., vol. 57, pp. 39-43, 2019, doi: https://doi.org/10.1016/j.jelectrocard.2019.08.017 [ Links ]

[10] R. E. Gregg , E. W. Hancock, and S. Babaeizadeh , “Detecting ECG limb lead wire interchanges involving the right leg lead-wire,” in Computing in Cardiology 2017, Rennes, France, 2017, doi: https://doi.org/10.22489/CinC.2017.014-061 [ Links ]

[11] B. Hede´n, M. Ohlsson, L. Edenbrandt, R. Rittner, O. Pahlm, and C. Peterson, “Artificial neural networks for recognition of electrocardiographic lead reversal,” Am. J. Cardiol., vol. 75, no. 14, pp. 929-933, 1995, doi: https://doi.org/10.1016/S0002-9149(99)80689-4 [ Links ]

[12] B. Hede´n , M. Ohlsson, H. Holst, M. Mjöman, et al., “Detection of frequently overlooked electrocardiographic lead reversals using artificial neural networks,” Am. J. Cardiol. , vol. 78, no. 5, pp. 600-604, 1996, doi: https://doi.org/10.1016/S0002-9149(96)00377-3 [ Links ]

[13] K. Rjoob , R. Bond , D. Finlay , V. McGilligan , S. J. Leslie, A. Iftikhar, and A. Peace, “Machine learning improves the detection of misplaced v1 and v2 electrodes during 12-lead electrocardiogram acquisition,” in 2019 Computing in Cardiology (CinC), Singapore, Singapore, 2019, pp. 1-4, doi: https://doi. org/10.22489/CinC.2019.035 [ Links ]

[14] J. de Bie, D. W. Mortara, and T. F. Clark, “The development and validation of an early warning system to prevent the acquisition of 12-lead resting ECGs with interchanged electrode positions,” J. Electrocardiol. , vol. 47, no. 6, pp. 794-797, 2014, doi: https://doi.org/10.1016/j.jelectrocard.2014.08.015 [ Links ]

[15] G. Zhu, D. Liu, Y. Du, C. You, J. Zhang, and K. Huang, “Toward an intelligent edge: Wireless communication meets machine learning,” IEEE Commun. Mag., vol. 58, no. 1, pp. 19-25, 2020, doi: https://doi.org/10.1109/MCOM.001.1900103 [ Links ]

[16] Khanzode, K. C. A., Sarode, R. D, “Advantages and Disadvantages of Artificial Intelligence and Machine Learning: A Literature Review,” Int. J. Libr. Inf. Sci., vol. 9, no. 1, 30-36, 2020, doi: https://doi.org/10.17605/OSF.IO/GV5T4 [ Links ]

[17]I. Jekova, V. Krasteva, R. Leber, R. Schmid, et al., “Interlead correlation analysis for automated detection of cable reversals in 12/16-lead ECG,” Comput. Methods Programs Biomed., vol. 134, pp. 31-41, 2016, doi: https://doi.org/10.1016/j.cmpb.2016.06.003 [ Links ]

[18]A. Medina, N. Lopez, J. Galdos, E. Supo, J. Rendulich, and E. Sulla, “Continuous Blood Pressure Estimation in Wearable Devices Using Photoplethysmography: A Review,” Int. J. Emerging Technol. Adv. Eng., vol. 12, no. 10, 104-113, 2022, doi: https://doi.org/10.46338/ijetae1022_12 [ Links ]

[19] J. R. Huamani Talavera , E. A. S. Mendoza, N. M. Dávila, and E. Supo, “Implementation of a real-time 60 Hz interference cancellation algorithm for ECG signals based on ARM cortex M4 and ADS1298,” in 2017 IEEE XXIV International Conference on Electronics, Electrical Engineering and Computing (INTERCON), Cusco, Perú, 2017, pp. 1-4, doi: https://doi.org/10.1109/INTERCON.2017.8079725 [ Links ]

[20] T. R. Sulla, S. J. Talavera, C. E. Supo , and A. A. Montoya, “Non invasive glucose monitor based on electric bioimpedance using AFE4300,” in 2019 IEEE XXVI International Conference on Electronics, Electrical Engineering and Computing (INTERCON), Lima, Perú, 2019, pp. 1-3, doi: https://doi.org/10.1109/INTERCON.2019.8853561 [ Links ]

[21] J. R. Beingolea, M. A. Zea Vargas, R. Huallpa, X. Vilca, R. Bolivar, and J. Rendulich , “Assistive Devices: Technology Development for the Visually Impaired,” Designs, vol. 5, no. 4, 2021, art. no. 75, doi: https://doi.org/10.3390/designs5040075 [ Links ]

[22] J. R. Beingolea, H. A. Rodrigues, M. Zegarra, E. Sulla Espinoza, R. Torres Silva, and J. Rendulich , “Designing a Multiaxial Extensometric Force Platform: A Manufacturing Experience,” Electronics, vol. 10, no. 16, 2021, art. no. 1907, doi: https://doi.org/10.3390/electronics10161907 [ Links ]

[23] M. Huisa C., T. E. Figueroa, E. Supo , J. Rendulich , and E. Espinoza, “PCG heart sounds quality classification using neural networks and Smote Tomek Links for the Think Health project,” in 1st International Conference on Computational Intelligence and Innovative Technologies (ICCIIT), Pune, India, 2022, pp. 803-811, do: https://doi.org/10.1007/978-981-19-7615-5_65 [ Links ]

[24] T. Eslami and F. Saeed, “Fast GPU PCC: A GPU-based technique to compute pairwise Pearson’s correlation coefficients for time series data FMRI study,” High-Throughput, vol. 7, no. 2, 2018, art. no. 11, doi: https://doi.org/10.3390/ht7020011 [ Links ]

[25]J. Lian, G. Garner, D. Muessig, and V. Lang, “A simple method to quantify the morphological similarity between signals,” Signal Process., vol. 90, no. 2, pp. 684-688, 2010, doi: https://doi.org/10.1016/j.sigpro.2009.07.010 [ Links ]

[26]M. J. Mc Loughlin, “New Electrocardiographic Methods Based on the Standard 12-Leads Ecg: Bipolar Precordial Leads,” 2022, ssrn.4250757, doi: http://dx. doi.org/10.2139/ssrn.4250757 [ Links ]

[27]T. N. Nguyen, T. H. Nguyen, and V. T. Ngo, “Artifact elimination in ECG signal using wavelet transform,” Telkomnika, vol. 18, no. 2, pp. 936-944, 2020, doi: https://doi.org/10.12928/TELKOMNIKA.v18i2.14403 [ Links ]

[28]V. Gupta, M. Mittal, and V. Mittal, “Performance evaluation of various pre-processing techniques for R peak detection in ECG signal,” IETE J. Res., vol. 68, no. 5, pp. 3267-3282, 2020, doi: https://doi.org/10.1080/03772063.2020.1756473 [ Links ]

[29] S. Banerjee and G. S. Kumar, “Quality guaranteed ECG signal compression using tunable-q wavelet transform and möbius transform based AFD,” IEEE Trans. Instrum. Meas., vol. 70, pp. 1-11, 2021, doi: https://doi.org/10.1109/TIM.2021.3122119 [ Links ]

[30] A. L. Goldberger, L. A. Amaral, L. Glass, J. M. Hausdorff, et al., “PhysioBank, PhysioToolkit, and PhysioNet: Components of a new research resource for complex physiologic signals,” Circulation, vol. 101, no. 23, pp. e215-e220, 2000, doi: https://doi.org/10.1109/TIM.2021.3122119 [ Links ]

[31] R. Bousseljot, D. Kreiseler, and A. Schnabel, “Nutzung der EKG Signaldatenbank CARDIODAT der PTB über das Internet,” J. Biomed. Eng., vol. 40, suppl. 1, 317, 1995, doi: https://doi.org/10.1515/bmte.1995.40.s1.317 [ Links ]

[32] P. Wagner, N. Strodthoff, R. Bousseljot , W. Samek, and T. Schaeffter, PTB-XL, a large publicly available electrocardiography dataset (version 1.0.1), PhysioNet. Accessed: 2024. [Online]. Available: https://doi.org/10.13026/x4td-x982 [ Links ]

[33] M. A. Reyna, E. A. Perez-Alday, A. Gu, C. Liu, et al., “Classification of 12-lead ECGs: the physionet/computing in cardiology challenge 2020,” in 2020 Computing in Cardiology, Rimini, Italy, 2020, pp. 1-4. doi: https://doi.org/10.22489/CinC.2020.236 [ Links ]

[34] J. Zheng, J. Zhang , S. A. Danioko, H. Yao, H. Guo, C. Rakovski, “A 12-lead electrocardiogram database for arrhythmia research covering more than 10,000 patients,” Sci. Data, vol. 7, 2020, art. no. 48, doi: https://doi.org/10.1038/s41597-020-0386-x [ Links ]

[35] N.-T. Bui, G.-s. Byun, “The comparison features of ECG signal with different sampling frequencies and filter methods for real-time measurement,” Symmetry, vol. 13, no. 8, 2021, art. no. 1461, doi: https://doi.org/10.3390/sym13081461 [ Links ]

[36] D. Gembris, M. Neeb, M. Gipp, A. Kugel, and R. Männer, “Correlation analysis on GPU systems using NVIDIA’s CUDA,” J. Real Time Image Proc., vol. 6, no. 4, pp. 275-280, 2011, doi: https://doi.org/10.1007/s11554-010-0162-9 [ Links ]

Received: June 22, 2024; Accepted: October 23, 2024

*Corresponding author TO: Edward Carello Figueroa Tejada. INSTITUTION: Universidad Nacional de San Agustín De Arequipa. ADDRESS: Nicolás de Pierola 808, Mariano Melgar, Arequipa, Perú. CORREO ELECTRÓNICO: efigueroat@unsa.edu.pe

CONFLICTS OF INTEREST

The authors declare no conflicts of interest.

AUTHOR CONTRIBUTIONS

E. C. F. T. conceptualization, formal analysis, investigation, methodology, validation, and writing- review and editing; C. E. M. H. conceptualization, data curation, formal analysis, validation; E. S. E. project administration, supervision, validation; J. R. funding acquisition, project administration, and supervision.

Creative Commons License This is an open-access article distributed under the terms of the Creative Commons Attribution License