How to reduce EKG into a quantifiable format

 

If you record EKG using J&J Engineering equipment go to Step 1. If not, skip to Step 3.

 

Step 1—converting J&J files into readable files

This step makes the .DTA file into an almost readable format (.CHD)

1.      Place pdsconvert.exe in the file folder in which your ekg files are located

2.      Double click on pdsconvert.exe.

3.      Input: Click on Browse and select the .DTA file you want extracted

4.      The program will automatically name all of the output files the same name as your .DTA file (but with a different extension.)

5.      Click “OK”

6.      It’ll take time but it’ll be extracted.

7.      If your .DTA file has two separate recordings in the same file, it will prompt you about which recording you want to extract. If you want to extract both, you will need to first extract the first, and then repeat the process, requesting the second recording. Don’t forget to rename the output files for the second recording to indicate that it’s a different file.

 

Step 2—Converts data files from UNIX to DOS and extracts EKG channel

This step converts the .CHD file into a readable file, makes a .TXT file, deletes the .CHD file, and then moves the .TXT file into a new folder.

 

1. You need to place the following batch files in the same folder as your .CHD data:

a. unix2dos.exe

b. ekgfast.exe

c. extfast.bat

2. You will need to edit extfast.bat to specify the appropriate location of your data and to which folder it will be moved.

3. At a command prompt type:

 

Extfast filename (where filename is the name of the CHD file you extracted above)

 

 


Step 3—Create IBI series files

In this step you will actually see the ekg series and then run a program which will calculate the time between each R spike, known as the Interbeat Interval Series.

1. Open Acqknowledge

2. Open file in Acknowledge, making sure you select text files as the file type

3. If you used J&J, you need to specify the right time course.

·        Display

o       Horizontal Axis

§         Interval = 1/1024 = .0009765625  (change if your sample rate is different)

4. Filter the file:

·        Filter

o       Edit

o       Transform

§         Digital Filter = low pass filter (default)

§         Cut off Frequency = 50

§         Filter entire Wave

§         OK

5. Make it easier to see the waveform:

·        Display

o       Autoscale waveform

6. Have the program calculate the Interbeat Interval Series (IBI)

·        Transform

o       Find Rate

§         Function: Interval (sec)

§         Remove Baseline

§         Deselect Autothreshold

§         Deselect Find rate of entire wave

§         Put in new graph

§         Positive Peak > ## ßthis is dependent on the height of the R-spike. Look to the right of the ekg series and figure out how high this number should be so that it will identify the R-spike and not other insignificant spikes

·        A graph should appear—save this file as a text file (.txt) and move it into a new folder. Name it no longer than 7 characters.

7.  If the IBI series has many noticeable artifacts (“stalagmites” or “stalactites”) then you have two options:

            a) Redo Step 6 with a different threshold for the positive peak ##

            b) Before re-doing step 6…

1) choose Transforms, Derivative, and Window=Hamming, Cutoff Freq=50, Number Coef=39, and check only “filter entire waveform” (which should be checked)

2) Display, Autoscale waveform

3) Now redo step 6, and you may need to select either a positive or negative peak, depending on the waveform.

8.  Note: Some artifacts may remain, but you will save yourself work if you try to minimize the artifacts at this point.  Also, stalactites are better than stalagmites, as the former can be resolved without necessarily looking at the raw data file (since there will be two artifactually short intervals that can be added together).

 

Step 4—Check files for artifacts

1. Open file in Excel

2. Highlight the dataset – column B

3. Insert Chart

4. Select Line Chart

5. Click on Finish

o       If the series looks like this (a “stalactite”):

o      

§         It means that the program thought it found an R-spike but probably didn’t.

§         You’ll need to return to the original EKG file to hand edit. Sometimes if you add the numbers together, it equals the true IBI.

 

o       If it looks like this (a “stalagmite”):

o      

§         It means that the program skipped over an R-spike. You’ll need to return to the original EKG file to hand edit.

 

o       So here’s what you have to do:

§         Go to the original file in Acknowledge and set up the EKG series as you did in Step 3, instructions 1-5.

·        Select the cursor tool

·        Select delta time

·        Go to the part of the file where the program either skipped or counted too many R-spikes.  You can find this by looking at the first column in the excel file, which contains a running time count from the start of the file.

·        Place the cursor at the start of the R-spike, hold down the mouse button, and drag to the next R-spike.

o       Type the number that appears in the delta time space next to the number in the excel file

o       Measure several of the R-spikes before the wacky measurement and after it to make sure you’re in the right spot.

o       When you’re sure you’ve got it the right IBI delete the wrong IBI and type in the right IBI (which may also involve inserting a row in Excel if you have a stalagmite, or deleting a row if you have a stalactite)

 

Step 5—Setup IBI files for John’s program (This step will convert the IBI series from seconds in time course to milliseconds (which is required for John’s program), and will also strip the first column from the data, as this running time index is no longer necessary.

1. Be sure you have the following executable file in the same folder as your IBI text files:

 

sec2msec

 

2. You must make all of your ibi files have a .asc extension. You can rename them quickly by typing at the command prompt: ren *.txt *.asc

 

3. At a command prompt type:

 

sec2msec filename

 

3.  If you like, you can create a batch file that contains many such commands, one per line, each line being for one file.  It may save you typing….  Command files have either a “bat” extension (Win9x), or a “cmd” extension (Win2K, WinXP).

 

Step 6—Extract all of the heart rate measures (Yeah! Almost Done!)

1. Be sure you have the following executable file in the same folder as your newly created millisecond IBI text files:

 

CMet

 

2. At a command prompt type:

 

CMet filename

 

(Again, you can make a batch file to run this on many subjects…)

 

This program will create the following variables in a file HRVMETRC.DAT:

Misc:

MeanIBI: Mean Interbeat Interval

MeanHR: Mean heart rate (the average of the rate-transformed IBI)

CSI: Toichi Cardiac Sympathetic Index

Toichi L: Length of longitudinal Axis (See Toichi et al, 1997)

Toichi T: Length of Transverse Axis (See Toichi et al, 1997)

N IBIs: Number of IBIs on which the metrics are based, which allows for loss for implementing the filter to band-limited RSA.

 

Measures of heart rate variability (both sympathetic and parasympathetic influences)

SDNN: Standard deviation of IBIs

RMSSD: Root mean square of differences between IBIs

MSD: Mean of the absolute value of consecutive IBI difference

LogHRV: Natural Log of variance of IBI Series

 

Measures of respiratory sinus arrhythmia (vagal tone)

PNN50: Proportion of the consecutive IBI differences greater than 50 msec

CVI: Toichi Cardiac Vagal Index

LogRSA: Natural Log of variance of filtered (.12-.40 Hz) IBI Series (Vagal Tone)

 

A text file will be created called “HRVMETRC.DAT”. As you run more files through the program, more rows will be added to the text file.

 

You must open this file in notepad. Save the file ENCODED as Unicode. Otherwise you’ll have problems opening it up in excel.

 

This file can be imported into Excel.

 

You’re done!