Software Open Access
Heart Vector Origin Point Detection and Time-Coherent Median Beat Construction
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.
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.
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).
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 . 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 . 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 ), 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”. 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) . 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.
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):
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.
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:
Then, we compare the gradient at any time step ∆tn 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
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 ).
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.
Installation and Requirements
For the latest version of this software, please refer to the associated GitHub repository . 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.
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 . For the latest version of the software, and to submit bug reports, please refer to the associated GitHub repository .
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.
This work was supported by 1R01HL118277 and 2R56HL118277 (PI Tereshchenko).
Conflicts of Interest
The authors have no conflicts of interest to declare.
- E. Frank, An accurate, clinically practical system for spatial vectorcardiography, Circulation. 13 (1956) 737-749.
- F.N. Wilson, F.D. Johnston, The vectorcardiogram, American Heart Journal. 16 (1938) 14-28.
- 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
- 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.
- 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.
- Heart Vector Origin Point Detection and Representative Median Beat construction software on GitHub. https://github.com/Tereshchenkolab/Origin [Accessed: 20 May 2021]
Anyone can access the files, as long as they conform to the terms of the specified license.
License (for files):
Total uncompressed size: 4.2 MB.
Access the files
- Download the ZIP file (3.0 MB)
Download the files using your terminal:
wget -r -N -c -np https://physionet.org/files/heart-vector-origin-matlab/1.0.0/