Giter Club home page Giter Club logo

iso2mesh's People

Contributors

emersonkeenan avatar fangq avatar ftadel avatar ithron avatar jishanshaikh4 avatar lrineau avatar phongatran avatar yaoruoyang avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

iso2mesh's Issues

mcpath - not recognized as an internal or external command error

A change in the mcpath file (line 30) from the previous version seems to have broken the ability to find files in the bin folder, typically executables.

Operating System: Windows 10
MATLAB: '9.2.0.538062 (R2017a)'
Error: '"cgalsurf.exe"' is not recognized as an internal or external command, operable program or batch file.
Current Code: mcpath (line 30) - if(exist(tempname,'file'))
Edited Code: mcpath (line 30) - if(exist([tempname getexeext],'file')) <-- looks for specific file (recommended)
Alternative Code: mcpath (line 30) - if(exist([fileparts(which(mfilename)) filesep 'bin'],'file')) <-- looks for the bin folder, this is how the previous version code worked.

v2m parameter "isovalues"

isovalues: a list of isovalues where the levelset is defined

Is there another way to explain what this parameter is, I don't understand it.

iso2mesh in Lead DBS

Dear all,
i'm using iso2mesh inside the toolbox Lead DBS and i would like to calculate the VTA. I need to know if in the mesh we consider the anisotropy and the inhomogeneity of the surrounding tissues to the nuclei.
Can someone give me some explanation about this?
Thank you in advance for your collaboration.
Regards,
Arianna

smoothsurf works incorrectly

Hi!
smoothsurf clearly work incorrectly on my geometry. I attach geometry here
files.zip
load('el.mat')
load('no.mat')
plotmesh(no,el)
sz=size(no);
no=smoothsurf(no,[],meshconn(el,sz(1)),1);
plotmesh(no,el)
clearly puts something inside of one of the channels.
Best regards

cgal* tools does not compile

I downloaded repo from sourceforge and trying to build cgal* tools from source because we are not allowed to put already compiled binaries to packages in Fedora:

cgalsurf

[brain@x1carbon build]$ make -j4
Scanning dependencies of target mesh_a_3d_gray_image
[ 50%] Building CXX object CMakeFiles/mesh_a_3d_gray_image.dir/mesh_a_3d_gray_image.cpp.o
/home/brain/rpmbuild/BUILD/iso2mesh-code-502-trunk/cgalsurf/mesh_a_3d_gray_image.cpp: In function ‘int main(int, char**)’:
/home/brain/rpmbuild/BUILD/iso2mesh-code-502-trunk/cgalsurf/mesh_a_3d_gray_image.cpp:76:95: error: no matching function for call to ‘make_surface_mesh(C2t3&, Surface_3&, CGAL::Surface_mesh_default_criteria_3<CGAL::Delaunay_triangulation_3<CGAL::Robust_circumcenter_traits_3<CGAL::Epick>, CGAL::Triangulation_data_structure_3<CGAL::Surface_mesh_vertex_base_3<CGAL::Robust_circumcenter_traits_3<CGAL::Epick>, CGAL::Triangulation_vertex_base_3<CGAL::Robust_circumcenter_traits_3<CGAL::Epick>, CGAL::Triangulation_ds_vertex_base_3<void> > >, CGAL::Delaunay_triangulation_cell_base_with_circumcenter_3<CGAL::Robust_circumcenter_traits_3<CGAL::Epick>, CGAL::Surface_mesh_cell_base_3<CGAL::Robust_circumcenter_traits_3<CGAL::Epick>, CGAL::Triangulation_cell_base_3<CGAL::Robust_circumcenter_traits_3<CGAL::Epick>, CGAL::Triangulation_ds_cell_base_3<void> > > >, CGAL::Sequential_tag>, CGAL::Default, CGAL::Default> >&, CGAL::Manifold_tag, unsigned int&, int)’
   CGAL::make_surface_mesh(c2t3, surface, criteria, CGAL::Manifold_tag(),initnum,atoi(argv[10]));
                                                                                               ^
