Creating custom raw file import

Hi,
I have datasets recorded in a binary file format which is not included in the BrainStorm’s list of supported file formats.
The publisher of the software that created the file has kindly provided me with a means to read this file into matlab
but I want to read the file as a raw file directly from BrainStorm.
What can I do to include this file format as another BrainStorm supported formats?

Nir

Hi Nir,

If you have Matlab code to read your file format, it is not too complicated. You need to write two functions:

  1. in_fopen_yourformat.m: Reads the file header, returns a structure sFile, as described here:
    http://neuroimage.usc.edu/brainstorm/Tutorials/EventMarkers#On_the_hard_drive
  2. in_fread_yourformat.m: Reads a block a recordings in the file

If you can provide me with these two functions, I would finish the work and add references to these new functions in in_fopen.m, in_fread.m and bst_get.m.
Note that the code used to read the files must be open: please check with the manufacturer that we will be able to redistribute the code as part of Brainstorm (we would include the code in the folder brainstorm3/external).
Is this for a specific EEG acquisition system?

Cheers,
Francois

Hi Francois
Thank you for the reoly
I will check with the manufacturer if the code he provided me with can be distributed.
The recordings are captured by DeyMed acquisition system (http://www.deymed.com/)
We have another acquisition system for which we created our own code to convert the native files to matlab.
given that this is an in-house code can it be integrated to BrainStorm as well?
the manufacturer of this system do not support matlab import.

Nir

If you can read the file in Matlab and the file format is not “too proprietary”, there is a way to read it in Matlab.
Send me one pair of in_fopen_xxx/in_fread_xxx functions for each format you want to include.

Ok thanx
I will send those files to you.

Ok
The manufacturer of one aquisition system has asked me directly not to publish the matlab code he provided me with.
The other file types I can read from python and matlab by means of file structure hacking. Therefore I presume it is not a good candidate for shering either.

Thenak you for your suggestions
Nir

For the file formats you cannot share: you can write a matlab script to re-write the files in a format that brainstorm can read (text-based, very simple binary like the EGI .raw file format). You can also directly write Brainstorm structures, as documented here (data file + channel file):
http://neuroimage.usc.edu/brainstorm/Tutorials/Epoching#On_the_hard_drive
http://neuroimage.usc.edu/brainstorm/Tutorials/ChannelFile#On_the_hard_drive

For the format you can share: it could still be interesting to format the code in Brainstorm format (in_fopen/in_fread functions) for an easier access for you, and for other users who share the same acquisition device.

Francois