(1) Overview


The electrocardiogram kit (ecg-kit) for Matlab is an open-source 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.

Figure 1 

This figure shows the GUI for correcting heartbeat locations for the multimodal recording included with the toolbox. Note that you can correct the missed and incorrectly located heartbeats produced by the automatic algorithms.

Figure 2 

A report created with ecg-kit for a multimodal recording after being processed with the example.m script. The heartbeats located in the pulsatile and ECG signals are identified with vertical lines, with an specific color code to indicate the type of heartbeat, and the algorithm responsible of this mark. Also the waves delineated are overprinted with several colors on top of the signal.

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. Implements the wabp [1] and wavePPG [6] algorithms.
  • ECG_heartbeat_classifier: Heartbeat classifier according to AAMI recommendations. It implements the a2hbc [7] and EP ltd [4] algorithms.
  • Corrector: Graphical user interface for correcting and visualizing results.
Figure 3 

Schematic of classes for accessing and processing signals. Data from several formats is shown in the left, interfacing through the ECGwrapper class. In the right, numeric results or reports are created after the application of the ECGtask objects.

The ecg-kit includes some algorithms originally developed in Matlab aznd 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.

(2) Availability

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


Additional system requirements



None. The toolbox includes all dependencies.

List of contributors

Llamedo Soria, Mariano.

Demski, Andrés Julio.

Software location

Archive (e.g. institutional repository, general repository) (required)

Name: ecg-kit

Persistent identifier: http://marianux.github.io/ecg-kit/

Licence: GPL version 2

Publisher: Llamedo Soria, Mariano

Date published: 05/05/15

Code repository GitHub

Name: ecg-kit

Identifier: http://marianux.github.io/ecg-kit

Licence: GPL

Date published: 05/05/15



(3) Reuse potential

This toolbox should be of interest for researchers interested in algorithms used for cardiovascular signal processing. It provides a common interface to multiple tasks and algorithms. This toolbox could be useful for researchers interested in performing simple cardiovascular signal processing and extracting measurements about heartbeats (rhythms, ectopic activity), wave amplitudes, intervals and their relationships, among others. In addition, algorithm researchers could find this software useful for comparing their algorithms with several others representative of the state-of-the-art, or extending the functionality of the default algorithms. The feature for creating reports from ECGtask’s results is useful for documenting experiments and publishing results.

Users interested in interfacing their algorithms to the kit are referred to the toolbox documentation, in order to create a user-defined ECGtask-derived class, or use the arbitrary tasks which are a simple interface to hook user defined algorithms. The first is a versatile but more complex method, while the second provides a static and limited interface, but much easier if your algorithm can be adapted to the requested interface.

This toolbox provides a good starting point for researchers studying new cardiovascular signal processing algorithms, or those already implemented, for either comparison or further development.

Competing Interests

The authors declare that they have no competing interests.