Full sources generated by "simulate recordings from scout" process not recognized as surface sources

Hi Brainstorm people,

I am simulating recordings from signals attributed to the Desikan-Killiany atlas scouts, and saving the "full sources" associated. I'd like to see the effect of the different ROI signals extraction functions on the signals and compare their results with the actual ROI signals used in the simulation. However, when I attempt to run the "extract scouts time series" process on the source file, I get the error message "Scout "bankssts L" is a surface scout but the sources are calculated on a volume grid."

I don't expect the source distribution used in the recording simulation to be volumic, since I used a surface atlas and the head model is a surface type. What's wrong with the above, and what should I do instead ?

The error is generated here:

The problem is that your source file contains a field GridLoc which is not empty, which here is interpreted as "this is a volume source model".
How did you end up having a field GridLoc not empty? Please identify which step caused this, and I'll be able to fix it if this is really an error.

Dear Francois,

That is indeed the problem.

I didn't do anything particular to get the non-empty GridLoc. My general procedure was to import a matrix from matlab in a dedicated subfolder of a virtual subject, then run the process to simulate recordings. The subject has the ICBM152 template anatomy and one of the default EEG caps. I created an OpenMEEG BEM headmodel with cortex surface as source space.

I looked and it turns out this head model has a 15002 x 3 GridLoc field. I guess the GridLoc of the source file is copied from the headmodel during the simulation process, line 255 here : https://github.com/brainstorm-tools/brainstorm3/blob/master/toolbox/process/functions/process_simulate_recordings.m

Am I correct ? What should I change ?

Great debugging report, thanks!

I added a test in process_simulate_recordings.m to prevent from saving GridLoc/GridOrient/GridAtlas if this is a surface head model:

Update Brainstorm and let me know how this works.

Thank you Francois for the fix ! It does work now.

I have a new question now : the signals have 12,000 time samples and there are 68 scouts. If I tick the option to use "all" functions to extract the scout time series, I end up with a single data matrix which is 14,125 x 12,000 (which by the way is not what is indicated by the comment which says 68x12000). I suppose the results of the 4 available functions are concatenated, but I am confused because 14,125 is >> 4*68, and is not even a multiple of 68. Is there an easy way to retrieve the results of each individual functions from the matrix, or is it preferable to call the process 4 times, with a different scout function each time ?

If you select "all", there is no aggregation of the time series in each scout.
If a scout has 60 vertices, you'll get 60 times series in output for a constrained source model, and possibly 60*3 time series for an unconstrained source model.
Your 68 scouts probably have a total number of 14125 vertices.

The label of each of these time series is available in the Description field of the file. You can identify which signal is coming from which scout with this information.

My bad, I misinterpreted the word "all", should have looked back at the tutorial.

FYI: To address all the recent questions we had related with simulations, I added some code in Brainstorm and wrote a new tutorial:

Great, thanks for the notification, I will have a look.

Just committed a new process "Simulate recordings from dipoles":


Excellent, this process is super useful.