Encountering FEM Mesh Generation Issues with SimNIBS 4: Skull penetrate Scalp Layer

Hello, I am currently working on creating a head model using FEM from T1+T2 images.

I successfully processed the first participant using SimNIBS 4, but I encountered an error with the second participant and wanted to seek advice on this forum.

However, I've run into the following issue:

After using SimNIBS 4 to create a 12-layer mesh through files > MRI segmentation > Generate FEM mesh, I encountered a problem where the skull breaches through part of the scalp after merging 5 layers. (Image attached)

This issue generates the following error message when I try to "Functional data", right-click on the channel file > Compute head model:

Dune reported error: Dune::Exception [findEntityImpl:/home/juan/bst-duneuro/src/duneuro/duneuro/common/edgehopping.hh:84]: coordinate is outside of the grid, or grid is not convex 

status = -1

I attempted to remesh using Iso2mesh, but encountered the following error message:

***************************************************************************
** Error: The FEM mesh generation failed.
** Check the Matlab command window for additional information.
** 
***************************************************************************
BST> Plugin iso2mesh already loaded: C:\Users\user\.brainstorm\plugins\iso2mesh
FEM> 1. scalp: E:\toolbox\brainstorm_db\Interoception\anat\S002\tess_scalp.mat
FEM> 2. skull: E:\toolbox\brainstorm_db\Interoception\anat\S002\tess_skull.mat
FEM> 3. white: E:\toolbox\brainstorm_db\Interoception\anat\S002\tess_white.mat
FEM> 4.  gray: E:\toolbox\brainstorm_db\Interoception\anat\S002\tess_gray.mat
FEM> 5.   csf: E:\toolbox\brainstorm_db\Interoception\anat\S002\tess_csf.mat
generating tetrahedral mesh from closed surfaces ...
creating volumetric mesh from a surface mesh ...
***************************************************************************
** Error: Line 117:  surf2mesh (line 117)
** Tetgen command failed
** 
** Call stack:
** >surf2mesh.m at 117
** >process_fem_mesh.m>Compute at 434
** >process_fem_mesh.m>ComputeInteractive at 1531
** >process_fem_mesh.m at 31
** >bst_call.m at 28
** >tree_callbacks.m>@(h,ev)bst_call(@process_fem_mesh,'ComputeInteractive',iSubject,[],GetAllFilenames(bstNodes)) at 1223
** 
***************************************************************************

I am roughly following the pipeline of the FEM with median nerve tutorial.
https://neuroimage.usc.edu/brainstorm/Tutorials/FemMedianNerveCharm#Merge_tissues

One potential solution I'm considering is to manually adjust the skull within the scalp, or to use a different algorithm to address the problem.

However, I am unfamiliar with manually changing surfaces, and I am concerned that it might lead to further complications.

If anyone has had a similar experience or knows of a solution, I would greatly appreciate your advice. I look forward to your response.

p.s. If I add 'disp(cmdout)' in surf2mesh.m's line 117,
a lot of warning and follow error messege printed:

Delaunay seconds:  47.414
Creating surface mesh ...
Found two overlapping facets.
  1st: [57305, 222151, 211697] #1
  2nd: [57305, 222151, 211697] #2
A self-intersection was detected. Program stopped.
Hint: use -d option to detect all self-intersections.

Best regards,

Bong

Hi @bong516612
There are many issues in your post.

First, the mesh looks weird; what is the yellow tissue in the attached figure?

Can you also post a figure of the 12-layer model?

I guess that the quality of the T1/T2 is not good, so the mesh generation fails to generate a correct mesh.
Can you check them?

The following issues you reported are related to this first problem,
once this is solved, we will see how it goes with the next steps.

Takfarinas

Hi @tmedani !!
Thank you for your reply.

I made a mistake. The figure was 12-layer model.

After merge, I got this 5-layer model picture
In the 5-layer model picture, yellow is now blue, I think this is CSF area.

I think that T1 and T2 image is not that good. with visual check, this images have quite bad motion artifact. Would it be better to just exclude the subject at this point?

I can share you my protocol of this subject.
here is the google drive link!

Thanks a lot

Bong