Question

Im trying to do a finite element analysis for the Aorta of a pacient and i have a cloud of 3d points :

XYZ = array([[  23.4929,  126.6431,   78.2083],
             [  23.505 ,  123.2618,   76.1998],
             [  23.52  ,  124.356 ,   80.4145],
             ..., 
             [116.4752,  136.5604,   79.988 ],
             [ 107.8206,  136.9329,   73.7108],
             [ 154.0807,   91.6834,   91.9668]])

Visualization:

![Aorta][1] [1]: http://i.stack.imgur.com/U25dM.png


For that i need to get the following arrays:

elem = {tetrahedrons made of 4 indexes}
faces = {triangules made of 3 indexes}

But my question is:

How can i get, using CGAL-bindings (for Python), the 3d triangulation of the point cloud and then get the tetrahedrons and triangles for the Mesh?

I already tried but the resulting 3d triangulation has indexes out of the len(XYZ) making no sense (result max index = 12000 vs len(XYZ) = 1949).

If someone that already used CGAL-bindings for python can help me with how to use it for this purpose or help me to comprehend the C++ code from CGAL Mesh Generation Examples, please :(.

http://doc.cgal.org/latest/Mesh_3/index.html#Chapter_3D_Mesh_Generation

#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;
// Criteria
typedef CGAL::Mesh_criteria_3<Tr> Mesh_criteria;
// To avoid verbose function and named parameters call
using namespace CGAL::parameters;
int main()
{
  // Loads image
  CGAL::Image_3 image;
  image.read("data/liver.inr.gz");
  // Domain    
  Mesh_domain domain(image);
  // Mesh criteria
  Mesh_criteria criteria(facet_angle=30, facet_size=6, facet_distance=4,
                     cell_radius_edge_ratio=3, cell_size=8);
  // Meshing
  C3t3 c3t3 = CGAL::make_mesh_3<C3t3>(domain, criteria);
  // Output
  std::ofstream medit_file("out.mesh");
  c3t3.output_to_medit(medit_file);
  return 0;
}

No correct solution

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top