Skip to Content.
Sympa Menu

cgal-discuss - Re: [cgal-discuss] MRI brain meshing

Subject: CGAL users discussion list

List archive

Re: [cgal-discuss] MRI brain meshing


Chronological Thread 
  • From: elhassan Abdou <>
  • To:
  • Subject: Re: [cgal-discuss] MRI brain meshing
  • Date: Thu, 8 Dec 2011 11:28:06 +0100

This snippet of code is a Part of Voreen code. I first generated binary
image mask of the brain(I do not have a full atlas of the brain) , so my data
are voxels with zeros and 10. 10 represents the brain mask, and zero is empty
space. I am sure the entire brain is totally fill with no holes inside it
except in a region that I made.(which is the aim of my project).
this the including part in the my .h
#include <CGAL/Exact_predicates_inexact_constructions_kernel.h>

#include <CGAL/Mesh_triangulation_3.h>
#include <CGAL/Mesh_complex_3_in_triangulation_3.h>
#include <CGAL/Mesh_criteria_3.h>

#include <CGAL/Labeled_image_mesh_domain_3.h>
#include <CGAL/make_mesh_3.h>
#include <CGAL/Image_3.h>
// Domain
typedef CGAL::Exact_predicates_inexact_constructions_kernel K;
typedef CGAL::Labeled_image_mesh_domain_3<CGAL::Image_3,K> Mesh_domain;

// Triangulation
typedef CGAL::Mesh_triangulation_3<Mesh_domain>::type Tr;
typedef CGAL::Mesh_complex_3_in_triangulation_3<Tr> C3t3;

// Mesh Criteria
typedef CGAL::Mesh_criteria_3<Tr> Mesh_criteria;

using namespace CGAL::parameters;

using tgt::vec3;
using tgt::vec4;


************************************************

The actual process is starting here by putting the data in one dimensional
array and send it to make_mesh_3
leadadd();

//generate tetrahedron
const tgt::svec3 outputdim = outputVolume_->getDimensions();
const Volume* outputVolume =
outputVolume_->getRepresentation<Volume>();
unsigned int i,j,k;
uint8_t *volumearray =new uint8_t[18874368];
/*for (k=0; k<(outputdim.z); k++) {
for (j=0; j<(outputdim.y); j++) {
for (i=0; i<(outputdim.x); i++) {

volumearray[k*outputdim.x*outputdim.y+j*outputdim.x+i]=outputVolume->getVoxelFloat(i,j,k);
}
}
}*/
for(size_t i=0;i<outputVolume->getNumVoxels();i++)

volumearray[i]=static_cast<uint8_t>(outputVolume->getVoxelFloat(i));
std::cout<<volumearray[500];
CGAL::Image_3 image(_createImage(outputdim.x, outputdim.y,
outputdim.z, 1, 0.585938, 0.585938, 2, sizeof(uint8_t),
WK_FIXED,SGN_UNSIGNED));
ImageIO_free(image.data());
image.set_data(volumearray);
Mesh_domain domain(image);
// Mesh criteria
Mesh_criteria criteria(facet_angle=30,
facet_distance=4,cell_radius_edge=3);

// Mesh generation and optimization in one call
C3t3 c3t3 = CGAL::make_mesh_3<C3t3>(domain, criteria,
CGAL::parameters::no_features(),
lloyd(time_limit=30),
exude(time_limit=10,
sliver_bound=10));
std::ofstream
medit_file("/Users/elhassanabdou/voreen/svnvoreen/trunk/out.mesh");
c3t3.output_to_medit(medit_file);
//end of generation
outport_.setData(outputVolume_);

Thanks in advance
Elhassan
On Dec 8, 2011, at 11:14 AM, Laurent Rineau (GeometryFactory) wrote:

> Le jeudi 08 décembre 2011 11:08:55 elhassan Abdou a écrit :
>> Dear ALL
>>
>> I attached in the mail a slice from the mri volume that I need to mesh. The
>> slice has some 90 degree angles resulted from segmentation. I tried to use
>> make_mesh_3 to generate tetrahedron for this but it does not work. I did
>> not use any optimization in mesh criteria.
>>
>> DO I miss something in the delaunay triangulation. I thought yesterday that
>> I should find away to control the divide and conquer during the mesh
>> generation. but I am not sure if this is right or wrong although I do not
>> have too much experience in the 3d delaunay triangulation.
>
> Please, send us your code, or some parts of the code (that use CGAL), and
> the
> data, or at least the header fields of your data.
>
> With that information, there is a chance that we can give you an answer.
>
> If the files are bigger than.. say 10Ko, please do not send the files as
> attachment to the mailing list. Post it to a dedicated web site (dropbox
> for
> example), or send the files directly to me (to avoid spamming the whole
> list
> with big attachments).
>
> --
> Laurent Rineau, PhD
> R&D Engineer at GeometryFactory http://www.geometryfactory.com/
> Release Manager of the CGAL Project http://www.cgal.org/
>
>
> --
> You are currently subscribed to cgal-discuss.
> To unsubscribe or access the archives, go to
> https://lists-sop.inria.fr/wws/info/cgal-discuss
>

Elhassan Abdou
Computational Science master student
Uppsala





Archive powered by MHonArc 2.6.16.

Top of Page