Getting started with BrainVision file format
Introduction
Brain Products provides technical and software solutions for neurophysiological and psychophysiological research and clinical applications. Their BrainAmp ExG amplifier allows to record signals with a sampling rate up to 5000 Hz and a broad hardware bandwidth ranging from DC to 1000 Hz. Brain Products also provides EEG caps, i.e. 'Easycaps', which contain the electrodes distributed over the head. These Easycaps are actually fabricated by http://www.easycap.de, where you can also find more information. Although it is possible to use a BrainAmp amplifier with another type of cap, or to use an Easycap with an different amplifier, the most common case is to use them together and that is why we describe them jointly on this page.
Further information on the BrainVision file format
The BrainVision file format consists of three separate files:
- A text header file (`.vhdr`) containing meta data
- A text marker file (`.vmrk`) containing information about events in the data
- A binary data file (`.eeg`) containing the voltage values of the EEG
Both text files are based on the Microsoft Windows INI format consisting of:
- sections marked as `[square brackets]`
- comments marked as `; comment`
- key-value pairs marked as `key=value`
For example, see this excerpt from a BrainVision header file (.vhdr):
Brain Vision Data Exchange Header File Version 1.0 ; Data synthesized by MNE-BIDS [Common Infos] DataFile=test.eeg MarkerFile=test.vmrk
In this short example we can observe a challenge that is caused by having three separate files for each dataset: It means that the single files have internal pointers to each other's locations (see the DataFile and MarkerFile keys in the example).
Preprocessing of raw eeg data
FieldTrip needs the user to define what file to read in. The BrainVision Recorder software usually stores different filetypes (.vhdr, .eeg, .vmrk). For reading the data into FieldTrip you can refer to the .eeg file, for example:
cfg = []; cfg.dataset = '/users/karlheinz/EEG/myrecording.eeg'; ...
The .eeg files are the raw data files, i.e. they contain the data as it has been stored upon acquisition.
You can subsequently epoch your data using ft_definetrial, and you can read in the data and preprocess it using ft_preprocessing. Note that in FieldTrip, no unit conversion takes place.
Sometimes users have already done some processing (e.g., rereferencing, epoching, artifact identification) in BrainVision Analyzer (BVA), and in order to avoid repeating the time consuming / subjective selection steps it might be preferable to start from the processed data. BrainVision Analyzer stores the processing steps in a so called history file, keeping the raw data unchanged, and applying the processing steps on-the-fly. This is not something that FieldTrip can work with, so you need to export your data first.
Exporting raw eeg data, applying BVA processing steps
The following describes the recipe to export the processed data into a format the FieldTrip can deal with. It produces a triplet of files (.vhdr, .vmrk and .seg (instead of .eeg)), that can be imported into FieldTrip, in much the same way as described above. You can do all the preprocessing you want to do in BrainVision Analyzer (e.g. iltering and re-referencing can be done too) and once you have the data segmented the way you want it select 'export > generic data'. You'll get a window (maybe 2 consecutive windows) popping up asking for various settings. Leave everything as it is, except make sure the following are set:
- For the filename output you should set it to be .seg instead of .eeg (which I think is the default).
- DataFormat should be 'BINARY'
- DataOrientation should be 'MULTIPLEXED'
- Encoding should be 'UTF-8'
- DataType should be 'TIMEDOMAIN'
- BinaryFormat should be 'IEEE_FLOAT_32'
Plotting
FieldTrip provides digital layouts for the purpose of plotting data recorded by means of an easycap. These layouts are stored in *.mat files and are based on the manufacturer's original drawings, which can also be found as *.gif files in the /template/layout directory.
Using FieldTrip, data recorded with Brain Vision hard- and software is readily plotted. It is important that the channel labels match that of the manufacturer specifications. Specify the layout that matches your set-up/easycap when plotting, e.g.
cfg.layout = 'easycapM1.lay';
Examples regarding the type of plots can be observed here. In the template directory you can find a collection of template layouts for plotting. If you want to create your own custom layout files, please have a look here.