Display mesh quality of tetrahedral mesh

139 views
Skip to first unread message

Konstantinos Mountris

unread,
Mar 23, 2015, 9:44:55 AM3/23/15
to iso2mes...@googlegroups.com
Dear Dr Fang,

I am using ISO2MESH for my work in the prostate modeling. Similar to another post I want to importh the mesh in FeBio for analysis. It supports abaqus format so i use an external script
mesh2abaqus to export the mesh in *.inp format. However I have problems too with negative Jacobians. I tried to use the mesh quality function to check the mesh's quality but it gives me this error:
=====================================================
Error using horzcat
Dimensions of matrices being concatenated are not consistent.

Error in elemvolume (line 27)
        e1=det([node(elem(i,:),2),node(elem(i,:),3),acol]);

Error in meshquality (line 32)
vol=elemvolume(node,elem);

Error in meshing_prostate (line 37)
quality=meshquality(face,newelem);
 =========================================================

I guess the problem is because the node is 610*4 array and the newelem a 1588*5 array.

Are you aware with this problem and how i could overcome it?
Thank you in advance for your response. Your answer in a past question of mine was very helpful.

Best regards,
Konstantinos Mountris.

Qianqian Fang

unread,
Mar 23, 2015, 11:37:06 AM3/23/15
to iso2mes...@googlegroups.com
hi Konstantinos

as specified in the help info of meshquality.m, the input must
be Nx3 for node, and Nx4 for elem. see

https://github.com/fangq/iso2mesh/blob/master/meshquality.m#L11-L12

if your node/elem have more columns (label columns), you need
to remove them before passing on to meshquality, i.e. use

q=meshquality(node(:,1:3),elem(:,1:4));

also, in your error message, it appears that your input is "face"
and "newelem". is the first parameter a typo?

Qianqian



Best regards,
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,
Mar 23, 2015, 12:14:28 PM3/23/15
to iso2mes...@googlegroups.com
Dear Dr Fang,
thank you for your help. I did as you mentioned and it is working fine. The name vairables were not the appropriate in the previous message due to some test. Sorry for that.

I check the quality and the minumum is 0.1503, It's not so far from zero. What is a good quality in average? Something more than 0.3?

Thank you very much.

Qianqian Fang

unread,
Mar 23, 2015, 1:29:17 PM3/23/15
to iso2mes...@googlegroups.com
On 03/23/2015 12:14 PM, Konstantinos Mountris wrote:
Dear Dr Fang,
thank you for your help. I did as you mentioned and it is working fine. The name vairables were not the appropriate in the previous message due to some test. Sorry for that.

I check the quality and the minumum is 0.1503, It's not so far from zero. What is a good quality in average? Something more than 0.3?

generally, iso2mesh (and the internally used meshing utilities, tetgen/CGAL)
produces good quality meshes by default. I often see the average around
0.7-0.8. For example

http://mcx.sf.net/cgi-bin/index.cgi?MMC/DigimouseMesh#How_is_this_mesh_different_from_Digimouse_tessellated_atlas

I've never seen anything below 0.5.

0.3 sounds too low. I again suspect there might be some input errors. but
if you attach the histogram of the quality, I may have a better idea.

Qianqian



Thank you very much.

Τη Δευτέρα, 23 Μαρτίου 2015 - 2:44:55 μ.μ. UTC+1, ο χρήστης Konstantinos Mountris έγραψε:
Dear Dr Fang,

I am using ISO2MESH for my work in the prostate modeling. Similar to another post I want to importh the mesh in FeBio for analysis. It supports abaqus format so i use an external script
mesh2abaqus to export the mesh in *.inp format. However I have problems too with negative Jacobians. I tried to use the mesh quality function to check the mesh's quality but it gives me this error:
=====================================================
Error using horzcat
Dimensions of matrices being concatenated are not consistent.

Error in elemvolume (line 27)
        e1=det([node(elem(i,:),2),node(elem(i,:),3),acol]);

Error in meshquality (line 32)
vol=elemvolume(node,elem);

Error in meshing_prostate (line 37)
quality=meshquality(face,newelem);
 =========================================================

I guess the problem is because the node is 610*4 array and the newelem a 1588*5 array.

Are you aware with this problem and how i could overcome it?
Thank you in advance for your response. Your answer in a past question of mine was very helpful.

Best regards,
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.

Konstantinos Mountris

unread,
Mar 24, 2015, 4:28:40 AM3/24/15
to iso2mes...@googlegroups.com
Dear Dr Fang,
sorry for the late response. I am pasting below my script and attach an image of the histogram! Thank you in advance.

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

%==Configuring parameters
ix = 1:size(img,1);
iy = 1:size(img,2);
iz = 1:size(img,3);
clear opt
opt.radbound=5;     %   max radius of Delauny sphere for 'cgalmesh'
maxvol = 500;
dofix = 1;      %   0: no mesh repair, 1: mesh repair
method = 'cgalmesh';     % input must be uint8
%isovalues;

%==Tetrahedral mesh calculation
[node,elem,face]=vol2mesh(img,ix,iy,iz,opt,maxvol,dofix,method);

newelem = meshreorient(node(:,1:3),elem(:,1:4));

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




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



%==EXPORT
saveabaqus(node(:,1:3),elem(:,1:4),'C:\Users\Tino\Documents\MATLAB\prostate.inp');

quality_graph.bmp

Qianqian Fang

unread,
Mar 25, 2015, 5:29:04 PM3/25/15
to iso2mes...@googlegroups.com
On 03/24/2015 04:28 AM, Konstantinos Mountris wrote:
Dear Dr Fang,
sorry for the late response. I am pasting below my script and attach an image of the histogram! Thank you in advance.

ok, the scripts looks fine to me. The mesh quality histogram looks fine too.
My earlier comments on the expected quality were based on the
memories for meshing parameters using tetgen. For cgalmesh, the
default input parameters were set to a different quality level. You may
change the mesh quality by setting opt.radbound/opt.angbound and opt.distbound
to improve the quality. The explanations of these parameters can be found here

http://doc.cgal.org/latest/Surface_mesher/index.html#title3

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.
Reply all
Reply to author
Forward
0 new messages