ECG Simulation

Rob MacLeod, Brian Birchler, and Cris Lapierre



Contents

1 Purpose and Background

1.1 Purpose

In this lab, we will make use of the simulation program ECGSIM, which carries out simulations of body-surface ECGs from cardiac sources. The user (you) can alter the sources by changing features of the action potentials in regions of the heart and then immediately generating a new set of heart and body surface data.

The goal of using a program like ECGSim is to understand relationships between parameters and features of the heart tissue and the resulting measurable features of the electrograms and electrocardiograms. You have seen some examples of these relationships in the experimental lab exercise, especially the frog lab; you have also seen the limitations and challenges in these experiments, some of which a simulation can easily overcome.

1.2 Background

The best source of background for the ECGSim program are the papers written by the authors of the program:

  1. ECGSim; An Interactive Tool for Studying the Genesis of QRST Waveforms by van Oosterom and Oostendorp.
  2. Genesis of the T wave as based on an Equivalent Surface Source Model, by van Oosterom.
(Both papers are linked as pdf to the references above so check the web version of this description to access the files.)

From the perspective of the class and how we have discussed the ECG, this program represents a complete simulation of the spread of activation through a human heart and the resulting electric potentials on the inner and outer surfaces of the heart and the outer surface of the body. It contains a time varying source model, a realistic volume conductor model, and approximations of the biophysics that links the sources to the surface potentials. The program has predetermined locations of the sources, shape of the heart, and heart within the torso volume conductor-these facets of the simulation are all fixed. What the user can alter are the parameters of the action potentials of each region of the heart. The model starts with a default sequence of activation, i.e., the order in which the action potentials fire. The user can adjust for any region of the heart the timing and the duration of the action potential as well as its resting potential (and hence amplitude). In this way, most features of the source of the ECG are freely adjustable. As soon as each adjustment is complete (and in some cases while the adjustment is in progress), the program computes the resulting potentials throughout the heart and thorax.

Another notable feature of the program is the ability to view the output in many different forms, e.g., activation time, repolarization time, action-potential duration, transmembrane potential, and extracellular surface potential, distributed over the surfaces of the model and as functions of time. It is also possible to compare the time signals resulting from a modified version of the simulation settings against the default settings. The surface display resembles what you have already seen with map3d and this is no accident--there has been a lot of interaction between researchers at Utah and the authors of ECGSim over the years.

An essential conceptual aspect of ECGSim is that it is running a simulation based on an underlying discrete model of the heart. Adjustments made to the model parameters act over a region of the heart, i.e., not for each cell individually. It is possible to alter the region of influence of changes in the parameters but within limits; the lower limit is the size of the underlying triangular elements that make up the discrete heart model. The Heart Display menu allows for visualization of the model nodes and/or triangles, which is useful to appreciate the resolution of the underlying simulations.

2 Lab Procedure

2.1 Before the lab!!

Make sure you have an active account for the CADE lab (not your UNID). If you do not this account already, go to the CADE lab in WEB 224 and ask about it. You may also want to set up your ID card so that you can gain access to the lab itself (which has a card scanner).

