Configure WFDB from physionet in Ubuntu 16.04

Configure WFDB from physionet in Ubuntu 16.04

Install prerequisites

1
apt-get install gcc libcurl4-openssl-dev libexpat1-dev

Download the current version of the WFDB software package

Download from https://physionet.org/physiotools/wfdb.tar.gz, then run

1
tar xfvz wfdb.tar.gz

Configure, install, and test the package

1
2
3
4
cd wfdb-10.x.y     ... here 10.x.y represents the version of wfdb in your PC
./configure
sudo make install ... intalled into /usr/local
make check

Install the WAVE on 64 bit Ubuntu

Basically, we first install 32-bit dependencies for the WAVE and then restore 64-bit dependencies in Ubuntu.

1
2
3
4
5
6
7
8
9
10
11
sudo -s
dpkg --add-architecture i386
apt-get remove libcurl4-openssl-dev:amd64
apt-get install xviewg-dev:i386 libcurl4-openssl-dev:i386 build-essential gcc-multilib
rm -f /etc/apt/sources.list.d/wfdb-tmp.list
./install-wave32 -q
apt-get remove libcurl4-openssl-dev:i386
apt-get install libcurl4-openssl-dev
apt-get install xfonts-100dpi
xset +fp /usr/share/fonts/X11/100dpi
xset fp rehash

Test using an example

Build a .c file named as psamples.c:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
#include <stdio.h>
#include <wfdb/wfdb.h>

main()
{
int i;
WFDB_Sample v[2];
WFDB_Siginfo s[2];

if (isigopen("100s", s, 2) < 2)
exit(1);
for (i = 0; i < 10; i++) {
if (getvec(v) < 0)
break;
printf("%d\t%d\n", v[0], v[1]);
}
wfdbquit();
exit(0);
}

Compile it using following command:

1
gcc -o psamples psamples.c -lwfdb

Run it:

1
./psamples

Then you can view the outputs as below:

1
2
3
4
5
6
7
8
9
10
995     1011
995 1011
995 1011
995 1011
995 1011
995 1011
995 1011
995 1011
1000 1008
997 1008

References

  1. https://physionet.org/physiotools/wpg/wpg.htm#Top [WFDB Programmer’s Guide]
  2. https://physionet.org/physiotools/wfdb-linux-quick-start.shtml [WFDB quick start for GNU/Linux]
  3. https://physionet.org/physiotools/wave-installation.shtml [WAVE installation notes]