Problems with remeshsurf and meshresample

161 views
Skip to first unread message

takfarinas medani

unread,
Feb 3, 2015, 11:09:41 AM2/3/15
to iso2mes...@googlegroups.com, Qianqian Fang, takfarines medani
Hello all

Dear Dr Fang, 

I regularly use  some functions of iso2mesh, it's a great jobs, thank you. 

But recently, I have a mesh representing the humain head with scalp, inner and outer skull layer,
attached file :myMesh_bst.dat

My code is : 

load('myMesh_bst','pnth','trih','pnti','trii','pnto','trio') %% Attached file myMesh

%% remeshsurface

[newno,newfc]=remeshsurf(pnth, trih,20);
figure('Color',[1 1 1]); %% (attached file named : scalp)
plotmesh(pnth, trih,'y>0');xlabel('X');ylabel('Y');zlabel('Z');

figure('Color',[1 1 1]); %% (attached file named : scalp_with_remeshsurf)
plotmesh(newno,newfc,'y>0');xlabel('X');ylabel('Y');zlabel('Z');

%The two figure are differentes !!

%% Assemblage des surfaces
[pnt, tri]=mergemesh(pnth,trih,pnti,trii,pnto,trio);
figure('Color',[1 1 1]);plotmesh(pnt,tri,'y>0'); % attached file named SurfMesh
xlabel('X');ylabel('Y');zlabel('Z');
legend('Scalp','InnerSkull','OuterSkull');grid;view([0 -90 0]);

%% Remplissage du volume Surface2Mesh
keepratio=1;
maxvol=1;
regions=[0 0.06019 -0.06;0 0 0.06;-0.0169 0.00035 -0.01997];
holes=[];
forcebox=1;

[node,elem,face]=surf2mesh(pnt,tri,min(pnt),max(pnt),keepratio,maxvol,regions,holes,forcebox);

figure;plotmesh(node,elem,'y>0');xlabel('X');ylabel('Y');zlabel('Z')%% 

  [no2,el2]=meshresample(node,elem,1);  % down sample the  mesh ==> ERRORS

My problems are : 

1- in %% remeshsurface
[newno,newfc]=remeshsurf(pnth, trih,20);

When I remesh the surface of the head, the obtained mesh has not the same shape! 
plotmesh(newno,newfc,'y>0'); 
give a bizare geométry (attached file named : scalp_with_remeshsurf)
I do knew why the shape of my mesh is changed? 

2- In  [node,elem,face]=surf2mesh(.....)

There is no distinction between the domaine, I specified the  regions (attached file : volumeMesh)

3- An other question: Which function is used to have a regular mesh (with the same volume of element and same density in the whole volume)
As shown in volumeMesh, I'd like to have the same mesh in all regions.

4- The function meshresample on [node,elem] doesn't work, 
the error is : Subscript indices must either be real positive integers or logicals.

I apologize for my numerous problems

Thank you advance for your help and advices

Takfarinas 


myMesh_bst.mat
scalp.png
scalp_with_remeshsurf.png
SurfMesh.png
volumMesh.png

Qianqian Fang

unread,
Feb 4, 2015, 3:34:39 PM2/4/15
to iso2mes...@googlegroups.com, takfarines medani
On 02/03/2015 11:09 AM, takfarinas medani wrote:
...


My problems are : 

1- in %% remeshsurface
[newno,newfc]=remeshsurf(pnth, trih,20);

When I remesh the surface of the head, the obtained mesh has not the same shape! 
plotmesh(newno,newfc,'y>0'); 
give a bizare geométry (attached file named : scalp_with_remeshsurf)
I do knew why the shape of my mesh is changed?

hi Takfarinas

your opt parameter appears to be incorrect in the remeshsurf call.
when opt is a scalar, it is supposed to be the desired triangle size
after remeshing.

however, your head mesh is only 0.1962 x 0.1567 x 0.24460 unit wide
(in meters?), and you asked the resampled mesh to have a triangle size
of 20 unit! it is way too big.

if you meant to up-sample the surface, I would do the following:

ndiv=30;
dx=min(max(pnth)-min(pnth))/ndiv
[newno,newfc]=remeshsurf(pnth, trih,dx);

plotmesh(newno,newfc,'y>0');xlabel('X');ylabel('Y');zlabel('Z');

this will produce a denser surface with a target triangle size
of 0.0052 unit.

but to me, your head mesh looks fine, curious why you wanted
to remesh it?


2- In  [node,elem,face]=surf2mesh(.....)

There is no distinction between the domaine, I specified the  regions (attached file : volumeMesh)

actually, when I ran it, this call failed.

with further investigation, it was caused by using forcebox=1;

setting forcebox=1 will mesh the bounding box region outside of the
surface and the box's diagonal is specified by the p0 and p1 inputs. in your
case, you used min/max of the nodes, so the bounding box and the
inner surface intersect at the extremes.

setting forcebox=0 solved the problem. the output mesh does have
region labels (a screen shot is attached)

if you do want to add a bounding box, you need to move your p0 and
p1 away from the surface to avoid intersection.


3- An other question: Which function is used to have a regular mesh (with the same volume of element and same density in the whole volume)
As shown in volumeMesh, I'd like to have the same mesh in all regions.

if you meant to mesh all domains with roughly the same element
size (they won't be exactly the same for sure), then you should make
the maxvol parameter small enough so that the impact of the surface
node density diminishes. For example, I set maxvol to 3e-8 by

[node,elem,face]=surf2mesh(pnt,tri,min(pnt),max(pnt),1,3e-8,regions);

the plot of the output mesh is also attached.



4- The function meshresample on [node,elem] doesn't work, 
the error is : Subscript indices must either be real positive integers or logicals.

meshresample only works for surfaces, not on tetrahedral meshes.
for volumetric meshes, downsample is done by regeneration of the
mesh with larger opt.radbound and maxvol values.



I apologize for my numerous problems

Thank you advance for your help and advices

let me know if these solve your problems.

Qianqian


Takfarinas 


--
You received this message because you are subscribed to the Google Groups "iso2mesh-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to iso2mesh-user...@googlegroups.com.
To post to this group, send email to iso2mes...@googlegroups.com.
Visit this group at http://groups.google.com/group/iso2mesh-users.
For more options, visit https://groups.google.com/d/optout.

The information in this e-mail is intended only for the person to whom it is
addressed. If you believe this e-mail was sent to you in error and the e-mail
contains patient information, please contact the Partners Compliance HelpLine at
http://www.partners.org/complianceline . If the e-mail was sent to you in error
but does not contain patient information, please contact the sender and properly
dispose of the e-mail.

headmesh_test.png
headmesh_refine.png

Qianqian Fang

unread,
Feb 10, 2015, 6:50:36 PM2/10/15
to takfarinas medani, iso2mes...@googlegroups.com
>> Hi Qianqian,
>> Thank you for your responses and explanation, it's very clear for me.
>> no it's work.
>> For your previous question (why I want to remesh it ) , it's
concerne an other mesh, I'd like to reduce the mesh density in order to
compare the accuracy of my results between the two models and then the
associated time consumption for the two resolutions

got you.

>> It's ok, now I understand why I have the message : intersecting
faces and regions,
>> now it's work.
>> Thank you, I get it, it's clear

>> Ok, so we cant remesh directly the volume, we need to run surf2mesh,
thank you, it's clear,


>>> I apologize for my numerous problems
>>> Thank you advance for your help and advices

no problem, I am glad it works, feel free to send in more questions :)

Qianqian

Reply all
Reply to author
Forward
0 new messages