Contact surfaces in multi region mesh

566 views
Skip to first unread message

Konstantinos Mountris

unread,
Apr 30, 2015, 10:16:24 AM4/30/15
to iso2mes...@googlegroups.com
Dear Dr Fang,

Currently I am improving my prostate FE model adding a mesh derived from clinical segmented ct images of the prostate the rectum and the bladder. As can been seen in the picture the 3 objects interesecting. I wanted to ask ou how is possible firstly to smooth the surface of the overall mesh and then specify the contact surfaces so we can set boundary conditions in these areas in the finite elements analysis. As i seen in the forum there are some problems with the merge_surfaces function. I need to use this or there is an alternative way?

Thank you in advance,
Konstantinos Mountris.
prostate.bmp

Qianqian Fang

unread,
Apr 30, 2015, 11:20:28 AM4/30/15
to iso2mes...@googlegroups.com
On 04/30/2015 10:16 AM, Konstantinos Mountris wrote:
Dear Dr Fang,

Currently I am improving my prostate FE model adding a mesh derived from clinical segmented ct images of the prostate the rectum and the bladder. As can been seen in the picture the 3 objects interesecting. I wanted to ask ou how is possible firstly to smooth the surface of the overall mesh and then specify the contact surfaces so we can set boundary conditions in these areas in the finite elements analysis. As i seen in the forum there are some problems with the merge_surfaces function. I need to use this or there is an alternative way?

hi Konstantinos

I assume your volume has been segmented in 3 labels - 1 label for
each object. In that case, you can just call v2m() with method='cgalmesh'
to get the mesh.

If you want to smooth the surfaces, you may consider v2s() with cgalmesh
option to obtain the surfaces, and then apply smoothing with sms(). 
You will have the risks of getting self-intersecting elements if the
smoothing is "too much".

Another alternative is to extract the surface corresponding to each label
using v2s()/vol2surf, and then apply smoothing to each component, and
then shrink them slightly towards their respective centroid (the shrinkage
needs to ensure they are no longer in contact), and then combine them
with mergemesh(). I personally like the last approach but you have to
manually find how much shrinkage is sufficient to decouple them.

Qianqian


Thank you in advance,
Konstantinos Mountris.
--
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.

Qianqian Fang

unread,
Apr 30, 2015, 11:29:17 AM4/30/15
to iso2mes...@googlegroups.com
On 04/30/2015 11:19 AM, Qianqian Fang wrote:
On 04/30/2015 10:16 AM, Konstantinos Mountris wrote:
Dear Dr Fang,

Currently I am improving my prostate FE model adding a mesh derived from clinical segmented ct images of the prostate the rectum and the bladder. As can been seen in the picture the 3 objects interesecting. I wanted to ask ou how is possible firstly to smooth the surface of the overall mesh and then specify the contact surfaces so we can set boundary conditions in these areas in the finite elements analysis. As i seen in the forum there are some problems with the merge_surfaces function. I need to use this or there is an alternative way?

hi Konstantinos

I assume your volume has been segmented in 3 labels - 1 label for
each object. In that case, you can just call v2m() with method='cgalmesh'
to get the mesh.

If you want to smooth the surfaces, you may consider v2s() with cgalmesh
option to obtain the surfaces, and then apply smoothing with sms(). 
You will have the risks of getting self-intersecting elements if the
smoothing is "too much".

Another alternative is to extract the surface corresponding to each label
using v2s()/vol2surf, and then apply smoothing to each component, and
then shrink them slightly towards their respective centroid (the shrinkage
needs to ensure they are no longer in contact), and then combine them
with mergemesh(). I personally like the last approach but you have to
manually find how much shrinkage is sufficient to decouple them.


forgot to mention, there is another approach. you can also apply
image thinning to the volume of each label, for example, assuming
your objects are labeled 1, 2 and 3 from top-left to right-bottom,
then if I can shrink the middle object (label=2) by 1 voxel, there
will be no contact. So, I can do this

obj2=thinbinvol(img==2,1);
img(img==2)=0;
img=img+obj2*2;

then, you may use v2s->sms->s2m to get the final mesh.

of course, the 3 objects are now isolated. if your analysis
depends on the fact that they are connected, then you will
have to use the cgalmesh option.

Qianqian

Konstantinos Mountris

unread,
May 4, 2015, 3:18:52 AM5/4/15
to iso2mes...@googlegroups.com
Hello dear Dr Fang,
Thank you for your reply and your recommendations. I want to test both scenarios where the objects are isolated or connected so i will check all your recomendations and see what suits best. Thank you very much for your help.
Best regards,
Konstantinos.

Konstantinos Mountris

unread,
May 6, 2015, 9:48:03 AM5/6/15
to iso2mes...@googlegroups.com
Dear Dr Fang,
I tried to solve my problem following your instructions but I wasn't successful until I come up with a modification of the suggesterd procedure.

Instead of applying the method in my image with the 3 objects

First I isolate each one of the objects

Then I generate a mesh either with v2m or with v2s -> sms -> s2m

and finally I merge the three meshes in one with mergemesh having first change the id (column 5) of the objects 2 and 3 element matrix.

In this way I can obtain a mesh with the 3 objects isolated without being necessary to smooth the surfaces. However I am applying a slight smoothing in order to discard sharp edges of the mesh due to the segmentation procedure.

