CGAL绑定(Python):Mesh_3示例

CGAL绑定(Python):Mesh_3示例,python,swig,mesh,image-segmentation,cgal,Python,Swig,Mesh,Image Segmentation,Cgal,是否有专门针对Mesh_3示例的cgal python绑定实现?我一直在尝试开始使用它,但似乎不是所有的类都是通过swig公开的,精确谓词\u不精确构造\u内核和网格域必须定义,但不是CGAL.CGAL\u网格3模块的一部分。多谢各位 mesh_3D_image.cpp: #include <CGAL/Exact_predicates_inexact_constructions_kernel.h> #include <CGAL/Mesh_tria

是否有专门针对Mesh_3示例的cgal python绑定实现?我一直在尝试开始使用它,但似乎不是所有的类都是通过swig公开的,
精确谓词\u不精确构造\u内核
网格域
必须定义,但不是
CGAL.CGAL\u网格3
模块的一部分。多谢各位

mesh_3D_image.cpp:

    #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
    #ifdef CGAL_CONCURRENT_MESH_3
      typedef CGAL::Mesh_triangulation_3<
        Mesh_domain,
        CGAL::Kernel_traits<Mesh_domain>::Kernel, // Same as sequential
        CGAL::Parallel_tag                        // Tag to activate parallelism
      >::type Tr;
    #else
      typedef CGAL::Mesh_triangulation_3<Mesh_domain>::type Tr;
    #endif
    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;
    }
#包括
#包括
#包括
#包括
#包括
#包括
#包括
//领域
typedef CGAL::精确谓词不精确结构内核K;
typedef CGAL::标记的\u图像\u网格\u域\u 3网格\u域;
//三角测量
#ifdef CGAL_并发网格_3
typedef CGAL::网格_三角剖分_3<
网格(u)域,,
CGAL::Kernel\u traits::Kernel,//与sequential相同
CGAL::Parallel_标记//激活并行的标记
>::Tr型;
#否则
typedef CGAL::Mesh_triangulation_3::type Tr;
#恩迪夫
typedef CGAL::网格复杂度3英寸三角测量C3t3;
//标准
typedef CGAL::Mesh_标准\u 3 Mesh_标准;
//避免冗长的函数和命名参数调用
使用名称空间CGAL::参数;
int main()
{
//加载图像
CGAL::Image_3 Image;
image.read(“data/liver.inr.gz”);
//领域
Mesh_域(图像);
//网格标准
网格标准(小平面角度=30,小平面尺寸=6,小平面距离=4,
单元半径与边缘比=3,单元大小=8);
//啮合
C3t3 C3t3=CGAL::生成网格3(域、标准);
//输出
std::流媒体文件(“out.mesh”);
c3t3.将_输出到_medit(medit_文件);
返回0;
}

唯一缺少的是可以处理分割图像的mesh domain类(类似于
SWIG\u CGAL/mesh\u 3/mesh\u domains.h

然后需要更新接口文件
SWIG\u CGAL/Mesh\u 3/CGAL\u Mesh\u 3.i
并将调用复制到 声明\全局\函数\域,并声明\全局\函数\域\用于此网格域的条件