Import only the TF map

Hello, community,

I have a question about importing files.
I use my routines to transform my data into frequency time, so I end up with files containing my data.
I would like to use Brainstorm to visualize and make statistics on these time and frequency data.
Since I don't have the previous data and the corresponding epochs, the database tree structure is abnormal.
Can you tell me if it is possible to just import the TF data in order to be able to visualize it?

Thank you,

With kind regards

Hello

There is no menu to import directly time-frequency maps into Brainstorm. You would need to modify your scripts so that they generates files structures that are directly compatible with the Brainstorm database (I assumed your own scripts are in Matlab, is this correct?).
https://neuroimage.usc.edu/brainstorm/Tutorials/TimeFrequency#On_the_hard_drive

To get an example of a structure that matches your recordings, the easier would be for you to import a piece of original recordings into the Brainstorm database, compute the time-frequency decomposition in Brainstorm, and then look at the file that was produced, try to produce a similar structure. (just remove the links to other files, eg. file.DataFile = [])

To add the output file to the database, you have many solutions. The simplest (but not the most efficient) are the following:

  1. use the GUI: right-click on a folder > File > Import from Matlab
  2. create the file directly where you want to have in the database (reuse the file name of the example computed earlier, just replace the date tag with whatever you want - prefer only numbers to make sure it won't conflict with other file tags used by Brainstorm)

If you create the file yourself in the brainstorm database, you have to reload the database so that Brainstorm becomes aware of these new files:

  1. right-click on the folder (or the subject, or the protocol) > Reload
  2. or use one of the functions db_reload_* in brainstorm3/toolbox/db (read the header of the functions for help)
    Additional help with more refined scripting in Brainstorm: https://neuroimage.usc.edu/brainstorm/Tutorials/Scripting

In the folders where you end up storing your new timefreq_...mat files, make sure you include a channel.mat, this will help for display and computation of statistics. The one you got from linking your original recordings to the Brainstorm database (it might need some manual editing if you do not have the same list or order of channels in your final TF file).
Other than that, I think you don't need anthing else in the database (but I might be missing out something).

Let me know if you need additional help with this

Dear Francois,

Thank you for your help,

I just tried what you told me, I can import the file correctly and display it in the interface. I can visualize the time frequency maps for each electrode.
On the other hand I can't display the topography of my timefre_.mat, but I added a channel.mat file that includes the electrode positions.
Any idea where it might come from?

The names of the channels must match exactly in the two files: channel.mat and timefreq.mat. You maybe need to edit one or the other.

Do you get any error message, or is it that you don't see the menus?

If you don't have the topography menus displayed when right-clicking on the TF file, it is because there is something wrong with the timefreq file, either in the file name or in one of the fields in the file. Try generating a valid file either with your own data or from the tutorial dataset, and compare it with the ones you created to understand what could be the issue.
image

Dear Francois,

Thank you it perfectly working

Kind regards

Dear Francois,

I have another question, I tried to do statistics on time frequency data and it works well.
For example, I want to use ft_freqanalysis, in the fieldtrip function it is possible to specify a ROI, and frequency of interest (for example only the beta band).
In the brainstorm version I can't choose this, I suspect that there is a possibility by going through extract value?
For example, if I want to do statistics on two electrodes for a single frequency band. I can't extract for all subjects the two interest electrodes with the beta band, is this extract value good that you have to use?

Thank you. Thank you.

Translated with www.DeepL.com/Translator

Indeed, not all the flexibility allowed by the Brainstorm processes (eg. "Test > Permutation test: Independent") was implemented in the process "Test > FieldTrip: ft_freqstat".

Calling the process "Extract > Extract values" should be a good option for doing this channel+frequency selection before calling the FieldTrip function.
To make it easier to select files in your database after, you could add a tag (process "File > Add tag") immediately after the call to "Extract values". This way you could filter the files in your database with the Filter box (bottom-right corner of the Brainstorm window) or the processes "File > Select *".