Digitization Workflow

From CVRG Wiki

Jump to: navigation, search

Contents

Available Tools

Digitization Tools

There are several tools available to digitize ECGs. Some of them are listed and described here.

This section of the wiki will cover the WinDig and Engauge tools.

You may download Engauge here.

You may download WinDig here.

Image Editing Tools

Before digitizing, you may want to enhance or clean up the image, or combine multiple images together to have multiple leads on the same axis.

The best open-source program for this is the GNU Image Manipulation Program, or GIMP. Download it here.

Preliminary Steps

Converting Scanned Image to an Image File

PDFs

If you have a PDF of an ECG that you want to scan, you must first convert it to an image format.

Select Image to Convert

  • Scroll to the point in the PDF where the image exists.
  • Go to the Tools menu and select the Select and Zoom... submenu. Within that submenu, select the "Snapshot Tool"
  • Select the part of the image that you want to digitize. It should automatically copy to the clipboard.

Image:SelectingPDF.JPG

Using Paint to Convert to an Image File

  • Open up Microsoft Paint application. Go to the Edit menu and select Paste. The image should appear in Microsoft Paint.

Image:PaintImagePast.JPG

  • Crop the image if necessary. Then Go to File -> Save As and make sure the Save As Type is bitmap (BMP extension). You can also save as a PNG file but it won't work with WinDig.

Image:SaveAsBitmap.JPG

Combining Leads from Multiple Images Into One Image

Once you've saved a bunch of leads off of a 12-lead image, you can then combine them on one axis using the GIMP image editor.

  • Open the Gimp program, and open the image containing the first lead.
  • Go to File -> Open As Layers and select an image containing another lead.
  • In the Layers dialog box, select Multiply in the Mode dropdown.

Image:Gimplayers.JPG

  • Using the Move tool in the toolbox dialog, position the layer for the next lead so that its axis lines up with the axis of the first lead.

Image:GimpMove.JPG

  • Repeat for as many leads as you want.

Image:TwoOverlaidLeads.JPG

  • Save the image as a bmp file and elect to flatten it when prompted.

Important Note

This is only applicable if you intend to digitize with Engauge. WINDIG DOES NOT SUPPORT MULTIPLE LEADS.

It is also not advisable to combine more than a couple leads together in one image, as it will be too difficult to get an accurate digitization.

WinDig

WinDig works best when the grid and the curve are different colors. For example, if the grid is red and the curve is black.

Note that WinDig includes a very handy zoom window and a coordinates window that can help you pinpoint the precise position of the cursor.

Image:ZoomTool.JPG

Handling Low Quality Black and White Graphs

If you have an image with prominent gridlines that are the same color as the curve, you will need to use the pen tool to trace over the curve in WinDig.

Select the pen tool from the menu and then select Color Limits from the options menu. You will get a dialog box where you can set the active pixel color:

Image:ActivePixel.JPG

Select an RGB that is easily identifiable. Then trace over the graph with the pen tool. If you make a mistake, use the rubber tool to erase.

Pen and Rubber tools in windig
Pen and Rubber tools in windig

Once you have completed your trace, go back to the color limits dialog and expand the limits a little bit beyond the color you set for the pen so that it is able to auto-digitize. See the auto-digitize instructions below.

Graph that is traced with pen tool in WinDig
Graph that is traced with pen tool in WinDig

Clear Out Previous Data

Sometimes WinDig will save data you've previously collected in a cache. To clear this data out, go to the Data menu and select Clear All.

Open File

  • Open the .bmp file containing the image in WinDig by going to the File menu and selecting Open.

Define Axis

  • Go to the Scale menu and select Define 3 Pts

Image:ScalePoints.JPG

  • Move the pointer on the graph to the origin and left click.

Image:DefinePoint.JPG

  • Make sure x and y are set to zero and click OK.
  • If your image has a sample signal (1mV high), use it as a guide to position the pointer 1mV high and at the 0 second mark.
  • Left click and enter 1000 for y and 0 for x. We are going to use microvolts as our units.
  • Position the pointer at the end of the graph along the x axis and left click. Enter for x however many milliseconds there are in the segment and 0 for y. Click okay

Define Color of Curve

  • Move the cursor over a part of the curve and press the L button on your keyboard. A dialog box will appear.

Image:ActivePixel.JPG

  • If you would like you may adjust the bounds of the R, G, and B values to define a range of colors of your curve. If the range is too big you may get more than one point for each x value. If it is too small it may not be able to trace the curve.

