need a help to mesh tiff images from X-ray CT

188 views
Skip to first unread message

Jaona Randrianalisoa

unread,
Nov 23, 2014, 7:31:20 AM11/23/14
to iso2mes...@googlegroups.com
Dear Prof. Fang,

I am a new user of Iso2mesh and before of all, I want to say "thank you a lot for making this code available to us."

Although I read careffuly the user guide and have take a look on various samples, i do not arrive to mesh my images as i expected. 

So let me introduce you my problem, I have a 3D tif image from X-ray CT after using ImagJ for binarization (you can download the source file of the image at http://esuptools.univ-reims.fr/esup-filex/getfilex.php?hash=689b8fa936b6708b4254408bfd973e21) and I want to mesh both black and white colors of the image with tetrahedral elements and i want to separate them into 2 regions/domains (region 1 for the white color and region 2 for the black corlo) and export the mesh into abaqus format. I tried the following script:

%-------------------------------------------------------------
for i=1:256
  test_f3(:,:,i)=imread('test_f3.tif',i);
end

[node,elem,face]=v2m(test_f3,0.5,5,100);

saveabaqus(node,face,elem,'test_f3.inp')

plotmesh(node(:,[2 1 3]),face,'facealpha',0.7);

%--------------------------------------------------------------

This script works but it meshes only the white region. So, could you give me some advises how to mesh both white and black regions of the images and separate them into 2 element sets in abaqus file?

Thank you by advance.

Best regards,

Jaona Randrianalisoa
Assist. Prof. University of Reims, France

Qianqian Fang

unread,
Nov 23, 2014, 11:25:35 AM11/23/14
to iso2mes...@googlegroups.com
hi Jaona

to generate a mesh for your input, you need to use the 'cgalmesh'
option in v2m. Here is my sample code:

[node,elem,face]=v2m(test_f3+1,[],5,10,'cgalmesh');
plotmesh(node(:,1:3),elem,'z<150');
hold on;
plotmesh(node(:,1:3),elem(elem(:,end)==1,:));
the output mesh screenshot is attached.

there was another workflow: binsurface->meshresample->surf2mesh,
however, the appearance of self-intersecting elements
after the meshresample often makes the last step impossible.
When it works, you can get something like these in the
mesh gallery:

http://iso2mesh.sourceforge.net/upload/vessel_mesh_surface.png
http://iso2mesh.sourceforge.net/upload/vessel_mesh_cut.png


Qianqian



Thank you by advance.

Best regards,

Jaona Randrianalisoa
Assist. Prof. University of Reims, France
--
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.

mesh_with_tubes.png

Jaona Randrianalisoa

unread,
Nov 23, 2014, 11:49:19 AM11/23/14
to iso2mes...@googlegroups.com
Dear Fang,

That really I want to obtain. I made some tests and the results are satisfactorily. So, thank you very much for your quick reply and i expect that this forum will continue as efficient like today.

Best regards,

Jaona

Jaona Randrianalisoa

unread,
Nov 29, 2014, 10:20:54 AM11/29/14
to iso2mes...@googlegroups.com
Dear Fang,

After one week of tests with v2m function, I would like to test the second workflow that you suggested (binsurface->meshresample->surf2mesh) because although the direct volume meshing with v2m is successful, this last provides a very rough surface between 2 regions however, i would like to obtain a surface slightly smooth (at least at the scale of the voxels).

So, could you give me some helps (or do you have script that i can be used/modify for this workflow) to mesh my CT images?

Thank you by advance,

Best regards,

Jaona

Qianqian Fang

unread,
Nov 30, 2014, 12:20:18 AM11/30/14
to iso2mes...@googlegroups.com
On 11/29/2014 10:20 AM, Jaona Randrianalisoa wrote:
Dear Fang,

After one week of tests with v2m function, I would like to test the second workflow that you suggested (binsurface->meshresample->surf2mesh) because although the direct volume meshing with v2m is successful, this last provides a very rough surface between 2 regions however, i would like to obtain a surface slightly smooth (at least at the scale of the voxels).

have you read this reply I posted previously to a similar question?

https://groups.google.com/d/msg/iso2mesh-users/NxYnW6imZSo/tvxoyBabPUUJ

to get a smoother interface between labels, you may apply a moderate
surface smoothing before calling surf2mesh.

let me know if this route works for you. The binsurface->.. route
is a harder path as it is very sensitive to the appearance of
self-intersecting elements.

Alternatively, if you know your domain will only contain non-intersecting
robs of known sizes and orientations, you may be able to solve
for the analytical equations for the intersecting profiles (a bunch
of ellipses) of each rod along the bounding box,
then you can use the "direct PLC" approach supported in
tetgen/iso2mesh to produce a high quality mesh. This will give
you the highest level control in boundary accuracy. Please
check out the iso2mesh/sample/demo_directplc_ex1.m
script as an example.

Qianqian


So, could you give me some helps (or do you have script that i can be used/modify for this workflow) to mesh my CT images?

Thank you by advance,

Best regards,

Jaona



On Sunday, November 23, 2014 1:31:20 PM UTC+1, Jaona Randrianalisoa wrote:
Dear Prof. Fang,

I am a new user of Iso2mesh and before of all, I want to say "thank you a lot for making this code available to us."

Although I read careffuly the user guide and have take a look on various samples, i do not arrive to mesh my images as i expected. 

So let me introduce you my problem, I have a 3D tif image from X-ray CT after using ImagJ for binarization (you can download the source file of the image at http://esuptools.univ-reims.fr/esup-filex/getfilex.php?hash=689b8fa936b6708b4254408bfd973e21) and I want to mesh both black and white colors of the image with tetrahedral elements and i want to separate them into 2 regions/domains (region 1 for the white color and region 2 for the black corlo) and export the mesh into abaqus format. I tried the following script:

%-------------------------------------------------------------
for i=1:256
  test_f3(:,:,i)=imread('test_f3.tif',i);
end

[node,elem,face]=v2m(test_f3,0.5,5,100);

saveabaqus(node,face,elem,'test_f3.inp')

plotmesh(node(:,[2 1 3]),face,'facealpha',0.7);

%--------------------------------------------------------------

This script works but it meshes only the white region. So, could you give me some advises how to mesh both white and black regions of the images and separate them into 2 element sets in abaqus file?

Thank you by advance.

Best regards,

Jaona Randrianalisoa
Assist. Prof. University of Reims, France
--
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.

Jaona Randrianalisoa

unread,
Dec 1, 2014, 12:47:32 PM12/1/14
to iso2mes...@googlegroups.com
Dear Qianqian,

I tried to run the script that you posted here: https://groups.google.com/d/msg/iso2mesh-users/NxYnW6imZSo/tvxoyBabPUUJ with my own source image but to my surprise, the meshed images (the two figures on the right side, see enclosed) do not correspond to mine. I checked the code but i do not see where is wrong. Here is the program that i used:

clear all;

% READ  a binary image from CT after binarization by ImageJ 
for i=1:256
  test_f3(:,:,i)=imread('test_f3.tif',i);
end

%Mesh a binary image which consists of multi-domains (black and white
%colors)
[no,el,fc]=v2m(test_f3+1,[],5,10,'cgalmesh');

% cgalmesh returns two facts for each triangle, remove duplicates
newfc=unique(sort(fc(:,1:3),2),'rows');
% smoothing the surface group
newno=sms(no(:,1:3),newfc(:,1:3),20,0.5);
% create volumetric mesh from the smoothed surfaces
seeds=repmat([35 25 15 5]',1,3)/sqrt(3); % use to label the region
[node,elem,face]=surf2mesh(newno(:,1:3),newfc,[],[],1,2,seeds);

subplot(221)
plotmesh(no(:,1:3),newfc,'x>y')
%view([0 1 0])

subplot(222)
plotmesh(node(:,1:3),face(:,1:3),'x>y')     
%view([0 1 0])

subplot(223)
plotmesh(no(:,1:3),el,'x>y')
%view([-1 1 0])

subplot(224)
plotmesh(node(:,1:3),elem,'x>y')
%view([-1 1 0])

Please, Could you checked what is wrong ??

Best regards,
Jaona



On Sunday, November 23, 2014 1:31:20 PM UTC+1, Jaona Randrianalisoa wrote:
result.jpg
Reply all
Reply to author
Forward
0 new messages