Error Generating Fem from subject's individual anatomy

Hi everyone!
I imported the subject's anatomy from his MRI file, i segmented it with CAT12 and everything went ok, then I generated a BEM mesh and it worked, but when I tried to generate a FEM mesh from that I got his error:

BST> Emptying temporary directory...
BST> Plugin iso2mesh already loaded: C:\Users\Omar.brainstorm\plugins\iso2mesh

FEM> 1. brain: PerlaSueno/tess_innerskull_bem_1922V.mat
FEM> 2. skull: PerlaSueno/tess_outerskull_bem_1922V.mat
FEM> 3. scalp: PerlaSueno/tess_head_bem_1922V.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 384
** >process_fem_mesh.m>ComputeInteractive at 1228
** >process_fem_mesh.m at 32
** >bst_call.m at 28
** >tree_callbacks.m>@(h,ev)bst_call(@process_fem_mesh,'ComputeInteractive',iSubject,iAnatomy) at 3011
**



** Error: The FEM mesh generation failed.
** Check the Matlab command window for additional information.
**


Thanks in advances!

pd: I tried selecting the original head mask but I got the same, I also tried the two versions of ISO2Mesh and brain2mesh but it always returned error

bserror2022

@tmedani
Do we already have a thread open somewhere to discuss this issue with @FangQ?

I believe that we fixed this issue, but I'm now getting the error as well,
I will check what is wrong on the current version.

1 Like

Yes please
:grin:

Maybe the problem is that the MRI I'm using was cut before the scalp ends, a common practice for clinical MRI since brain ends a few centimeters before:

perlacompleto
Perlacara

But the cortex is actually complete, so I'm not sure

Thanks in advances!

just checking... :slight_smile:
any updates?

Thanks in advances!

1 Like

Hey @tourette95

Thanks for the reminder, sorry for late response.

Yes, I was checking it, it seems that we could still use the current version, with the latest version of iso2mesh.
I think the error is due to multiple version of iso2mesh in your matlab path.

Could you remove all the previous versions of iso2mesh, make sure that there is not other old version on matlab path, some tools include by default some iso2mesh functions.

After that, download the latest version of iso2mesh from the github ,https://github.com/fangq/iso2mesh, unzip it and add it to Brainstom,
or just let brainstorm install it for you https://neuroimage.usc.edu/brainstorm/Tutorials/Plugins

Then try again to generate the FEM mesh, it should work.

Let me know the results.

thanks :slight_smile:

as long as the surfaces are not intersecting the mesh generation should work.

Thank you very much! I will try it :D!

1 Like

Update:
I removed ans reinstalled ISO2MESH and I was able to generate the FEM mesh without any trouble, but just with the MergeSurf option, the other options did not work.
:slight_smile:

Thanks for feedback,
it should work with "MergeMesh" with the previous version of "iso2mesh" (not 2021) and should be much faster.
could you share the error that you got?

I followed your advice about use previous version of ISO2MESH but I got the next error:

FEM> 1. brain: PerlaFotostim_copy/tess_innerskull_bem_1922V.mat
FEM> 2. skull: PerlaFotostim_copy/tess_outerskull_bem_1922V.mat
FEM> 3. scalp: PerlaFotostim_copy/tess_head_mask.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 536
** >process_fem_mesh.m>ComputeInteractive at 1228
** >process_fem_mesh.m at 32
** >bst_call.m at 28
** >tree_callbacks.m>@(h,ev)bst_call(@process_fem_mesh,'ComputeInteractive',iSubject,iAnatomy) at 3013

It is weird since I did not use surf2mesh but ISO2MESH
:open_mouth: