Error remeshing FEM created by SimNIBS4

Hi all,

I'm running into an issue with remeshing an FEM generated using SimNIBS4. I'm following the FemMedianNerveCharm tutorial to compute a head model using anisotropic white matter conductivities estimated from the DTI. I first tried to use the FEM with all 12 layers generated from charm from SimNIBS4. However, this failed during the "Compute Head Model" step with DUNEuro (my FEM model also has air cavities that are not tesselated), which is why I went back and followed through the tutorial to merge the tissues into 5 layers and remesh using Iso2mesh (Extract surfaces > Generate FEM Mesh using white, gray, csf, skull, scalp > MergeMesh > Max vluem = 0.001, Percentage kept = 100. However, I'm getting the following error when trying to remesh the surfaces:

Line 117: surf2mesh (line 117)
Tetgen command failed

Call stack:

surf2mesh.m at 117
process_fem_mesh.m>Compute at 404
process_fem_mesh.m>ComputeInteractive at 1283
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 1199

I tried going through the forums but couldn't quite find a solution. Any help on this would be greatly appreciated!



Have you check this post?

1 Like

Also, you can print extra information:

  1. Print the path of the surf2mesh function that is being called:
    It should be .... /.brainstorm/plugins/iso2mesh/iso2mesh-1.9.6/surf2mesh.m

  2. Open such a file:
    edit PATH_FROM_STEP1

  3. Just before the line that prompts the error (117), add
    to show the text provided by tetgen before stopping (or crashing)

1 Like

Hi @jleung

Adding to @Raymundo.Cassani recommendation,
can you plot the neighboring surfaces two by two and check for any intersections?
ex (white + gray), (gray + CSF) , ....

I also encountered this problem. I suspect that the generation of FEM mesh failed because of grid intersection. How can I solve the problem of grid intersection?