How to get a tessellation triangle label/number?

Dear BrainStorm Experts

Is there any easy way to obtain the number that labels a triangle in the tessellated brain surface which can be displayed by BrainStorm? I would like to perform some simulations with source seeding, where I’d like to seed the sources at very particular locations. Optimally, I’d like to click at the image of the brain and then obtain the number of the underlying tessellation triangle, so that I could seed a source in that triangle. Is this possible?

Thanks a lot in advance for your help,

Best wishes
Cezary

Hi Cezary,
You can get a vertex number (for your seed) by right clicking on the surface, select Get coordinates from the pop-up menu, then select the vertex that you want. The vertex number (source #) will be displayed in the box.

Beth

[QUOTE=ebock;7931]Hi Cezary,
You can get a vertex number (for your seed) by right clicking on the surface, select Get coordinates from the pop-up menu, then select the vertex that you want. The vertex number (source #) will be displayed in the box.

Beth[/QUOTE]

Hi Beth :slight_smile:
Thanks a lot!
Cheers
Cezary

Hi again
I’m facing another problem now. I thought I had somewhat more than 16 000 possible locations (vertices or triangles; vertices, I guess; this is the number from the ImageGridAmp field in the constrained approach, i.e. the one with the moment vectors normal to the surface of the brain) but clicking on the surface of the brain I can see that there are more than 20 000 (at least I get such numbers when I use the Get coordinates tool you recommended). So what is wrong? My approach or something else? BTW, I know that the number of vertices does not need to be equal to the number of faces but this discrepancy seems too large (if one could assign the two values I mentioned above to those two numbers).
Cezary

Hello Cezary,
If you look at the bottom of the “Surface” tab in the Brainstorm window, you should be able to see the number of vertices and faces.
Brainstorm uses the vertices of the cortex tesselation to define the source space: your matrix ImageGridAmp should have a number of rows equal to the number of vertices if you are using a constrained model, or 3x the number of vertices for an unconstrained model.
If in the “Get coordinates” window you see a vertex index higher than the number of vertices that you see in the “Surface” tab, please take a screen capture of all those windows at the same time and send post it on the forum.
Francois

Hello Francois
Thank you for your reply. I hereby attach a screen shot you have requested.
Perhaps the problem is buried in the deep brain model that I’m using. BTW, Denis Schwartz from CENIR knows more about this model in case you’d need more details.
Cheers
Cezary

Hi Cezary,
There is no problem with this screen capture: your surface has 24358 vertices (as shown at the bottom of the Surface tab), and the index of the selected vertex in the Coordinates tab is #23643.
Francois

Hi Francois
Yes, but why is the first dimension of the corresponding Grid variables smaller, i.e. equal to 16562?
Cheers
Cezary

Hi Cezary,

I see you are working with a “mixed” head model.
In this case, there is not necessarily a strict one-to-one correspondence between the indices of the vertices of the cortex surface and your grid of source points.

You have 24358 vertices in your cortex surface, and from that, you configured the different regions of your model to create a grid of 16562 source points (=dipoles).
The number is different probably because you are using some regions in “volume”: those regions have a high density of points on their surface, but they are used to define a volume grid that is a lot more sparse.

To convert between the index of a vertex and the corresponding index in the source grid (which is possible only for the regions that were not used as volumes), you need to use the information contained in the field GridAtlas.
The function [B]bst_convert_indices.m[/B] can help you with this, read the header of the function.

Cheers,
Francois

Hi Francois
Thank you very much for these detailed explanations. What I still don’t understand though is the discrepancy between the two numbers that I marked one in red (bottom of the attached screen shot) and one in orange (on the left), i.e. 23640 vs 24358. Is the mixed model the reason for that?
As to those marked in green, it must indeed be the “volumetric” approach, as the discrepancy between Vertices and GridRows affects only the thalamus, and not the cortex, nor the cerebellum.
Besides, do I understand correctly that it’s not possible to equalize these numbers whenever one uses a “volumetric” approach?
Cheers
Cezary

Hi Cezary,

24358 = Number of points of the cortex surface
23640 = Number of points of the cortex surface that are related with regions in the source model. There are some areas of the cortex surface that are probably not included in your source model (probably the area around the midbrain).

3662 = Number of vertices in the ‘thalamus R’ surface (you could have downsampled this a bit)
145 = Number of points in the volume grid created inside the thalamus surface, for source modeling

I’m not sure what you mean by “equalize”.
To convert between the different types of indices, use the function bst_convert_indices.m

Francois

If you are lost with these structures, maybe you can ask for help directly to Denis Schwartz.
He’s supposed to write a tutorial on how to use the DBA atlas at some point.

I’ve tried to use the bst_convert_indices.m function but it doesn’t work. See the attached shot. I must be doing something wrong.
PS By “equalize” I mean: make them equal. I hoped these numbers could be exactly the same, either as a result of using some extra function or a particular setup of BS options. Couldn’t they?

Yes, I’ll approach Denis.

What you are doing wrong: the first argument must be a list of vertex indices, not 3D points.

As long as the grid of source points is different from the points of the cortex surface, the indices corresponding to one region are the different…
To have the same indices between the cortex surface and the source model, you need to make your source model equal to the cortex surface.
This is what happens when you use constrained source models using only the cortex (not using mixed of volume headmodels).

Right. So is this correct?

>> [iSourceRows, iRegionScouts, iVertices] = bst_convert_indices([SIM.GridAtlas.Scouts(1, 1).Vertices SIM.GridAtlas.Scouts(1, 2).Vertices SIM.GridAtlas.Scouts(1, 3).Vertices SIM.GridAtlas.Scouts(1, 4).Vertices SIM.GridAtlas.Scouts(1, 5).Vertices SIM.GridAtlas.Scouts(1, 6).Vertices], SIM.nComponents, SIM.GridAtlas, 1);

>> size(iSourceRows)
ans =
1 16274

>> size(iRegionScouts)
ans =
1 4

>> size(iVertices)
ans =
1 16274

If so, why do I have 16274 now, and not the old 16562? The function’s help says: “Modified list of vertices (when some are removed, compared with the initial iVertices)”.

PS I’ll maybe give the volume model up, if only possible. Not sure if there is any other way to include the thalamus though.

I would not recommend you manipulate this GridAtlas structure by yourself.
The indexing of all those different matrices is very complicated and it took me a lot of time to get it right.
We’ll get it properly documented later.

What are you trying to do exactly?
If you take all the indices of all the GridAtlas.Scouts.Vertices structure like you do here, you end up mixing volume and source regions. You should not be doing this…
Can you please describe what indices you are trying to convert into what? The correct solution will be much easier to point at.

As a side note, you can join all the elements of an array of structures with the following syntax:
[SIM.GridAtlas.Scouts.Vertices]

To be honest, I’d not like to convert anything to anything. When I worked with a simple model, things were clearer to me.
What I’m doing now is simulations in which I’m trying to seed sources in order to check if a certain new localization method can find them well. I’ve encountered the problem of the difference in the vertices numbers while doing this and so I’m trying to get things right.
Since Denis won’t be available till March, I’ll probably exclude the thalamus from the simulations for the time being, as it seems to be the only structure that causes the problem (in the mixed volume model including the cortex, the cerebellum and the thalamus). So I’ll rather recreate the solution space with a simple model that will include the cortex and the cerebellum only.

I updated the process “Simulate > Simulate recordings from scout” so that you can use it with your simulations with mixed source models.

To simulate source files, you can do the following:

  1. Create N scouts
  2. Create a “matrix” with N signals (for instance using the other processes in the Simulate menu)
  3. Run “Simulate recordings from scout” on this file.

Does this get any closer to what you want to do?
Francois

Hi Francois
Sorry for my late response.
I think it’s probably best if I wait for the meeting with Denis (early March), which will probably save a bit of your time. Especially that I’m not supposed to update BS alone, to make sure we use the same versions here in Paris.
I’ve been seeding ECDs by simply exporting relevant structures to Matlab, replacing the corresponding entries, and importing back. This worked well for me (when I worked with the cortex only) until I encountered the indexing problem in the mixed/volume model including the thalamus.
So I’ll write to you soon.
A+
Cezary