From 8700846451458b8c32f8fcb28941a5b89a6b91be Mon Sep 17 00:00:00 2001 From: Jane Tournois Date: Thu, 21 Jan 2016 10:04:17 +0100 Subject: [PATCH 1/4] remove deprecated binder1st from Mesh_3/test --- Mesh_3/test/Mesh_3/test_meshing_3D_gray_image.cpp | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/Mesh_3/test/Mesh_3/test_meshing_3D_gray_image.cpp b/Mesh_3/test/Mesh_3/test_meshing_3D_gray_image.cpp index d7d09a9176f..bdc8d7b58ac 100644 --- a/Mesh_3/test/Mesh_3/test_meshing_3D_gray_image.cpp +++ b/Mesh_3/test/Mesh_3/test_meshing_3D_gray_image.cpp @@ -32,6 +32,16 @@ // To avoid verbose function and named parameters call using namespace CGAL::parameters; +template +struct Greater_than { + typedef T argument_type; + Greater_than(const T& second) : second(second) {} + bool operator()(const T& first) const { + return std::greater()(first, second); + } + T second; +}; + template struct Image_tester : public Tester { @@ -44,7 +54,7 @@ public: Image, K_e_i, Image_word_type, - std::binder1st< std::less > > Mesh_domain; + Greater_than > Mesh_domain; typedef typename CGAL::Mesh_triangulation_3< Mesh_domain, @@ -70,7 +80,7 @@ public: // Domain Mesh_domain domain(image, - std::bind1st(std::less(), 2.9f),//transform + 2.9f, //isovalue 0.f, //value_outside 1e-3, //error_bound &CGAL::default_random);//random generator for determinism From 790c4d68aa5c7250d4a1a055a2de5c8c09b9b164 Mon Sep 17 00:00:00 2001 From: Jane Tournois Date: Thu, 21 Jan 2016 10:44:39 +0100 Subject: [PATCH 2/4] change default template parameter in 3D gray images, it's very likely that the area of interest is the area where voxels have high values associated --- Mesh_3/examples/Mesh_3/mesh_3D_gray_image.cpp | 13 +--------- .../include/CGAL/Gray_image_mesh_domain_3.h | 25 +++++++++---------- 2 files changed, 13 insertions(+), 25 deletions(-) diff --git a/Mesh_3/examples/Mesh_3/mesh_3D_gray_image.cpp b/Mesh_3/examples/Mesh_3/mesh_3D_gray_image.cpp index 3f9c1b5ffc6..9350bb6cba4 100644 --- a/Mesh_3/examples/Mesh_3/mesh_3D_gray_image.cpp +++ b/Mesh_3/examples/Mesh_3/mesh_3D_gray_image.cpp @@ -35,21 +35,10 @@ typedef float Image_word_type; -template -struct Greater_than { - typedef T argument_type; - Greater_than(const T& second) : second(second) {} - bool operator()(const T& first) const { - return std::greater()(first, second); - } - T second; -}; - // Domain typedef CGAL::Exact_predicates_inexact_constructions_kernel K; typedef CGAL::Gray_image_mesh_domain_3 > Mesh_domain; + Image_word_type> Mesh_domain; // Triangulation typedef CGAL::Mesh_triangulation_3::type Tr; diff --git a/Mesh_3/include/CGAL/Gray_image_mesh_domain_3.h b/Mesh_3/include/CGAL/Gray_image_mesh_domain_3.h index 039188eb009..9d351af7714 100644 --- a/Mesh_3/include/CGAL/Gray_image_mesh_domain_3.h +++ b/Mesh_3/include/CGAL/Gray_image_mesh_domain_3.h @@ -28,19 +28,20 @@ #include #include -#include namespace CGAL { namespace internal { -template -struct Less_than { - typedef T argument_type; - Less_than(const T& second) : second(second) {} - bool operator()(const T& first) const { return std::less()(first, second); } - T second; -}; + template + struct Greater_than { + typedef T argument_type; + Greater_than(const T& second) : second(second) {} + bool operator()(const T& first) const { + return std::greater()(first, second); + } + T second; + }; } @@ -52,7 +53,7 @@ struct Less_than { template, + typename Transform = internal::Greater_than, typename Subdomain_index = int> class Gray_image_mesh_domain_3 : public Labeled_mesh_domain_3< @@ -80,8 +81,7 @@ public: /// Constructor Gray_image_mesh_domain_3(const Image& image, const Image_word_type iso_value, - const Image_word_type value_outside = - (std::numeric_limits::max)(), + const Image_word_type value_outside = 0., const FT& error_bound = FT(1e-3), CGAL::Random* p_rng = NULL) : Base(Wrapper(image, @@ -94,8 +94,7 @@ public: Gray_image_mesh_domain_3(const Image& image, const Transform& transform, - const Image_word_type value_outside = - (std::numeric_limits::max)(), + const Image_word_type value_outside = 0., const FT& error_bound = FT(1e-3), CGAL::Random* p_rng = NULL) : Base(Wrapper(image, transform, value_outside), From 845fc80bef208b9b690f3ead8a0ac4137e607cf0 Mon Sep 17 00:00:00 2001 From: Jane Tournois Date: Thu, 21 Jan 2016 11:59:38 +0100 Subject: [PATCH 3/4] improve documentation of Gray_image_mesh_domain_3 --- Mesh_3/doc/Mesh_3/CGAL/Gray_image_mesh_domain_3.h | 14 ++++++++------ Mesh_3/doc/Mesh_3/Mesh_3.txt | 9 +++++++++ 2 files changed, 17 insertions(+), 6 deletions(-) diff --git a/Mesh_3/doc/Mesh_3/CGAL/Gray_image_mesh_domain_3.h b/Mesh_3/doc/Mesh_3/CGAL/Gray_image_mesh_domain_3.h index 3dfabf18aec..ea5e789f463 100644 --- a/Mesh_3/doc/Mesh_3/CGAL/Gray_image_mesh_domain_3.h +++ b/Mesh_3/doc/Mesh_3/CGAL/Gray_image_mesh_domain_3.h @@ -8,7 +8,8 @@ gray image. A 3D gray image is a grid of voxels, where each voxel is associated with a gray level value. This class is a model of the concept `MeshDomain_3`. The domain to be discretized is the union of voxels that lie inside a surface -described by an isolevel value, called \a isovalue. +described by an isolevel value, called \a isovalue. The voxels lying inside the +domain have gray level values that are larger than the isovalue. This class includes a member function that provides, by interpolation, a gray level value at any query point. @@ -19,7 +20,7 @@ The intersection is then constructed by bisection. The bisection stops when the query segment is shorter than a given error bound `e`. This error bound is given by `e=d`\f$ \times\f$`bound` where `d` is the length of the diagonal of the bounding box (in world coordinates) and -`bound` is the argument passed to the constructor of `Labeled_image_mesh_domain_3`. +`bound` is the argument passed to the constructor of `Labeled_image_mesh_domain_3`. \tparam Image is the type of the input image. @@ -54,18 +55,19 @@ public: /*! Construction from an image. +The object to be meshed is described by the voxels that have a gray-level +value higher than the input isovalue. @param image the input image @param iso_value the isovalue, inside `image`, - of the surface describing the boundary of the object to be meshed + of the surface describing the boundary of the object to be meshed. @param value_outside the value attached to voxels outside of the domain - to be meshed + to be meshed. It should be lower than `iso_value` @param error_bound is relative to the size of the image. */ Gray_image_mesh_domain_3( const Image& image, const Image_word_type iso_value, - const Image_word_type value_outside = - std::numeric_limits::max(), + const Image_word_type value_outside = 0., const BGT::FT& error_bound = BGT::FT(1e-3)); /// @} diff --git a/Mesh_3/doc/Mesh_3/Mesh_3.txt b/Mesh_3/doc/Mesh_3/Mesh_3.txt index e680ce15dd3..2f11ea82b5d 100644 --- a/Mesh_3/doc/Mesh_3/Mesh_3.txt +++ b/Mesh_3/doc/Mesh_3/Mesh_3.txt @@ -565,6 +565,7 @@ for more details. \subsection Mesh_33DDomainsBoundedbyIsosurfaces 3D Domains Bounded by Isosurfaces +\subsubsection Mesh_33DDomainsImplicitIsosurfaces 3D Domains Bounded by Implicit Isosurfaces The following code produces a 3D mesh for a domain whose boundary surface is an isosurface defined by an implicit function. \cgalFigureRef{figureimplicit_domain} shows a cut view of the @@ -579,6 +580,14 @@ constructor of the `Mesh_criteria` instance. Cut view of a 3D mesh produced from an implicit domain \cgalFigureEnd +\subsubsection Mesh_33DDomainsGrayImageIsosurfaces 3D Domains Bounded by Isosurfaces in 3D Gray-Level Images + +The following example produces a 3D mesh for a domain whose boundary surface +is the isosurface associated to an isovalue inside the input gray-level +3D image. + +\cgalExample{Mesh_3/mesh_3D_gray_image.cpp} + \subsection Mesh_3MeshingMultipleDomains Meshing Multiple Domains \anchor Mesh_3_subsection_examples_multi_domain From e5d5f4f2bd007dc5eb0aea1f49cac4263b507717 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Loriot?= Date: Fri, 22 Jan 2016 09:05:27 +0100 Subject: [PATCH 4/4] add missing example --- Mesh_3/doc/Mesh_3/examples.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/Mesh_3/doc/Mesh_3/examples.txt b/Mesh_3/doc/Mesh_3/examples.txt index f79b97adc11..e542b02035e 100644 --- a/Mesh_3/doc/Mesh_3/examples.txt +++ b/Mesh_3/doc/Mesh_3/examples.txt @@ -12,4 +12,5 @@ \example Mesh_3/mesh_polyhedral_domain.cpp \example Mesh_3/mesh_polyhedral_domain_with_features.cpp \example Mesh_3/mesh_two_implicit_spheres_with_balls.cpp +\example Mesh_3/mesh_3D_gray_image.cpp */