ECG Viewer - Opens and manipulates raw ECG data

Author: Dakota Williams, [email protected]

Table of Contents

  1. Setup
    1. Prerequisites
    2. Compilation
    3. Running
  2. Workflow
    1. Opening
    2. Filtering
    3. Detrending
    4. Denoising
    5. Marking Bad Leads
    6. Annotations
    7. Exporting
    8. Data
    9. Bad Leads
    10. Annotations
  3. Acknowledgements

1. Setup [top]

1.1. Prerequisites [top]

To run this application, a Java Runtime Environment (JRE) version 1.6 or higher is required. This program is platform-independent thanks to the Java Virtual Machine, meaning this application is not dependent on the client operating system. If plugin development is desired, then a Java Development Kit (JDK) version 1.6 or higher is also needed. For more information about plugins, see section 2.1 of this document. If compilation of the source code is necessary, then a JDK version 1.6 or higher and GNU make is also needed. If compilation is not necessary, skip section 1.2. A breakdown of requirements and dependencies are shown in the table below.

| General Use        | Plugin Development | Application Development

---:|:------------------:|:------------------:|:----------------------: JRE | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: JDK | | :heavy_check_mark: | :heavy_check_mark: make| | | :heavy_check_mark:

The latest JDK and JRE are available here.

Getting make:

1.2. Compilation [top]

Compiling the source code is as simple as running make release. This creates a folder called ECGViewer in the source directory containing the jar and folders contains the libraries and plugins. During active development there are other targets for the makefile:

1.3. Running [top]

To run the program, either double click on ECGViewer/ECGViewer.jar to execute it, or, from command line, run the command java -jar ECGViewer/ECGViewer.jar.

2. Workflow [top]

This section goes through a sample workflow of processing a dataset. To begin, run the program with one of the prescribed methods in section 1.3. The program should look like this:

2.1. Opening [top]

There are two options for opening a file, opening the whole file and opening a subset of a file. To open a whole file, go to File->Open... which will present a dialog like this:

Opening a subset of a file is a bit different. Using File->Open Subset... will show a dialog

like this. The two text boxes on the left side of the dialog specify the time into the dataset that begins the subset and how long the subset is, respectively. Both of these times are measured in milliseconds.

Currently, the supported file types include .dat, .123, 64-lead .txt, and .csv (exported from this application) files. For a more in depth analysis of these files, see plugins/DATFile.java and plugins/_123File.java. More file types can be read in by creating plugins. For more information on creating plugins, see plugins/README.

After loading the file, the main window should display the leads as graphs.

2.2. Filtering [top]

Applying a filter can be done two ways: To an individual lead, or to all the leads at once. Applying a filter to all the leads in done in the main window from the Filter All menu. Selecting a method from there will display a preview dialog of a single lead and parameter sliders for that filter. After clicking OK, the filter will be applied to all leads.

The other way to apply a filter is to one lead, individually. Clicking on a graph will produce a window as shown below.

Controls for navigating the graph:

The lower text boxes allow for manual focus of the graph. Start offset sets the where the left side of the graph is aligned. Length sets how much the x-axis contains.

The menu Filter on this lead window has all of the filter options available to filter just this lead.

2.2.1. Detrending [top]

The main purpose of detrending is to bring the data to a baseline so it can accurately represent the data. The detrending options can be found on the first half of the Filter menu, before the separator.

2.2.2. Denoising [top]

Denoising a signal removes extraneous data and leaves the more important parts of the signal. The denoising options are found on the second half of the Filter menu, after the separator. Some solid options include:

2.3. Marking Bad Leads [top]

Picking out bad leads must be done individually to each lead. To do so, click on the lead's graph in the main window to open that lead's window. On that lead's menu, click Dataset->Bad Lead. Doing so will set the background of that lead to red, indicating it is bad.

There is an option to interpolate bad leads with their direct neighbors. In the settings panel (Main Window File->Settings), check Interpolate Bad Leads? to activate this functionality.

2.4. Annotations [top]

Annotations are used to mark places of interest in the signal. Four designated titles currently exist:

  1. P-wave,
  2. QRS-complex,
  3. R-wave,
  4. T-wave

They represent the major features in a single beat. Annotations are placed on an individual lead, but apply to all leads. For example, if an annotation is set on lead a, then on lead b, the same annotations appear.

Placing an annotation is a two-step procedure. First, make sure Annotation->Place Annotations is checked. This disables the graph navigation function and enables placing annotations. Second, selecting the correct type of annotation from the Annotation menu and clicking on the graph where the annotation should be placed will add a new annotation. To enable graph navigation, uncheck Annotation->Place Annotations.

There is a feature to auto annotate the R-waves (highest peaks) in the signal. To use this, click Annotation->Find R-Waves.

To clear all annotations, use Annotation->Clear.

Customizing annotation colors can be set from the settings panel.

2.5. Exporting [top]

Exporting data allows it to be used in other programs and routines not a part of this application. All export methods can be found in the File menu of the main window.

2.5.1. Data [top]

Like opening data, exporting data can be done two ways: All at once, or just a subset. To export all of the data, use File->Export.... To export just a subset of the data, use File-Export Subset.... The subset bounds are defined by the two text boxes at the bottom of the main window. In both of these methods, the file format must be chosen from the drop-down in the export dialog.

Currently, there is one way of exporting data. The data is exported into a file of comma separated values (CSV), where first row is the lead number, and each subsequent row is the time followed by the value for that lead at that time. Even though the drop-down provides a MATLAB matrix option, do not use it since it does not work.

2.5.2. Bad Leads [top]

Exporting bad leads is done by File->Export Bad Leads.... The file output is all of the lead numbers of the bad leads, one per line.

2.5.3. Annotations [top]

Exporting annotations is invoked by File->Export Annotations.... Each annotation is associated with a number in order of how they appear in the menu (P-wave -> 0, QRS -> 1, etc.). These numbers are stored with there temporal position in the signal, one per line.

For example, an R-wave (3rd in menu -> 2) annotation was placed at time 1000. When the annotations are exported, then the file would have a line that looks like 2.0 1000.0.

3. Acknowledgements [top]

This work is supported by the National Science Foundation CAREER Award #ACI-1350374

Libraries Used

  1. JFreeChart v1.0.19 - unmodified
  2. Apache Commons Math v3.3 - unmodified
  3. savitzky-golay-filter - modified
    1. SGFilter.java was updated to resolve deprecated dependencies on Apache Commons Math. A copy of the Apache license is contained in the sgfilter directory
  4. JWave - unmodified
  5. Java Look and Feel Graphics Repository - unmodified