Software Open Access

Heart Vector Origin Point Detection and Time-Coherent Median Beat Construction

Erick Andres Perez Alday Larisa Tereshchenko

Published: May 25, 2021. Version: 1.0.0


When using this resource, please cite: (show more options)
Perez Alday, E. A., & Tereshchenko, L. (2021). Heart Vector Origin Point Detection and Time-Coherent Median Beat Construction (version 1.0.0). PhysioNet. https://doi.org/10.13026/jfeg-4820.

Additionally, please cite the original publication:

Perez-Alday, E. A., Li-Pershing, Y., Bender, A., Hamilton, C., Thomas, J. A., Johnson, K., Lee, T.L., Gonzales, R., Li, A., Newton, K., Tereshchenko, L. G. (2019). Importance of the heart vector origin point definition for an ECG analysis: The Atherosclerosis Risk in Communities (ARIC) study. Computers in Biology and Medicine, 104, 127-138. doi:10.1016/j.compbiomed.2018.11.013

Please include the standard citation for PhysioNet: (show more options)
Goldberger, A., Amaral, L., Glass, L., Hausdorff, J., Ivanov, P. C., Mark, R., ... & Stanley, H. E. (2000). PhysioBank, PhysioToolkit, and PhysioNet: Components of a new research resource for complex physiologic signals. Circulation [Online]. 101 (23), pp. e215–e220.

Abstract

An appropriate selection of the heart vector origin point defines the ECG’s baseline, which then affects all subsequent ECG measurements. We introduce software capable of automatically identifying the heart vector origin point and constructing a time-coherent median beat. We define the heart vector electrocardiographic (VCG) origin point based on its electrophysiological and biophysical meaning: the electrically quiet, or isoelectric state of the heart when the heart vector does not move in 3D space. The electrically silent period is defined as the segment between the end of repolarization and the onset of P-wave (if present), or the beginning of the QRS complex.

The definition of the VCG origin point determines the definition of the vector magnitude ECG baseline. Vector-Magnitude that is zeroed at the origin of the heart vector provides the most physiologically accurate cardiac beat. This is a fundamental step for any further global ECG and VCG measurements. Time-coherent median beat preserves the physiological sequence of cardiac activation and recovery. The time-coherent approach takes an easily detectable fiducial point (maximum |dV/dt|)  as detected only on one ECG lead (e.g., X). Corresponding time-points on two other leads (e.g., Y and Z) are taken regardless of their morphological features. Such an approach significantly reduces the chance of error and preserves the physiological sequence of cardiac activation and recovery. The algorithm requires an input of a 10-second raw digital orthogonal ECG signal (XYZ leads).


Background

The ECG measurements are based on the lead theory which assumes that the heart is a dipole vector (heart vector) that is moving during the cardiac cycle in three-dimensional (3D) space, forming vectorcardiographic (VCG) loops [1]. Projection of the heart vector movement on any ECG lead axis produces the waveform measured in that lead. The electrical origin of the heart vector has important electrophysiological and biophysical meaning, as it is defined by the isoelectric state of the heart [2]. The electrocardiographic method, developed by Einthoven and colleagues, quantifies the magnitude and direction of the resultant electromotive force produced by the heart at a given time instance during the cardiac cycle.

In 1938, Wilson and Johnston highlighted the importance of the heart vector origin point (see Figure 3 from [2]), which corresponds to the electrocardiographic baseline. Due to technological limitations in the 1930s, they were not able to define the origin point, and noted that “details are lost in the uniformly black area which surrounds the isoelectric point”.[2] Modern ECG signal resolution allows the characterization of its fine features. However, contemporary ECG standards ignore the VCG origin definition [3,4].

This algorithm defines the heart vector origin point and constructs a time-coherent global median beat. In a large (nearly 16,000 participants) study, we defined the origin point of the heart vector as the electrically silent portion of the cardiac cycle (isoelectric period) [5]. We showed that the physiologically meaningful definition of the heart vector’s origin point and time-coherent global XYZ median beat construction affected ECG measurements and improved predictive accuracy of ECG and VCG biomarkers of sudden cardiac death.


Software Description

We introduce software capable of automatically identifying the VCG origin point from a time-coherent global XYZ median beat. The VCG origin point is defined based on its electrophysiological and biophysical meaning: the electrically quiet, or isoelectric state of the heart when the heart vector does not move in 3D space. The electrically silent period is defined as the segment between the end of repolarization and the onset of P-wave (if present), or the beginning of the QRS complex. The definition of the VCG origin point determines the definition of the VM ECG baseline.

Algorithm to detect the VCG electrically quiet origin point:

Figures 1 and 2 provide an overview of the algorithm. Two time interval windows are identified to select an isoelectric segment in the TP segment. The first window (w1) is dynamically calculated from the RR’ interval using the following equation (eq. 1):

