Help with Leadfield and importing headmodel into neuropype

All i have is this, no layers

defaced

The BEM layers are what is computed with the menu "Generate BEM surfaces" that you used.
They are named innerskull, outerskull and head. Display them all in the same figure, and change the transparencies and figures from the Surface tab.

Please post a screen capture showing these files in the database explorer as well.

Hi Francois, Here it is

And with these files selected, OpenMEEG tells you that the meshes are intersecting?

Yes

Can you please share this example with us so I can have a look at it?
Right-click on the subject > File > Export subject, upload the .zip file somewhere (dropbox, google drive...) and post the download link here.

Thanks
Francois

Thanks a lot, here it is

Thank you for the dataset.
It appears that the meshes are indeed intersecting, because of this hole on the left side of the head:
image

I managed to get around this error by selecting a lower number of vertices for the head layer. Select for instance 1082 for the head in the options to generate the BEM surface.
With less vertices, the head surface is smoother and the hole doesn't go as deep into the skull layers, and OpenMEEG accepts the input surfaces.

HI Francois,

Thanks a lot, i unfortunatly still get the same error. Also, how do i delete previous BEM structures without deleting the protocol. I had to delete everything and re-import it again.

Error: OpenMEEG call: om_assemble -HM
** "C:\Users\EGI.brainstorm\tmp\openmeeg.geom"
** "C:\Users\EGI.brainstorm\tmp\openmeeg.cond"
** "C:\Users\EGI.brainstorm\tmp\openmeeg_hm.mat"
** OpenMEEG error #1:
** om_assemble version 2.4.1 compiled at Aug 22 2018 19:47:28 using OpenMP
** Executing using 4 threads.
**
** | ------ om_assemble
** | -HM
** | C:\Users\EGI.brainstorm\tmp\openmeeg.geom
** | C:\Users\EGI.brainstorm\tmp\openmeeg.cond
** | C:\Users\EGI.brainstorm\tmp\openmeeg_hm.mat
** | -----------------------
** (DEPRECATED) Please consider updating your geometry file to the new format 1.1 (see data/README.rst): C:\Users\EGI.brainstorm\tmp\openmeeg.geom
** This geometry is a NESTED geometry.
** Info:: Mesh name/ID : 1
** # vertices : 1922
** # triangles : 3840
** Euler characteristic : 2
** Min Area : 9.59724e-06
** Max Area : 5.97762e-05
** Info:: Mesh name/ID : 2
** # vertices : 1922
** # triangles : 3840
** Euler characteristic : 2
** Min Area : 8.92727e-06
** Max Area : 5.70633e-05
** Info:: Mesh name/ID : 3
** # vertices : 1082
** # triangles : 2160
** Euler characteristic : 2
** Min Area : 2.9158e-05
** Max Area : 0.00016172
** Info:: Domain name : Scalp
** Conductivity : 1
** Composed by interfaces : +1 -3
** Interface "1"= { mesh "1" }
** Interface "3"= { mesh "3"(outermost) }
** Info:: Domain name : Skull
** Conductivity : 0.0125
** Composed by interfaces : +2 -1
** Interface "2"= { mesh "2" }
** Interface "1"= { mesh "1" }
** Info:: Domain name : Brain
** Conductivity : 1
** Composed by interfaces : -2
** Interface "2"= { mesh "2" }
** Info:: Domain name : Air
** Conductivity : 0
** Composed by interfaces : +3
** Considered as the outermost domain.
** Interface "3"= { mesh "3"(outermost) }
** !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
** !!!!!!!!!!! WARNING !!!!!!!!!!!
** !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
** 2 meshes are intersecting !
** Info:: Mesh name/ID : 1
** # vertices : 1922
** # triangles : 3840
** Euler characteristic : 2
** Min Area : 9.59724e-06
** Max Area : 5.97762e-05
** Info:: Mesh name/ID : 3
** # vertices : 1082
** # triangles : 2160
** Euler characteristic : 2
** Min Area : 2.9158e-05
** Max Area : 0.00016172
**
** For help with OpenMEEG errors, please refer to the online tutorial:
** https://neuroimage.usc.edu/brainstorm/Tutorials/TutBem#Errors


Hi Sorry i figured out how to delete it

Following up on this. I reduced the scalp to 812 vertices and it still gives me the same error

Im going to share the file again. Perhaps i did something wrong when i loaded everything in again

I recomputed the BEM surfaces with 1082 vertices on all the layers, and it seems to work.
Otherwise, try other combinations: recompute another head surface (right-click on the MRI) with less erosion and then downsample it, or something like this. Or downsample the head surface from BrainSuite. The one thing you need to do is to find a way to produce a surface that reduces the depth of this hole.

Note that the error get is not a bug. If the surfaces of the different tissues were perfect, they would intersect over a much broader section, which does not satisfy the requirement for compute a BEM model with OpenMEEG.
If you can't get this to work for this patient, use a spherical model instead.

Hi Francois, thanks very much! I was able to get it in with 1082v. I now have may questions concerning the head model and how i can export the head model into neuropype in a format neuropype will accept. I am also emailing neuropype with questions, and ill let you know if they end up answering my questions first.

Question 1: Atlas
For neuropypes colin Atlas, the variables they have are: "labeling, labels and name" I was I was able to get the labels and name from my brainstorm/brainsuite svreg atlas, however i am not sure where to find the variable "labeling" and what that corresponds too in my atlas. Ive attached the colins head model from neuropype here (which contains neuropyes atlas) and my svreg atlas here.

Colins

Svreg

Thanks very much

Kristina

Here is a list of the fields in the neuropype headmodel, and where to get the info from in the brainstorm database:

If you think your conversion function could be useful for other users, it would be interesting to include it in the Brainstorm distribution, formatted in a way similar to the function that creates FieldTrip headmodel structures (out_fieldtrip_headmodel.m):
https://github.com/brainstorm-tools/brainstorm3/blob/master/toolbox/io/out_fieldtrip_headmodel.m

Hi Francois, what do you mean "loop on the scouts" for the atlas? I see ROI and the vertices attached to each ROI, how do i copy these vertices and paste them correctly into the atlas labeling variable (4495,1)?

Is it the sulci map (15335x1)double that i am to copy and paste into the labeling(4495,1) variable of the collins head model?

Sulcimap

Also, where or how would i compute CSF?

what do you mean "loop on the scouts" for the atlas? I see ROI and the vertices attached to each ROI, how do i copy these vertices and paste them correctly into the atlas labeling variable (4495,1)?

Something like:

npmat.atlases.labeling = zeros(4495,1);
for i=1:length(bstmat.Scouts)
   npmat.atlases.labeling(bstmat.Scouts(i).Vertices) = label_index;
end

(you'll need some coding skills with Matlab and a good understanding of all these structures in order to do this)

Is it the sulci map (15335x1)double that i am to copy and paste into the labeling(4495,1) variable of the collins head model?

I'm sorry, I have no idea where your surfaces came from. You will most likely need to use the Brainstorm cortex surface instead of the one that you have in you neuropype head model.

Also, where or how would i compute CSF?

These are labels on the cortex surface. There is no CSF.