My current shortcome is that despite the level of smoothnesh I cant get rid of the edges in the bottom of the objects shown in the attached image which affect negatively the quality of my mesh. Due you have any suggestions?

Thank you in advance,

Konstantinos.
image.png

Qianqian Fang

unread,
May 6, 2015, 3:09:47 PM5/6/15
to iso2mes...@googlegroups.com
On 05/06/2015 09:48 AM, Konstantinos Mountris wrote:
Dear Dr Fang,
I tried to solve my problem following your instructions but I wasn't successful until I come up with a modification of the suggesterd procedure.

Instead of applying the method in my image with the 3 objects

First I isolate each one of the objects

Then I generate a mesh either with v2m or with v2s -> sms -> s2m

and finally I merge the three meshes in one with mergemesh having first change the id (column 5) of the objects 2 and 3 element matrix.

In this way I can obtain a mesh with the 3 objects isolated without being necessary to smooth the surfaces. However I am applying a slight smoothing in order to discard sharp edges of the mesh due to the segmentation procedure.

My current shortcome is that despite the level of smoothnesh I cant get rid of the edges in the bottom of the objects shown in the attached image which affect negatively the quality of my mesh. Due you have any suggestions?


Thank you in advance,

Konstantinos.

Τη Δευτέρα, 4 Μαΐου 2015 - 9:18:52 π.μ. UTC+2, ο χρήστης Konstantinos Mountris έγραψε:
Hello dear Dr Fang,
Thank you for your reply and your recommendations. I want to test both scenarios where the objects are isolated or connected so i will check all your recomendations and see what suits best. Thank you very much for your help.
Best regards,
Konstantinos.

Τη Πέμπτη, 30 Απριλίου 2015 - 4:16:24 μ.μ. UTC+2, ο χρήστης Konstantinos Mountris έγραψε:
Dear Dr Fang,

Currently I am improving my prostate FE model adding a mesh derived from clinical segmented ct images of the prostate the rectum and the bladder. As can been seen in the picture the 3 objects interesecting. I wanted to ask ou how is possible firstly to smooth the surface of the overall mesh and then specify the contact surfaces so we can set boundary conditions in these areas in the finite elements analysis. As i seen in the forum there are some problems with the merge_surfaces function. I need to use this or there is an alternative way?

Thank you in advance,
Konstantinos Mountris.
--
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.

Konstantinos Mountris

unread,
May 11, 2015, 3:24:34 AM5/11/15
to iso2mes...@googlegroups.com
 Dear Dr Fang,
thanks to your suggestions my problem was fixed and I exported a very good quality mesh. Thank you for your work with ISO2MESH and your user support. You do an excellent job.
Best regards,
Konstantinos.

Konstantinos Mountris