In file included from /home/brain/rpmbuild/BUILD/iso2mesh-code-502-trunk/cgalsurf/mesh_a_3d_gray_image.cpp:6:0:
/usr/include/CGAL/make_surface_mesh.h:47:6: note: candidate: template<class C2T3, class Surface, class Criteria, class Tag> void CGAL::make_surface_mesh(C2T3&, const Surface&, const Criteria&, Tag, int)
 void make_surface_mesh(C2T3& c2t3,
      ^
/usr/include/CGAL/make_surface_mesh.h:47:6: note:   template argument deduction/substitution failed:
/home/brain/rpmbuild/BUILD/iso2mesh-code-502-trunk/cgalsurf/mesh_a_3d_gray_image.cpp:76:95: note:   candidate expects 5 arguments, 6 provided
   CGAL::make_surface_mesh(c2t3, surface, criteria, CGAL::Manifold_tag(),initnum,atoi(argv[10]));
                                                                                               ^
In file included from /home/brain/rpmbuild/BUILD/iso2mesh-code-502-trunk/cgalsurf/mesh_a_3d_gray_image.cpp:6:0:
/usr/include/CGAL/make_surface_mesh.h:64:6: note: candidate: template<class C2T3, class SurfaceMeshTraits_3, class Criteria, class Tag> void CGAL::make_surface_mesh(C2T3&, const typename SurfaceMeshTraits_3::Surface_3&, const SurfaceMeshTraits_3&, const Criteria&, Tag, int)
 void make_surface_mesh(C2T3& c2t3,
      ^
/usr/include/CGAL/make_surface_mesh.h:64:6: note:   template argument deduction/substitution failed:
/usr/include/CGAL/make_surface_mesh.h: In substitution of ‘template<class C2T3, class SurfaceMeshTraits_3, class Criteria, class Tag> void CGAL::make_surface_mesh(C2T3&, const typename SurfaceMeshTraits_3::Surface_3&, const SurfaceMeshTraits_3&, const Criteria&, Tag, int) [with C2T3 = CGAL::Complex_2_in_triangulation_3<CGAL::Delaunay_triangulation_3<CGAL::Robust_circumcenter_traits_3<CGAL::Epick>, CGAL::Triangulation_data_structure_3<CGAL::Surface_mesh_vertex_base_3<CGAL::Robust_circumcenter_traits_3<CGAL::Epick>, CGAL::Triangulation_vertex_base_3<CGAL::Robust_circumcenter_traits_3<CGAL::Epick>, CGAL::Triangulation_ds_vertex_base_3<void> > >, CGAL::Delaunay_triangulation_cell_base_with_circumcenter_3<CGAL::Robust_circumcenter_traits_3<CGAL::Epick>, CGAL::Surface_mesh_cell_base_3<CGAL::Robust_circumcenter_traits_3<CGAL::Epick>, CGAL::Triangulation_cell_base_3<CGAL::Robust_circumcenter_traits_3<CGAL::Epick>, CGAL::Triangulation_ds_cell_base_3<void> > > >, CGAL::Sequential_tag>, CGAL::Default, CGAL::Default> >; SurfaceMeshTraits_3 = CGAL::Surface_mesh_default_criteria_3<CGAL::Delaunay_triangulation_3<CGAL::Robust_circumcenter_traits_3<CGAL::Epick>, CGAL::Triangulation_data_structure_3<CGAL::Surface_mesh_vertex_base_3<CGAL::Robust_circumcenter_traits_3<CGAL::Epick>, CGAL::Triangulation_vertex_base_3<CGAL::Robust_circumcenter_traits_3<CGAL::Epick>, CGAL::Triangulation_ds_vertex_base_3<void> > >, CGAL::Delaunay_triangulation_cell_base_with_circumcenter_3<CGAL::Robust_circumcenter_traits_3<CGAL::Epick>, CGAL::Surface_mesh_cell_base_3<CGAL::Robust_circumcenter_traits_3<CGAL::Epick>, CGAL::Triangulation_cell_base_3<CGAL::Robust_circumcenter_traits_3<CGAL::Epick>, CGAL::Triangulation_ds_cell_base_3<void> > > >, CGAL::Sequential_tag>, CGAL::Default, CGAL::Default> >; Criteria = CGAL::Manifold_tag; Tag = unsigned int]’:
/home/brain/rpmbuild/BUILD/iso2mesh-code-502-trunk/cgalsurf/mesh_a_3d_gray_image.cpp:76:95:   required from here
/usr/include/CGAL/make_surface_mesh.h:64:6: error: no type named ‘Surface_3’ in ‘class CGAL::Surface_mesh_default_criteria_3<CGAL::Delaunay_triangulation_3<CGAL::Robust_circumcenter_traits_3<CGAL::Epick>, CGAL::Triangulation_data_structure_3<CGAL::Surface_mesh_vertex_base_3<CGAL::Robust_circumcenter_traits_3<CGAL::Epick>, CGAL::Triangulation_vertex_base_3<CGAL::Robust_circumcenter_traits_3<CGAL::Epick>, CGAL::Triangulation_ds_vertex_base_3<void> > >, CGAL::Delaunay_triangulation_cell_base_with_circumcenter_3<CGAL::Robust_circumcenter_traits_3<CGAL::Epick>, CGAL::Surface_mesh_cell_base_3<CGAL::Robust_circumcenter_traits_3<CGAL::Epick>, CGAL::Triangulation_cell_base_3<CGAL::Robust_circumcenter_traits_3<CGAL::Epick>, CGAL::Triangulation_ds_cell_base_3<void> > > >, CGAL::Sequential_tag>, CGAL::Default, CGAL::Default> >’
CMakeFiles/mesh_a_3d_gray_image.dir/build.make:62: recipe for target 'CMakeFiles/mesh_a_3d_gray_image.dir/mesh_a_3d_gray_image.cpp.o' failed
make[2]: *** [CMakeFiles/mesh_a_3d_gray_image.dir/mesh_a_3d_gray_image.cpp.o] Error 1
CMakeFiles/Makefile2:67: recipe for target 'CMakeFiles/mesh_a_3d_gray_image.dir/all' failed
make[1]: *** [CMakeFiles/mesh_a_3d_gray_image.dir/all] Error 2
Makefile:83: recipe for target 'all' failed
make: *** [all] Error 2

And for cgalsimp2 and cgalmesh I dont understand how to compile it to one binary which will be used by iso2mesh.

cgalv2m BUG

image

I'm trying mesh a head volume specified by a volumetric uint8 image of 6 grayscale values (42.5000 85.0000 127.5000 170.0000 212.5000 255.0000)

Dimensions are 394x466 x620

I'm getting the following error:

Error using cgalv2m (line 87)
output file was not found, failure was encountered when running command: \n"C:\Users\Arttu\Documents\MATLAB\iso2mesh\bin\cgalmesh.exe"
"C:\Users\Arttu\AppData\Local\Temp\iso2mesh-Arttu\pre_cgalmesh.inr" "C:\Users\Arttu\AppData\Local\Temp\iso2mesh-Arttu\post_cgalmesh.mesh"
30.000000 2.000000 0.500000 3.000000 100.000000 1648335518

I have attached the zip of the pre_cgalmesh.inr

pre_cgalmesh.zip

How to find indices of nodes to faces

Hello,

I am projecting the pointCloud (vertices2) to surface (vertices1, faces1) using proj2mesh:

  1. calculate the nodal norm
    nv=nodesurfnorm(vertices1,faces1);
  2. calculate the distances
    [d2surf,cnL]=dist2surf(vertices1,nv,vertices2);
  3. project
    [newptL elemidL weightL]=proj2mesh(vertices1,faces1,vertices2,nv,cnL);

elemidL corresponds to surface triangle (in elem) containing projected point? if so, I do have faces1(elemidL,:). How to find corresponding vertices1 IDs of these triangles to form the surface which contains all projected points?

how to get nodes order from element id?

Regards

Bug: cgalv2m

When running vol2mesh on a 3D binary or uint8 image array, the executable file cgalmesh.exe fails for large arrays with the error message: 'Error using cgalv2m (line 87) output file was not found, failure was encountered when running command: "pathto\iso2mesh\bin\cgalmesh.exe" ".\tmp\pre_cgalmesh.inr" ".\tmp\post_cgalmesh.mesh" 30.000000 0.500000 0.200000 3.000000 1.000000 1648335518'

When this command is run directly in a terminal, the executable finishes without producing an error message or output post_cgalmesh.mesh file.

This error occurs for both 32 and 64-bit binaries and does not to be an issue with memory.

The work of the meshing algorithm is ustable for big meshes

Hi!
Meshing with
[node,elem,face]=v2m(part,0.5,3,50);
or
[no,el,regions,holes]=v2s(part,0.5,3);
works fine for small volumes (100x100x100 voxels):
Capture1
but for bigger volumes (500x100x500 voxels) the real surfaces are no longer followed by the exactly same command
Capture2
Capture3

CGAL Surface_mesher and Mesh_3 may miss isolated inclusions

The previous report can be found here:

http://cgal-discuss.949826.n4.nabble.com/missing-objects-when-meshing-a-3D-image-with-multiple-disconnected-inclusions-td3349283.html

Testing image is included in the above report.

Basically, if there are multiple isoloated inclusions (same or differnt label) inside a background volume of index 0, the surface mesher or 3D mesher may return the mesh of a subset of these inclusions in a more or less random manner.

cgalv2m does not create flat boundaries

Hi @fangq

Regarding our discussion about the error on " cgalv2m "

Here is the error :
错误使用 cgalv2m (第 87 行)
output file was not found, failure was encountered when running command: \n"E:\Works during the
student period\Work during PhD\SOFC research\SOFC Model\Mesh\iso2mesh\iso2mesh\bin\cgalmesh.exe"
"C:\Users\Lenovo\AppData\Local\Temp\iso2mesh-Lenovo\pre_cgalmesh.inr"
"C:\Users\Lenovo\AppData\Local\Temp\iso2mesh-Lenovo\post_cgalmesh.mesh" 30.000000 5.000000 0.500000
3.000000 1=5:0.7:5:5:5:5 1648335518

出错 vol2mesh (第 54 行)
[node elem,face]=cgalv2m(vol,opt,maxvol);

出错 v2m (第 18 行)
[node,elem,face]=vol2mesh(img,1:size(img,1),1:size(img,2),1:size(img,3),opt,maxvol,1,method,isovalues);

出错 Mesh_generation (第 12 行)
[node,elem,face]=v2m(imag,0.5,opt,maxvol,'cgalmesh');

Merge tetra mesh with multiple elemID within enclosed surface

Hi @fangq

I hope you are doing well,

We are pushing the modeling to include the shape of the electrode in the simulation (we will include it in Brainstorm soon).

My question is related to the possibility to merge a tetra mesh volume within a closed surface (in the brain volume).

We have the complete sEEG electrode model (lead with multiple contacts), as shown in this figure,
I was able to construct it thanks to iso2mesh, a great tool again.

image

We would like to integrate these electrodes together within the brain volume, a simple scenario is in this figure:

image

The model that I used in this figure is just with one tissue for the electrode, and surf2mesh works fine with the seed points,
however, it's not easy when we use the model in the first figure, with multiple sEEG contacts,

So, is there any option within iso2mesh/tetgen that allows generating this model?

Any recommendations/or scripts are welcome.

Thanks again for your precious help.

Best,
Takfarinas

Bug in the z-axis index calculations in surf2volz.m

Shouldn't line 57 surf2volz.m read:
zz=floor(((zi(iz(i))-zi(1)))/dz0);

I just had some cases where the generated volume grew larger in the z-dim than the input vector specified. It created some issues with the calls in surf2vol.m.

Tetgen command failed

Dear Fang,
I have used

[node,elem]=meshcheckrepair(nodes_TP(:,2:4),triangularelements,'meshfix').

This generated node array of size103242x3 and element array of size 208868x3.

Later I ran
[node1,face1]=extrudesurf(node(:,1:3),elem(:,1:3),[0 0 +7]);
keepratio = 1;
maxvol=0.1;
[node11,elem11,face11] = s2m(node1,face1,keepratio,maxvol).

still I am getting the same error.
Please help me.
Thanks in advance

Originally posted by @praveenvenky in #26 (comment)

Bug Report

node output of vol2mesh is sometimes an Nx4 matrix when handed a 3D logical array. This is not consistent with the node dimensions in the input to savemsh.m, savestl.m, etc...

Saving only the first three columns seems to work to fix this.

meshrefine can not create convex hull for meshes with co-planar triangles on Octave

OS: Fedora Silverblue 28
CPU: Intel® Core™ i5-5200U CPU @ 2.20GHz × 4
GPU: Intel® Core™ i5-5200U CPU @ 2.20GHz × 4
Toolbox: mmclab-linux-x86_64-v2018 with GNU octave

When running demo_sfdi_2layer.m the following error occurs...

`>> demo_sfdi_2layer

generating tetrahedral mesh from closed surfaces ...
creating volumetric mesh from a surface mesh ...
volume mesh generation is complete
refining the input mesh ...
generating tetrahedral mesh from closed surfaces ...
creating volumetric mesh from a surface mesh ...
tetgen.mexa64: tetgen.cxx:20313: tetgenmesh::finddirectionresult tetgenmesh::finddirection(tetgenmesh::triface*, double*, long int): Assertion `ori3 != 0.0' failed.
error: Tetgen command failed
error: called from
surf2mesh at line 114 column 8
meshrefine at line 237 column 15
mmcaddsrc at line 71 column 17
demo_sfdi_2layer at line 60 column 20

`

Unexpected error with surf2mesh/tetgen

Hi @fangq

I'm trying to generate tetra mesh from nested, closed, and not intersecting surfaces.
There are fives surfaces:
wm, gm, CSF, skull, and scalp.

When I try to generate the FEM with all these surfaces the following tetgen error appears
image

The weird behavior is when I try to use just a subset of the surfaces, in this cases it works!
the first group: wm, gm, CSF and skull ==> the tetra mesh is generated correctly
image

the second group : wm, gm, skull and scalp ==> it works
image

and just to check, when I use the scalp, skull CSF, it works
image

I tried this in three subjects and the same errors appear.

I don't have any idea why this is happening, could you please help us with this issue?

Here is a link to an example of the data and a small script test.m that call surf2mesh
https://www.dropbox.com/sh/90ar3g1o6htwvjy/AADESjZ2Prps-FQXe6cRcMKQa?dl=0

Thank you in advance for your support.

Best,

cgalv2m gets stuck

I'm trying to use function [node,elem,face]=cgalv2m(vol,opt,maxvol,method) to mesh a uint8 volume that I have attached.

nested_sphere.zip

I'm using the following input

[node,elem,face]=cgalv2m(nested_sphere,[],100,'cgalmesh')

The code gets stuck and this is printed in console:

Mesh sizes are (label=size) (1=1.64834e+009)

Recompile for Apple M1 Macs

Hi Dr. Fang, I was wondering if you could guide me on how to recompile the binaries on a Mac using Terminal? Thank you so much!

Tetgen command failed

Hi, I'm trying to use the surf2mesh function but I'm getting the error:
"
Error using surf2mesh (line 114)
Tetgen command failed
"

Can you help with this?

Regards,

Nightbringer

Python bindings for iso2mesh?

Hi, I want to create and use iso2mesh in python. Is there any plan in providing python bindings? or how could I re-implement iso2mesh using tetgen and some documents?

Thanks!

Meshes are not reproduced across Linux/Windows platforms

Reported by

Kevin G. McIver
Graduate Assistant, Honors College of Engineering
Sloan Indigenous Graduate Scholar
Mechanical Engineering


Dr. Fang,

The error documented here is an inconsistency between the surfaces generated with CGAL using the meshresample tool when aggressively resampling a surface from an image. If the isosurface command is used to make the surface, the resample command is almost always inconsistent Windows to Linux. If you use a value of around .7 for the keepratio MATLAB to Linux consistency is possible using the v2s command and the ‘simplify’ subroutine.

Using the ‘cgalmesh’ method results in random numbers of faces and vertices based on the image every time, I saw a forum post of you from ~2015 attempting to solve that, I find myself wondering if you were ever able to solve it?

The surfboolean command, given the same input also still results in a slightly different surface mesh.

Another note, is that the surface smoothing function is also guilty of causing small differences given the same input Linux to Windows.

Thank you for this codebase, it’s exceptionally helpful, and provides great functionality for creating STLs from image geometry.

Best,
Kevin G. McIver


Testing data
ExampleError.zip

CGAL Surface_mesher produces dense clusters of nodes

Quite often, cgalsurf (Surface_mesher class in CGAL 3.x) produces an unusually dense node cluster as a result of a focused surface refinement; sometimes, this refinement can result in an infinite loop which eventually exhausts the system memory. This issue was originally reported here:

https://sympa.inria.fr/sympa/arc/cgal-discuss/2010-11/msg00032.html

A maximum node number count limit was added to iso2mesh to prevent the infinite loop, but still, many users had complained about the sub-optimal mesh quality of the mesh with uneven node distributions. The previous user reports can be found here:

https://groups.google.com/d/msg/iso2mesh-users/Wx_EKVJSVSE/WEbGED42oXAJ
https://groups.google.com/d/msg/iso2mesh-users/aRll2B0BKm0/_CTeiyFMlMwJ
https://groups.google.com/d/msg/iso2mesh-users/UermqCPNY_g/BgHf32g-Pj0J
https://groups.google.com/d/msg/iso2mesh-users/N-kF7Tmoyqk/TnD_ZkKFH2kJ
https://groups.google.com/d/msg/iso2mesh-users/EeBtu_ZUyUY/HzrFVEOl3uYJ

mesh
mymeshproblem

merge the nodes at the two interfaces

I am looking for a function which permits to merge the nodes at the two contacting interfaces (F1,V1) and (F2,V2). By any chance, maybe there is one in iso2mesh?

output labels or the data of "elem(:,5)" from surf2mesh

Dear Dr @fangq ,
I have already posted this issue in brain2mesh :
fangq/brain2mesh#8 (comment)

I thought that we have solved this issue,
however, we still have it....

This is the scenario :
We use 3 surfaces to generate volume mesh to different regions,
let say in the surface I have 3 regions [1 2 3];

When I use the surf2mesh function, I get the three regions, which is great,
but the labels are not sorted correctly.

Here is my script :
the data files are here :
https://github.com/brainstorm-tools/brainstorm3/tree/master/defaults/anatomy/ICBM152

bstAnatomyPath = '\brainstorm\brainstorm3\defaults\anatomy\ICBM152'
%% 1- Load the surfaces
% Here I use the default subject but it can be any of the surfaces
head  = load(fullfile(bstAnatomyPath,'tess_head.mat'));
inner  = load(fullfile(bstAnatomyPath,'tess_innerskull.mat'));
outer  = load(fullfile(bstAnatomyPath,'tess_outerskull.mat'));
brain  = load(fullfile(bstAnatomyPath,'tess_cortex_pial_low.mat'));

%% 2- Merge the surfaces```

[newnode,newelem]=mergemesh(head.Vertices,head.Faces,...
                                                     outer.Vertices,outer.Faces,...
                                                     inner.Vertices,inner.Faces);

% Find the seed point for each region
center_inner = mean(inner.Vertices);
[~,~,~,~,seedRegion1]=raysurf(center_inner,[0 0 1],inner.Vertices,inner.Faces);
[~,~,~,~,seedRegion2]=raysurf(center_inner,[0 0 1],outer.Vertices,outer.Faces);
[~,~,~,~,seedRegion3]=raysurf(center_inner,[0 0 1],head.Vertices,head.Faces);


%% Generate the volume Mesh
% Generate volume mesh
factor_bst = 1.e-6;
maxvol = 0.1; 
keepratio = 1;
regions = [seedRegion1;seedRegion2;seedRegion3];
% The order is important, the output label will be related to this order,
% which is related to the conductivity value.

[node,elem,face]=surf2mesh(newnode,newelem,...
                                                min(newnode),max(newnode),...
                                                keepratio,maxvol*factor_bst,regions,[]);  

First problem:

elemID = unique(elem(:,5))
 % result : elemID = 0 1 2

figure;
subplot(1,2,2)
col = ['r','y','b'];
elemID = unique(elem(:,5));
for ind = 1 : length(elemID)
plotmesh(node,elem((elem(:,5)==elemID(ind)),:) ,'y>0','facecolor',col(ind));
hold on;
grid on; grid minor;
end
legend({'Inner','Outer','Scalp'})
hold on
coor = mean((inner.Vertices));
%quiver3(coor(1),coor(2),coor(3),0,0,0.1,'LineWidth',2);
subplot(1,2,1) ; % figure
plotmesh(inner.Vertices,inner.Faces ,'y>0','facecolor','r'); hold on;    
plotmesh(outer.Vertices,outer.Faces ,'y>0','facecolor','y'); hold on;
plotmesh(head.Vertices,head.Faces ,'y>0','facecolor','b'); hold on;
legend({'Inner','Outer','Scalp'});
grid on; grid minor;

the plot is here : left are the surfaces, right is the volume
image

For this specific problem since it's stable we choose to fix it manually and we set this : elem((elem(:,5)==0),5) = 3;

image

This is working in this specific case, but we want to avoid this intervention.
Do you have any recommendation?

Second problem:
Now let assume that we are using this manual correction,
the second problem occurs when we change the keepratio from 1 to 0.8
The output label are not stable also with this parameter.
Here are new results :

image

We will really appreciate your help to solve these issues.

Thank you in advance for your help.
Best Regards
Takfarinas

Issue when Installing Iso2mesh in cluster (remote computation resources)

[zwang945@login-phoenix-1 tools]$ make clean
rm -rf built #../bin
for i in cgalmesh cgalsimp2 cgalsurf cork meshfix meshfix/contrib/JMeshLib/test tetgen; do make --no-print-directory -C $i clean; done
make[2]: *** No rule to make target clean'. Stop. make[1]: *** [clean] Error 2 make[2]: *** No rule to make target clean'. Stop.
make[1]: *** [clean] Error 2
make[2]: *** No rule to make target `clean'. Stop.
make[1]: *** [clean] Error 2
rm: cannot remove ‘bin/off2obj’: No such file or directory
make[1]: [clean] Error 1 (ignored)
rm: cannot remove ‘lib/libcork.a’: No such file or directory
make[1]: [clean] Error 1 (ignored)
rm: cannot remove ‘lib/libcorkdebug.a’: No such file or directory
make[1]: [clean] Error 1 (ignored)
rm -f -f .o jmeshlib
/bin/rm .o .a tetgen *~
/bin/rm: cannot remove ‘
.o’: No such file or directory
/bin/rm: cannot remove ‘
.a’: No such file or directory
/bin/rm: cannot remove ‘tetgen’: No such file or directory
/bin/rm: cannot remove ‘
~’: No such file or directory
make[1]: *** [clean] Error 1
make: *** [clean] Error 2

Iso2mesh ERROR using cgalv2m

I am trying to mesh a 3D volume using iso2mesh to get a Tetrahedron based unstructured mesh but I get the following error:

creating surface and tetrahedral mesh from a multi-domain volume ...
'"cgalmesh.exe"' is not recognized as an internal or external command,
operable program or batch file.
Error using cgalv2m (line 97)
output file was not found, failure was encountered when running command: \n"cgalmesh.exe"
"C:\Users\vinit\OneDrive\Documents\MATLAB\MATBOX_Microstructure_analysis_toolbox-master\iso2mesh\iso_temp\pre_cgalmesh.inr"
"C:\Users\vinit\OneDrive\Documents\MATLAB\MATBOX_Microstructure_analysis_toolbox-master\iso2mesh\iso_temp\post_cgalmesh.mesh

error in meshresample.m: cgalsimp2.exe does not generate post_remesh.off for pre_remesh.off of 136MB

Hi, I got an error in meshresample.m:
system([' "' mcpath('cgalsimp2') exesuff '" "' mwpath('pre_remesh.off') '" ' num2str(keepratio) ' "' mwpath('post_remesh.off') '"']);

this command does not generate post_remesh.off file,but exited quietly, with a number 529697949 echoed.

The command in string was
"F:\bin\cgalsimp2.exe" "C:\Users\Jiang\AppData\Local\Temp\iso2mesh-Jiang\pre_remesh.off" 0.5 "C:\Users\Jiang\AppData\Local\Temp\iso2mesh-Jiang\post_remesh.off"

The pre_remesh.off was found (136MB), but after the command, post_remesh.off was not generated. Is this because the mesh is too complicated?

Thanks

Possible bug in vol2surf

When generating a mesh from image slices, Matlab shows this error "Operands to the || and && operators must be convertible to logical scalar values." at the line 87 of vol2surf.m. I think it is related to the fact that it is a matrix comparison so & should be used instead of &&. After changing that it seems to work fine, but you may want to check it just in case.

Compilation seems broken in Ubuntu 18.10

Hello,
compilation seems broken in Ubuntu 18.10.

Running make on tag v1.9.1 fails with error:

~/iso2mesh/tools/meshfix/contrib/OpenNL3.2.1/src/nl_single_file.c:3439:10: fatal error: SuperLU/slu_cdefs.h: No such file or directory
 #include <SuperLU/slu_cdefs.h>
          ^~~~~~~~~~~~~~~~~~~~~

It works fine if I revert commit 24736f5 which makes sense since this commit (updating the meshfix submodule to commit cc7430c) added the "SuperLU" directory in the include which does not exist in Ubuntu (at least not in my setup).

Maybe there is a configuration option to specify the include directory for SuperLU that I missed.

Additional info:

  • Linux distribution: Ubuntu 18.10 Cosmic
  • SuperLU package: libsuperlu-dev:amd64 version 5.2.1+dfsg1-3build1
  • SuperLu include directory: /usr/include/superlu

Hope this helps.

Best regards,

Convert PointCloud to triangulation mesh

Hi,

I need to convert point cloud to triangulation mesh with Matlab. I have a 3D matrix (x,y,z coordinates) and I need a triangulation mesh matrix with the vertices of each triangle to calculate the curvature of each of them.

It is possible to do it with iso2mesh??

Thank you!

Error when calling the "mergesurf"

Hi @fangq

Regarding our discussion about the error on "mergesurf"
the discussion was started here: brainstorm-tools/brainstorm3#185 (comment)

Here is the error :


K>> [newnode, newelem] = mergesurf(bemMerge{:});
Error using surfboolean (line 188)
surface boolean command failed:
cd "C:\Users\33649\AppData\Local\Temp\iso2mesh-medani\" &&
"C:\Users\33649\.brainstorm\iso2mesh\win64\iso2mesh\bin\cork.exe" -resolve
"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 in mergesurf (line 39)
   [newnode,newelem]=surfboolean(newnode,newelem,'all',no,el);

Here is the link to the bemMerge data used in this function :
https://www.dropbox.com/transfer/AAAAAKGCEsm9-ZjHkyNhHVC8U6-WpakkIL17e3RlXGEDPB25Gn00P5s

We are sure that these surfaces are not intersecting since they are extracted from a known tetrahedral mesh.
Here is a view of the surfaces:
image

and the tetra mesh from where they are extracted:
image
image

In the meantime, I will try to reproduce it on Linux to check your proposition.

Thank you.
Takfarinas

Need a robust surface mesh Boolean operation utility

The current surfboolean function using libGTS utilities are not robust, and fails randomly. The libGTS has not been actively maintained.

A robust surface boolean operation function is much wanted. Contribution is highly appreciated!

cgal binaries do not produce output files

I've found in issue in which the cgalsim2 and cgalsurf binaries fail to generate output files. I've replicated this on my RHEL5, RHEL7, and Windows 10 64-bit machines. The binaries take the input files such as pre_remesh.off, but they fail to produce the output files. I checked, and the temp directory is writable, and the binaries are getting the full paths for input and output files. (I would attach the input files, but they are 19 MB). I can't find a workaround here. The binaries run with no apparent errors but don't generate output files, like so:

Finished...
547842 edges removed.
6 final edges.
<matlab debug, then continue>
47 [node,elem]=readoff(mwpath('post_remesh.off'));
Error using fgets
Invalid file identifier.

Would love to use this software! Thanks.

extrudesurf and s2m

Hello,
1.I wanted to generate a counterpart(bottom part) for a toppart.
2. So i used volface() and extracted all triangular faces.
3. I extracted only the bottom surface of the top part with triangular mesh.
4. I extruded it and used meshrepair(meshfix) and generated a solid using s2m with tetrahedral mesh.

My problem here is the number of nodes on the bottom surface of top part and top surface of bottom part are not same even though they are same.
Please help me how to solve this.

best regards
Praveen

Connect Objecct Mesh

Does iso2mesh have a function to mesh two connected objects? I recently created a model that contains several overlapping ellipsoids. I used the triangular element to mesh the surface of each ellipsoid. However, when I tried to use the surf2mesh function create a 3d tetrahedral elements the function doesn't work. I believe the reason is that some of the nodes on one ellipsoid in inside another ellipsoid. How can I deal with this problem?

Index exceeds the number of array elements (0).

hello,

Please help me solving error for my following code:
[node11,elem11,face11] = s2m(node1,face1,keepratio,maxvol)

The error is as follows:

Index exceeds the number of array elements (0).

Error in savesurfpoly (line 104)
boxnode=[p0;p1(1),p0(2:3);p1(1:2),p0(3);p0(1),p1(2),p0(3);

Error in surf2mesh (line 88)
savesurfpoly(no,el,holes,regions,p0,p1,mwpath('post_vmesh.poly'),dobbx);

Error in s2m (line 40)
[node,elem,face]=surf2mesh(v,f,[],[],keepratio,maxvol,regions,holes);

Error in main1 (line 215)
[node11,elem11,face11] = s2m(node1,face1,keepratio,maxvol)

Thanks in advance.
Best Regards

Need a robust surface mesh repairing tool

Removing self-intersecting elements is extremely important, however, the current available method, meshcheckrepair('meshfix') calls meshfix (https://code.google.com/p/meshfix/) made by Marco Attene et al. which can only repair simple surfaces (homologous to a sphere). We need something more general to deal with complex surfaces such as two intersecting spheres.

Warning about shadowed core library

I am using Ubuntu 18.04 and GNU Octave, version 4.2.2.
When using addpath on the precompiled iso2mesh or

pkg load iso2mesh

to load iso2mesh from the PPA I get the following warnings:

warning: function ../iso2mesh196linux/base64encode.m shadows a core library function
warning: called from
mmclab_help_example at line 4 column 1
warning: function ../iso2mesh196linux/base64decode.m shadows a core library function
warning: called from
mmclab_help_example at line 4 column 1

With Octave 5.2 or 6.3 on Ubuntu 20.04 I don't have these warnings, so this problem might have solved itself.

surf2mesh/Tetgen v1.9.2: Different behavior with MacOS?

A Brainstorm user reported an issue with MacOS here:
https://neuroimage.usc.edu/forums/t/fem-meshing-and-fem-head-model/18920/6

Yvonne prepared an example dataset which works well on Windows 10 and Ubuntu 18, but fails on her MacOS computer (surf2mesh: Tetgen command failed).

More precisely:

Is there anything that could explain this behavior?
Something that was fixed for MacOS after you released v1.9.2?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.