SOFTWARE METAPAPER ecg-kit: a Matlab Toolbox for Cardiovascular Signal Processing

The electrocardiogram kit (ecg-kit) for Matlab is an application-programming interface (API) developed to provide users a common interface to access and process cardiovascular signals. In the current version, the toolbox supports several ECG recording formats, most of them used by the most popular databases, which allows access to more than 7 TB of information, stored in public databases such as those included in Physionet or the THEW project. The toolbox includes several algorithms frequently used in cardiovascular signal processing, such as heartbeat detectors and classifiers, pulse detectors for pulsatile signals and an ECG delineator. In addition, it provides a tool for manually reviewing and correcting the results produced by the automatic algorithms. The results obtained can be stored in a Matlab (.MAT) file for backup or subsequent processing, or used to create a PDF report.


Introduction
The electrocardiogram kit (ecg-kit) for Matlab is an opensource application-programming interface (API) that provides an abstraction level for accessing and processing cardiovascular signals. It is a collection of several commonly used tools, such as those algorithms included in Physionet's WFDB software package [1], QRS detectors, wavedet ECG delineator, pulse wave detectors, heartbeat classifiers and other new tools for inspecting, correcting and reporting these results.
The toolbox is available at http://marianux.github.io/ ecg-kit/, where the user can find links to the documentation and source code. There is also a bug tracker for issues and requests, available to the community in Github, a user forum and videos with the typical tasks performed with the toolbox. The current release of the ecg-kit toolbox is for Matlab only, because Octave, the GNU version of Matlab, does not support object-oriented programming. In the next releases, the toolbox will probably be fully compatible with Octave.
The toolbox provides access to more than 7TB of data available in public databases, mainly hosted in Physionet [1] and THEW [2]. The ECG recording formats currently supported by the toolbox are MIT, ISHNE, HES, AHA and Mortara (Mortara's SuperECG exported), find references to these formats in the documentation.
The core of this toolbox is a class called ECGwrapper. This class provides an abstraction layer for the recordings format and length, which offers the possibility of processing recordings of several days or seconds with the same interface. The wrapper also provides an interface to several tasks, such as QRS detectors and classifiers, a heartbeat delineator and two pulse wave detectors. These tasks are routine in cardiovascular signal processing, providing not only the detection of each heartbeat or pulse, but the per-beat wave segmentation also. Each task is implemented through another (abstract) class called ECGtask, which provides an abstraction layer from the algorithm to the ECGwrapper. ECGtask class provides a base interface that is enlarged and enriched by higher hierarchy ECGtask classes, such as ECGtask_QRS_detection or ECGtask_ECG_ delineation. Each task can implement several algorithms that can be used at the same time, with a common configuration. The reader is referred to the examples in the documentation for further details.
The toolbox also includes several functions to visualize and create reports, as those shown in Figure 2. The reporting and visualization functions can pretty print raw recording signals, and ECGtask's results produced by the toolbox as well.
The installation of the toolbox is simple and well described in the project web page. After installing ecg-kit, the user can start by trying the examples that shows most of the features in short recordings, also included with the kit, producing an output as is shown in Figures 1 and 2.
The full procedure to install and execute the examples is described in the toolbox documentation.

Implementation and architecture
The ECGwrapper is the main class of this API as shown in Figure 3. It is the main interface to all toolbox features as well. In addition, it also has some low-level methods, such as read_signal, useful for accessing signal samples. The wrapper class defines a property called ECGtaskHandle, where ECGtasks and all derived classes can be plugged-into. This class objective is to provide ECGtaks-derived classes, a common interface for reading data samples. As mentioned before, the ECGtask is an abstract class definition where a minimum interface is specified. From this minimum interface, tasks that are more specific can be implemented, namely: • QRS_detection: It implements algorithms gqrs, wqrs and ecgpuwave from Physionet [1], Pan & Tompkins [3], EP ltd [4] and wavedet [5]. • ECG_delineation: It only implements the wavedet algorithm [5]. • PPG_ABP_detector: Peak detection in pulsatile signals.
The ecg-kit includes some algorithms originally developed in Matlab and others developed and integrated into the kit calling them via system calls.

Quality control
Quality control is performed by running the example scripts in a dataset that includes recordings from all databases from Physionet [1] and THEW [2], as well as others developed by our group. In the current version, quality is measured with respect to the results obtained with the original tools, which were previously validated, also a visual qualitative inspection of the reports generated. For this task, we developed a quality testing dataset which includes recordings from several databases used in the research group of Zaragoza. In the upcoming versions, a quantitative analysis will be implemented in order to ensure quality of the implemented algorithms.

Operating system
The toolbox has been tested on 64-bit versions of Linux and Windows 7. We are looking for contributors for testing it over MAC OS. The Matlab version recommended for the current release is 2013b, which has been tested in Windows 7, Linux Ubuntu 15.04, and a computer cluster, the High Performance Computing Unit of the CIBER in Bioengineering, Biomaterials & Nanomedicine (CIBER-BBN), at the University of Zaragoza (ICTS "NANBIOSIS") [8].

Programming language
Matlab.

Additional system requirements
None.

Dependencies
None. The toolbox includes all dependencies.