unread,
Jun 2, 2015, 4:58:08 AM6/2/15
to iso2mes...@googlegroups.com
Dear Dr Fang,
I hope this finds you well. Currently I am trying to optimize my contact model. I have some small penetrations and possibly be generating a finer mesh i could get rid of them. Unfortunately I cant produce a good fine mesh despite my efforts.
The best result i had was by first using the remeshsurf function with opt=1 and after calling the meshresample for getting rid from the node cluster as mentioned before in our discussion. Despite the good quality of the mesh (min=0.21 & mean=0.73) the jacobians are very small and the mesh is not suitable for a FEM analysis (can't converge).

Could you please share your ideas for this issue with me?

Best regards,
Konstantinos.

Τη Πέμπτη, 30 Απριλίου 2015 - 4:16:24 μ.μ. UTC+2, ο χρήστης Konstantinos Mountris έγραψε:

Qianqian Fang

unread,
Jun 5, 2015, 2:25:04 PM6/5/15
to iso2mes...@googlegroups.com
On 06/02/2015 04:58 AM, Konstantinos Mountris wrote:
Dear Dr Fang,
I hope this finds you well. Currently I am trying to optimize my contact model. I have some small penetrations and possibly be generating a finer mesh i could get rid of them. Unfortunately I cant produce a good fine mesh despite my efforts.

hi Konstantinos

reducing opt.radbound and maxvol will lead to a fine mesh (you can
get as fine as you want). What did you mean by "a good fine mesh"?
do you have specific requirements?

a screenshot on the not-so-good mesh would be helpful.


The best result i had was by first using the remeshsurf function with opt=1 and after calling the meshresample for getting rid from the node cluster as mentioned before in our discussion. Despite the good quality of the mesh (min=0.21 & mean=0.73) the jacobians are very small and the mesh is not suitable for a FEM analysis (can't converge).

generating a fine mesh is relatively easy in iso2mesh than a
coarser mesh. You can even use meshrefine (the svn version)
to refine specific labels, or near specific nodes.

I will be happy to look at your mesh script and give suggestions.

Qianqian


Could you please share your ideas for this issue with me?
Best regards,
Konstantinos.

Τη Πέμπτη, 30 Απριλίου 2015 - 4:16:24 μ.μ. UTC+2, ο χρήστης Konstantinos Mountris έγραψε:
Dear Dr Fang,

Currently I am improving my prostate FE model adding a mesh derived from clinical segmented ct images of the prostate the rectum and the bladder. As can been seen in the picture the 3 objects interesecting. I wanted to ask ou how is possible firstly to smooth the surface of the overall mesh and then specify the contact surfaces so we can set boundary conditions in these areas in the finite elements analysis. As i seen in the forum there are some problems with the merge_surfaces function. I need to use this or there is an alternative way?

Thank you in advance,
Konstantinos Mountris.
--
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.

Konstantinos Mountris

unread,
Jun 8, 2015, 4:37:45 AM6/8/15
to iso2mes...@googlegroups.com
Dear Dr Fang,

Thank you for your reply in my question. By the time you replied I was able to figure out how to refine my mesh however I wasn't able to use the sortmesh function correctly (by good mesh I mean to reorder the nodes for have a optimised mesh for fe analysis) obviously I am missing something out from the function call. I would be glad if you could help me with that and also if you have any suggestions for my current demands. I want instead of having a tetrahedral mesh of 3 domains, to obtain a mesh where the 2 domains will be made of shell elements and the third of tetrahedral elements. I have seen a previous question like that in the forum but I havent test if in my case its appliable since in the last steps of my scripts I am merging the meshed domains in one global mesh.

I am sharing with you my script as you asked me and I hope for any recommendations of yours. Thank you very much in advance.

Best regards,
Konstantinos.

%### Volumetric Mesh Generation Script
%### for prostate labeled images using
%### ISO2MESH
%### Editor: Konstantinos Mountris
%### Version: V1.2
%### Pre: Input anamyze(.hdr) label images
%### Post: Output tetrahedral meshes for use in FeBio
%-------------------------------------------------------

clc; clear all;

%====ISO2MESH location folder
addpath('/home/mood/MATLAB/iso2mesh')
addpath('/home/mood/MATLAB/Misc')


%====OpenImage
header = analyze75info('AYMAND^Jacques-label.hdr');
img = analyze75read(header);

%img = smooth3(img, 'gaussian', 1, 0.2); %   smooth image


[x1,y1,z1] = ind2sub(size(img),find(img==1));
[x2,y2,z2] = ind2sub(size(img),find(img==2));
[x3,y3,z3] = ind2sub(size(img),find(img==3));

%====Separate regions
prostate = (img==1);
bladder = (img==2);
rectum = (img==3);

%====Configuring parameters
ix = 1:size(img,1);
iy = 1:size(img,2);
iz = 1:size(img,3);
clear opt;
opt.angbound = 20;  %   lower bound in degrees for mesh facets angles
opt.radbound = 3;   %   upper bound for mesh facet circ_center vs del_surface center
opt.distbound = 2;  %   upper bound for del_surface radius
maxvol = 500;
dofix = 1;          %   0: no mesh repair, 1: mesh repair
method = 'cgalsurf';
isovalues = 1;

%====Mesh regions
[no1,fa1,regions1,holes1]=vol2surf(prostate,ix,iy,iz,opt,dofix,method,isovalues);
[no2,fa2,regions2,holes2]=vol2surf(bladder,ix,iy,iz,opt,dofix,method,isovalues);
[no3,fa3,regions3,holes3]=vol2surf(rectum,ix,iy,iz,opt,dofix,method,isovalues);
 
[no1,fa1]=remeshsurf(no1,fa1(:,1:3),2);    %   finer mesh
[no1,fa1]=meshresample(no1,fa1(:,1:3),0.7); %   get rid of dense node-cluster
fa1=meshreorient(no1,fa1(:,1:3));
[no1,el1,face1]=surf2mesh(no1,fa1,69,288,1,maxvol,regions1,holes1,0);
el1=removedupelem(el1);
%[no1,el1,face1,nodemap]=sortmesh(no1,el1,4,face1,3);


[no2,fa2]=remeshsurf(no2,fa2(:,1:3),2);
[no2,fa2]=meshresample(no2,fa2(:,1:3),0.7);
fa2=meshreorient(no2,fa2(:,1:3));
[no2,el2,face2]=surf2mesh(no2,fa2,87,282,1,maxvol,regions2,holes2,0);
el2=removedupelem(el2);
el2(:,1:4)=meshreorient(no2,el2(:,1:4));

[no3,fa3]=remeshsurf(no3,fa3(:,1:3),2);
[no3,fa3]=meshresample(no3,fa3(:,1:3),0.7);
fa3=meshreorient(no3,fa3(:,1:3));
[no3,el3,face3]=surf2mesh(no3,fa3,68,323,1,maxvol,regions3,holes3,0);
el3=removedupelem(el3);
%el3(:,1:4)=meshreorient(no3,el3(:,1:4));

%====Set different region ids to generated regions
el2(:,5) = el2(:,5)+1;
el3(:,5) = el3(:,5)+2;

%====Merge regions in one mesh
[node, elem] = mergemesh(no1,el1,no2,el2,no3,el3);

 
%====Calculate mesh quality
q = meshquality(node(:,1:3),elem(:,1:4));
subplot(1,2,1);
hist(q,100)

%====Visualize the resulting mesh
subplot(1,2,2);
%figure;
plotmesh(node(:,1:3),elem(:,1:4));
axis equal;

%====EXPORT
mesh2abaqus(node,elem,'/home/mood/Documents/PHD_thesis/Models_Febio/MRI_atlas/Patient_1/AymandCT4.inp');


Τη Πέμπτη, 30 Απριλίου 2015 - 4:16:24 μ.μ. UTC+2, ο χρήστης Konstantinos Mountris έγραψε:

Qianqian Fang

unread,
Jun 8, 2015, 11:45:20 AM6/8/15
to iso2mes...@googlegroups.com
On 06/08/2015 04:37 AM, Konstantinos Mountris wrote:
Dear Dr Fang,

Thank you for your reply in my question. By the time you replied I was able to figure out how to refine my mesh however I wasn't able to use the sortmesh function correctly (by good mesh I mean to reorder the nodes for have a optimised mesh for fe analysis) obviously I am missing something out from the function call. I would be glad if you could help me with that

for command format for sortmesh is

[no,el,fc,nodemap]=sortmesh(origin,node,elem,ecol,face,fcol)

however, you wrote this instead:

[no1,el1,face1,nodemap]=sortmesh(no1,el1,4,face1,3);

you missed the "origin" input, and your ecol/fcol should be vectors

if you want to sort the nodes based on distance to the first node,
then you should do:

[no1,el1,face1,nodemap]=sortmesh(no1(1,:), no1,el1,1:4,face1,1:3);




and also if you have any suggestions for my current demands. I want instead of having a tetrahedral mesh of 3 domains, to obtain a mesh where the 2 domains will be made of shell elements and the third of tetrahedral elements. I have seen a previous question like that in the forum but I havent test if in my case its appliable since in the last steps of my scripts I am merging the meshed domains in one global mesh.

in your below script, you've already meshed the 3 labels separately. with
that, you've already have access to either tetrahedral mesh or surface
meshes to all 3 inclusions.

or, your question is how you can merge the 3 domains (two are tetrahedral
one is surface). I don't think you can do that because the dimensions of
elem and face are different. You can, of course, replicate the last column of
face to make it 4-column, so you can merge, but you should keep in mind
that most FE simulators do not support this type of 4-column surface representation.

you need to consult your simulator input format to see what form of
surfaces and tetrahedral meshes are required.

Qianqian

--
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.

Konstantinos Mountris

unread,
Jun 12, 2015, 11:50:03 AM6/12/15
to iso2mes...@googlegroups.com
Dear Dr Fang,
Sorry for my late response. I tried out your recommendation for the sortmesh but i get the same mistake:
==========================
Error in sortmesh (line 31)
if(isempty(origin))

Output argument "fc" (and maybe others) not assigned during call to "/home/mood/MATLAB/iso2mesh/sortmesh.m>sortmesh".

Error in prostInBlock (line 63)
[node,elem,face,nodemap]=sortmesh(node(1,:), node,elem,1:4,face,1:3);
===================================
Also I would like to ask you regarding my new meshing efforts. I am trying to mesh also the space around the 3 objects.
I use vol2mesh and i get the mesh in the attached picture. Is there a way to isolate the 3 objects (no connections between them) and increase the quality? The min quality is 0.1.

=============

clc; clear all;

%====ISO2MESH location folder
addpath('/home/mood/MATLAB/iso2mesh')
addpath('/home/mood/MATLAB/Misc')


%====OpenImage
header = analyze75info('AYMAND^Jacques-label.hdr');
img = analyze75read(header);
img=uint8(img);

for u = 188:335
    for v = 213:303
        for w = 40:93
            if img(u,v,w)==0
                img(u,v,w)=4;
            end
        end
    end
end


%fprintf(1,'filling holes in the volumetric image...\n');
%tic
%cleanimg=fillholes3d(logical(img>0),10);
%toc




%====Configuring parameters
ix = 1:size(img,1);
iy = 1:size(img,2);
iz = 1:size(img,3);
clear opt;
opt.angbound = 20;  %   lower bound in degrees for mesh facets angles
maxvol = 200;

dofix = 1;          %   0: no mesh repair, 1: mesh repair
method = 'cgalmesh';
isovalues = 4;


opt.radbound=2;
opt.side='lower';

tic
[node,elem,face]=vol2mesh(img,ix,iy,iz,opt,maxvol,dofix,method,isovalues);
toc
[node,elem,face,nodemap]=sortmesh(node(1,:), node,elem,1:4,face,1:3);


%====Calculate mesh quality
q = meshquality(node(:,1:3),elem(:,1:4));
subplot(1,2,1);
hist(q,100)

%====Visualize the resulting mesh
subplot(1,2,2);
%figure;
plotmesh(node(:,1:3),face(:,1:3),'y>250');
axis equal;
============

Thank you in advance,
Konstantinos

volmesh.png

Qianqian Fang

unread,
Jun 12, 2015, 3:56:42 PM6/12/15
to iso2mes...@googlegroups.com
On 06/12/2015 11:50 AM, Konstantinos Mountris wrote:
Dear Dr Fang,

Sorry for my late response. I tried out your recommendation for the sortmesh but i get the same mistake:

 can you try the latest (svn) version?


==========================
Error in sortmesh (line 31)
if(isempty(origin))

Output argument "fc" (and maybe others) not assigned during call to "/home/mood/MATLAB/iso2mesh/sortmesh.m>sortmesh".

Error in prostInBlock (line 63)
[node,elem,face,nodemap]=sortmesh(node(1,:), node,elem,1:4,face,1:3);
===================================
Also I would like to ask you regarding my new meshing efforts. I am trying to mesh also the space around the 3 objects.
I use vol2mesh and i get the mesh in the attached picture. Is there a way to isolate the 3 objects (no connections between them) and increase the quality? The min quality is 0.1.

you will have to extract the surface of each object, smooth them,
and merge again, then run s2m. This will give better quality.

Qianqian

Konstantinos Mountris

unread,
Jun 13, 2015, 11:00:34 PM6/13/15
to iso2mes...@googlegroups.com
Dear Dr Fang,
thanks for the support. Actually the example vol2mesh 3 with the head-brain image is exactly what i need. I imported the generated mesh in FeBio and i saw that the domains and their surfaces are differentiated. Exactly as I would like to be in my case. I need to mesh a block of tissue inside which there is the prostate the bladder and the rectum. I want to be able to differantiate the different domains and their surfaces. I try to use your example and modify it for my problem but unfortunately i get a Error using fgets
Invalid file identifier.  Use fopen to generate a valid file identifier. error and I cant understand why! Could you help me with this issue? Here is my script..


clc; clear all;

%====ISO2MESH location folder
addpath('/home/mood/Documents/MATLAB/iso2mesh')
addpath('/home/mood/Documents/MATLAB/Misc')

%====OpenImage
header = analyze75info('AYMANDJacques.hdr');
img = analyze75read(header);


% change souroundings value 0 -> 4
for u = 188:338

    for v = 213:303
        for w = 40:93
            if img(u,v,w)==0
                img(u,v,w)=4;
            end
        end
    end
end

%====Separate regions
tissue = (img==4);
tissue=fillholes3d(logical(tissue>0),10).*1;
prostate = (img==1).*1;
bladder = (img==2).*2;
rectum = (img==3).*3;

total=tissue+prostate+bladder+rectum;
total = total(185:343,210:306,37:96);

% create volumetric tetrahedral mesh from the two-layer 3D images
clear opt;

% by default, vol2mesh uses 'cgalsurf' method, which requires the following
opt(1,2,3,4).radbound=[4,2,2,2];
%opt(1,2,3,4).side=['lower','lower','lower','lower']; %


tic
[node,elem,face]=vol2mesh(total,1:size(total,1),1:size(total,2),1:size(total,3),opt,200,1);
toc


plotmesh(node(:,[2 1 3]),face,'facealpha',0.7);
mesh2abaqus(node,elem,'/home/mood/Documents/PHD_thesis/Models_Febio/MRI_atlas/Patient_1/AymandCT5.inp');

Best regards,
Konstantinos.


Τη Πέμπτη, 30 Απριλίου 2015 - 4:16:24 μ.μ. UTC+2, ο χρήστης Konstantinos Mountris έγραψε
Dear Dr Fang,

Qianqian Fang

unread,
Jun 13, 2015, 11:56:05 PM6/13/15
to iso2mes...@googlegroups.com
On 06/13/2015 11:00 PM, Konstantinos Mountris wrote:
Dear Dr Fang,
thanks for the support. Actually the example vol2mesh 3 with the head-brain image is exactly what i need. I imported the generated mesh in FeBio and i saw that the domains and their surfaces are differentiated. Exactly as I would like to be in my case. I need to mesh a block of tissue inside which there is the prostate the bladder and the rectum. I want to be able to differantiate the different domains and their surfaces. I try to use your example and modify it for my problem but unfortunately i get a Error using fgets
Invalid file identifier.  Use fopen to generate a valid file identifier. error and I cant understand why! Could you help me with this issue? Here is my script..

it's hard to debug without data. can you send me your data offline?
if the array is large, please down-sample it before sending.
also, matlab .mat file is preferred over analyze.

--
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.

Konstantinos Mountris

unread,
Jun 14, 2015, 6:25:39 AM6/14/15
to iso2mes...@googlegroups.com
Here is the img variable stored in matlab after loading the analyze file. I hope you will be able to debug it,
Thank you very much.
Best regards,
Konstantinos
image.mat

Qianqian Fang

unread,
Jun 15, 2015, 12:58:50 PM6/15/15
to iso2mes...@googlegroups.com
On 06/14/2015 06:25 AM, Konstantinos Mountris wrote:
Here is the img variable stored in matlab after loading the analyze file. I hope you will be able to debug it,

hi Konstantinos

here is my script:


load image.mat

% get bounding box range

[nbbx,fbbx]=binsurface(img>0);

% remove the background

img(img==4)=0;

% mesh the surface of the inclusions

[no,fc]=v2s(img,[],8,'cgalmesh');

% smooth the surface

newno=sms(no,fc,20,0.5,'lowpass');

% define a seed point for each region, the first is the background

% use the 4th number in each row to define the desired mesh density
% this needs the svn version of iso2mesh
seeds=[min(nbbx)+1 100;296,258,60 30;264,258,63 30;234,258,80 30];

% mesh the domain

[node,elem]=surf2mesh(newno,fc,min(nbbx),max(nbbx),1,[],seeds,[],1);

% plot the mesh

plotmesh(node,elem(elem(:,end)>1,:))
hold on;
hs=plotmesh(node,volface(elem(:,1:4)),'z<60','facealpha',0.3);

the output mesh plots are attached.

the mesh quality looks good to me (avg q=0.756).

I don't know how your Jacobian was calculated, and how is it related
to your mesh. If your modeling software still complains about Jacobians,
then I think it is best for you to understand the relationship between
the Jacobian and the mesh, for example, you need to use a denser
mesh. The mesh quality metric perhaps is irrelevant to the failure of
the modeling.


Qianqian

Thank you very much.
Best regards,
Konstantinos

Τη Πέμπτη, 30 Απριλίου 2015 - 4:16:24 μ.μ. UTC+2, ο χρήστης Konstantinos Mountris έγραψε:
Dear Dr Fang,

Currently I am improving my prostate FE model adding a mesh derived from clinical segmented ct images of the prostate the rectum and the bladder. As can been seen in the picture the 3 objects interesecting. I wanted to ask ou how is possible firstly to smooth the surface of the overall mesh and then specify the contact surfaces so we can set boundary conditions in these areas in the finite elements analysis. As i seen in the forum there are some problems with the merge_surfaces function. I need to use this or there is an alternative way?

Thank you in advance,
Konstantinos Mountris.
--
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.
prb_mesh.png
prb_mesh2.png

Konstantinos Mountris

unread,
Jun 16, 2015, 5:22:50 AM6/16/15
to iso2mes...@googlegroups.com
Hello Dr Fang,
I check your script and its working beautifully. Thank you.
However in my modeling i need to set specific constraints in the surfaces of the different regions. Is it possible to change the id of the faces of the regions to differentiate the surfaces of the materials.
What i need is to have for region 1 faces with id 1 for region 2  faces with id 2 etc.
In all my attempts so far this was my problem. I hope in your script to be able to fix this.

Best regards,
Konstantinos.


Τη Πέμπτη, 30 Απριλίου 2015 - 4:16:24 μ.μ. UTC+2, ο χρήστης Konstantinos Mountris έγραψε:

Konstantinos Mountris

unread,
Jun 16, 2015, 9:41:22 AM6/16/15
to iso2mes...@googlegroups.com
Dear Dr Fang,
Unfortunately I wasn't able to work around the problem of my last post. Are you aware of a way to specify manually and correctly the faces id?

Thank you in advance,

Konstantinos.

Τη Πέμπτη, 30 Απριλίου 2015 - 4:16:24 μ.μ. UTC+2, ο χρήστης Konstantinos Mountris έγραψε:

Qianqian Fang

unread,
Jun 16, 2015, 12:01:10 PM6/16/15
to iso2mes...@googlegroups.com
On 06/16/2015 05:22 AM, Konstantinos Mountris wrote:
Hello Dr Fang,
I check your script and its working beautifully. Thank you.
However in my modeling i need to set specific constraints in the surfaces of the different regions. Is it possible to change the id of the faces of the regions to differentiate the surfaces of the materials.
What i need is to have for region 1 faces with id 1 for region 2  faces with id 2 etc.

do not use the face output from surf2mesh. the faces of each
segment can be easily computed by

fc1=volface(elem(elem(:,end)==1,1:4));
fc2=volface(elem(elem(:,end)==2,1:4));
...

then

figure;
plotmesh(node,fc1)
figure;
plotmesh(node,fc2)
...

if you want to reorder the labels, simply reorder the rows of the
seeds array.

Qianqian

In all my attempts so far this was my problem. I hope in your script to be able to fix this.

Best regards,
Konstantinos.

Τη Πέμπτη, 30 Απριλίου 2015 - 4:16:24 μ.μ. UTC+2, ο χρήστης Konstantinos Mountris έγραψε:
Dear Dr Fang,

Currently I am improving my prostate FE model adding a mesh derived from clinical segmented ct images of the prostate the rectum and the bladder. As can been seen in the picture the 3 objects interesecting. I wanted to ask ou how is possible firstly to smooth the surface of the overall mesh and then specify the contact surfaces so we can set boundary conditions in these areas in the finite elements analysis. As i seen in the forum there are some problems with the merge_surfaces function. I need to use this or there is an alternative way?

Thank you in advance,
Konstantinos Mountris.
--
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.

Konstantinos Mountris

unread,
Jun 18, 2015, 5:11:40 AM6/18/15
to iso2mes...@googlegroups.com
Hello Dr Fang,
I check the commands and i can visualise the different parts of the mesh. Thank you.
The average quality is indeed 0.75 but the minimum quality is very small approximately 0.01 when normaly so far is around 0.15-0.20 which is a good value for my FE software (FeBio)
Also in the interface between the surfaces exist connecting tetrahedras ( the domains are not absolutely isolated). I couldnt repair this for different smoothing factors.

I tried alternatively to make the surface meshes of each domain separately and connect the them with the merge surf function but I get the following error.
"/tmp/iso2mesh-root/pre_surfbool1.gts" "/tmp/iso2mesh-root/pre_surfbool2.gts" -v >
"/tmp/iso2mesh-root/post_surfbool.off"
ERROR: set: surface `/tmp/iso2mesh-root/pre_surfbool1.gts' is not an orientable manifold

I am using the latest svn version of iso2mesh.

Thank you in advance,

Konstantinos.
Τη Πέμπτη, 30 Απριλίου 2015 - 4:16:24 μ.μ. UTC+2, ο χρήστης Konstantinos Mountris έγραψε:

Qianqian Fang

unread,
Jun 18, 2015, 6:26:01 PM6/18/15
to iso2mes...@googlegroups.com
On 06/18/2015 05:11 AM, Konstantinos Mountris wrote:
Hello Dr Fang,
I check the commands and i can visualise the different parts of the mesh. Thank you.
The average quality is indeed 0.75 but the minimum quality is very small approximately 0.01 when normaly so far is around 0.15-0.20 which is a good value for my FE software (FeBio)

it is common to have a small number of "poorly shaped" elements
and a Joe-lue=0.01 is not disastrous for most modeling software.

if your method is so sensitive to mesh quality, then I guess you
will have to find a good mesh optimization software. The meshing
utility, tetgen, used in surf2mesh uses "radius-edge ratio" internally
to measure  the mesh quality instead of Joe-Liu parameter. By
default, iso2mesh allows a maximum radius-edge ratio to 1.414.
This does not equal to a lower-bound in Joe-Liu measure. The
element quality control in tetgen is explained on pages 10-12 of
the manual:

http://wias-berlin.de/software/tetgen/1.5/doc/manual/manual.pdf



Also in the interface between the surfaces exist connecting tetrahedras ( the domains are not absolutely isolated). I couldnt repair this for different smoothing factors.

I intentionally kept the shared interface between the two of your
domains. I did not know you have to ask the two domains to have
non-overlapping surface. are you sure this is completely necessary?



I tried alternatively to make the surface meshes of each domain separately and connect the them with the merge surf function but I get the following error.
"/tmp/iso2mesh-root/pre_surfbool1.gts" "/tmp/iso2mesh-root/pre_surfbool2.gts" -v >
"/tmp/iso2mesh-root/post_surfbool.off"
ERROR: set: surface `/tmp/iso2mesh-root/pre_surfbool1.gts' is not an orientable manifold

mergesurf is experimental, and can not deal with such cases.

if you really need them to be separate, I would call v2s for each
inclusion, then, shrink them slightly towards their centroids by multiplying
a scaling factor to x/y/z, and then merge them. They should not touch
each other.

Qianqian



I am using the latest svn version of iso2mesh.

Thank you in advance,
Konstantinos.
Τη Πέμπτη, 30 Απριλίου 2015 - 4:16:24 μ.μ. UTC+2, ο χρήστης Konstantinos Mountris έγραψε:
Dear Dr Fang,

Currently I am improving my prostate FE model adding a mesh derived from clinical segmented ct images of the prostate the rectum and the bladder. As can been seen in the picture the 3 objects interesecting. I wanted to ask ou how is possible firstly to smooth the surface of the overall mesh and then specify the contact surfaces so we can set boundary conditions in these areas in the finite elements analysis. As i seen in the forum there are some problems with the merge_surfaces function. I need to use this or there is an alternative way?

Thank you in advance,
Konstantinos Mountris.
--
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.

Konstantinos Mountris

unread,
Jun 19, 2015, 4:12:44 AM6/19/15
to iso2mes...@googlegroups.com
Hello Dr Fang,
Indeed this is the workflow that I followed finally.
Instead of using the cgalmesh for the different domains surf mesh i used the cgalsurf option and i merged the 3 meshes after some correction for the dense cluster nodes.
I mesh the whole surface mesh using the seeds and keeping the bounding box and that was all.

One more question please. Could you explain me briefly the choice of the seeds for future use? Its just enough to be points in the different domains or their location is also important? Thank you in advance.

Best regards,

Konstantinos.


Τη Πέμπτη, 30 Απριλίου 2015 - 4:16:24 μ.μ. UTC+2, ο χρήστης Konstantinos Mountris έγραψε:

Qianqian Fang

unread,
Jun 19, 2015, 12:26:35 PM6/19/15
to iso2mes...@googlegroups.com
On 06/19/2015 04:12 AM, Konstantinos Mountris wrote:
Hello Dr Fang,
Indeed this is the workflow that I followed finally.
Instead of using the cgalmesh for the different domains surf mesh i used the cgalsurf option and i merged the 3 meshes after some correction for the dense cluster nodes.
I mesh the whole surface mesh using the seeds and keeping the bounding box and that was all.

ok, then the only thing left for you is to figure out whether it was really
the small number of poorly shaped elements that have caused the
modeling failure, or it was something else. Personally, I will be
surprised that it was the former case. Asking in FeBio's mailing
list, you should have a better idea.


One more question please. Could you explain me briefly the choice of the seeds for future use? Its just enough to be points in the different domains or their location is also important? Thank you in advance.

the location is not important, as long as the seed point is inside of
one of the surface components. for a collection of closed simple
surfaces, you can use surfseeds() to suggest seeds for each isolated
component.

Qianqian



Best regards,
Konstantinos.


Τη Πέμπτη, 30 Απριλίου 2015 - 4:16:24 μ.μ. UTC+2, ο χρήστης Konstantinos Mountris έγραψε:
Dear Dr Fang,

Currently I am improving my prostate FE model adding a mesh derived from clinical segmented ct images of the prostate the rectum and the bladder. As can been seen in the picture the 3 objects interesecting. I wanted to ask ou how is possible firstly to smooth the surface of the overall mesh and then specify the contact surfaces so we can set boundary conditions in these areas in the finite elements analysis. As i seen in the forum there are some problems with the merge_surfaces function. I need to use this or there is an alternative way?

Thank you in advance,
Konstantinos Mountris.
--
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.

Konstantinos Mountris

unread,
Jul 2, 2015, 4:00:43 AM7/2/15
to iso2mes...@googlegroups.com
Hello Dr Fang,
I hope this finds you well. Lately I am using the mesh generated with this method quite efficiently. I exported it in abaqus format using mesh2abaqus function and imported it in febio. While every domain inside the bounding box is differentiable and i can give different material properties, however the surfaces of the domains are not exist or at least cant be differentiated. Do you have any ideas how this can be approached? I miss something in my meshing script or it can be possibly a restriction of febio or the abaqus format?

Thank you in advance,

Konstantinos.

Τη Πέμπτη, 30 Απριλίου 2015 - 4:16:24 μ.μ. UTC+2, ο χρήστης Konstantinos Mountris έγραψε:

Qianqian Fang

unread,
Jul 4, 2015, 4:21:50 PM7/4/15
to iso2mes...@googlegroups.com
On 07/02/2015 04:00 AM, Konstantinos Mountris wrote:
Hello Dr Fang,
I hope this finds you well. Lately I am using the mesh generated with this method quite efficiently. I exported it in abaqus format using mesh2abaqus function and imported it in febio. While every domain inside the bounding box is differentiable and i can give different material properties, however the surfaces of the domains are not exist or at least cant be differentiated.

I don't understand what this means. can you explain?

Qianqian

Do you have any ideas how this can be approached? I miss something in my meshing script or it can be possibly a restriction of febio or the abaqus format?

Thank you in advance,
Konstantinos.

Τη Πέμπτη, 30 Απριλίου 2015 - 4:16:24 μ.μ. UTC+2, ο χρήστης Konstantinos Mountris έγραψε:
Dear Dr Fang,

Currently I am improving my prostate FE model adding a mesh derived from clinical segmented ct images of the prostate the rectum and the bladder. As can been seen in the picture the 3 objects interesecting. I wanted to ask ou how is possible firstly to smooth the surface of the overall mesh and then specify the contact surfaces so we can set boundary conditions in these areas in the finite elements analysis. As i seen in the forum there are some problems with the merge_surfaces function. I need to use this or there is an alternative way?

Thank you in advance,
Konstantinos Mountris.
--
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.

Konstantinos Mountris

unread,
Jul 7, 2015, 3:27:48 AM7/7/15
to iso2mes...@googlegroups.com
Dear Dr Fang,
sorry for my late response. In my previous mail I was meaning that in the scenario where the bounding box is not contained in the mesh I have 3 seperated organs and by exporting the mesh using mesh2abaqus the domains are labeled with different labels so I can set body loads and conditions and same happens with the surfaces allowing me to set boundary conditions on the surfaces of the domains. If I keep the bounding box now i have 4 different domains and i can give different properties but I missing the surface information. The only surfaces I can interact with are the edges of the bounding box. If I ispect the mesh in FeBio I can see that the three domains are pure tetrahedra without the triangulated surface. I hope the last sentence didn't confused you.
NoSurfaces.png

Qianqian Fang

unread,
Jul 7, 2015, 12:13:53 PM7/7/15
to iso2mes...@googlegroups.com
On 07/07/2015 03:27 AM, Konstantinos Mountris wrote:
Dear Dr Fang,
sorry for my late response. In my previous mail I was meaning that in the scenario where the bounding box is not contained in the mesh I have 3 seperated organs and by exporting the mesh using mesh2abaqus the domains are labeled with different labels so I can set body loads and conditions and same happens with the surfaces allowing me to set boundary conditions on the surfaces of the domains. If I keep the bounding box now i have 4 different domains and i can give different properties but I missing the surface information.

I think your real question was how FeBio defines loads/boundary
conditions on an interior boundary. When you add a bounding
box, all organ surfaces become interior boundaries, but they do
not disappear. You should still be able to access them by inspecting
the boundaries of each label (in matlab, you can use volface() in
iso2mesh to extract these interior boundaries, but again, I think
your question is how to let FeBio to pick up these boundaries).

If this is correct, I think the best place for you to get answers is
the FeBio forum.

http://mrlforums.sci.utah.edu/forums/forumdisplay.php?1-FEBio-Forums


The only surfaces I can interact with are the edges of the bounding box. If I ispect the mesh in FeBio I can see that the three domains are pure tetrahedra without the triangulated surface. I hope the last sentence didn't confused you.

again, this really seems to me is an FeBio issue. You should figure
out how to define/import the interior boundaries and set the BC
there. An FeBio developer should give you some directions.

Qianqian


Τη Πέμπτη, 30 Απριλίου 2015 - 4:16:24 μ.μ. UTC+2, ο χρήστης Konstantinos Mountris έγραψε:
Dear Dr Fang,

Currently I am improving my prostate FE model adding a mesh derived from clinical segmented ct images of the prostate the rectum and the bladder. As can been seen in the picture the 3 objects interesecting. I wanted to ask ou how is possible firstly to smooth the surface of the overall mesh and then specify the contact surfaces so we can set boundary conditions in these areas in the finite elements analysis. As i seen in the forum there are some problems with the merge_surfaces function. I need to use this or there is an alternative way?

Thank you in advance,
Konstantinos Mountris.
--
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.
Reply all
Reply to author
Forward
0 new messages