Eldon Nelson Paper

From EE5811 Unoffical Wiki

Investigations into Visualization and Significance of Phase Relationships in Cardiac Rhythms

  • Eldon Nelson ( eldon_nelson@ieee.org )
  • Professor Holte
  • EE5811
Table of contents

Abstract

Visualization of the heartbeat today via the EKG is usually depicted as a linear representation in time with different heights representing levels of energy of the strokes of the heart. The proposal of this project is to think of new ways to visualize the heart be in ways that might be more intuitive and bring forth new ideas into diagnosing the heart beat, as well as being an educational tool. A proposal by Stephen Malinowski on “Some Ideas for Visualizing Cardiac Sounds”[1] (http://section09.net/EE5811/index.php/Eldon_Nelson_Paper#endnote_1) from 1997 provides a background for looking deeper into ways of visualizing the heart beat. A proposal was made that perhaps a circular or other creative representations of the heart beat more information could be communicated. Through analysis of the heart beat by paying special attention to the phase differences of the heart in different physical conditions such as: fatigue or hunger. I believe that that the phase differences, and patterns held within, might be able to yield interesting information on the physical condition of the patient.

Introduction

“Some say that we owe our consciousness to our hearts and that it is the heart which suffers pain and feels anxiety. But this is not the case; rather, it is torn just like the diaphragm, and even more than that for the same reasons: for blood-vessels from all parts of the body run to the heart, and the heart encapsulates these, so that it feels any pain or tension occurring in a human being. Moreover, the body inevitably shudders and contracts when it feels pain, and likewise when it is overwhelmed by joy. This is why the heart and the diaphragm are particularly sensitive. Yet neither of these parts has any share in consciousness; rather, it is the brain which is responsible for all these.”

On the Sacred Disease 425 BC [2] (http://section09.net/EE5811/index.php/Eldon_Nelson_Paper#endnote_2)

The stethoscope [3] (http://section09.net/EE5811/index.php/Eldon_Nelson_Paper#endnote_3) was invented by René-Théophile-Hyacinthe Laennec in 1816 allowed for listening to the heart with the clarity needed to distinguish the different strokes of the heart. The focus of heart rate measurement has moved towards electronic analysis in recent years, because of the ability to get a clearer picture of the heart beat with less susceptibility to noise factors present in audio analysis. From this electronic capture of the actual electrical signals that drive heart operation we can think of new ways to analyze this data.

Today, an EKG or Electro-Cardiogram is a linear representation of the electrical activity of signals from the heart. As time progresses the electrical potential is measured and plotted with respect to time - the larger the electrical potential the higher the plot in the y-direction. A problem with this approach is that a heart beat itself repeats. And if something repeats it may be called cyclical, which brings up the question of this project: could a circular representation of the heart beat give new insight into diagnosis of patients?

Typical EKG

[4] (http://section09.net/EE5811/index.php/Eldon_Nelson_Paper#endnote_4)

This methods paper will explore how EKG data can be presented in different ways. The idea of phase will be introduced as a possible method of EKG visualization. The process of getting raw EKG data and manipulating it and presenting it in automated ways will also be discussed. The end result of this method is to show how EKG data can be looked at in different new ways.

What might be valuable is first to look at the structures of the heart briefly to understand where the EKG signal comes from and what are the components of the EKG. First we can start by looking at the commonly used letters that describe the components of the heart beat.

EKG Representation with Letter Correspondence

[5] (http://section09.net/EE5811/index.php/Eldon_Nelson_Paper#endnote_5)

The three most common characteristics are the “P”, “QRS”, and the “T” wave. These letters were assigned by early cardiac researcher Willem Einthoven [6] (http://section09.net/EE5811/index.php/Eldon_Nelson_Paper#endnote_6) in 1903 who assigned these letter names to the EKG signals. The “P” wave is the electrical signal that precludes the contraction of both the atria – left and right. The “QRS” wave is the electrical signal that precludes the contraction of both the ventricles – left and right. The “T” wave is the repolarization of the ventricles where the relative electrical potential of the ventricles becomes positive again. There is a special notation used in this project by the annotators that group "QRS" into what they call "N" signifying the highest peak of the EKG which is also known as "S". There are other components of the heart that have come into common practice, but will not be important for this project.

Heart Diagram from Wikipedia

[7] (http://section09.net/EE5811/index.php/Eldon_Nelson_Paper#endnote_7)

Methods

The first step towards looking at the EKG signals is to find the signals themselves. There are many options at doing this including going to hospitals and getting permission to record various EKG signals, or even just recording your own using Labview – which was available to the class [8] (http://section09.net/EE5811/index.php/Eldon_Nelson_Paper#endnote_8). After some searching and recommendations it was found that a service named PhysioNet [9] (http://section09.net/EE5811/index.php/Eldon_Nelson_Paper#endnote_9) carried a wealth of high quality recordings of EKG signals, I would learn later that some of those signals are annotated by medical doctors. The ability to get high quality EKG data was a major breakthrough in the progress of this project.

While getting the EKG data was relatively simple, understanding how Physionet decided to package a EKG signal was a bit harder. Instead of a human readable format, the EKG signals are for the most part binary files with a lot of variability to them. For example “Signal files are binary, and usually contain either 16-bit amplitudes (format 16), pairs of 12-bit amplitudes bit-packed into byte triplets (format 212), or 8-bit first differences (format 8).” [10] (http://section09.net/EE5811/index.php/Eldon_Nelson_Paper#endnote_10) This variability and the fact that an EKG “record is not a file; rather, it is an extensible collection of database files” [11] (http://section09.net/EE5811/index.php/Eldon_Nelson_Paper#endnote_11) makes using the Physionet data itself harder than it had to be.

We are in luck that there is a community of programmers that have built tools to work with Physionet data. These tools, written for Linux, and licensed under the GPL [12] (http://section09.net/EE5811/index.php/Eldon_Nelson_Paper#endnote_12) (General Public License ) allow anyone to modify and distribute the code to their needs. With the tools provided by the PhysioToolkit [13] (http://section09.net/EE5811/index.php/Eldon_Nelson_Paper#endnote_13) I could finally work with the data in more conventional ways. The first step was to make the data human readable using the command line tools named rdsamp [14] (http://section09.net/EE5811/index.php/Eldon_Nelson_Paper#endnote_14) and rdann [15] (http://section09.net/EE5811/index.php/Eldon_Nelson_Paper#endnote_15) . Below are examples of the use and output of these tools. Now that the data is in human readable format I was able to create tools that manipulated that data into formats and structures I wanted.

RDSAMP Example

The below example shows how a EKG datafile can be decomposed into time and voltage potential in a human readable format.

[eldon@localhost data]$ rdsamp -r sel100 -p -v | head
time    MLII    V5
(sec)   (mV)    (mV)
 0.000   4.725   4.775
 0.004   4.735   4.745
 0.008   4.725   4.735
 0.012   4.715   4.745
 0.016   4.720   4.735
 0.020   4.705   4.725
 0.024   4.700   4.710
 0.028   4.690   4.715
 ...

RDANN Example

The below example shows how a EKG annotation record can be decomposed into time and description labels.

[eldon@localhost data]$ rdann -r sel100 -a q1c -v | head
     Time   Sample #  Type  Sub Chan  Num      Aux
  10:01.088   150272     (    0    0    0
  10:01.160   150290     p    0    0    0
  10:01.188   150297     )    0    0    0
  10:01.264   150316     (    0    0    1
  10:01.320   150330     N    0    0    1
  10:01.336   150334     )    0    0    1
  10:01.576   150394     t    0    0    0
  10:01.676   150419     )    0    0    2
  10:01.884   150471     (    0    0    0
 ...

Methods Flow Chart

After the data is in a more manageable format from the Physionet tools I was able to construct a small program to figure out phase relationships from the annotation records. The annotation records are one of the extra files that are included in the Physionet database. These annotation records provide data points in time that describe the components of the EKG. The program I programmed in PERL allows for a user to supply human readable annotation data similar to the RD2ANN Example above and get files suitable for graphing in a spreadsheet program or further statistical analysis.

Example Phase Output Human Readable

[eldon@localhost data]$ ~/ee5811/code/phase.pl -file sel100.annotations -angle degree -style human

Time in Seconds of Heart Beat: 602.78
Period Time in Seconds: 0.836000000000013,
       Phase of N_E 12.057416267951
       Phase of T 103.349282296653
       Phase of T_E 156.746411483265
       Phase of U 191.196172248784
       Phase of U_E 232.535885167445
       Phase of P_S 258.373205741633
       Phase of P 282.488038277486
       Phase of P_E 310.047846889959
       Phase of N_S 335.885167464098
Time in Seconds of Heart Beat: 603.616
Period Time in Seconds: 0.823999999999955,
       Phase of N_E 12.2330097087473
       Phase of T 104.854368932048
       Phase of T_E 153.786407766988
       Phase of U 197.47572815535
       Phase of U_E 246.407766990339
       Phase of P_S 265.631067961206
       Phase of P 286.601941747616
       Phase of P_E 323.300970873808
       Phase of N_S 344.271844660218 

From the above data we see how the output of RDANN is transformed into data that gives us the phase of the components of the heart beat and figures out the Start (_S) and End (_E) of heart components based off of the annotation data and the context of the data.

This human readable view is useful, but for use in a spreadsheet or statistical program a different type of format is needed. The lowest common denominator format for passing data is named CSV [16] (http://section09.net/EE5811/index.php/Eldon_Nelson_Paper#endnote_16) (Comma Separated Value). Built into the program is a simple command line switch that transforms the human readable phase data into a format readable by many programs; including spreadsheets.

Example Phase Output CSV

[eldon@localhost data]$ ~/ee5811/code/phase.pl -file sel100.annotations
-angle degree -style csv | head -n 30
N Time (Seconds), N Period (Seconds),N End, T Start, T, T End, U
Start, U, U End, P Start, P, P End, N Start, N
602.78,0.836000000000013,12.057416267951,103.349282296653,156.746411483265,191.196172248784,232.535885167445,258.373205741633,282.488038277486,310.047846889959,335.885167464098,
603.616,0.823999999999955,12.2330097087473,104.854368932048,153.786407766988,197.47572815535,246.407766990339,265.631067961206,286.601941747616,323.300970873808,344.271844660218,
604.5,0.836000000000013,18.9473684210449,120.574162679412,161.913875598073,201.531100478449,254.928229665061,275.598086124392,299.712918660294,330.71770334929,358.277511961714,

This data can easily be read into a spread sheet program to produce interesting graphs such as the one below that show the EKG in a completely different context than the writer has ever seen a heart beat represented before.

For more information on how these command line program work consult the appendix and built in help in the programs themselves.

Results

The result of all this data manipulation is the graph below. Instead of looking at the human heart beat as a linear representation we can think of it as a repeating process – a cyclical event that can be measured not only by its period, or the heart rate, but the phase relationship of the components of the heart beat.

Phase Relationship of EKG Data Graph from sel100 with q2c Annotations

The above graph is similar to a pie graph where the different colors represent the components of the heart beat. But each concentric circle is a distinct heart beat. There are many heart beats displayed in the graph above in each of these circles and we can see the phase of each of these heart beats. The phases are aligned with the N wave, which is a line north of the center – effectively aligned at 90 degrees. The phase then increases in angle from there going through the heart beat in a counter-clock-wise motion.

In a clinical presentation of this perhaps you would have this animated spinning circle keeping track of the heart beat with a text in the corner denoting heart rate. The hope is that by displaying the heart rate in this new phasor form interesting information on the heart can more easily be seen.

The data presented here in some of the following pictures is from the QT [17] (http://section09.net/EE5811/index.php/Eldon_Nelson_Paper#endnote_17) Database on PhysioNet, which has a variety of heart arrhythmia samples. What is most interesting is that most of these samples have some annotations within them by experts who have used the PhysioNet tools to annotate portions of the EKG samples. Below I will post more of the graphs that were made from this database being interpreted through the phase visualization tool.

Phase Relationship of EKG Data Graph from sel230 with q1c Annotations

Phase Relationship of EKG Data Graph from sel102 with q1c Annotations

Phase Relationship of EKG Data Graph from sel102 with q1c Annotations Subset

Discussion

It has yet to be proven if a phasor representation of the heart beat has any particular value. A study would have to be done to figure out situations where phase variability or particular phase characteristics can be used to diagnose conditions. What we can see with the limited investigation done so far is that there is variation with the phases of the heart.

Start of N Wave Phase and Standard Deviation without Outliers

Sample Average STD
sel230_q1c 324.23 11.38
sel102_q1c 341.75 11.29
sel100_q2c 339.97 12.28

You can, with inspection, see that sel230 is 15 degrees earlier with the start of the N Wave compared to sel100 and sel102. This 15 degree phase shift might be a queue on a certain conditions of the patient. Or it might just be judgment error by the annotator when looking at different people’s EKG readings. It is unfortunate that the EKG data does not have enough information to identify characteristics of the patient, which would lead to an interesting study.

Some of the larger singularities in the phase charts are perhaps due to difference, or skipping of components of the heart beat by the annotator or even problems with my own parsing algorithms that seek to take apart these annotation files. It has been noticed that the time difference between N waves is as much as 10 seconds in the annotation files, which either signifies a heart arrhythmia or the annotator skipped over a portion of the EKG data. It was also interesting that some annotation files were annotated in different ways with more or less heart beat characteristics; possibly depending on who was annotating them and their free time.

Ehics

This project relies on the PhysioNet project, although the idea is applicable to real world situations. The data on PhysioNet is assumed to be genuine and generally free of errors. The confidentiality of the subjects is kept secret not only from the generic naming conventions, but by what data is actually presented: purely binary data files without even fields for such things as patient names.

While I would have appreciated having a full patient record along with the EKG data that perhaps would be too much information for a casual user on the internet to access. This added data could have helped me come up with diagnosis for certain phase characteristics of the EKGs.

Discussion

This project is relies on a lot of things and leaves other questions unanswered. The goal, as stated in the abstract, was to look at novel ways of visualizing the heart beat to possibly get a better idea of the physical condition of the patient. While there was presented a method and apparatus to view the heart beat in an interesting way, I was not able to start with data that would help me understand the role of phase relationships in physical condition.

I firmly believe that the traditional EKG data readout is not the optimum method to present the heart beat. There is just so much information to be display as a linear representation. Perhaps this phase based approach with modifiers to include amplitude would be the best option? Perhaps, a different approach all together. There are efforts to annotate the EKG signal automatically [18] (http://section09.net/EE5811/index.php/Eldon_Nelson_Paper#endnote_18) ; this annotation could be fed into this idea of phase extraction and quickly displayed in real time. Today, doctors and experts do this annotation by hand which is rather unwieldy even with software tools to help them.

Conclusion

This project built upon ideas by Stephen Malinowski that were posted on his personal website based on discussion with doctors he was consulting with in April and May of 1997. It is a strange coincidence I was looking for a project dealing with EKG visualization when I came across his notes. After getting permission from him to continue in a similar vein I continued to investigate the role of phase in heart beats.

The resource PhysioNet was a great help in getting me quality EKG data – even EKG data that was annotated with the information that I needed to create my visualizations and start my look at the statistics of the heart beat. PhysioNet also is home to many GPL software tools that helped me decompose their files into formats that I could use myself. Using their tools as a base I built my own tools upon their functionality and also am releasing my code to whoever would like to use it.

The result of this project are graphs that show the heart beat in a novel new way using the idea of phasors. I was surprised to see that in my first few graphs a 15 degree difference in where the start of the N wave started in some of the samples. I would need new EKG data with patient information on it to make any hypothesis on what this condition might mean. The project has room to grow with real patient data with more information on their conditions as well as some improvements in the algorithms that create the graphs.

Bibliography

  1. ^  “Some Ideas for Visualizing Cardiac Sounds.” Stephen Malinowski. 1997. <http://www.well.com/user/smalin/heartviz.html>. 12/09/2005
  2. ^  “Hearts and Minds: The heart in Greek medicine and philosophy.” On the Sacred Disease. 425 BCE. <http://www.wellcome.ac.uk/doc_WTX023667.html>. 12/09/2005
  3. ^  “Stethoscope.” Wikipedia. 2005. <http://en.wikipedia.org/wiki/Stethoscope>. 12/09/2005
  4. ^  “What the ECG is About”. Flesh and Bones. Page 5. <http://www.fleshandbones.com/readingroom/pdf/505.pdf>. 12/09/05.
  5. ^  “EKG Complex”. Wikipedia. September 2005. <http://en.wikipedia.org/wiki/Image:EKG_complex.png>. 12/09/2005.
  6. ^  “Electrocardiogram”. Wikipedia. <http://en.wikipedia.org/wiki/Electrocardiogram>. 12/09/05.
  7. ^  “Heart labelled large.png”. Wikipedia. December 2003. <http://en.wikipedia.org/wiki/Image:Heart_labelled_large.png>. 12/09/2005.
  8. ^  “Lecture Notes from 11/30/05 Labview Presentation in EE5811”. EE5811 taught by Professor Holte. 11/30/2005. <http://section09.net/EE5811/index.php/Nov_28_2005>. 12/09/2005.
  9. ^  “PhysioNet”. Physionet. <http://www.physionet.org/resource.shtml>. 12/09/2005.
  10. ^  “WFDB Programmer’s Guide”. George Moody. Harvard-MIT Division of Health Sciences and Technology. Page 67. August 20, 2005. <http://www.physionet.org/physiotools/wpg/wpg.pdf>. 12/09/2005.
  11. ^  “WFDB Programmer’s Guide”. George Moody. Harvard-MIT Division of Health Sciences and Technology. Page 67. August 20, 2005. <http://www.physionet.org/physiotools/wpg/wpg.pdf>. 12/09/2005.
  12. ^  “GNU General Public License”. Free Software Foundation. June 1991. <http://www.gnu.org/copyleft/gpl.html>. 12/09/05.
  13. ^  “PhysioToolKit”. PhysioNet. <http://www.physionet.org/physiotools/>. 12/09/05.
  14. ^  “rdsamp: read WFDB signal files”. PhysioNet. <http://www.physionet.org/physiotools/wag/rdsamp-1.htm>. 12/09/05.
  15. ^  “rdann: read a WFDB annotation file”. PhysioNet. <http://www.physionet.org/physiotools/wag/rdann-1.htm>. 12/09/05.
  16. ^  “The Comma Separated Value (CSV) File Format”. Creativyst Software. 2005. < http://www.creativyst.com/Doc/Articles/CSV/CSV01.htm#ProcForm>. 12/17/05.
  17. ^  “A Database for Evaluation of Algorithms for Measurement of QT and Other Waveform Intervals in the EKG.” Pablo Laguna, Roger G. Mark, Ary Goldberger and George B. Moody. Computers in Cardiology 1997, vol. 24, pp. 673-676.
  18. ^  “Semia: semi-automatic interactive graphic editing tool to annotate ambulatory EKG records.” Dorn R, Jager F. University of Ljubljana. Comput Methods Programs Biomed. 2004 Sep;75(3):235-49.

Appendix

Programs and Documentation

The programs that were written during this project to create the graphs are described and available at this link Eldon Nelson Files.