BEst toolbox in brainstorm compiled version

Hello, I've been working with braisntorm a year ago and in several cases came to the point where the use of the MEM inverse solution in the source analysis would be very, very useful and helpful but is not available in the brainstorm compiled version,
Since I have not a MATLAB licence it's dificult to reach to the point where the accuray of the spatial extent of the EEG generators can be used,
Hope the BEst toolbox could be included in the next brainstorm compiled version,
If there's anything I can do to help tel me please, I'll be glad to,
I already said this in another place but this is a propper one to so: Ā”Congratulations! to Tadel F, Baillet S, Mosher JC, Pantazis D, Leahy RM and all the team for this great, great software. I really love brainstorm and use it daily in my research work,


We are currently working on a new plugin manager, to handle the third-party contributions in a more standardized way. Once defined as a plugin, an external toolbox such as the BEst toolbox could be loaded and compiled together with Brainstorm.

@youneszer @klack @RChowdhury @tanguy @Lina @cgrova @aliobaibk @edelaire
If you re-write your BEst toolbox as a Brainstorm plugin, I might be able to compile it and distribute it as part of the standalone Brainstorm package.
This would imply mainly to write an entry for it in the bst_plugin.m function:

This is still under active development, but I will post again a message on this thread when it ready for the BEst developers to switch to the new implementation.

Hello Francois thank you, after rewriteing it, whatĀ“s next? IĀ“ll try with a copy of the rewrote plugin in my brainstorm3\external\brainstropy and see how it works?
IĀ“ll try to do it and let you know how it works,

No, there is not nothing that you can try at the moment...

I'm not done yet with the new plugin manager anyway, I'll post a message when this is online.
Then, hopefully the MEM developers will reply and get in touch with us to update their distribution stream.

OK I'll be pending, Thanks,

The Brainstorm plugin manage is ready to integrate BrainEntropy toolbox:

But now we need to wait for news from the developers of the toolbox...


Hello @Palaccivatbfc,

Apologies for this late reply, BEst will soon be available as a Brainstorm plugin.

Alternatively, there exists a compiled version of BEst provided here within a Docker container (MATLAB Runtime included) which is currently used in cluster computing environments.
Its inputs are assumed to be Brainstorm files, and its outputs can be imported back to Brainstorm, if interested I could provide you more details.

Thank you very much,


Thank you, yes I'm interest in more details about it,

Hello Jorge,

Apologies for the delay, but here are some instructions to use BEst-docker or BEst-singularity.
You will be using command lines to invoke BEst, and I am assuming that you have some familiarity with either Docker or Singularity.

I would suggest Singularity (version 3+) with what follows.

  1. Download the BEst singularity image:

mkdir best-singularity && cd best-singularity
singularity build ./best-latest.sif docker://multifunkim/best:latest

The above two commands make the directory best-singularity and save the image file best-latest.sif in it.

  1. Test BEst:

singularity exec ./best-latest.sif /bin/bash -c 'best inputData "$BEST_DATA_DIR/test-data.mat" outputDirName best-outputs memMethod cMEM sensorsTypes EEG+MEG reconstructionWindow "0.7 0.71" baselineWindow "0 0.5"'

The above command shows the minimum command line (i.e., with only required arguments) to run cMEM on a recording called test-data.mat.
The test data file test-data.mat is available within the image best-latest.sif, in a directory called $BEST_DATA_DIR.
During the execution, you will be able to see on your terminal what you usually see with MATLAB when running BEst from Brainstorm. Please see this best-sample-output.txt (4.3 KB) for reference.
If the command runs without error, you will also have an output .mat file in a directory named best-outputs relative to your current working directory.

  1. Run BEst on your data

If the above test was successful, you are ready to run BEst on your data.
Please see the attached files cmem-help.txt (13.9 KB), and wmem-help.txt (15.6 KB) which are the generated pretty help texts for calling BEst (all available arguments parallel the Brainstorm GUI panel that you are familiar with).

The following are some examples of commands:

best inputData "meg-data-collection01.tar.gz" outputDirName "crv97" memMethod cMEM sensorsTypes MEG reconstructionWindow "-0.5 0.3" baselineWindow "-2 -1" baseline "emptyroom-crv.mat" useParallel true maxWorkers 10

best inputData "eeg-data01.mat" outputDirName "wrv97" memMethod wMEM sensorsTypes EEG reconstructionWindow "0 10" baselineWindow "-2 0" frequencies 8-13 useParallel true maxWorkers 10

For the first command, the files within the input .tar.gz will be processed at once, a baseline file is supplied for the noise covariance estimation and a MATLAB parallel pool with 10 workers is requested.
For the second command, wMEM is used to localize an alpha frequency band EEG oscillatory pattern.

To be able to test on your files, the following three steps, as illustrated in the attached document BEst-cmdline, how to.pdf (185.2 KB) are needed.

  • Export your data from Brainstorm, you may export the data as a compressed file if you want all files to be processed at once as illustrated above.
  • Run BEst.
  • Import outputs back in Brainstorm for further analyses.


  • BEst is available in CBRAIN. If you are interested to use BEst in CBRAIN, you would only need to export and import data as described above, CBRAIN would provide you with a web-based GUI similar to Brainstorm for running BEst (so no command lines) and many other features.
  • Make sure to check the default parameters of the arguments not specified by command line. They may differ from Brainstorm. The list of all options is always displayed in the terminal at the beginning of the execution as shown in the sample output.

Hello, please don't apologize I undertand, thank you very much for all. Let me tell you that I ran the porcess in Windows 10 and it worked pretty well. I just tried it in the Mac and I had the same issues. I'll follow all the steps you sent me and let you know what happened,
Best regards,

Hello BEst toolbox is working fine I just did this in Mac, 84 secs in processing,Capto_Capture 2021-05-01_12-45-12_p.m.

1 Like

Hello Jorge,

This is great, and thanks for the update.

FYI, related to your other posts and since I see that you are using Brainstorm v. 31-Mar-2021.
The latest versions of Brainstorm offer BEst through the plugins manager and embed BEst in its compiled version.

Thanks for the update, have a good week,

Thanks for the feedback.

However, I would be suspicious of the screen capture you posted.
This isolated electrodes with these very high values, completely disconnected with its neighbors, really looks like a bad channel.

Yo mean the big despolarization? Yes it is a despolarization, and it is a bad channel. I did it on purpuse because I was looking to isolate the analysis with something pretty obvious. As you can see the system identified the changes far away from the average of the rest of the channels. Now that I'm confident in my system I'll work with all my recordings that are reliable,