Convert BS to filedtrip

Hi everyone!

I would like to export some eeg procesed in BS, to fieldtrip in order to perform further analysis,
I know there are some scripts in order to make it, but I don't really get how to use it,
I would like to process, filter, clean and select epochs with BS, and then export that cleanned file to open it with fieldtrip,

A tutorial about converting BS to fieldtrip structures (step guided) could be great!!

Thanks in advance!

All the functions to convert from Brainstorm structures to FieldTrip structures are named out_fieldtrip_*.m.
Read the header of the functions for help.
If you are familiar with data structures and scripting in Brainstorm, it should be self-explanatory. If you are not, read this tutorial first (the section "File structures" lists links to the description of all the Brainstorm data structures):
https://neuroimage.usc.edu/brainstorm/Tutorials/Scripting

You can find examples of how to call these functions in the FieldTrip-based processes: process_ft_*.m

Thanks!
it seems easy, but it also seems like that will only work on continous or not database imported data, the data I would like to convert to Fieldtrip is epoched (once data is clean and I selected "import to database" option from the raw file).
Can it be done?
Thanks in advance!

ps: I saw there is also a script to convert BS matrix to Fieldtrip, will it work with a connectivity matrix, To analyse results from computing coherence with BS, in Fieldtrip?


ps: I saw there is also a script to convert BS matrix to Fieldtrip, will it work with a connectivity matrix, To analyse results from computing coherence with BS, in Fieldtrip?

No, it is not possible to convert automatically connectivity structures (yet).
Three options:

  • do your connectivity analysis and statics both in Brainstorm
  • do your connectivity analysis and statics both in FieldTrip
  • write a short conversion script to create a FieldTrip structure from the Brainstorm results. This is not complicated if you are already familiar with the two environments, and you already have some examples (all the out_fieldtrip_*.m functions)

I see!
Thank you

Hi Francois! I am trying to use this code to export a brainstorm preprocessed recording to Fieldtrip. However, I am getting the error messages attached in the screenshot.

The following is the code I used for specifying input files:

[ftData, DataMat, ChannelMat, iChannels] = out_fieldtrip_data ('A4/@rawA4_2_281214-1_tsss_mc_resample_notch_band/brainstormstudy.mat', 'A4/data/A4/@rawA4_2_281214-1_tsss_mc/channel_vectorview306_acc1.mat', 'MEG', 0 );

Can you indicate where I may be going wrong?

Thanks for your help as always! :slight_smile:

The first parameter of out_fieldtrip_data must be the file containing the recordings or a "Link to raw file", starting with the tag data_. Instead, you selected the file brainstormstudy.mat, which only contains a few metadata related with the folder.

Some examples here: Tutorials/Scripting - Brainstorm