[Eeglablist] importing edf, bdf - memory and speed issues

Robert Oostenveld r.oostenveld at fcdonders.ru.nl
Wed Feb 1 00:58:41 PST 2006


Dear EEGLAB users and colleagues,

For our F.C. Donders FieldTrip toolbox I wrote a mex file for reading  
in Biosemi BDF data (together with Peter Desain of the NICI in  
Nijmegen). The BDF format is very similar to EDF: it has the same  
header, only the data itself is stored in 24 bits (3 bytes) instead  
of 16 bits (2 bytes). Reading in 24 bit per value is possible in  
matlab, but converting the 24 bits into a floating point value number  
makes it very slow. In plain C, this conversion can be done very  
fast. Therefore I thought that the slowness that I observed for  
reading the BDF file was due to the bit-conversion. However, now I  
also noticed recently that other people have problems with the EDF  
format (slow and especially consuming larger amounts of memory than  
expected).

So perhaps it is an idea to adapt the mex file to suit 16 bit EDF  
data. I already have made a quick attempt, but I would appreciate it  
if one of you could pursue this. Attached you can find 6 files:
  * read_edf.m and read_bdf.m, which read in the header and data from  
an EDF/BDF file respectively
  * read_16bit.m and read_24bit.m, which contain the help for the low- 
level mex files
  * read_16bit.c and read_24bit.c, which are the actual low-level mex  
files

Note: I have not tested the 16 bit code and I am not even 100% sure  
whether the 24 bit code works completely correct on any platform  
(Peter Desain told me that it worked for him). I am at least aware  
that the calibration (converting the bit values to physical "uV"  
values) is not yet implemented. I would appreciate it if you could  
compare either the BDF or EDF implementation (depending on your  
dataformat) to the traditional pure-matlab implementations included  
in EEGLAB. Please report back on whether they work (or do not work).  
If they require changes in order for them to work correctly, please  
tell me where in the code and why the changes are needed. I will then  
incorporate your suggestions in my "official" version, which will  
benefit all users.

The main matlab functions will not work directly with EEGLAB, since  
they are designed for Fieldtrip and have a sligtly different API. But  
that should not be a major issue, it is straightforward to convert  
them to EEGLAB-like functions. Testing the functionality should be  
done on the Matlab command line without the EEGLAB gui anyway. The  
mex files require compilation before they work: on the matlab command  
line you should enter "mex read_16bit.c" and/or "mex read_24bit.c"

I am looking forward to your reactions,
Robert

PS I have already discussed with Scott, Arno and colleagues that we  
want to share more file-input routines between EEGLAB and FieldTrip  
(and BIOSIG). We still have to work out the details for organising  
this, but in the future efforts like these will be more smoothly  
integrated in our respective open source projects.

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Robert Oostenveld, PhD
F.C. Donders Centre for Cognitive Neuroimaging
Radboud University Nijmegen
phone: +31-24-3619695
http://www.ru.nl/fcdonders/
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-------------- next part --------------
A non-text attachment was scrubbed...
Name: read_biosemi_bdf.m
Type: application/octet-stream
Size: 9075 bytes
Desc: not available
URL: <http://sccn.ucsd.edu/pipermail/eeglablist/attachments/20060201/378d982a/attachment.obj>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: read_24bit.m
Type: application/octet-stream
Size: 1409 bytes
Desc: not available
URL: <http://sccn.ucsd.edu/pipermail/eeglablist/attachments/20060201/378d982a/attachment-0001.obj>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: read_edf.m
Type: application/octet-stream
Size: 9038 bytes
Desc: not available
URL: <http://sccn.ucsd.edu/pipermail/eeglablist/attachments/20060201/378d982a/attachment-0002.obj>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: read_24bit.c
Type: application/octet-stream
Size: 2801 bytes
Desc: not available
URL: <http://sccn.ucsd.edu/pipermail/eeglablist/attachments/20060201/378d982a/attachment-0003.obj>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: read_16bit.m
Type: application/octet-stream
Size: 1393 bytes
Desc: not available
URL: <http://sccn.ucsd.edu/pipermail/eeglablist/attachments/20060201/378d982a/attachment-0004.obj>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: read_16bit.c
Type: application/octet-stream
Size: 2775 bytes
Desc: not available
URL: <http://sccn.ucsd.edu/pipermail/eeglablist/attachments/20060201/378d982a/attachment-0005.obj>
-------------- next part --------------





More information about the eeglablist mailing list