Hi!
I was trying to recompute the FEM model with ISO2MESH for a subject in which DUNEURO keeps failing, as suggested here https://neuroimage.usc.edu/brainstorm/Tutorials/FemMedianNerveCharm#Remesh_with_Iso2mesh
However I am getting the following error:
***************************************************************************
** Error: 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 1194
**
***************************************************************************
***************************************************************************
** Error: The FEM mesh generation failed.
** Check the Matlab command window for additional information.
**
***************************************************************************
the error in surf2mesh.m at line 117 is related to the following (cmdout
)
cmdout =
'Opening C:\Users\ALIEN_ANALYSIS_ONE\AppData\Local\Temp\iso2mesh-ALIEN ANALYSIS ONE\post_vmesh.poly.
Delaunizing vertices...
Warning: Point #329258 is coincident with #384897. Ignored!
Warning: Point #384637 is coincident with #329028. Ignored!
Warning: Point #384426 is coincident with #328817. Ignored!
Warning: Point #384432 is coincident with #328823. Ignored!
Warning: Point #384797 is coincident with #329179. Ignored!
goes on for 1355 lines
Warning: Point #329672 is coincident with #287302. Ignored!
Warning: Point #329777 is coincident with #291930. Ignored!
Warning: Point #329668 is coincident with #287299. Ignored!
Delaunay seconds: 3.796
Creating surface mesh ...
Found two overlapping facets.
1st: [329302, 87842, 234574] #1
2nd: [329302, 87842, 234574] #2
A self-intersection was detected. Program stopped.
Hint: use -d option to detect all self-intersections.
If I try to add the -d
option as suggested, such as line 111 in surf2mesh.m is now
[status, cmdout]=system([' "' mcpath(method,exesuff) '" -A -q1.414a -d' num2str(maxvol) ' ' moreopt ' "' mwpath('post_vmesh.poly') '"']);
I get the following error:
***************************************************************************
** Error: Line 38: fscanf
** Invalid file identifier. Use fopen to generate a valid file identifier.
**
** Call stack:
** >readtetgen.m at 38
** >surf2mesh.m at 121
** >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 1194
**
***************************************************************************
This is due to the fact that readtetgen.m at line 38 tries to
[dim,count] = fscanf(fp,'%d',3);
but fb
is -1
because at line 34 it fp=fopen([fstub,'.ele'],'rt');
but the file fopen
is looking for (.ele) does not exist.
Is there any solution to this?
Thanks in advance for your support