reading bdf+ files?
r.oostenveld at FCDONDERS.RU.NL
Wed Mar 10 21:57:25 CET 2010
On 8 Mar 2010, at 10:30, Thomas Hartmann wrote:
> thanks for the quick answere.
> yes, bdf+ is bdf with an annotation-channel added. this channel is unlike the bdf trigger channel. so this, as i had already expected, explains the problem.
> my major motivation for using bdf+ is the availability of a ready-to-use c++ library. unfortunatly it only writes bdf+ or edf+, not the "standard" format.
> does someone know of a stable, well-documented, free library (c or c++) to write eeg-data in a format, fieldtrip can read?
I would probably write it in a brainvision analyzer alike format. Although I am not aware of formal/official documentation, the file format is very simple (and widely supported). It consists of an ascii header file (*.vhdr), an ascii marker file (*.vmrk) and a binary file with the data. Although the data file is normally binary, it can also be ascii (but that makes reading it very inefficient).
The ascii header file (ini-like) explains the format of the binary file, which can have different data formats (int16,32 and probably floats) and be multiplexed or not.
On ftp://ftp.fcdonders.nl/pub/fieldtrip/tutorial/subj2.zip you can find some example data which is used in http://fieldtrip.fcdonders.nl/tutorial/continuous. I don't know the details of that particular dataset, but probably it is pretty standard. I guess it has 64 channels 32 bit continuous recording with 5 to 10 different trigger values in it. Combined with fieldtrip/fileio/private/read_brainvision_vhdr, read_brainvision_eeg and read_brainvision_vmrk you can probably easily figure out what the file format is. Writing the two text files and a binary multiplexed file could easily be done without a C++ library. I just realised that in fieldtrip you can also export to that file format using the write_data function. Have a look in fieldtrip/fileio/private/write_brainvision_eeg for the details of the simplest format.
Hmm, a more challenging problem from the C++ perspective then is to implement the accompanying *reader* for it. In Matlab that is simple, but parsing the text files in C++ and going over all possible options and sub-formats would be non-trivial in C++. You might want to have a look at http://biosig.sourceforge.net/projects.html to see whether that provides a C++ solution.
The aim of this list is to facilitate the discussion between users of the FieldTrip toolbox, to share experiences and to discuss new ideas for MEG and EEG analysis. See also http://listserv.surfnet.nl/archives/fieldtrip.html and http://www.ru.nl/neuroimaging/fieldtrip.
More information about the fieldtrip