Heart Rate Variability (Undergoing revision 22-August-2011)
The program processHRV was written to read in Biopac AcqKnowledge (.acq), Matlab (.mat created by John's GE program, Nate's bioread program or the NCACAM psychophysiological data processing program), text files containing EKG or pressure pulse (PulseOx) heart data and work (_processHRNV.mat). It will automatically pick peaks, facilitate editing of the results, and save interbeat intervals (ibi) to text files. It can also read in respiration data from these file types and compute its power spectral density for comparison with the PSD of the heart's interbeat intervals (IBIs). An estimate of the respiratory sinus arrythmia (RSA: natural log power in the 0.15-0.40 Hz HF band) and the ratio of the LF(0.04-0.15Hz)/HF(0.15-0.40Hz) log powers are displayed. Power spectral densities for the IBI series and respiration if present are displayed in the PSD window and can be saved to a Matlab file. It is possible to change the lower and upper bounds of the HF band to better match reslut from the respiration PSD. The LF and HF display boxes will reflect any changes to these frequency boundaries.
processHRV is started for Biopac data by typing
'processHRV('acq',3,4)' at the Matlab prompt where the second and third
arguments, 3 and 4, are the channels containing the EKG and Respiration
data respectively. For text or the NCCCAM created Matlab (.mat) files
containing heart data use 'processHRV('text',1000)' or
'processHRV('mat',500)' where the second argument is the sampling rate.
For pulse OX files created by the GE scanner type processHRV('GE',250)
where 250 is the sampling rate (Note that the 250 sampling rate required
special programming of the Scanner and that after the last scanner
upgrade the sampling rate reverted to the GE default of 200; CHECK THE
SAMPLING RATE). For Matlab files created with Nate's 'bioread' program
use processHRV('bioread',3,2) where 3 is ECG channel and 2 is the
respiration channel. To summarize the calls
are: processHRV('acq',3,4) where ECG on channel
3 and respiration on channel 4 processHRV('text',1000) text data file at 1000 Hz
sampling rate process('mat',500) NCCAM created
Matlab file processHRV('GE',250) Matlab file
created by GE scanner processHRV('bioread',3,2)
Matlab file created by Nate's bioread 'acq2mat' function processHRV('work') open a previously saved work file
(_processHRV.mat) If for some reason Matlab
can't find processHRV then type 'addpath
/d1/local/matlab/HRV/processHrvRespMat' for Linux or 'addpath
W:\d1\local\matlab\HRV\processHrvRespMat' for PC at Brogden; or at Keck
'addpath /apps/brogden/matlab/HRV/processHrvRespMat' for Linux or
'addpath W:\apps\brogden\matlab\HRV\processHrvRespMat' for PC. After
entering this command an Open File dialog will appear allowing the user
to choose an input file. The figure above shows processHRV after
reading in a text heart pulse file recorded in the MRI. The control
window in the upper right contains buttons for manipulating the EKG
graph (upper left), the plotted peaks (yellow circles), and the peak
threshold (cyan line). Directly below this EKG window is a plot of the
interbeat intervals (IBIs) with IBI times in milliseconds on the
vertical axis and recording time in seconds on the horizontal axis. Note
the skipped beat at approximately 260 seconds - we'll fix this
now. Expand the EKG time scale by
clicking on <--> in the EKG plot frame and scroll to 260 seconds by
clicking the right arrow (>). The EKG plot should appear as shown below
with the missed beat clearly visible: Click on the 'o' peak marker to the left or
right of the missed beat to select it (turning it red). Next in the
'Peaks' frame click on the appropriate button 'Add Left' or 'Add Right'
to approximately place a new 'o' peak marker over the missed peak
(actually, it is placed half way between the selected peak and
previous/next peak). Select the new peak and and click on the point
where you would like to move it (note that sometimes you may be clicking
on the EKG curve or one of the plot gride lines so the peak won't move
there - just keep trying nearby points). Then use the Up/Down/Left/Right
buttons in the Move Peak frame to move it onto the missed
peak. Increasing (-><-) and zeroing (<) the time scale
reveals (below) in the IBI window that all missed beats have been found
and corrected. Interbeat interval data can be saved to a text file by
clicking the IBIs button in the Save frame. Ten hertz spline
interpolated IBI data can be saved by clicking the IBIspline button and
power spectral data by clicking the PSD button. It is probably best to
save all output files. The HRV frame in the EkgControl window displays
several important parameters: natural log power LF(0.04-0.15Hz);
HF(0.15-0.40 Hz RSA); LF/HF ratio and heart rate.
Some EKG data files may not be so easy to clean.
It may be necessary to raise or lower the threshold (cyan line) and
click on the Find Peaks button in order to improve on the initial peak
picks. For good estimates of respiratory sinus arrythmia (RSA), it's
best to have several minutes of good data. Respiraton data The EkgControl window has additional buttons in
the second column. These allow the user to move the lower and upper
bounds of the high frequency (HF/RSA) range in order to get a better
estimate of RSA if respiration data are available. Click the Plot button
in the respiratory frame to open the respiration data file recorded at
the same time as the EKG data. Choose the correct file from the file
open dialog. The respiration data are then plotted in red above the EKG
data in the top plot window. Two vertical white lines in the respiration
plot can be used to select a continuous section of good data for
estimating the power spectrum of the respiration data. These lines can
be moved by clicking on one or the other to select it then moving the
cursor to a new location and clicking the left mouse button. The
respiratory power spectrum is plotted in the PSD window in red. As
described above the low and high HF boundaries can be moved to match the
respiratory range and thus show a better estimate of RSA in the HF
window (here it looks like the lower bound could be moved down to 0.12
Hz). NOTE that while the white lines define the time range for computing
the PSD of respiration the whole recording time is still used to compute
the RSA shown in the HF window. In the lower right is the Save frame.
Buttons located here allow the user to save the IBI text file, the
IBIspline (10 Hz) file, the PSDs, a work file, or all of those listed.
The work file allows the user to exit the program before editing is done
and then return to the work by typing 'processHRV('work') which will
open a previously saved _processHRV.mat file. This program's primary
purpose is to create a cleaned listing of IBs and NOT to produce final
LF/HF values. These results are left to more sophisticated programs that
analyze IBI series. Click
here for a detailed description of heart rate variability data
processing. Click
here for CMETX recommended software for processing IBI
data.