Custom current source map plot code

Hi Francois,

I have the solution for a source reconstruction algorithm that I wrote. This is a matrix containing the source time series for each one of the dipoles in the head model (created with brainstorm). I want to display the results on the MRI or cortex as is done in the Epilepsy tutorial with the sLORETA reconstruction. I have been doing some scripting taking that tutorial as example but I haven't been able to load my results as the overlay file in the imaging (I already formatted my results into a bst_template structure, but it seems to need a file in the Brainstorm database).

Any ideas in how I could do this please?

Thank you!
Valentina

If you want to do display your results using the Brainstorm tools, you need first to save your file as a file in the Brainstorm database indeed.

The easiest is maybe to first create a template source file in the Brainstorm database which is similar to the file you want to obtain: maybe compute a source file in Brainstorm with the same dimensions as your file, and the replace the ImageGridAmp matrix with your own values (export to Matlab/modify/import back, or directly modify the .mat files). Then display the file as if it was any Brainstorm file.
More risky approach: save the file in the database and reload the protocol (see the functions db_reload_* if you want to automate it).

The data structures are documented in the sections "On the hard drive" of the tutorials, and the tutorial Scripting will give you a lot of information on how to manipulate Brainstorm files and structures:
https://neuroimage.usc.edu/brainstorm/Tutorials/Scripting#File_structures
https://neuroimage.usc.edu/brainstorm/Tutorials/Scripting#Custom_processing

Thank you Francois!