The WFDB Software Package is a comprehensive software package developed at Physionet to permit an effective use of PhysioBank data.
The WFDB Software Package is made of several components: the WFDB library plus several application for signal processing and WAVE, a GUI for working with waveform data. The software (except WAVE) is supported natively (once built with MinGW using the windows API) on Windows 32 bit platforms, but, unfortunately, most modern Windows machines now run a 64 version of Windows 7.
Many users (like me and my students) over the years used the WFDB library plus the WFDB_tools to read and write data in the PhysioBank format from Matlab. The WFDB_tools are now obsolete and a different approach is reccomended for the same goal, the WFDB Toolbox for Matlab.
Unfortunately, while I reccomend the WFDB Toolbox for Matlab for new projects, we have accumulated a bunch of Matlab codes which use the WFDB_tools, so it would be a pain to rewrite all of them. I therefor decided to build an (unsupported) version of the WFDB library and tools (no WAVE GUI) which run natively under Windows 7 64 bit. I pubblish here this (unsupported) notes for the needs of my students and who might have the same necessity.
If you are in a hurry of getting you software at work, here are the links to the binaries produced with the process described below. As stated in the relevant section, when compiling ecgupwave you now need to use gfortran (g77 is not supported in gcc 4.x). This leads to slighly different results and further testing is needed. So use ecgupwave bearing this in mind.
(Here an older 32 bit version of the same library, in case you need it for a comparison:
A nice guide for building a native 32 bit version of the WFDB suite is provided by Physionet here. The procedure to build a native 64 bit version is similar.
The steps are:
ln -s /bin/x86_64-w64-mingw32-gcc.exe /bin/gcc.exe ln -s /bin/x86_64-w64-mingw32-strip.exe /bin/strip.exe ln -s /bin/x86_64-w64-mingw32-ranlib.exe /bin/runlib.exe ln -s /bin/x86_64-w64-mingw32-ar.exe /bin/ar.exe ln -s /bin/x86_64-w64-mingw32-as.exe /bin/as.exe ln -s /bin/x86_64-w64-mingw32-gfortran.exe /bin/gfortran.exe
This will create symbolic links to the MinGW64 cross-compiler. Old 32 bit versions of the codes might be on the Cygwin path, so, to be to double sure that this is not the case, from the Cygwin prompt we set:
PATH="/usr/local/bin:/usr/bin:/cygdrive/c/Windows/system32" PATH=$PATH:"/cygdrive/c/Windows:/cygdrive/c/Windows/System32/Wbem" export PATH
./configure --prefix=/opt/libcurl --without-ssl --host=x86_64-w64-mingw32 make make install
The configure script can take a long time. Just be patient. The library will be built and installed under /opt/libcurl.
int __cdecl execv(const char *_Filename,char *const _ArgList[]) __MINGW_ATTRIB_DEPRECATED_MSVC2005;with
int __cdecl execv(const char *_Filename,const char * _ArgList[]) __MINGW_ATTRIB_DEPRECATED_MSVC2005;This MUST be reversed (the old line must be plugged back) once expat is built. Then download the source from the website of the project and unpack in your favorite folder. Finally, from this folder, at the Cygwin command prompt type:
./configure --prefix=/opt/libexpat --host=x86_64-w64-mingw32 make make install
The library will be installed in /opt/libexpat.
mkdir -p /opt/wfdb/bin export PATH="/opt/wfdb/bin:$PATH" cd /opt/libcurl cp -p bin/curl-config bin/libcurl-4.dll lib/* /opt/wfdb/bin cp -pr include /opt/wfdb cd /opt/libexpat cp -p lib/* /opt/wfdb/bin mkdir /opt/wfdb/include/expat cp -pr include/* /opt/wfdb/include/expat
We need to adapt the source to the x86_64-w64-mingw32 toolchain:
echo "ARCH = $ARCH" >>site.defwith
echo "ARCH = x86_64-w64-mingw32" >>site.defThe script is not meant for cross-compilation, but we want the right host type in the final code. Also, replace the two lines
sed 's/NOCYGWIN/-mno-cygwin/' site.def mingw-slib.def >site-slib.def sed 's/NOCYGWIN/-mno-cygwin/' mingw.def >>site.def ;;with
sed 's/NOCYGWIN//' site.def mingw-slib.def >site-slib.def sed 's/NOCYGWIN//' mingw.def >>site.def ;;
The option -mno-cygwin is not supported anymore by GCC. But the x86_64-w64-mingw32 toolchain will build software not dependent on Cygwin in any case.
/#undef _WIN32 /* ... or 32-bit MS-Windows API either */with
/* #undef _WIN32 */ /* ... or 32-bit MS-Windows API either */
LC = LL =with:
LC = `curl-config --cflags` LL = `curl-config --libs`the line:
CFLAGS = $(MFLAGS) -g -O $(CCDEFS) $(LC) -I$(INCDIR)with:
CFLAGS = $(MFLAGS) -g -O $(CCDEFS) $(LC) -I$(INCDIR) -I/opt/wfdb/include/expatand the line:
LDFLAGS = -L$(LIBDIR) -lwfdb $(LL)with:
LDFLAGS = -L$(LIBDIR) -L/opt/wfdb/bin -lwfdb $(LL)
./configure --without-cygwin --with-libcurl --prefix=/opt/wfdb make make install
During the check of the library, you might get WFDB error. These are due to the different path separator in Cygwin ("/") and Win64 ("\"). To check that the library was built properly, open a Windows prompt, move to the checkpkg folder and type.
lcheck -v >lcheck.W64.log
The lcheck.W64.log should then contained only tests with an OK on their side.
The library is now built as well as the WFDB tools. You should move it where you prefer and add the bin folder to the system path. You should check that the dll only links to 64 bit modules. To do so, download the 64 bit version of the http://www.dependencywalker.com/ and run it on the wfdb-10.5.dll file. You should get no errors related to 32 bit modules loaded (a situation like the one in this picture is fine).
ecgpuwave is a nice QRS detector that works on PhysioBank data. A bit of changes to the original code are necessary to make it compatible with the new GFortran.
make make install cp /usr/x86_64-w64-mingw32/sys-root/mingw/bin/libgfortran-3.dll /opt/wfdb/bin/.
The last line is necessary to copy the dll which is needed.
./ecgpuwave -r 100s -a testThe first test should fail and you should have the following output on the console:
QRS en el ECG: 75 QRS en la conv.: 74 QRS conformados: 74 .. 72 beats Test 1 Failed bxb -r 100s -a test exp -O -f 0 -w s1 >bxb.out 2>&1 Test 2 passed
The failure is likely due to a different size of the double precision variables, with gfortran 64 bit. The second passed test says that the difference found in the reference points is minimal, but more checks should be performed. So use ecgpuwave with this in mind.
The WFDB_tools are wrappers which permit to exploit the WFDB library from within the Matlab prompt. As written above, this is an obsolete way of doing, but still useful for old codes.
To build the WFDB tools:
if mlv_ge('7.1'), oext = 'mexw32'; else oext = 'dll'; endin the file gnumex.m so that reads:
if mlv_ge('7.1'), oext = 'mexw64'; else oext = 'dll'; end
©2012 Roberto Sassi