(eq. 1) W 1 = f l o o r ( R R i n t e r v a l × 0.8 372.69 0.5 ) W_1=floor(RR'_{interval}×0.8-372.69*0.5) \tag{eq. 1}

The center of the window, TC, also depended on the RR interval and the type of beat under investigation. Two cases are identified: (1) TC = 260ms, if RR interval (RRint) < 600 ms and median beat ≠ Supraventricular (S). TC = 320ms, for any other case: RRint ≥ 600 ms for any type of beat or RRint < 600 but median beat =S.

(eq. 2) T C = { 260 m s  to the left of  R p e a k  if  R R i n t < 600 m s  and beat S 320 m s  to the left of  R p e a k ,  & any other case T_C= \begin{cases}260ms \text{ to the left of } R_{peak} \text{ if }RR_{int}<600ms \text{ and beat} ≠S\\ 320ms \text{ to the left of } R_{peak}, \text{ & any other case}\end{cases} \tag{eq. 2}

The second window (w2) is a fixed window of 320ms with the same Tc center. If the edges of w1 were larger than the edges of w2, the edges of w1 were set to be the same as w2.

Following the selection of the isoelectric baseline, the algorithm uses two approaches to select the flattest line on VM and XYZ leads signal within w1: (1) clustering of the signal with the least variance in a given window and (2) minimum absolute change of magnitude closest to the end of the window.

Searching for a candidate segment with the least variance

We calculate the variance on the X, Y, and Z lead signals with a moving window of 20ms (movvarXYZ). Using the MATLAB function movvar, we identify the segment with the least amount of variance i.e. the flattest portion of the signal. Candidate points are identified by looking for the segments containing the largest number of counts from the histogram of movvarXYZ with a fixed bin width of 10 µV2. Once candidate points are identified, they are separated into clusters. The clusters are then defined such that the minimum distance between the edges of neighboring clusters was larger or equal to 8ms in order to reduce the impact of noise within the signal. The algorithm selected two candidate clusters comprised of the largest number of elements with which to perform origin point calculation.

The absolute voltage gradient across X, Y, and Z is calculated with a time step of 10ms. Then, the average of the sum of the absolute voltage gradient across the X, Y, and Z leads of a given cluster is obtained. The cluster with the smallest average gradient is chosen to best approximate the isoelectric segment, and the origin point is chosen at the median time point of that candidate cluster. If the last criteria was not met and the algorithm could not identify an origin point candidate within w1, the search for an origin point is carried on to w2 with the algorithm described above.

Searching for a candidate segment with the least change

As an alternative approach, we attempt to identify the isoelectric segment by computing the sum of the absolute voltage gradient on the X, Y, and Z leads:

(eq. 3) x , y , z | V M | = | d V x d t n | + | d V y d t n | + | d V z d t n | \sum{x,y,z}|∇VM|=|\frac{dV_x}{dt_n}|+|\frac{dV_y}{dt_n}|+|\frac{dV_z}{dt_n}| \tag{eq. 3}

Then, we compare the gradient at any time steptn and their neighboring time points (tn-1 and tn+1 ) against the minimum of the sum of the voltage absolute gradient (eq. 4) in the window w1

(eq. 4) m i n x , y , z | V M | = argmin t n : t n w 1 ( d V x d t n + d V y d t n + d V z d t n ) min \sum{x,y,z}|∇VM|=\DeclareMathOperator*{\argmin}{arg\,min} \underset{tn:tn ∈ w1}{\operatorname{argmin}}(\frac{dV_x}{dt_n}+\frac{dV_y}{dt_n}+\frac{dV_z}{dt_n}) \tag{eq. 4}

The candidate origin point is the middle point of the segment where the comparison is below a threshold of 0.1 mV, to look for a stable isoelectric line. The comparison is performed starting at the right edge of the window w1 (closest to the R peak), then working backward toward the preceding T wave with a time step of ∆tn=4ms .

Final selection of the origin point

At the final step of the algorithm, the two previously identified candidate origin points are compared using the following criteria: area under the curve of reconstructed VM and sum of the average absolute gradient in 10ms time steps. Individual VMs are reconstructed for each candidate by defining the candidate as the zero-value baseline. The area under the curve for each VM is computed only in window w1. The sum of the average absolute gradient of each VM, with a time step of 10ms, is calculated around each candidate. The final heart vector origin point with the smallest area under the windowed VM curve and the minimum average voltage gradient is selected.

Construction of a representative time-coherent global XYZ median beat

A three-step approach is used (Figure 3):

Beat labeling and dominant type beat selection

First, each beat on a 10-second 12-lead ECG recording must be appropriately labeled. Non-analyzable beats due to noise and artifacts and non-dominant ectopic beats must be excluded from the analysis. Kors transformation matrix is used to obtain the orthogonal X, Y, and Z leads from 12-lead ECG (see the Kors transformation matrix in the associated GitHub repository [6]).

Single-lead median beat construction

At the next step, all included beats on a single lead, Vx , are then aligned to construct a representative single-lead median beat, VMX . The maximum absolute of the first derivative (maximum |dV/dt|) is used to construct the single-lead median beat. After alignment, the representative median beat, VMX , is constructed using the median function of MATLAB (MathWorks, Natick, MA, USA).

Global XYZ multi-lead beat construction

At the third step, we construct a time-coherent global XYZ median beat. Single-lead alignment is performed only on a single lead (X). Corresponding time points on leads Y and Z are used for the construction of time-coherent global XYZ median beat.

V M X T i m e = V M X ( c e n t e r e d  at  max Q R S | V M X t | ) V_{MX_{Time}}=V_{MX} (centered \text{ at } \underset{QRS}{\operatorname{max}} |\frac{∂VMX}{∂t}|)
V M Y T i m e = V M Y ( c e n t e r e d  at  max Q R S | V M X t | ) V_{MY_{Time}}=V_{MY} (centered \text{ at } \underset{QRS}{\operatorname{max}} |\frac{∂VMX}{∂t}|)
V M Z T i m e = V M Z ( c e n t e r e d  at  max Q R S | V M X t | ) V_{MZ_{Time}}=V_{MZ} (centered \text{ at } \underset{QRS}{\operatorname{max}} |\frac{∂VMX}{∂t}|)

Installation and Requirements

For the latest version of this software, please refer to the associated GitHub repository [6]. This code has been developed in Matlab and tested on Matlab versions 2016-2020. It can be also run in Octave. An example data file has been provided, including a test file for time-coherent global median beat construction. A test file for the heart vector origin point detection (median beat) is generated as an output of median beat construction. Subsequently, a test file for the viewer is generated as an output of origin point detection.


Usage Notes

This software may assist researchers with identifying the heart vector origin point. An associated paper entitled "Importance of the heart vector origin point definition for an ECG analysis: The Atherosclerosis Risk in Communities (ARIC) study" provides more detail on the approach used in this software [1].  For the latest version of the software, and to submit bug reports, please refer to the associated GitHub repository [6]. 

Limitations

This is semi-automated software that requires a review of the results using a viewer. The software provides an opportunity for users to correct the origin point manually, and to observe the effect of the change of origin point on median beat morphology. The software has been tested, but nevertheless may contain bugs.


Acknowledgements

This work was supported by 1R01HL118277 and 2R56HL118277 (PI Tereshchenko).


Conflicts of Interest

The authors have no conflicts of interest to declare.


References

  1. E. Frank, An accurate, clinically practical system for spatial vectorcardiography, Circulation. 13 (1956) 737-749.
  2. F.N. Wilson, F.D. Johnston, The vectorcardiogram, American Heart Journal. 16 (1938) 14-28.
  3. P. Kligfield, L.S. Gettes, J.J. Bailey, R. Childers, B.J. Deal, E.W. Hancock, H.G. van, J.A. Kors, P. Macfarlane, D.M. Mirvis, O. Pahlm, P. Rautaharju, G.S. Wagner, M. Josephson, J.W. Mason, P. Okin, B. Surawicz, H. Wellens, Recommendations for the standardization and interpretation of the electrocardiogram: part I: the electrocardiogram and its technology a scientific statement from the American Heart Association Electrocardiography and Arrhythmias Committee, Council on Clinical Cardiology; the American College of Cardiology Foundation; and the Heart Rhythm Society endorsed by the International Society for Computerized Electrocardiology, J Am Coll.Cardiol. 49 (2007) 1109-1127
  4. J.J. Bailey, A.S. Berson, A. Garson, Jr., L.G. Horan, P.W. MacFarlane, D.W. Mortara, C. Zywietz, Recommendations for standardization and specifications in automated electrocardiography: bandwidth and digital signal processing. A report for health professionals by an ad hoc writing group of the Committee on Electrocardiography and Cardiac Electrophysiology of the Council on Clinical Cardiology, American Heart Association, Circulation. 81 (1990) 730-739.
  5. Perez-Alday EA, Li-Pershing Y, Bender A, Hamilton C, Thomas JA, Johnson K, Lee TL, Gonzales R, Li A, Newton K, Tereshchenko LG. Importance of the heart vector origin point definition for an ECG analysis: The Atherosclerosis Risk in Communities (ARIC) study. Comput Biol Med. 2019 Jan;104:127-138.
  6. Heart Vector Origin Point Detection and Representative Median Beat construction software on GitHub. https://github.com/Tereshchenkolab/Origin [Accessed: 20 May 2021]

Share
Access

Access Policy:
Anyone can access the files, as long as they conform to the terms of the specified license.

License (for files):
MIT License

Corresponding Author
You must be logged in to view the contact information.

Files

Total uncompressed size: 4.2 MB.

Access the files
Folder Navigation: <base>
Name Size Modified
origin_code_physionet
Figure_1.png (download) 1.3 MB 2021-05-25
Figure_2.png (download) 1.6 MB 2021-05-25
Figure_3.png (download) 1.1 MB 2021-05-25
LICENSE.txt (download) 1.1 KB 2021-05-25
SHA256SUMS.txt (download) 1.0 KB 2021-05-25
Time_alignment_code_github.m (download) 4.1 KB 2021-03-29
origin_point_github.m (download) 9.6 KB 2021-03-29