INSTALLATION
============




General remarks:
----------------
Please check the Makefile and (un)define the corresponding defines: 

The following DEFINES are recommended and required:
 -D=WITH_CHOLMOD        used for re-referencing of data, REQUIREMENT: cholmod from libsuitesparse
 -D=WITH_ZLIB	        used to handle gzip-ped files,  REQUIREMENT: zlib (http://zlib.net/)
 -D=WITH_GSL	        provides interface to GSL, REQUIREMENT: GNU Scientific Library (GSL), 
 -D=WITH_FEF	        includes support for FEF-format from CNSystems (fails with MinGW) 
 -D=WITH_FAMOS	        includes (partial) support for FAMOS format 
 -D=__4HAERTEL__	support for special flavor of FAMOS format (experimental) 

 Other flags are used for experimental development 
 -D=WITH_DICOM, -D=WITH_GDCM 	experimental DICOM support 

If some libraries are not available on your system, remove the corresponding DEFINES in Makefile. 


Prerequisites: 
----------------
for building libbiosig, save2gdf, mma (mathematica) and mex (matlab)  
	sudo apt-get install subversion libz-dev libsuitsparse-dev 
	svn co https://biosig.svn.sourceforge.net/svnroot/biosig/trunk/biosig4c++ 
	svn co https://biosig.svn.sourceforge.net/svnroot/biosig/trunk/biosig/

for building SigViewer  
	sudo apt-get install qt4-dev-tools  libqt4-dev  libqt4-qt3support
	svn co https://libgdf.svn.sourceforge.net/svnroot/libgdf/trunk libgdf 
	svn co https://sigviewer.svn.sourceforge.net/svnroot/sigviewer/trunk sigviewer

for cross-compilation with Win32 target platform:   
	aptitude install -R autoconf automake bash bison bzip2 \
                    cmake flex g++ intltool make sed \
                    libtool openssl libssl-dev \
                    libxml-parser-perl patch perl \
                    pkg-config scons unzip wget \
                    xz-utils yasm mercurial 
	hg clone http://hg.savannah.nongnu.org/hgweb/mingw-cross-env mingw-cross-env
	cd mingw-cross-env
	make gcc zlib suitesparse

Host=Win32 platform: 
	MinGW32 (with g++)  
	You need to use Makefile.win32 like this 
	make -f Makefile.win32  	
		

Platform specific information
-----------------------------
# Linux, MacOSX(?) 
You need GNU gcc, g++ (ver>4.0), make, zlib (if you do not have zlib, do not define WITH_ZLIB), 
libsuitesparse (if you do not have libsuitesparse, do not define WITH_CHOLMOD).

Running make compiles the converter.
  make 		 	# makes the file format converter
  make save2gdf 	# makes the file format converter
  make win32		# makes the file format converter for Win32
  make physicalunits 	# makes the en/decoder for physical units
  make libbiosig.a  	# makes a static library 
  make mex4o 		# makes mexSLOAD for Octave (requires Octave-headers2.9 or higher)
  make mex4m 		# makes mexSLOAD for Matlab (path_to_mex need to be defined in Makefile)
  make biosig4python 	# compiles the BioSig interface for Python (requires SWIG and Python)
  make all  		# all of the above
  make sigviewer 	# recompiles SigViewer (requires qmake and Qt, the sources of sigviewer and libgdf, must be in ../sigviewer and ../libgdf resp.)
  make testscp 
  make testhl7	
  make test		# tests HL7<->SCP, SCP<->GDF, GDF<->HL7 converters
  make test6		# tests bidirectional conversion between 6 differerent data formats	

# MinGW Crosscompiler on Linux for Windows  
- install mingw32 mingw32-binutils mingw32-runtime
- run the command  
   make win32/save2gdf.exe      # converter between data format s
   make win32/libbiosig.dll     # dynamic library 
   make win32/libbiosig.lib     # static library    
   make mexw32			# Win32/Matlab mex interface 
   make win32mma		# Win32/Mathematica interface
   make win32                   # all of the above

# Windows + MinGW
Support for FEF, ZLIB, CHOLMOD is turned off, because of lack of support in MinGW. 
In general, Makefile.win32 should be used. 
- Run the make command 
   make -f Makefile.win32 libbiosig.a
   make -f Makefile.win32 save2gdf.exe
   make -f Makefile.win32 sigviewer
   make -C mma -f Makefile.win32 sload.exe	# mathematica interface

You can also start compilation of sigviewer. 
   First, you need to have the sigviewer sources in ..\sigviewer and 
   Then, you need to run once qmake in ..\sigviewer\src\ 
   make -f Makefile.win32 sigviewer 

# Matlab/Win32 using MinGW on Windows
do the steps in "Windows+MinGW"
install and configure gnumex (from http://gnumex.sf.net)  
  make libbiosig.a
  start matlab
  >> gnumex 	% configure mingw for mex
  >> mex mexSLOAD.cpp libbiosig \mingw\lib\libws2_32.a
	
# Mathematica/Win32 using MinGW on Windows
Adapt user-specified variables (directory names) in Makefile.win32 and mma/Makefile.win32	
  cd biosig4c++/mma
  make -f Makefile.win32 sload.exe
	
# Windows + Cygwin
Currently, only the file converter save2gdf is supported.
- install Cygwin
- within Cygwin install gcc4 g++4, zlib, suitesparse/cholmod and make 
- run the make command 
   make save2gdf 

# MSVC - Microsoft Visual C++
  MSVC is currently not supported. The main incompatibility is 
  the use of the typeof() operator. Since typeof() is very convinient, 
  I'm not planning to change this. However, you can easy replace 
  any typeof()-operator by the appropriate type, and the code 
  should compile on MSVC as well. 

# Other platforms (Windows+MSVC, MacOSX, Solaris, etc. )
Not tested (yet). Let me know about successful compilations, 
or tell me what changes are needed.   

	
Installation: 
-------------
run as root 
  make 
  make install 		# installs save2gdf, save2scp, save2aecg, 
  make install_octave	# installs mexSLOAD.mex in /usr/local/share/octave/site-m/
  make install_sigviewer	# installs sigviewer
 

Execution:
----------
# if test.gdf exists, some header information is displayed
save2gdf test.gdf     		

# help and usage information 
save2gdf -h

# converts a data file into a GDF format (destination
save2gdf PFE103.scp t5.gdf     		

# converts a data file into a SCP format (destination
save2scp t5.gdf t5.scp      		
save2gdf -f=SCP t5.gdf t5.scp      		

# converts a data file into a HL7aECG format (destination
save2aecg t5.gdf t5.hl7      		
save2gdf -f=HL7aECG t5.gdf t5.hl7

# load matlab into octave or matlab
start octave or matlab
addpath path_to_mexSLOAD.mex
[data,HDR] = mexSLOAD(filename); % loads data and header information 


Development & Testing:
----------------------
There are several testing functions included. 
The following commands test the converter and should finish without errors.  
	make test 
	make testhl7
	make testscp
	make test6

The Octave/Matlab script 
	test0/test01.m 
tests whether the various data formats give the same results 
or whether some conversion error has been included.  



    $Id: README,v 1.26 2009/02/27 09:18:33 schloegl Exp $
    Copyright (C) 2005,2006,2007,2008,2009,2011 Alois Schloegl <a.schloegl@ieee.org>
    This function is part of the "BioSig for C/C++" repository 
    (BioSig4C++) at http://biosig.sf.net/ 

