About localization errors

Hi all
I need to make a simular valuation to what was done in this paper:

Effects of forward model errors on EEG source localization- Zeynep Akalin Acar- Scott Makeig

" To assess localization errors for dipole sources located anywhere in the brain, the EEG scalp potential maps were simulated in the subject-specific reference head models (RLS-4) for a rectangular 3-D grid of dipole locations with 8-mm spacing through the cortical volume. To better understand the effect of source orientation
on source localization, three orthogonal (x, y, z oriented) simulated dipoles were placed at each grid location. (Here x ran anterior to posterior, y left to right, and z bottom to top of the head). The resulting 3-D grid source spaces for the four subjects comprised 6,075–7,512 dipoles (at 2,025–2,504 grid locations). For each subject, the simulated scalp projections of each dipole source to the 256 scalp electrodes were then localized in the five template head models, using gradient descent seeded by the best-fitting location in the subject source-space grid. Note that simulations were performed without adding sensor (or other) noise. Therefore the localization errors presented in this section represent a best-case scenario with ideal signal-to-noise ratio (SNR). "

I dont know if it work is possible do it in Brainstorm, or from scripts of brainstorm.

I think doing something like this, but with a greater number of dipoles

Regards

[QUOTE=gamoeeg;8167]Hi all
I need to make a simular valuation to what was done in this paper:

Effects of forward model errors on EEG source localization- Zeynep Akalin Acar- Scott Makeig

" To assess localization errors for dipole sources located anywhere in the brain, the EEG scalp potential maps were simulated in the subject-specific reference head models (RLS-4) for a rectangular 3-D grid of dipole locations with 8-mm spacing through the cortical volume. To better understand the effect of source orientation
on source localization, three orthogonal (x, y, z oriented) simulated dipoles were placed at each grid location. (Here x ran anterior to posterior, y left to right, and z bottom to top of the head). The resulting 3-D grid source spaces for the four subjects comprised 6,075–7,512 dipoles (at 2,025–2,504 grid locations). For each subject, the simulated scalp projections of each dipole source to the 256 scalp electrodes were then localized in the five template head models, using gradient descent seeded by the best-fitting location in the subject source-space grid. Note that simulations were performed without adding sensor (or other) noise. Therefore the localization errors presented in this section represent a best-case scenario with ideal signal-to-noise ratio (SNR). "

I dont know if it work is possible do it in Brainstorm, or from scripts of brainstorm.

I think doing something like this, but with a greater number of dipoles

Hello,

You can use Brainstorm to run simulations using and existing study that contains at least: a channel file, a head model and a source file.
It loads the source maps and multiply them with the forward model (=head model). This produce recordings (EEG, MEG, ECOG or SEEG).

You can use this feature in two ways:

  1. Open a source file and run it from the Scout tab: menu Sources > Simulate recordings.
    If there are some scouts selected, it restricts the simulation to them, if not it uses the sources from the entire brain.
  2. Use the processes in the “Simulate” category:
    http://neuroimage.usc.edu/forums/showthread.php?1763-EEG-simulations

If you are not comfortable yet with the Brainstorm interface, you could start by reading the 12+3 introduction tutorials, and possibly the EEG/Epilepsy tutorial if your mainly interested in EEG.

Cheers,
Francois

Thaks for you reply francois

so far I can generate scout based simulations that involve a number of vertices, but these are limited scout since I select them manually. Then on these generate a simulated signal. Instead I need to generate a simulated signal in each of the 15002 model vertices my head. Wherefore do this work manually is impossible. What do you recommend me to automate the simulation and to be keeping each of these ?. Whereas the ultimate aim is to implement wMNE each simulation (inverse solution) to verify the location of the inverse solution vs the actual position of the simulation.

And Other Question is: Can I choose deep scouts under cortex surface to simulate signal in this location?

Regards

Hello,

This is not something you can do with the interface or with the script generator. You have to write your own script to do this.

  1. Either based on the processes documented in the previous post: in a loop with 15000 iterations, edit the scout surface to change the list of vertices for your scout (set sSurface.Atlas(i).Scout(j).Vertices = k), and run the simulation process. Files management will be complicated…
  2. Or, you just write your own script to do all your simulations. The display and database functions are not very helpful for your simulation… Read and understand the function bst_simulation, it contains most of the things you need.

Deep regions: yes, you can simulate recordings from deep sources, but keep in mind that they generate very small fields and that the deeper you go, the lower the spatial resolution.

Hi Francois

I think that is very complex create my own code. However, you write about:

Either based on the processes documented in the previous post: in a loop with 15000 iterations, edit the scout surface to change the list of vertices for your scout (set sSurface.Atlas(i).Scout(j).Vertices = k), and run the simulation process.

Can you give more details about this?

how i can edit the scout surface?

where i can integrate sSurface.Atlas(i).Scout(j).Vertices=K) ?

If you consider that this is a very difficult task to develop with brainstorm, you other software you recommend me?

Regards

If you want to run 15000 single source simulations in a loop, you will have no other choice than to code it yourself in a Matlab script.
I think Brainstorm would still be easier than anything else to manipulate, but you will not find any step by step instructions, in any environment. You’ll have to directly read the code of some example functions and understand what is done in them, and do a lot of experiments on your own.

You will have to write something that looks like the function: brainstorm3/toolbox/math/bst_simulation.m
Place a break point at the beginning of the function (click at the left of a line in the editor), then run a simulation on one scout using the Brainstorm interface. When the debugger stops, you can inspect the values of the variables to see how you are supposed to set the input variables.
If you don’t much about Matlab scripting/debugging, you might want to start by reading a bit about this. There are lots of resources available online to learn how to code in Matlab.

The scouts are saved in the cortex surface file. You can read easily this file from a script, for instance in the function bst_simulation you could use:
sSurface = in_tess_bst(HeadModelMat.SurfaceFile)

Good luck!
Francois

Dear francois

I try to create my own code, I’ve been reading the code of the bst_simulación function. However I have many doubts, I understand how to create scripts in matlab. You could guide me on the input variables need in this occasion?

I acknowledge four input variables, but do not know where to get each of them, or if I should use them all:

ResultsFile
iVertices
Comment
isVolumeAtlas

You could guide me on how to extract from each architectures can export data from the interface?

What would be the correct way to call the function bst_simulation, for my task?

"
1 newDataFile = bst_simulation (ResultsFile, iVertices, Comment = ‘’ isVolumeAtlas = 0)

2 newDataFile = bst_simulation (ResultsFile, iVertices): Use only the selected vertices

3 newDataFile = bst_simulation (ResultsFile): Use all the vertices

"
I would start by understanding how to simulate a source, (imagining one scout). From the command line of matlab, then clearly identify what should remove the function bst_simulation to create my own script.

Sorry so many questions

Thanks Greetings

What you want is to run 15000 simulations, one for each vertex, right?
So you should call your code in a loop, and generate one set of recordings for each source.
But I guess you would not want to create 15000 files, you are going to use those simulations for something else, isn’t it? So you should integrate this something in your loop.

My suggestion was not to call bst_simulation but to write a function that looks like bst_simulation, that also include the loop.
You can ignore everything related with the volume atlases (in your case isVolumeAtlas is always 0).
The best way for you to understand it is probably to debug it, as I suggested in my previous post.

If you haven’t read them, you should start by reading all the online tutorials…

Cheers,
Francois