mirror of https://github.com/CGAL/cgal
Merge pull request #664 from janetournois/Mesh_3-replace_binder2nd-pmoeller
Mesh 3 - Improve Gray level images domain and fix warnings
This commit is contained in:
commit
277a91b4f0
|
|
@ -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.
|
where each voxel is associated with a gray level value.
|
||||||
This class is a model of the concept `MeshDomain_3`.
|
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
|
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,
|
This class includes a member function that provides, by interpolation,
|
||||||
a gray level value at any query point.
|
a gray level value at any query point.
|
||||||
|
|
@ -54,18 +55,19 @@ public:
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
Construction from an image.
|
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 image the input image
|
||||||
@param iso_value the isovalue, inside `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
|
@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.
|
@param error_bound is relative to the size of the image.
|
||||||
*/
|
*/
|
||||||
Gray_image_mesh_domain_3(
|
Gray_image_mesh_domain_3(
|
||||||
const Image& image,
|
const Image& image,
|
||||||
const Image_word_type iso_value,
|
const Image_word_type iso_value,
|
||||||
const Image_word_type value_outside =
|
const Image_word_type value_outside = 0.,
|
||||||
std::numeric_limits<ImageWordType>::max(),
|
|
||||||
const BGT::FT& error_bound = BGT::FT(1e-3));
|
const BGT::FT& error_bound = BGT::FT(1e-3));
|
||||||
|
|
||||||
/// @}
|
/// @}
|
||||||
|
|
|
||||||
|
|
@ -565,6 +565,7 @@ for more details.
|
||||||
|
|
||||||
\subsection Mesh_33DDomainsBoundedbyIsosurfaces 3D Domains Bounded by Isosurfaces
|
\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
|
The following code produces a 3D mesh for a domain whose boundary surface
|
||||||
is an isosurface defined by an implicit
|
is an isosurface defined by an implicit
|
||||||
function. \cgalFigureRef{figureimplicit_domain} shows a cut view of the
|
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
|
Cut view of a 3D mesh produced from an implicit domain
|
||||||
\cgalFigureEnd
|
\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
|
\subsection Mesh_3MeshingMultipleDomains Meshing Multiple Domains
|
||||||
|
|
||||||
\anchor Mesh_3_subsection_examples_multi_domain
|
\anchor Mesh_3_subsection_examples_multi_domain
|
||||||
|
|
|
||||||
|
|
@ -12,4 +12,5 @@
|
||||||
\example Mesh_3/mesh_polyhedral_domain.cpp
|
\example Mesh_3/mesh_polyhedral_domain.cpp
|
||||||
\example Mesh_3/mesh_polyhedral_domain_with_features.cpp
|
\example Mesh_3/mesh_polyhedral_domain_with_features.cpp
|
||||||
\example Mesh_3/mesh_two_implicit_spheres_with_balls.cpp
|
\example Mesh_3/mesh_two_implicit_spheres_with_balls.cpp
|
||||||
|
\example Mesh_3/mesh_3D_gray_image.cpp
|
||||||
*/
|
*/
|
||||||
|
|
|
||||||
|
|
@ -35,21 +35,10 @@
|
||||||
|
|
||||||
typedef float Image_word_type;
|
typedef float Image_word_type;
|
||||||
|
|
||||||
template<typename T>
|
|
||||||
struct Greater_than {
|
|
||||||
typedef T argument_type;
|
|
||||||
Greater_than(const T& second) : second(second) {}
|
|
||||||
bool operator()(const T& first) const {
|
|
||||||
return std::greater<T>()(first, second);
|
|
||||||
}
|
|
||||||
T second;
|
|
||||||
};
|
|
||||||
|
|
||||||
// Domain
|
// Domain
|
||||||
typedef CGAL::Exact_predicates_inexact_constructions_kernel K;
|
typedef CGAL::Exact_predicates_inexact_constructions_kernel K;
|
||||||
typedef CGAL::Gray_image_mesh_domain_3<CGAL::Image_3, K,
|
typedef CGAL::Gray_image_mesh_domain_3<CGAL::Image_3, K,
|
||||||
Image_word_type,
|
Image_word_type> Mesh_domain;
|
||||||
Greater_than<Image_word_type> > Mesh_domain;
|
|
||||||
|
|
||||||
// Triangulation
|
// Triangulation
|
||||||
typedef CGAL::Mesh_triangulation_3<Mesh_domain>::type Tr;
|
typedef CGAL::Mesh_triangulation_3<Mesh_domain>::type Tr;
|
||||||
|
|
|
||||||
|
|
@ -28,19 +28,20 @@
|
||||||
#include <CGAL/Mesh_3/Image_to_labeled_function_wrapper.h>
|
#include <CGAL/Mesh_3/Image_to_labeled_function_wrapper.h>
|
||||||
|
|
||||||
#include <functional>
|
#include <functional>
|
||||||
#include <limits>
|
|
||||||
|
|
||||||
namespace CGAL {
|
namespace CGAL {
|
||||||
|
|
||||||
namespace internal {
|
namespace internal {
|
||||||
|
|
||||||
template<typename T>
|
template<typename T>
|
||||||
struct Less_than {
|
struct Greater_than {
|
||||||
typedef T argument_type;
|
typedef T argument_type;
|
||||||
Less_than(const T& second) : second(second) {}
|
Greater_than(const T& second) : second(second) {}
|
||||||
bool operator()(const T& first) const { return std::less<T>()(first, second); }
|
bool operator()(const T& first) const {
|
||||||
T second;
|
return std::greater<T>()(first, second);
|
||||||
};
|
}
|
||||||
|
T second;
|
||||||
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -52,7 +53,7 @@ struct Less_than {
|
||||||
template<class Image,
|
template<class Image,
|
||||||
class BGT,
|
class BGT,
|
||||||
typename Image_word_type = float,
|
typename Image_word_type = float,
|
||||||
typename Transform = internal::Less_than<Image_word_type>,
|
typename Transform = internal::Greater_than<Image_word_type>,
|
||||||
typename Subdomain_index = int>
|
typename Subdomain_index = int>
|
||||||
class Gray_image_mesh_domain_3
|
class Gray_image_mesh_domain_3
|
||||||
: public Labeled_mesh_domain_3<
|
: public Labeled_mesh_domain_3<
|
||||||
|
|
@ -80,8 +81,7 @@ public:
|
||||||
/// Constructor
|
/// Constructor
|
||||||
Gray_image_mesh_domain_3(const Image& image,
|
Gray_image_mesh_domain_3(const Image& image,
|
||||||
const Image_word_type iso_value,
|
const Image_word_type iso_value,
|
||||||
const Image_word_type value_outside =
|
const Image_word_type value_outside = 0.,
|
||||||
(std::numeric_limits<Image_word_type>::max)(),
|
|
||||||
const FT& error_bound = FT(1e-3),
|
const FT& error_bound = FT(1e-3),
|
||||||
CGAL::Random* p_rng = NULL)
|
CGAL::Random* p_rng = NULL)
|
||||||
: Base(Wrapper(image,
|
: Base(Wrapper(image,
|
||||||
|
|
@ -94,8 +94,7 @@ public:
|
||||||
|
|
||||||
Gray_image_mesh_domain_3(const Image& image,
|
Gray_image_mesh_domain_3(const Image& image,
|
||||||
const Transform& transform,
|
const Transform& transform,
|
||||||
const Image_word_type value_outside =
|
const Image_word_type value_outside = 0.,
|
||||||
(std::numeric_limits<Image_word_type>::max)(),
|
|
||||||
const FT& error_bound = FT(1e-3),
|
const FT& error_bound = FT(1e-3),
|
||||||
CGAL::Random* p_rng = NULL)
|
CGAL::Random* p_rng = NULL)
|
||||||
: Base(Wrapper(image, transform, value_outside),
|
: Base(Wrapper(image, transform, value_outside),
|
||||||
|
|
|
||||||
|
|
@ -32,6 +32,16 @@
|
||||||
// To avoid verbose function and named parameters call
|
// To avoid verbose function and named parameters call
|
||||||
using namespace CGAL::parameters;
|
using namespace CGAL::parameters;
|
||||||
|
|
||||||
|
template<typename T>
|
||||||
|
struct Greater_than {
|
||||||
|
typedef T argument_type;
|
||||||
|
Greater_than(const T& second) : second(second) {}
|
||||||
|
bool operator()(const T& first) const {
|
||||||
|
return std::greater<T>()(first, second);
|
||||||
|
}
|
||||||
|
T second;
|
||||||
|
};
|
||||||
|
|
||||||
template <typename Concurrency_tag = CGAL::Sequential_tag>
|
template <typename Concurrency_tag = CGAL::Sequential_tag>
|
||||||
struct Image_tester : public Tester<K_e_i>
|
struct Image_tester : public Tester<K_e_i>
|
||||||
{
|
{
|
||||||
|
|
@ -44,7 +54,7 @@ public:
|
||||||
Image,
|
Image,
|
||||||
K_e_i,
|
K_e_i,
|
||||||
Image_word_type,
|
Image_word_type,
|
||||||
std::binder1st< std::less<Image_word_type> > > Mesh_domain;
|
Greater_than<Image_word_type> > Mesh_domain;
|
||||||
|
|
||||||
typedef typename CGAL::Mesh_triangulation_3<
|
typedef typename CGAL::Mesh_triangulation_3<
|
||||||
Mesh_domain,
|
Mesh_domain,
|
||||||
|
|
@ -70,7 +80,7 @@ public:
|
||||||
|
|
||||||
// Domain
|
// Domain
|
||||||
Mesh_domain domain(image,
|
Mesh_domain domain(image,
|
||||||
std::bind1st(std::less<Image_word_type>(), 2.9f),//transform
|
2.9f, //isovalue
|
||||||
0.f, //value_outside
|
0.f, //value_outside
|
||||||
1e-3, //error_bound
|
1e-3, //error_bound
|
||||||
&CGAL::default_random);//random generator for determinism
|
&CGAL::default_random);//random generator for determinism
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue