BESA is a high-quality commercial software package for source analysis of EEG and to a lesser extent MEG data (see www.besa.de). The original DOS version of BESA implemented spatiotemporal dipole fitting with a spherical head model and since then it has been extended with various other algorithms. One of the strong points of BESA is that it allows for flexible constrains on the multiple dipoles from which the source model is built up. These constraints can be implemented in a graphical user interface, which also allows for quick visual feedback of the dipole fit results. By including prior anatomical or functional knowledge as constraints on the source model, it is possible to make robust estimations of relatively complex source configurations. Recent extensions of BESA include frequency analysis and some beamformer scanning.
Fieldtrip has very extensive support for advanced frequency and time-frequency analysis of EEG and MEG data. The main approach for source analysis that is currently implemented in FieldTrip uses various beamformer methods in the time, but especially in the frequency domain. In that respect, it differs a little bit from BESA. However, a large difference between BESA and Fieldtrip is that the latter also includes support for advanced statistical analysis of channel and source level data.
Since BESA is strong on the side of spatiotemporal dipole modeling and has a nice user interface, and Fieldtrip is strong on advanced frequency estimates and statistical analysis on the channel and source level, it is desirable to combine the functionality of the two. This tutorial describes how you can read in channel and source level data that has been analyzed in BESA, and how you can enhance your analysis of that data in Fieldtrip.
Perhaps Fieldtrip should turn off global editing in their wiki settings.
BESA has its own file formats for storing various aspects of the data. Most of the files contain the data in plain ascii format and it is relatively easy to read in their contents into Matlab or any other program. You can use a normal text editing program like Microsoft Wordpad to have a look at the content and format of the files.
Fieldtrip directly supports the following BESA file formats:
It is possible to use the low-level functions in Fieldtrip to read in the BESA data into Matlab, but it is preferred to use the high-level besa2fieldtrip function. That function will read the data and format it into a structure that is compatible with fieldtrip. Depending of the content of the file, the data will be formatted to appear similar to the output of one of the fieldtrip functions:
For example, you can read in event-related potential data using
timelock = besa2fieldtrip('filename.avr');
or a time-frequency estimate of power using
freq = besa2fieldtrip('filename.tfc');
For some of the file formats, there happen to be two low-level conversion functions importers. FieldTrip comes with the low-level functions of itself, but there is also a BESA toolbox written by Karsten Hochstatter. The preferred method for using BESA2FIELDTRIP is to download the BESA toolbox and to add it to your Matlab path. The conversion function will automatically detect and use it when available on your path.
BESA electrode files can also be read into Matlab, using the ft_read_sens function. They do not directly correspond to a core Fieldtrip data structure, but you can add the electrode information to any fieldtrip data structure according to this:
data = besa2fieldtrip(‘yourbesafile.avr’); data.elec = ft_read_sens(‘yourelectrodes.sfp’);
Because BESA *.dat files do not include mask information, the resulting data structure will not have the .inside and .outside fields assigned correctly, which will lead to errors in subsequent analyses in fieldtrip. Consequently these fields much be set for each subject. The following code is an example of how to develop a reasonable mask and apply it to all subjects (it masks out only those coordinates with a value of 0 for all subjects):
files=dir(['yoursubjectdirectory' filesep '*.dat']); inside=; for k=1:length(files) src(k)=besa2fieldtrip(files(k).name); in=find(src(k).avg.pow); inside(end+1:end+length(in))=in; end inside=unique(inside); outside=1:length(src(1).pos); outside(inside)=; for k=1:length(files) src(k).outside=outside; src(k).inside=inside; end