save2gdf je utilita z biosig4c++, je součástí projektu BioSig

Konverzní utilita save2gdf umožní konvertovat data do formátů:

  • ASCII
  • BIN – data každého kanálu v samostatném souboru
  • BDF
  • CWFB
  • EDF
  • GDF (v1 and v2)
  • HL7aECG
  • SCP-ECG (EN1064)

Vstupní formáty: viz http://hci.tugraz.at/schloegl/biosig/TESTED:

  • ACQ
  • BDF (?)
  • BKR
  • CFWB
  • CNT(Neuroscan)
  • EDF
  • EGI/RAW
  • GDF v1
  • GDF v2
  • HL7aECG
  • MFER
  • SCP-ECG

Kompilace

editovat

Potřebujeme g++

  make
  make mex
    make: *** No rule to make target `mexBiosig.c', needed by `mex'.  Stop.
$ make save2gdf
Makefile:191: warning: overriding commands for target `sopen_fef_read.o'
Makefile:181: warning: ignoring old commands for target `sopen_fef_read.o'
gcc-4.1 -pipe -fPIC -Wall -O2 -Wextra -D=WITH_ZLIB -D=__4HAERTEL__ -D=WITH_FAMOS -D=WITH_CHOLMOD     -c -o save2gdf.o save2gdf.c
make: gcc-4.1: Command not found
make: *** [save2gdf.o] Error 127

Přepíšeme na gcc-4.4

$ make save2gdf
Makefile:191: warning: overriding commands for target `sopen_fef_read.o'
Makefile:181: warning: ignoring old commands for target `sopen_fef_read.o'
gcc-4.4 -pipe -fPIC -Wall -O2 -Wextra -D=WITH_ZLIB -D=__4HAERTEL__ -D=WITH_FAMOS -D=WITH_CHOLMOD     -c -o save2gdf.o save2gdf.c
In file included from biosig-dev.h:37,
                 from save2gdf.c:30:
biosig.h:84:37: error: suitesparse/cholmod.h: No such file or directory
make: *** [save2gdf.o] Error 1

README:

