brain2mesh
brain2mesh copied to clipboard
Error when calling brain2mesh
Hi @fangq,
I'm trying to run the bran2mesh function on a segmented MRI into 5 tissues, but I'm not able to make it work as expected, here is my example :
the link below contains the "tissues" data which is the segmentation of the MRI into 5 main tissues, ordered from inner to outer (label 1 to 5) wm(1), gm(2), csf(3), skull(4) and scalp(5)
here is the code
load('tissues') % download from this link https://www.dropbox.com/t/XBpvzMCBg9acTGTB
seg2 = [];
names={'wm','gm','csf','skull','scalp'};
for i = 5:-1:1
seg2.(names{i}) = uint8(tissues.Cube==i);
end
cfg.dotruncate = 1;
[node,elem,face] = brain2mesh(seg2,cfg);
here is the output
>> cfg.dotruncate = 1;
[node,elem,face] = brain2mesh(seg2,cfg);
95 segname=fieldnames(density);
extracting surfaces from a volume ...
region 1 centroid : 130.000000 91.666667 1.333333
processing threshold level 1...
Surface Mesh Extraction Utility (Based on CGAL 3.6)
(modified for iso2mesh by Qianqian Fang)
http://iso2mesh.sf.net
RNG seed 1648335518
set initial mesh size to 50
Refining... maximum node number is set to 100000
reach maximum node limit, element angular bound may not satisfied
done.
Final number of points: 100000
surface mesh generation is complete
extracting surfaces from a volume ...
region 1 centroid : 119.500000 21.666667 1.333333
processing threshold level 1...
Surface Mesh Extraction Utility (Based on CGAL 3.6)
(modified for iso2mesh by Qianqian Fang)
http://iso2mesh.sf.net
RNG seed 1648335518
set initial mesh size to 50
Refining... maximum node number is set to 100000
done.
Final number of points: 40491
surface mesh generation is complete
extracting surfaces from a volume ...
region 1 centroid : 117.500000 18.666667 1.333333
processing threshold level 1...
Surface Mesh Extraction Utility (Based on CGAL 3.6)
(modified for iso2mesh by Qianqian Fang)
http://iso2mesh.sf.net
RNG seed 1648335518
set initial mesh size to 50
Refining... maximum node number is set to 100000
reach maximum node limit, element angular bound may not satisfied
done.
Final number of points: 100000
surface mesh generation is complete
extracting surfaces from a volume ...
region 1 centroid : 116.000000 16.666667 1.333333
processing threshold level 1...
Surface Mesh Extraction Utility (Based on CGAL 3.6)
(modified for iso2mesh by Qianqian Fang)
http://iso2mesh.sf.net
RNG seed 1648335518
set initial mesh size to 50
Refining... maximum node number is set to 100000
done.
Final number of points: 19658
surface mesh generation is complete
generating tetrahedral mesh from closed surfaces ...
creating volumetric mesh from a surface mesh ...
volume mesh generation is complete
extracting surfaces from a volume ...
region 1 centroid : 114.000000 14.666667 1.333333
processing threshold level 1...
Surface Mesh Extraction Utility (Based on CGAL 3.6)
(modified for iso2mesh by Qianqian Fang)
http://iso2mesh.sf.net
RNG seed 1648335518
set initial mesh size to 50
Refining... maximum node number is set to 100000
done.
Final number of points: 1835
surface mesh generation is complete
generating tetrahedral mesh from closed surfaces ...
creating volumetric mesh from a surface mesh ...
volume mesh generation is complete
Error using surfboolean (line 188)
surface boolean command failed:
cd "C:\Users\33649\AppData\Local\Temp\iso2mesh-medani\" && "G:\My Drive\GitFolders\GitHub\iso2mesh\bin\cork.exe" -first
"C:\Users\33649\AppData\Local\Temp\iso2mesh-medani\pre_surfbool1.off" "C:\Users\33649\AppData\Local\Temp\iso2mesh-medani\pre_surfbool2.off"
"C:\Users\33649\AppData\Local\Temp\iso2mesh-medani\post_surfbool.off" -1648335518
ERROR: error at c:\users\fangq\cork\src\mesh\mesh.isct.tpp, line #1063: Ran out of tries to perturb the mesh
Error in brain2mesh (line 235)
[final_surf_n,final_surf_f] = surfboolean(nbox,fbox(:,[1 3 2]),'first',surf_n,surf_f);
As usual, I will appreciate it If you can orient me to solve this issue.
Thank you in advance for your help.
best,