Automatically Detect Points

  • Once you've defined the color of the curve, position the cursor over the curve and right-click. Be sure to have the cursor positioned over a part of the curve where the pixel is the same color as the color you defined previously. Some curves can contain many different colors.
  • If WinDig is successful in finding points, the color of the curve will change slightly and it will automatically move the cursor ahead as far as it was able to automatically digitize. If the entire curve is not captured, simply right-click on the curve again and repeat until you've reached the end.

Image:TracedLine.JPG

  • If WinDig is having trouble detecting points, try increasing Delta X-Y. This increases the maximum pixels WinDig will search for a match to the color you defined. You can find this option in the Options menu.

Image:DeltaXY.JPG

  • You can also manually create points by simply double clicking a part of the graph.

Preparing Data to Be Saved

  • First go to the Data menu and select Format.

Image:FormatDataMenu.JPG

  • Make sure "X in exp format" and "Y in exp format" are UNCHECKED. Also select a comma as the data separator.

Image:FormatData.JPG

  • Go to the Data menu and select Edit. You will see all the data points that were collected.

Image:CurrentData.JPG

  • If there are duplicate y values for a given millisecond, or if something looks "off" you should remove it from the list.

Saving Data

  • Go to the Data menu and select Save.

Image:SaveData.JPG

  • Choose a file name and make sure the extension is csv. Then save the file.

Engauge

Though less precise than WinDig, Engauge is more versatile and can be run on non-Windows systems. It can also handle more than one lead as long as it is on the same axis.

Importing an Image

  • Go to the File menu and select Import..., NOT Open

Image:EngaugeImport.JPG

  • Navigate to the image file in the file system and open it.
  • The image will appear in Engauge.

Calibrating an Image

If the image quality appears poor, go to the Settings menu and select Discretize. There will be several different tools you can use to make the graph look more visible.

Image:Discretize.JPG

Defining the Axis

  • Click the Axis button (circled in diagram below).

Image:EngaugeAxisSelect.JPG

  • Click the origin and define the value of 0, 0. Then click along the Y axis and X axis respectively and define a point. Use microvolts and milliseconds as your units.

Automatically Detect Points on the Graph

  • Select the Segment Fill tool

Image:EngaugeSegmentFillSelect.JPG

  • You will notice that some parts of the curve (and possibly parts of the grid) have green lines over them. This is where Engauge has "detected" a potential curve.
  • Move the cursor over one of the green segments on your graph. A box will appear outlining exactly where that segment begins and ends.

Image:EngaugeBox.JPG

  • Click over this box and Engauge will automatically generate points.

Image:EngaugePoints.JPG

  • Keep going through the graph until Engauge has digitized all the green sections.

Manually Specify Points

  • You will probably now notice that some of the peaks and valleys of the graph were not detected by Engauge's green line. It is now necessary to manually create points in these regions.
  • Select the "Curve Point" tool from the toolbar.

Image:EngaugeManPts.JPG

  • Manually place points along evenly spaced time intervals on the curve (every x milliseconds). Not a regular "curve distance" intervals, but regular time intervals. This means that segments with a large slope (or nearly vertical) will have fewer points than segments with a small slope (aka nearly flat).
  • Notice that as you add points, the blue line connecting the points together will change and be a better trace of the curve.

Removing incorrect points

You may remove a point you mistakenly entered by switching to the Select Tool. Do this by clicking the Select Mode icon in the toolbar.

Image:SelectTool.JPG

Then click on the point you want to remove. You should see a green box around it.

Image:SelectPoint.JPG

Press the delete key to remove the point.

Exporting Data

  • Go to Export Setup under the Settings Menu.

Image:ExportSetup.JPG

  • Make sure you match the settings in the above image, using commas as you delimiters.
  • Then go to Export in the file menu and save the raw data file as a csv

Multiple curves

If you have an ECG image with multiple leads on the same axis, you may define each lead as a separate "curve" in Engauge.

  • Go to the Settings menu and select Curves.

Image:EngaugeCurves.JPG

  • Click the New button in the dialog box to add a new lead. Type its name and click ok.

Image:CurveName.JPG

  • Clicking the properties button will allow you to change the color and other attributes of each curve.

Image:CurveProperties.JPG

  • Once you've defined your curves, use the curve selection drop-down in the toolbar to specify which curve you're working with.

Image:LeadSelector.JPG

  • Before saving the file, make sure that you are interpolating Y values for all curves.

Image:ExportSetupMult.JPG

Personal tools
Project Infrastructures