(1) "libbiosig.a" provides a library for accessing different dataformats.
Recommended:
       cholmod
       zlib (http://zlib.net/)
       GNU Scientific Library (GSL)
...
Compilation:
-------------
# Linux
You need g++(>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).

Aha, namám nainstalovaný balík libsuitesparse-dev pro práci s řídkými maticemi. Tak v Makefile zakomentuji

DEFINES       = -D=WITH_ZLIB -D=__4HAERTEL__ -D=WITH_FAMOS # -D=WITH_CHOLMOD #-D=WITH_FEF -D=WITH_DICOM #-D=WITH_GDCM #-D=WI

Běhají mraky warningů a nakonec:

g++-4.4 -pipe -fPIC -Wall -O2 -Wextra -D=WITH_ZLIB -D=__4HAERTEL__ -D=WITH_FAMOS   save2gdf.o -L /usr/local/lib/ libbiosig.a -lz -lcholmod  -o save2gdf 
/usr/bin/ld: Warning: size of symbol `GDFTYP_BITS' changed from 2 in save2gdf.o to 1184 in libbiosig.a(biosig.o)
/usr/bin/ld: Warning: size of symbol `LEAD_ID_TABLE' changed from 4 in save2gdf.o to 744 in libbiosig.a(biosig.o)
/usr/bin/ld: cannot find -lcholmod
collect2: ld returned 1 exit status
make: *** [save2gdf] Error 1

Tak ještě zakomentuju:

LIBS          = libbiosig.a -lz # -lcholmod # t240/libfef.a #-lgdcmDSED -lgsl -lgslcblas -lm    # static

Sláva, přeloženo!

Teď ještě zjistit, jak to funguje:

save2gdf -v
save2gdf (BioSig4C++) v0.80

Bylo to zkompilované z balíku biosig4c++-0.90.zip

testovací soubor

editovat

Použiji testovací soubor save2gdf, GDF v. 1.99

vlastní test

editovat
save2gdf -VERBOSE=2 -f=HL7aECG gdf2test.gdf gdf2test.HL7
save2gdf -VERBOSE=2 -f=CFWB gdf2test.gdf gdf2test.CFWB
save2gdf -VERBOSE=2 -f=GDF gdf2test.gdf gdf2test.GDF
save2gdf -VERBOSE=2 -f=EDF gdf2test.gdf gdf2test.EDF
save2gdf -VERBOSE=2 -f=BDF gdf2test.gdf gdf2test.BDF
save2gdf -VERBOSE=2 -f=SCP_ECG gdf2test.gdf gdf2test.SCP_ECG
save2gdf -VERBOSE=2 -f=CFWB gdf2test.gdf gdf2test.CFWB

Poznámky:

Zkonvertuje do verse GDF 2.20

Při -VERBOSE=2 vypíše:

[FIXED HEADER]
Recording:
        ID              : recording identification                                        
        Institution     : 
        Technician      :       # default: localuser
        Equipment       : b4om1.92
        IPv4 address    : 0.0.0.0        # default:local host
Manufacturer:
        Name            :  
        Model           :  
        Version         :  
        SerialNumber    :  
Patient:
        ID              : X
        Name            : X
        Gender          : female
        Eye Impairment  : unknown
        Heart Impairment: unknown
        Age             : 55.3 years
        Birthday        : (712721.000000) Sun May 13 00:00:01 1951
        StartOfRecording: (732924.589128) Sun Sep  4 14:08:21 2006

bpb=568
row-based=0
uncalib  =0
OFdetect =1
FileName:       gdf2test.gdf
Type    :       GDF
Version :       1.99
HeadLen :       1792
NoChannels:     6
SPR:            200
NRec:           50
Fs:             1000.000000
Events/Annotations:     100
Events/SampleRate:      1000.000000

Při -VERBOSE=3 navíc:

[CHANNEL HEADER] 0x9a34ca8
#No  LeadId   Label      Fs[Hz]      SPR GDFTYP  Cal         Off     PhysDim    PhysMax          PhysMin    DigMax      DigMin  HighPass LowPass Notch       X          Y          Z
# 1:   0    0 chan 1   1000.000000   200 int16  1.000000e+00 0.000000e+00 uV    100.000000      0.000000   100.000000   0.000000  nan     nan   0.000000   0.000000   0.000000   0.000000
# 2:   0 3200 chan 2    100.000000    20 int16  1.000000e+00 0.000000e+00 mV    100.000000      0.000000   100.000000   0.000000  nan     nan   0.000000   0.000000   0.000000   0.000000
# 3:   0 3520 chan 3    200.000000    40 int16  1.000000e+00 0.000000e+00 %     100.000000      0.000000   100.000000   0.000000  nan     nan   0.000000   0.000000   0.000000   0.000000
# 4:   0 4160 chan 4    100.000000    20 int16  1.000000e+00 0.000000e+00 -     100.000000      0.000000   100.000000   0.000000  nan     nan   0.000000   0.000000   0.000000   0.000000
# 5:   0 4480 chan 5     20.000000     4 int16  1.000000e+00 0.000000e+00 -     100.000000      0.000000   100.000000   0.000000  nan     nan   0.000000   0.000000   0.000000   0.000000
# 6:   0 4544 NEQS        0.000000     0 int16  1.000000e-01 0.000000e+00 <B0>C 100.000000      0.000000  1000.000000   0.000000  nan     nan   0.000000   0.000000   0.000000   0.000000

Vytvoří soubory:

  7221 2010-02-19 16:02 gdf2test.ASCII
 99000 2010-02-19 16:02 gdf2test.s01
 10000 2010-02-19 16:02 gdf2test.s02
 20000 2010-02-19 16:02 gdf2test.s03
 10000 2010-02-19 16:02 gdf2test.s04
  2000 2010-02-19 16:02 gdf2test.s05
     0 2010-02-19 16:02 gdf2test.s06

a chcipne s chláškou:

table of event codes not found
Debugging Information: (Format=109) FILE.POS=50 is not zero.
Floating point exception

Zkusil jsem starší verzi 0.70 a s ní je to ještě horší.

Vytvoří soubory

  7222 2010-02-19 16:04 gdf2test.BIN
 20000 2010-02-19 16:04 gdf2test.s01
  2000 2010-02-19 16:04 gdf2test.s02
  4000 2010-02-19 16:04 gdf2test.s03
  2000 2010-02-19 16:04 gdf2test.s04
   400 2010-02-19 16:04 gdf2test.s05
     0 2010-02-19 16:04 gdf2test.s06

a chyba jako v předchozím případě.