Importing BESA .foc files into Brainstorm for Source Analysis

Dear Brainstorm Team,

We would like to use Brainstorm to do regional source modelling on our EEG data, but are having trouble importing our preprocessed artifact corrected FOC files (binary format) from BESA into Brainstorm.

We have converted these FOC files into MATLAB matrices, but the event/trigger information is not carried through to Brainstorm.

We were wondering if you knew of a good way to import the event/trigger info. Please let us know.

Thank you very much,
Manda

Unfortunately, the .foc file format does not seem to be publicly documented, we won't be able to add a direct support for it in Brainstorm.

Can you export the .foc files to something else, like BDF or EDF+?
And export separately the events with the BESA .evt file format?
All this could be read easily from Brainstorm.

I don't think going through a .mat file is a good solution, unless you want to do all the conversions of structures manually. You need to create two files for each file, a channel file and a data file: https://neuroimage.usc.edu/brainstorm/Tutorials/Scripting#File_structures

Dear Francois,

Thank you very much for your reply.

Unfortunately, there is no .bdf export in BESA. When exported as a .edf file and imported into Brainstorm as an "EEG:EDF / EDF+ (.rec;.edf)" file, the following warning message shows up:

"Interrupted EDF file ("EDF+D") detected. It is recommended to convert it to a continuous ("EDF+C") file first. Do you want to continue reading this file as continuous and attempt to fix the timing of event markers? NOTE: This may not work as intended, use at your own risk!"

The data was exported from BESA as continuous data. Therefore, can we ignore the warning message?

Alternatively, there is an option to export files in BESA as .mul files. Would importing as a "EEG: BESA exports (.avr;.mul;*.mux)" file be a better alternative? The .mul files seem to be imported to brainstorm well, but the event information is not carried through. Would there be a way to separately import the event information as .evt files from BESA to Brainstorm?

Please advise. Thank you very much.

Interrupted EDF file ("EDF+D") detected. It is recommended to convert it to a continuous ("EDF+C") file first.

This is only a flag defining the type of the file in the header. If your file is continuous, you should be able to load it correctly in Brainstorm. Ignore this warning and double-check the timing of the events carefully, as there might be some bugs in the EDF+D reader (used much less frequently).

Alternatively, there is an option to export files in BESA as .mul files. Would importing as a "EEG: BESA exports ( .avr; .mul;*.mux)" file be a better alternative?

If the files are not too big, you can indeed use a text-based file. This creates bigger files, which are slower to read, but if it works for you, this is a valid option.

Would there be a way to separately import the event information as .evt files from BESA to Brainstorm?

If you can export the events to .evt files from BESA, you can probably import then to Brainstorm. Import your BESA .mul file to the Brainstorm database, open it for display, and in the Record tab, use the menu File > Add events from file.

To convert a file back to a binary continuous file (in which you can scroll), right-click on it in the database explorer > Review as raw.

Dear Francois,
Thank you very much for all your help.

Both EDF+D and MUL files work. It sounds like EDF+D files are more desirable, as they are smaller and faster to read. Therefore, we will convert our files to this format for the regional source analysis.

Thank you again!