fangq / brain2mesh

Brain2Mesh - a one-liner for high-quality brain mesh generation
http://mcx.space/brain2mesh
Other
34 stars 14 forks source link

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

Closed tmedani closed 4 years ago

tmedani commented 5 years ago

Hi, I use iso2mesh to generate volume mesh from surfaces mesh with differents 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 in correct way, From differents situation I get labels with [0 2 3] or [3 0 1]... So at each time I need to check manually the label and the region.

Do you know how I can make this process automatically, I mean, how I can control the output labels region 1 ==> 1 region 2 ==> 2 region 3 ==> 3 ...

Thank you for your helps Bests Takfarinas

fangq commented 4 years ago

@tmedani, I must have missed this report, although it should have been submitted to iso2mesh instead of brain2mesh.

For the issue you are seeing, this is not a bug. The surf2mesh output mesh label depends on the order of the seed points defined in your "regions" input to surf2mesh/s2m.

For example, if you define 3 points, p1, p2 and p3 in your regions: regions=[p1; p2; p3];

and then call s2m(no,fc,...,'tetgen',regions) to get your mesh, then the surface compartment enclosing p1 will be labeled as 1, that enclosing p2 will be labeled as 2, and so on. If no seed is defined to a enclosed region, it will be labeled as 0. This is the behavior to tetgen 1.4.x.

If you replace 'tetgen' to 'tetgen1.5', and do not define regions, it will automatically number the regions, in a relatively random order. You will need to relabel them by computing the centroids of each label, and map it to your tissue label map.

hope this helps. I am closing this as it is not a bug.

tmedani commented 4 years ago

@tmedani, I must have missed this report, although it should have been submitted to iso2mesh instead of brain2mesh.

For the issue you are seeing, this is not a bug. The surf2mesh output mesh label depends on the order of the seed points defined in your "regions" input to surf2mesh/s2m.

For example, if you define 3 points, p1, p2 and p3 in your regions: regions=[p1; p2; p3];

and then call s2m(no,fc,...,'tetgen',regions) to get your mesh, then the surface compartment enclosing p1 will be labeled as 1, that enclosing p2 will be labeled as 2, and so on. If no seed is defined to a enclosed region, it will be labeled as 0. This is the behavior to tetgen 1.4.x.

If you replace 'tetgen' to 'tetgen1.5', and do not define regions, it will automatically number the regions, in a relatively random order. You will need to relabel them by computing the centroids of each label, and map it to your tissue label map.

hope this helps. I am closing this as it is not a bug.

Hi, Yes, I figured out this issue and sorry to post it in the wrong directory. Thank you for your answer and clarification. Regards

fangq commented 4 years ago

no problem. glad it was resolved.