- 
PhysioNet  ·  PhysioBank  ·  PhysioToolkit

WFDB SWIG Wrappers

Notice: This initial release of the wfdb-swig package is beta software; use it at your own risk! This version has been released to coincide with the release of version 10.4.1 of the WFDB Software Package, which should be installed on your system in order to make successful use of the wfdb-swig package.

The following combinations of target languages and platforms are known to work using the standard build procedure:

GNU/LinuxMac OS XMS Windows
Perl 5worksworksworks
Pythonworksworks
Javaworks
C#works

Other combinations may also work with minor changes in the build procedure. If you can document the steps needed to build any of the combinations not marked in the table above, please send details.

Purpose:

Wrappers are fragments of "glue code" that allow functions or subroutines written in one language to be invoked by code written in another ("target") language.

The WFDB library is a collection of specialized functions that provide uniform access to digitized signals and annotations in a wide variety of formats, including those in PhysioBank. The WFDB library is written in C and includes bindings for C++ and wrappers for Fortran.

The wfdb-swig package provides wrappers that permit programs written in several other programming languages to use the WFDB library. The wrappers are generated automatically using the Simplified Wrapper Interface Generator (SWIG). Tested target languages include Perl5, Python, Java, and .NET languages (C# and Visual Basic). It is also possible with very little additional effort to generate wrappers for other languages supported by SWIG, including Guile, mzScheme, PHP, Ruby, and Tcl.

Matlab wrappers are not provided by this package, but are available in the WFDB_tools package. Since Matlab does support calling Java code, however, it may be possible to use the Java wrappers from Matlab. This has not been tested; if you try this, please send feedback.

Authors:

Isaac Henry (ihenry@physionet.org), George Moody (george@physionet.org)

Background literature:

The SWIG web site (http://www.swig.org/)
The WFDB Programmer's Guide

Platforms:

GNU/Linux (development) Mac OS X, MS Windows. Other platforms supported by SWIG should also work but have not been tested.

Code organization:

The SWIG interface file wfdb.i defines the WFDB API and provides the information needed by SWIG to create the wrappers. The generated wrapper code for each language is stored in a subdirectory (wfdb-java, wfdb-perl, etc.) together with other files needed for that language. See the README files in the language-specific subdirectories for details.

Downloading:

The current version of the wfdb-swig package (most recently updated on Thursday, 6 April 2006 at 23:29 EDT) may be downloaded in source form, as a compressed tar archive (123K). (WinZip users, please read about how to unpack .tar.gz archives in the FAQ.) You may also browse through the source tree to read or download individual files.

Installation:

See INSTALL in the top-level wfdb-swig directory.

Testing:

The C programming examples from the WFDB Programmer's Guide have been translated to each tested language and are located in the examples subdirectory. To test the wrappers after installing them, use 'make check' as described in INSTALL, or test them more extensively by comparing the outputs of these examples against those of the original C examples, which are included in the examples directory of the WFDB Software Package.

Further work:

Updating/modifying the wrappers

The wrappers will need to be regenerated for new versions of WFDB if the WFDB API changes in any way, such as by addition of new public functions, constants, macros, or data types. Such changes are signalled by a new major or minor WFDB version number (for example, the wrappers need to be regenerated when upgrading from WFDB 10.3.x to 10.4). Versions that differ by release number only (e.g., 10.4.0 and 10.4.1) share the same API and can use the same set of wrappers.

When using the normal installation procedure (see INSTALL), the wrappers are regenerated automatically by SWIG as needed, based on the contents of the SWIG interface file wfdb.i. Language-specific interface files may also be located in each subdirectory (e.g. wfdb-java/javadoc.i). Source files (*.c, *.java, *.cs, *.py, and so on) are auto-generated by SWIG and should not be edited manually under any circumstances.

Since wfdb.i includes wfdb.h (the C-language WFDB library API), new or modified functions, constants, and data types that may appear in new versions of the WFDB library are picked up automatically, and no changes to the SWIG interface files are required. Macros, however, are not automatically wrapped by SWIG; if necessary, they can be implemented as C functions in wfdb.i, as was done in Isaac Henry's original version of these wrappers for use with WFDB library version 10.3. Beginning with WFDB library version 10.4, automatically wrappable function equivalents are provided for all public macros, so it should no longer be necessary to modify wfdb.i for this purpose.

Creating wrappers for other target languages

This package currently contains wrappers for Perl, Python, Java, and .NET. Follow these examples to generate wrappers for other languages supported by SWIG; if you are successful, please write to wfdb-swig@physionet.org to let us know what you did and how you did it.

Language-specific documentation

At present SWIG does not support generation of language specific documentation (such as javadoc). Future versions of SWIG may add this functionality.


Send feedback about this page to PhysioNet

Your comments and suggestions are welcome. We encourage you to use our feedback form to comment on this page. If you would like to receive a reply, please send your comments by email to webmaster@physionet.org, or post them to:

PhysioNet
MIT Room E25-505A
77 Massachusetts Avenue
Cambridge, MA 02139 USA

Updated Friday, 07-Apr-2006 12:23:50 EDT National Institute of Biomedical Imaging and Bioengineering National Institutes of Health National Institute of General Medical Sciences