reading bdf+ files?

Thomas Hartmann thomas.hartmann at UNI-KONSTANZ.DE
Thu Mar 11 00:38:05 CET 2010

hi robert,
thanks again for the detailed answere. i have indeed already thought
about the brainvision format. what makes me favor bdf is the fact that
it only works with one file. renaming a brainvision-file is a problem as
filenames are used to identify trigger and data files.

as i got to know the bdf format quite well in the last days, i would
prefere that one if its well supported in fieldtrip. i would propably
have to write my own lib for that, but the format seems pretty straight

can you give me a hint of how triggers are stored in the "original"
biosemi bdf format? from what i understood, they use an extra channel
with the same samplingrate as the others, writing the trigger values as
24bit values, thus constisting of 3 bytes each. each of the byte seems
to have a different meaning. do you know something about that?

best regards,

Am 10.03.2010 21:57, schrieb Robert Oostenveld:
> Hi Thomas,
> 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 you can find some example data which is used in 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 to see whether that provides a C++ solution.
> best regards,
> Robert
> ----------------------------------
> 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 and

Dipl. Psych. Thomas Hartmann

University of Konstanz
Department of Psychology
P.O. Box D25
78457 Konstanz

Tel.: +49 (0)7531 88 4612
Fax: +49 (0)7531-88 4601
Email: thomas.hartmann at

"I am a brain, Watson. The rest of me is a mere appendix. " (Arthur Conan Doyle)

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 and

More information about the fieldtrip mailing list