Help with Leadfield and importing headmodel into neuropype

Hello,

I made a head model in brainsuite and uploaded all the anatomy into brainstorm. I am not sure how to compute the forward model. I have a .loc file to upload electrode locations, but im not sure how to do that either.

I am trying to create a head model to use in neuropype for real time source localization neurofeedback. I'm not allowed to attach neuropypes head model and atlas below because i am a new user, but mine needs to be in the exact format. Neuropype told me they used brainstorm to create their head model, so i am hoping i can do the same! It is just the regular Colin-339ch-4495v-scalar-4shell-1.1.hm and the atlas Colin-339ch-4495v-scalar-4shell-1.1-atlas_labels.txt. Thanks very much!

Hoping to head back soon, thanks very much

Hi Kristina,

To compute a forward model with Brainstorm, you need to:

  1. In the anatomy side of the database, import the BrainSuite anatomy folder: https://neuroimage.usc.edu/brainstorm/Tutorials/ImportAnatomy#Import_the_anatomy
  2. Optional: Compute BEM surfaces for this subject if you want to compute the forward solution with OpenMEEG: https://neuroimage.usc.edu/brainstorm/Tutorials/TutBem
  3. In the functional side of the database: create a new folder, and import in it your .loc file (popup menu "Import channel file"). Not sure what your file looks like, but you should be able to find a file format that works.
  4. Register/adjust the positions of the electrodes on the head surface (right-click on the channel file > MRI registration > Edit, read the tooltip of the toolbar buttons for help)
  5. Right-click on the channel file > Compute head model

This might be difficult to follow if you haven't read the introduction tutorials (all the section "Get started"):
https://neuroimage.usc.edu/brainstorm/Tutorials
All the help you need to compute your forward model is in there.

The export to this .hm file format, this is something you will have to write yourself. I looked at the file you sent by email, and it is simply a .mat file renamed in .hm. You will need to reorganize/rename the fields you get in the "head model" file created by Brainstorm and create this .hm structure.
Or if they've done it before, you can simply ask you neuropype friends to give you their code.

To post files on this forum: upload them somewhere else (dropbox, google drive,...) and post a download link here.

Cheers
Francois

Hi Francois,

Thanks very much! Why is the compute BEM optional?

Best wishes

Kristina

Hi Francois,

I uploaded my electrodes and fixed the positioning. I ran compute head model openMeegBEM, source space MRI volume (also it does not give me the option custom source model) and EEG is checked net to OpenMeeg BEM. Scalp, skull, brain verties are all correct. Checked is use adaptive integration. I click ok and get this error.

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
** -3.99543PI
** -3.99543PI
** Interface "1" is not closed !
** Please correct a mesh orientation when defining the interface in the geometry file.
**
** For help with OpenMEEG errors, please refer to the online tutorial:
** https://neuroimage.usc.edu/brainstorm/Tutorials/TutBem#Errors

I am wondering if this is a memory error?

Best wishes

Kristina

Why is the compute BEM optional?

It depends on the forward model you decide to use:
https://neuroimage.usc.edu/brainstorm/Tutorials/HeadModel#Forward_model

source space MRI volume

https://neuroimage.usc.edu/brainstorm/Tutorials/TutVolSource

also it does not give me the option custom source model

https://neuroimage.usc.edu/brainstorm/Tutorials/DeepAtlas

I am wondering if this is a memory error?

No, as the error message says "Interface "1" is not closed" there is a problem with your BEM surfaces. Are you trying to use surfaces that are not the ones that Brainstorm generated?
Please post a screen capture of the database explorer showing the anatomy files.

Hi Francois,

I redid everything and got a new error

WARNING: Some dipoles are outside the BEM layers (1 dipoles).
The leadfield for these dipoles is probably incorrect.


** 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.87146e-06
** Max Area : 4.84885e-05
** Info:: Mesh name/ID : 2
** # vertices : 1922
** # triangles : 3840
** Euler characteristic : 2
** Min Area : 9.17031e-06
** Max Area : 4.52864e-05
** Info:: Mesh name/ID : 3
** # vertices : 1922
** # triangles : 3840
** Euler characteristic : 2
** Min Area : 1.62294e-05
** Max Area : 0.000110168
** 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.87146e-06
** Max Area : 4.84885e-05
** Info:: Mesh name/ID : 3
** # vertices : 1922
** # triangles : 3840
** Euler characteristic : 2
** Min Area : 1.62294e-05
** Max Area : 0.000110168
**
** For help with OpenMEEG errors, please refer to the online tutorial:
** https://neuroimage.usc.edu/brainstorm/Tutorials/TutBem#Errors


Here are screen shots of the anatomy files and channel file

T1%20CHAN

These are some tests we added very recently to correct for some possibly inaccurate results obtained with OpenMEEG. So new that they are not documented yet.
Right-click on the cortex surface > Force inside skull. This should get rid of the warning.
If you don't see this menu, update Brainstorm first.

Please let us know how it goes.

Hello,

I'm trying to configure my head model to be exported in the neuropype structure. Not sure how to do this, or where to find this information with the current head model that i made in brainstorm. Attached is a zip file of their head model and atlas, both of which i need.

Colin-339ch-4495v-scalar-4shell-1.1-atlas_labels.txt (9.3 KB)

Best wishes

Kristina

Hi Francois,

I got this error when i tried to force inside skull

Error in
tree_callbacks>@(h,ev)tess_force_envelope(filenameFull,sSubject.Surface(sSubject.iInnerSkull).FileName)

Can you please post the full error message?

Hi Francois, here it is

This is most likely a path issue, as in your other post:

No still doesn't work

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.59214e-06
** Max Area : 5.92121e-05
** Info:: Mesh name/ID : 2
** # vertices : 1922
** # triangles : 3840
** Euler characteristic : 2
** Min Area : 8.9194e-06
** Max Area : 5.65091e-05
** Info:: Mesh name/ID : 3
** # vertices : 1922
** # triangles : 3840
** Euler characteristic : 2
** Min Area : 1.63175e-05
** Max Area : 0.000114196
** 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.59214e-06
** Max Area : 5.92121e-05
** Info:: Mesh name/ID : 3
** # vertices : 1922
** # triangles : 3840
** Euler characteristic : 2
** Min Area : 1.63175e-05
** Max Area : 0.000114196
**
** For help with OpenMEEG errors, please refer to the online tutorial:
** https://neuroimage.usc.edu/brainstorm/Tutorials/TutBem#Errors


I tried re-downloading brainstorm3 and the most recent openmeeg and it still will not work 9same error) I read on another forum that i need to change my geom file to 1.1, but i am not sure how to do that

There is something very suspicious about your BEM meshes. OpenMEEG tells you they are intersecting...
Can you produce a figure showing all the layers and post it here?

Example:
image
https://neuroimage.usc.edu/brainstorm/Tutorials/TutBem#BEM_surfaces

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