An Open-source Toolbox for Analysing and Processing PhysioNet Databases in MATLAB and Octave

The WaveForm DataBase (WFDB) Toolbox for MATLAB/Octave enables integrated access to PhysioNet’s software and databases. Using the WFDB Toolbox for MATLAB/Octave, users have access to over 50 physiological databases in PhysioNet. The toolbox provides access over 4 TB of biomedical signals including ECG, EEG, EMG, and PLETH. Additionally, most signals are accompanied by metadata such as medical annotations of clinical events: arrhythmias, sleep stages, seizures, hypotensive episodes, etc. Users of this toolbox should easily be able to reproduce, validate, and compare results published based on PhysioNet’s software and databases.


Introduction
The WaveForm DataBase (WFDB) Toolbox for MATLAB/Octave (see Figure 1) is a collection of over 30 functions and utilities that integrate PhysioNet's open-source applications and databases with the high-precision numerical computational and graphics environment of MATLAB and Octave. The WFDB Toolbox for MATLAB/Octave is an open-source project supported by PhysioNet [1], with a dedicated support mailing address at: wfdb-matlab-support@physionet.org. A managed community forum for discussions is also available at https://groups.google.com/forum/#!forum/wfdb-app-toolbox.
The WFDB Toolbox for MATLAB and Octave currently provides direct access to over 50 databases in PhysioNet (around 3 TB of data). The function RDSAMP allows users to load PhysioNet waveform data into MATLAB's or Octave's workspace; if the database signals are not cached locally, they are automatically fetched from PhysioNet's servers using HTTP and stored locally for future access. In addition, the function RDANN allows users to load meta data (defined as "annotations" in WFDB terminology). The annotations are generated by medical experts examining the raw waveforms, or by sophisticated published medical algorithms. Examples of the types of annotations available include arrhythmia events, evoked potential epoch markers, epileptic seizure onset, sleep stages, apnea events, and signal quality indication. The PHYSIONETDB function allow users to browse PhysioNet's databases within MATLAB/Octave. The output argument of PHYSIONETDB, a cell array following the input syntax of RDSAMP, provides a convenient way to process all databases and signals in PhysioNet, using only two 'for' loops and RDSAMP.
The WDFB Toolbox also provides functions useful for processing physiological signals. Some of these functions consist of MATLAB/Octave wrappers for open-source C-code functions published in the literature and contributed by user's to PhysioNet. Among the currently implemented wrappers to popular third-party C-code software are ECGPUWAVE [2][3][4][5], EDR [6], MSENTROPY [7][8], and WABP [9]. The WFDB Toolbox also contains a wrapper, BXB, to a function for testing and reporting performance results of cardiac rhythm and ST segment measurement algorithms according to ANSI/AAMI EC38:1998 [10][11]. Thus this library and the databases provide a vital resource for MATLAB and Octave users who want to learn, validate, and compare different biosignal processing algorithms.

Implementation and architecture
A schematic diagram of the software architecture is shown in Figure 2. The top level of the toolbox consists of HTML documentation files and *.m files. The MATLAB/Octave layer is responsible for interfacing between the user and the toolbox. Additional files not shipped with the toolbox, but available at the code repository, are used for unit testing at the MATLAB/Octave layer. This MATLAB/Octave layer is linked through a Java API (provided either through MATLAB or Octave) to a set of Java classes. These Java classes are responsible for path configuration, library/binary loading, I/O parsing, multi-thread processing, and basic database queries. The Java classes are linked to WFDB native binaries through standard input, output, and error pipes that are created when the JVM performs a system call. An example of this framework in the specific case of reading PhysioNet data using RDSAMP on a Windows environment is shown in Figure 3.

Quality control
A unit-test framework has been specifically developed for the toolbox, in order to ensure consistent testing in both MATLAB and Octave environments. The goal of the unit tests is to certify a minimum quality prior to public releases. These test suites were individually run on 64-bit versions of GNU Octave 3.6.4, MATLAB 2013a/2013b, Windows 7, Mac OS X 10.9, and Linux Ubuntu 13. These tests ensure that all documented examples work as expected in all the supported environments. In some cases, tests for known issues were also added. These issues are not yet fixed, but have been documented through the repository tracking system. The unit test framework, and the list of known issues and bugs in the code repository are updated and maintained by the PhysioNet developers.

(3) Reuse potential
This software should be of interest to any user who wishes to do signal processing research with biomedical data. This software can be used as valuable resource for reporting and validating scientific and industry results. PhysioNet encourages the use of this toolbox and its accessible databases for educational purposes as well.