Error in openMEEG for 319663 vertices

Hello,
when I use 319663 vertices and I want to compute head model, I get this error.

Thank you for your guidance.

Please share the entire error message that is shown in the Matlab command window to determine the problem.

Why do you need to use 319663 vertices? Do you need this resolution?
You will end with a Gain matrix with ~nbChnnel x 0.96 million columns.

We recommend downsampling to ~15k.

Thank you for your reply. We’ve encountered a warning: one or more dipoles are located outside the BEM layer (‘Skull’). This could affect the accuracy of the leadfield. To address this, consider the following steps:

Try recomputing the BEM surfaces with more vertices.
Alternatively, right-click on the cortex file and select ‘Force inside skull.’ For detailed instructions, refer to the OpenMEEG BEM tutorial, specifically the section on handling dipoles outside the BEM layer. After making these adjustments, run the ‘Compute head model’ process again and then have this Error:

** Error: OpenMEEG call: om_assemble -DSM
** "C:\Users\Talee.brainstorm\tmp\openmeeg_240802_110031\openmeeg.geom"
** "C:\Users\Talee.brainstorm\tmp\openmeeg_240802_110031\openmeeg.cond"
** "C:\Users\Talee.brainstorm\tmp\openmeeg_240802_110031\openmeeg_dipoles.txt"
** "C:\Users\Talee.brainstorm\tmp\openmeeg_240802_110031\openmeeg_dsm.mat"
** OpenMEEG error #1:
** om_assemble version 2.4.1 compiled at Aug 22 2018 19:47:28 using OpenMP
** Executing using 6 threads.
**
** | ------ om_assemble
** | -DSM
** | C:\Users\Talee.brainstorm\tmp\openmeeg_240802_110031\openmeeg.geom
** | C:\Users\Talee.brainstorm\tmp\openmeeg_240802_110031\openmeeg.cond
** | C:\Users\Talee.brainstorm\tmp\openmeeg_240802_110031\openmeeg_dipoles.txt
** | C:\Users\Talee.brainstorm\tmp\openmeeg_240802_110031\openmeeg_dsm.mat
** | -----------------------
** (DEPRECATED) Please consider updating your geometry file to the new format 1.1 (see data/README.rst): C:\Users\Talee.brainstorm\tmp\openmeeg_240802_110031\openmeeg.geom
** This geometry is a NESTED geometry.
** Info:: Mesh name/ID : 1
** # vertices : 1922
** # triangles : 3840
** Euler characteristic : 2
** Min Area : 7.90588e-06
** Max Area : 6.73148e-05
** Info:: Mesh name/ID : 2
** # vertices : 1922
** # triangles : 3840
** Euler characteristic : 2
** Min Area : 5.81266e-06
** Max Area : 7.73134e-05
** Info:: Mesh name/ID : 3
** # vertices : 1082
** # triangles : 2160
** Euler characteristic : 2
** Min Area : 2.68544e-05
** Max Area : 0.000116932
** 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) }
** Error memory allocation failed...
**
** For help with OpenMEEG errors, please refer to the online tutorial:
** https://neuroimage.usc.edu/brainstorm/Tutorials/TutBem#Errors

Thank you for your response. I also need a higher resolution, will this cause problems?

The problem is that there is not enough RAM in your system to handle the cortex with 319,663 vertices.

Try using a cortical surface with less vertices.

1 Like

EEG spatial source resolution is within a few centimeters [depending on some parameters]; therefore, having a source space resolution within um or mm will not improve a lot the accuracy of your model.
In other words, having 10 sources or 100 sources within 1cm2 of brain will not really improve your localization, since in both cases your source will be within this 1cm2 area.
Using these 300k sources requires a lot of RAM memory both for the forward and for the inverse problem computation, and you also need more space to store the results.
If you still want a higher resolution than the recommended 15k source, you can use 50k or 100k, this could work on your computer.

Thank you for your response. Can this be done with GPU?

Thank you for your complete answer.

No, there what is required is more RAM:
Random-access memory - Wikipedia

Please read carefully @tmedani advices:

The spatial resolution for source localization is limited by the sensors. Using more vertices will not improve the resolution, it will not create new information that was not there. Yes, you will have more vertices, but the spatial resolution will be the same.

image
(Upsampling, note that )

1 Like

Thank you.