Professional Documents
Culture Documents
Open Source Tool
Open Source Tool
net/publication/220539765
CITATIONS READS
3 297
6 authors, including:
Some of the authors of this publication are also working on these related projects:
All content following this page was uploaded by Xose A. Vila on 07 January 2014.
L. Rodríguez-Liñares ∗ , A.J. Méndez, M.J. Lado, D.N. Olivieri, X.A. Vila, I. Gómez-Conde
Dpto. Informática University Vigo, Spain1
a r t i c l e i n f o a b s t r a c t
Article history: In this paper we describe a software package for developing heart rate variability analysis.
Received 15 October 2009 This package, called RHRV, is a third party extension for the open source statistical envi-
Received in revised form ronment R, and can be freely downloaded from the R-CRAN repository. We review the state
26 April 2010 of the art of software related to the analysis of heart rate variability (HRV). Based upon this
Accepted 24 May 2010 review, we motivate the development of an open source software platform which can be used
for developing new algorithms for studying HRV or for performing clinical experiments. In
Keywords: particular, we show how the RHRV package greatly simplifies and accelerates the work of
Heart rate variability the computer scientist or medical specialist in the HRV field. We illustrate the utility of our
Open source package with practical examples.
Apnea © 2010 Elsevier Ireland Ltd. All rights reserved.
Signal processing
∗
Corresponding author at: Escuela Superior de Ingeniera Informática, As Lagoas, s/n, 32004 Ourense, Spain. Tel.: +34 988387009.
+34 986813929.
E-mail addresses: leandro@uvigo.es (L. Rodríguez-Liñares), mrarthur@uvigo.es (A.J. Méndez), mrpepa@uvigo.es
(M.J. Lado), olivieri@uvigo.es (D.N. Olivieri), anton@uvigo.es (X.A. Vila), igconde@correo.ei.uvigo.es (I. Gómez-Conde).
1
http://www.milegroup.net.
0169-2607/$ – see front matter © 2010 Elsevier Ireland Ltd. All rights reserved.
doi:10.1016/j.cmpb.2010.05.012
40 c o m p u t e r m e t h o d s a n d p r o g r a m s i n b i o m e d i c i n e 1 0 3 ( 2 0 1 1 ) 39–50
studies [6,7]. As an indication that HRV continues to be an laible tools to study HRV, consists mostly of custom software
active practical field with unresolved problems, there were 21 packages or a loose collection of utilities (a significant number
papers directly related with HRV in the recent 2009 Computers of them using Matlab or Octave). Some authors describe their
in Cardiology Conference [8]. algorithms, yet do not give specifics of the implementation
Unfortunately, clinical practitioners have not included HRV platform or language. Among the few authors that describe
analysis in their standard diagnostic protocols. As a conse- specific environments for studying HRV signals, many of the
quence, medical device manufacturers have not traditionally tools are proprietary and not made available in the public
placed a high priority on including this type of analysis in their domain for use by other researchers.
products [7]. First generation monitoring systems of the 1990s Recently, National Instruments described how variability
permitted the analysis of only a limited number of basic para- analysis can be performed in LabVIEW [10]. While they freely
meters in the time domain and provided only rudimentary offer both the LabVIEW model and documentation, the Lab-
spectral analysis. The principal disadvantage of these early VIEW software platform is a commercial product and is more
systems, however, was the inherent limitations for modifying frequently used by hardware designers or experimentalists
measurement parameters as well as the inflexibility of data than by computer scientists working in the field of medical
format interchange. informatics.
Modern commercial monitoring systems have impro- We have previously mentioned Physionet, which is a web
ved considerably due to greater computational capability of portal containing an extensive database of physiologic signals
embedded systems and to the ability to include a greater range as well as software tools, such as the WFDB [11] library, that
of flexibility. For example, our research related to signal pro- are freely available. Amongst the utilities offered at this site is
cessing of apnea, a chronic sleep disorder, has benefitted from the C language based HRV Toolkit [12] that utilizes the WFDB
recent commercial polysomnographic systems such as the library to obtain signals of heart rate and parameters of varia-
Ultrasom Network by Nicolet and the Somnoscreen of Sonome- bility, both in the time and frequency domain. This is a basic
dics, where variability analysis may be performed both in the software tool and requires installation of both the libraries and
time and frequency domain. Such systems also offer the pos- the HRV Toolkit on systems that support C.
sibility of using different standard formats required by various Recently, Physionet published a news item on their web-
data processing software and hardware tools. site [13] which suggests three different options available for
Despite these improvements, present commercial systems performing HRV analysis with their databases:
are designed for clinical uses and do not have the program-
mability needed by researchers in signal processing, looking • The preliminary version of our package RHRV [14].
for new and yet unforeseen discriminators or algorithms. For • A collection of Matlab scripts [15] which implement func-
this task, researchers rely upon software post-processing. As tions for the linear and non-linear spectrum. Nonetheless,
an example, such systems do not directly permit the custo- these Matlab scripts do not include convenient interfaces
mization of the spectral bands, nor other analysis parameters for importing data, nor does it include specific graphics uti-
such as the size of temporal windows, type of spectral esti- lities.
mators, etc. Thus, researchers rely upon software tools, and • A software package called KUBIOS-HRV [16,17]. The latest
not commercial clinical systems for exploring new diagnostic version of this software is based on Matlab and is multi-
techniques. platform. It imports ASCII files as well as data files from
In this paper we present a software tool useful for resear- Polar and Suunto heart rate monitors (HRM and SDF/STE
chers in the HRV field. The paper is structured as follows. In files, respectively). It has a well designed graphical interface
Section 2 we review the state of the art in the field of software and performs analysis in time and frequency domain as well
for HRV analysis. Section 3 contains a general description of as non-linear dynamical studies.
our software package and an example for presenting the use
of our tool. In Section 4, we present another example in order The most complete and useful software tool that we
to explain how our tool could be used to validate a medical encountered for HRV analysis is the aHRV, developed by Nevro-
hypothesis related with HRV. Finally a discussion section is kard [18]. This is a very well designed commercial tool that
included in which we summarize the main advantages of our provides many options. With this software, heart rate data
software tool and describe future work. from multiple sources such as ASCII files, binary files in Euro-
pean Data Format [19], or other proprietary formats may be
imported. Other aspects of this software include time and
2. Background frequency analysis, flexibility for modifying input processing
parameters, and a well designed user interface. Nevorkard also
The development of our HRV software package grew out of offers other modified versions of this tool, such as LT-HRV for
what we perceived as a need to unify software functionality analyzing segmented ECG records or OSAS for apnea scree-
into one open source and easily extendible tool. We based ning.
our decision to develop the package in the R-language after As researchers, however, we believe that our use of the
a thorough bibliographic review, paying careful attention to aHRV system has several drawbacks. Foremost, it is a closed
the software tools being employed and developed. commercial tool, which is not typically an issue for hospital
The majority of researchers have obtained their data from users, but poses significant limitations for researchers interes-
commercial acquisition systems or from a standard database ted in developing new algorithms. Thus, beyond the provided
such as Physionet [9]. Besides, a large collection of ava- functionalities, it isn’t possible to implement new algorithms,
c o m p u t e r m e t h o d s a n d p r o g r a m s i n b i o m e d i c i n e 1 0 3 ( 2 0 1 1 ) 39–50 41
The instantaneous heart rate can be defined as the inverse An evenly spaced heart rate series may be obtained with
of the time separation between two consecutive heart beats. InterpolateNIHR(), which uses cubic spline interpolation.
The core utility BuildNIHR() implements this operation and This functions fills the HR field of HRVData structure.
fills the niHR field of the Beat dataframe. Functions are provided to graphically represent the non-
Intervals within the heart beat time series, which are of interpolated and interpolated heart rate (PlotNIHR() and
physiologic interests, are annotated in so-called episode files. PlotHR(), respectively). These functions allow the user to
The RHRV package provides functions for loading ASCII or include episodic information in the plots.
WFDB formatted files (LoadEpisodesAscii() and LoadAp- A large part of the core functionality of the RHRV
neaWFDB()). Besides, manual episodes generation is possible package is dedicated to the spectral analysis of heart rate
with AddEpisodes(). Another option is to generate new signals. As can be observed in Fig. 2, several analyses
episodes from existing ones: this is done with GenerateE- (with different input parameters) may be performed and
pisodes(), which inserts an annotation with a specific time stored in parallel. The package includes functions for cal-
duration before or after an existing episode event. culating the spectrogram and the energy contained within
Outlier or spurious points may be deleted manually or auto- specified spectral bands (CalculateSpectrogram() and Cal-
matically. In order to delete outliers manually, a graphical culatePowerBand()). The function CalculatePowerBand()
editor is provided (from the function call EditNIHR()) so that calculates the spectrogram and then obtains the power in four
the user may interactively delete ranges of points from the spectral bands: ULF, VLF, LF and HF. Default limits for these
instantaneous heart rate analysis. The elimination of these bands and the size and shift of the analysis window are spe-
points does not affect the calculation of beat intervals or cified but can be modified by the user.
the subsequent interpolation since the input data from the RHRV includes specialized plotting utilities for represen-
ECG consists of a sequence of absolute time positions. Since ting the spectrogram and the power in each spectral band
episodes are identified by their beginning instants and their (PlotSpectrogram() and PlotPowerBand(), respectively).
durations and both magnitudes are absolute times, removal Episodic information can be included in the plots.
of artifacts has no effect on them. Automatic removal of out- The package provides functions to split heart rate signals
liers can also be performed by the FilterNIHR() function. and power band arrays into new data structures corresponding
This function is based on an algorithm developed by one of to intervals inside and outside episodes (SplitHRbyEpi-
the authors [4], that uses adaptive thresholding for rejecting sodes() and SplitPowerBandByEpisodes()). The former is
beats whose value exceeds the cumulative mean threshold. used by AnalyzeHRbyEpisodes() to perform a comparison of
The filter also eliminates points that are not within acceptable HR data inside and outside episode events.
physiological values.
c o m p u t e r m e t h o d s a n d p r o g r a m s i n b i o m e d i c i n e 1 0 3 ( 2 0 1 1 ) 39–50 43
For a more detailed description of each of these functions, information), and how this information is used for parameter
the software package is distributed with an extensive user comparison.
manual that conforms to the standards of R-package distri- The example uses a data record (a03) from the Apnea-
butions of the CRAN repository. ECG database [23], constructed for the 2000 Computers in
Cardiology Challenge, which can be downloaded from the Phy-
3.3. A practical example siobank collection [24].
An analysis of Listing 1 is useful to describe the program
In this section, an illustrative example of a heart rate variabi- logic and flow, as well as the different parts of the package that
lity analysis with our software package is presented. Listing 1 are involved:
shows an example program for studying apnea signal data. In
particular, this example illustrate how data is loaded and pro- • All the functions in the package accept a logical
cessed, how plots are generated (including physiologic episode argument verbose that instructs the program to
44 c o m p u t e r m e t h o d s a n d p r o g r a m s i n b i o m e d i c i n e 1 0 3 ( 2 0 1 1 ) 39–50
Listing 5 – Code implementation for generating episodes before and after the apnea events.