Notice: This release of the wfdb-swig package is compatible with version 10.5.0 and later versions of the WFDB Software Package. The most recent version of the WFDB Software Package 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/Linux||Mac OS X||MS Windows|
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.
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 may also be possible to generate wrappers for other languages supported by SWIG, including Guile, mzScheme, Octave, PHP, Ruby, and Tcl.
The WFDB Toolkit for Matlab uses the Java wrappers from this package to provide efficient access to WFDB applications such as rdann, rdsamp, wrann, and wrsamp from the Matlab environment. One-click installation is possible; it is not necessary to have installed the wfdb-swig package beforehand.
Raja Selvaraj is developing a pure Python module without external dependencies that provides a subset of rdann and rdsamp functionality. The current version can read local records (no NETFILES) containing exactly two signals stored in format 212. Download the code (wfdbtools.py) and its documentation (links will open in another window).
Isaac Henry (email@example.com), George Moody (firstname.lastname@example.org)
The SWIG web site (http://www.swig.org/)
The WFDB Programmer's Guide
GNU/Linux (development) Mac OS X, MS Windows. Other platforms supported by SWIG should also work but have not been tested.
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.
The current version of the wfdb-swig package (most recently updated on
Tuesday, 12 July 2011 at 18:17 EDT) may be downloaded in source form, as a tarball (wfdb-swig.tar.gz,
Older versions of the wfdb-swig package are also available in the PhysioToolkit Archives.
See INSTALL in the top-level wfdb-swig directory.
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.
Updating/modifying the wrappers
The wrappers will need to be regenerated for new versions of WFDB if the WFDB API changes in any way that is not backward-compatible, such as by removal or redefinition of 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.4.x to 10.5). Versions that differ by release number only (e.g., 10.5.0 and 10.5.8) share the same API and can use the same set of wrappers.
Note that new functions are occasionally added without a change in the major or minor versions of the WFDB library. In such cases, the wrappers can be regenerated to obtain access to the new functions; using an old copy of the WFDB library with regenerated wrappers can result in run-time errors if newly-defined functions are missing.
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.
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 email@example.com to let us
know what you did and how you did it.
At present SWIG does not support generation of language specific documentation
(such as javadoc). Future versions of SWIG may add this functionality.
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 firstname.lastname@example.org to let us know what you did and how you did it.
At present SWIG does not support generation of language specific documentation (such as javadoc). Future versions of SWIG may add this functionality.