2.2 Lab Day

  1. Meet at WEB 208. You should all have user accounts for these systems that the CADE Lab people will set up for you (see above). Log into your account and set your password according to the (rather strict) rules.

  2. Once you log in, start ECGSim (Macintosh HD > mathend000# Applications > mathend000# ECGSim)

Note: ECGSim is also loaded onto all computers in labs 1, 2 (Linux) and 7 (Windows). On a Linux machine, type "ecgsim" in the shell window and hit enter. For Windows, click on the ecgsim icon in the start menu (Start > mathend000# All Programs > mathend000# ecgsim).

2.3 Capturing images

For the report on this lab, use a screen capture utility to grab images. On Mac/OSX systems, there is a utility called Grab that will capture a window or a selected region of the screen. For manipulating images and doing basic editing, the program Graphic Converter is outstanding (and cheap). Also very reasonably priced and more powerful than Grab is Snapz Pro, which is also capable of capturing animation as well as single images.

Windows has a screen capture utility as well. The screen shot is copied to the clipboard and can be pasted into paint and saved in a variety of image formats. Use ctrl + PrintScreen to capture the entire screen, or alt + PrintScreen to capture just the active window. In Linux, use a command called ``import'' to save images from the screen to files. For details on the Linux command, type

     man import
or ask the TA or instructor for assistance.

Another program for manipulating images is called ``gimp'' and is available on the CADE computers. As with all computer programs, different operating systems have their own programs for image manipulation so learn about these before coming to the lab.

For each of the images you capture and save to your labs report, include a caption describing the contents and which feature of the image is of special interest.

2.4 Learning to use ECGSim

Figure 1: Overview of ECGSim window layout. Each window has settings and interactions available to the use to set parameters and display results in a range of formats--see text for details.
 
ecgsim-startup.jpg

ECGSIM allows you to see the electrical activation of the heart in a number of different forms, as a sequence of color maps of membrane potential, heart potential, and body surface potential and then summarized as a map of activation time or repolarization time. It also allows you to see the dipole vector as a function of time. The program allows the user to adjust features such as cell resting potential or action potential duration and amplitude from a selected region on the inner or outer surfaces of the heart. Figure fig:ecgsim-startup shows the standard layout of the display windows. The icons at the top of each window are shortcuts to specific functions while pull down menus along the top of the main computer window provide pathways to special menus and windows for adjusting simulation and display parameters.

Specific things to try in the lab include the following:

Setup display:
  1. Under the Heart:Orientation menu, select the ``Lock to thorax'' button.
  2. Move the arrow over the borders between windows in the display and enlarge the heart and torso windows (upper row) by reducing the windows in the lower row. We will not immediately use the lower left panel and the lower right will serve just for indicating the point in time of the potential maps in the upper panels.
  3. Click the Help button and observe how it works. The ``What's this'' option is particular useful when running the program.
View heart potentials
  1. Under the Heart:Surface Function menu, select the ``Heart surface potential'' option or click on the button above the heart display that shows the red contour lines.
  2. Use the arrow keys to move forward and backward in time and observe the way the potential distribution changes over the surface.
  3. Rotate the surface around and observe it from different aspects to help localize activity on the heart. Make sure to look inside the heart chambers as well as on the outer surface.
View activation time map
  1. Under the Heart:Surface Function menu, select the ``Depolarization times'' option or click on the button marked with the upward-going step function.
  2. Rotate the surface around and observe it from different aspects to help localize activity on the heart.
  3. You should be able to reconcile this single map, which shows the time at which the cells in that are become stimulated, with the sequence of events you saw in the display of surface potentials. Go back and forth between the two displays (potentials and depolarization/activation time) to make sure the link is clear.

View transmembrane potentials
  1. Under the Heart:Surface Function menu, select the ``Transmembrane potential'' option (or click on the button marked with Vd mathend000#).
  2. Use the arrow keys to move forward and backward in time and observe the way the potential distribution changes over the surface.
  3. This sequence should again reinforce what the depolarization time map you looked at above suggested and how membrane potential is related to heart surface potential maps. Compare the transmembrane voltage with the extracellular surface voltage and make sure the relationship between the two makes sense to you.

View dipole vector loops
  1. Under the Heart:Surface Function menu, select the ``None'' option.
  2. Under the Heart:Display options menu, Surface of myocardium select ``Transparent'', under Heart vector select ``Opaque'' under Heart vector select ``Opaque'', and under Vector loop select ``Opaque''.
  3. Once again, use the arrow keys to move forward and backwards in time, rotate the image around, and observe the vector loop and the way the dipole vector follows this loop.
  4. Select three standard views of the thorax (use the Thorax:Orientation option) and for each, use the Heart:Copy command to save the view to the copy buffer of the computer. Then launch some application that will accept an image and paste the image from the copy buffer for saving and eventual inclusion in the lab report. You can also use the import program to capture the content of the screen to a file. Note: if this approach does not work for saving the images from ECGSim, then use the ``import'' program or some other means to capture images from screen.

Body surface potentials
  1. Under the Heart:Surface Function menu, again select the ``Heart surface potential'' option.
  2. Under the Thorax:Surface Function menu, select the ``Simulated potentials'' option (the button above the display with the red contour lines).
  3. Use the arrow keys to move forward and backward in time and observe the way the potential distribution changes over the surface.
  4. Rotate the surface around and observe it from different aspects to help localize activity on the torso.
  5. Looking at both the heat and torso surfaces, try and identify features that transfer between the two. Try and draw some general conclusions about how information from the heart transfers to the body surface. Does everything visible on the heart surface have a clear correlate on the body surface? Does each local feature of the heart surface project clearly to the body surface? Can you always look at the body surface map and predict what the associated heart map looks like?

2.5 Lab Exercises

2.5.1 Activation and repolarization maps

Be sure you understand the concept of activation time; it is the time at which the cells in a specific location undergo depolarization, i.e., the rapid transition from the resting state to the excited stated. ECGSim allows you to display the depolarization time for the heart beat in a single image on the heart surface. For the default heart beat in the simulation, switch back and forth between displaying the activation time map and the sequence of heart-surface potentials.

By selecting a point (control-click) on the epicardial surface, you can also see the associated action potential and (by pushing the button with the light blue signal icon) electrogram shape for the associated region. Try this for several locations and observe the relationship between action potential and electrogram.

Question: From your observations, how is it possible to tell from the morphology of heart surface potentials if a region has become activated, i.e., is there a feature of the time signal that can indicate when activation occurs?

Recovery is a term used when referring to extracellular potentials and is the complement of activation. It is the time at which a region experiences return to the resting (polarized) state and corresponds to the time at which the nearby cells undergo repolarization. Using the same heart beat as above, switch back and forth between potentials and repolarization time displays (there is a button for this above the display window that shows and down-sloping smooth step function) and observe the relationship. Also, compare the shapes of the action potential and the electrogram from the same location and look for a correlation.

Question: From your observations, is there a feature in the morphology of the electrogram that could indicate when repolarization occurs, i.e., if you had to predict repolarization from the electrogram only, what feature of the electrogram signal would be a reasonable surrogate for that repolarization time.

Next, find a location on the heart surface where there are some notable potentials during the T wave and then control-click on that region in the heart display window; the action potential from that location will appear in the lower left-hand window; turn on the display of electrograms in that window (click on blue time signal button in upper left of action potential window) and then compare repolarization time with the electrogram signal.

Question: Can you describe an algorithm for detecting activation and recovery times from the electrogram signals? (This question is the practical application of the two previous questions).

2.5.2 Activation recovery interval and AP duration

Another important metric of the heart tissue electrical activity is the duration of the action potentials and there is a parameter available in the electrogram signal called the ``activation-recovery interval'', ARI, that is considered a reflection or surrogate of AP duration. To show ARI values, select the button above the heart display that contains a horizontal line with arrows at both ends.

Question: Look at the pattern of ARI's and describe (with a figure or two) how this parameter varies over the heart surface, epicardial and endocardial. Make sure to include the figure and some text to describe and interpret its contents, in the report.

Now select, (control-click) some points on the heart surface and observe the local action potentials. See if their duration matches the ARI values for a set of points selected from all around the heart.

The real power of ECGSim lies in simulating the electrocardiographic response to changes in action potential characteristics. All such changes occur by means of sliders in the lower left panel of the display, where you can see the local action potential and electrogram shape for the currently selected heart location.

To see this behavior in action, in a few regions of the heart, try shifting the duration of the action potential and observe the effects on the electrogram shape.

Question: From your observations about ARI (or AP duration), identify (with a figure and text) one set of ECG signal features that depend on AP duration?

3 Lab Report

Introduction:
Begin the report with a brief (half to full page) introduction about what the program did, i.e., what you think its purpose and capabilities were.
Methods:
In the Methods section, describe briefly, in a paragraph for each exercise, what you did to use the program and specifically produce the figures in the results section--include any relevant settings you had but do not go into detail of things like how you acquired the images. Always keep in mind, the directions should allow us or someone with the background of your classmates and the lab description to replicate the experiments.
Results and Discussion:
In the Results and Discussion sections, for each exercise, address the questions in the description above. Make sure to use both images and text to describe all your results. The emphasis is on qualitative descriptions but see if you can find ways to quantify the results where possible.
Conclusion:
Compare and contrast the experience in the experimental labs and this simulation lab. Generally, what are the advantages of simulation over experiments? What can one learn from experiments that is not possible with simulation? Use your specific experiences to support more general observations about experimental and simulation approaches to scientific discovery.

4 Obtaining the software

To download your own copy of ECGSIM, visit the web site http://www.ecgsim.org. If you have questions about the software and what else it might be good for, please ask Rob.

About this document ...

ECG Simulation

This document was generated using the LaTeX2HTML translator Version 2002-2-1 (1.71)

Copyright © 1993, 1994, 1995, 1996, Nikos Drakos, Computer Based Learning Unit, University of Leeds.
Copyright © 1997, 1998, 1999, Ross Moore, Mathematics Department, Macquarie University, Sydney.

The command line arguments were:
latex2html -split 3 -no_white -link 3 -no_navigation -no_math -html_version 3.2,math -show_section_numbers -local_icons descrip

The translation was initiated by Rob Macleod on 2008-03-12


Rob Macleod 2008-03-12