32#include "ConfigExamples.h"
33#include "DGtal/base/Common.h"
34#include "DGtal/helpers/StdDefs.h"
35#include "DGtal/helpers/Shortcuts.h"
45 unsigned int nb = 0, nbok = 0;
56 params(
"noise", 0.3 ) );
59 ++nb; nbok += ok ? 1 : 0;
62 trace.
beginBlock (
"Load vol file -> build main connected digital surface." );
71 ++nb; nbok +=
surface->size() == 21239 ? 1 : 0;
75 trace.
beginBlock (
"Load vol file -> extract 2 isosurfaces -> build mesh" );
79 params(
"faceSubdivision",
"Centroid" )(
"surfelAdjacency", 1);
85 trace.
info() <<
"#mesh150=" << mesh150->nbVertex()
86 <<
" #mesh40=" << mesh40->nbVertex() << std::endl;
88 ++nb; nbok += ( mesh150->nbVertex() < mesh40->nbVertex() )
89 && ( mesh40->nbVertex() == 273182 ) ? 1 : 0;
93 trace.
beginBlock (
"Load vol file -> extract 2 triangulated isosurfaces -> save as OBJ." );
97 params(
"faceSubdivision",
"Centroid" )(
"surfelAdjacency", 1);
108 ++nb; nbok += ok40 ? 1 : 0;
109 ++nb; nbok += ok150 ? 1 : 0;
113 trace.
beginBlock (
"Load vol file -> build main digital surface -> breadth first traversal -> save OBJ with colored distance." );
117 params(
"surfaceTraversal",
"BreadthFirst" )
118 (
"colormap",
"Jet" );
125 for (
unsigned int i = 0; i < surfels.size(); ++i ) colors[ i ] = cmap( i );
128 ++nb; nbok += ok ? 1 : 0;
132 trace.
beginBlock (
"Build polynomial shape -> digitize -> noisify -> save as vol file." );
136 params(
"polynomial",
"3*x^2+2*y^2+z^2-90" )(
"gridstep", 0.25 )
143 ++nb; nbok += ok ? 1 : 0;
147 trace.
beginBlock (
"Build polynomial shape -> digitize -> build digital surface -> save primal surface as obj." );
151 params(
"polynomial",
"goursat" )(
"gridstep", 0.25 );
159 ++nb; nbok += ok ? 1 : 0;
163 trace.
beginBlock (
"Build polynomial shape -> digitize -> build indexed surface on a subpart." );
167 params(
"polynomial",
"leopold" )(
"gridstep", 0.25 )
168 (
"minAABB", -12.0 )(
"maxAABB", 12.0 )
169 (
"surfaceComponents",
"All" );
173 auto K =
SH3::getKSpace( SH3::Point::zero, Kwhole.upperBound(), params );
180 ++nb; nbok +=
surface->size() > 1000 ? 1 : 0;
184 trace.
beginBlock (
"Build polynomial shape -> digitize -> noisify -> count components -> save OBJ with different colors." );
188 params(
"polynomial",
"leopold" )(
"gridstep", 0.25 )
189 (
"minAABB", -12.0 )(
"maxAABB", 12.0 )
190 (
"surfaceComponents",
"All" )(
"noise", 0.5 );
201 trace.
info() <<
"#connected components = " << vec_surfs.size() << std::endl;
202 std::map< SH3::Surfel, unsigned int> label;
204 for (
auto&& surf : vec_surfs ) {
206 for (
auto&& s : surfels ) label[ s ] = n;
212 for (
unsigned int i = 0; i < all_surfels.size(); ++i )
213 colors[ i ] = cmap( label[ all_surfels[ i ] ] );
216 ++nb; nbok += ok ? 1 : 0;
220 trace.
info() << nbok <<
"/" << nb <<
" passed tests." << std::endl;
Structure representing an RGB triple with alpha component.
const Point & lowerBound() const
Return the lower bound for digital points in this space.
const Point & upperBound() const
Return the upper bound for digital points in this space.
Aim: This class is used to simplify shape and surface creation. With it, you can create new shapes an...
static KSpace getKSpace(const Point &low, const Point &up, Parameters params=parametersKSpace())
static CountedPtr< DigitizedImplicitShape3D > makeDigitizedImplicitShape3D(CountedPtr< ImplicitShape3D > shape, Parameters params=parametersDigitizedImplicitShape3D())
std::vector< Color > Colors
static CountedPtr< Mesh > makeMesh(CountedPtr< TriangulatedSurface > triSurf, const Color &aColor=Color::White)
static std::vector< CountedPtr< LightDigitalSurface > > makeLightDigitalSurfaces(CountedPtr< BinaryImage > bimage, const KSpace &K, const Parameters ¶ms=parametersDigitalSurface())
static CountedPtr< GrayScaleImage > makeGrayScaleImage(Domain aDomain)
static SurfelRange getSurfelRange(CountedPtr< ::DGtal::DigitalSurface< TDigitalSurfaceContainer > > surface, const Parameters ¶ms=parametersDigitalSurface())
static CountedPtr< LightDigitalSurface > makeLightDigitalSurface(CountedPtr< BinaryImage > bimage, const KSpace &K, const Parameters ¶ms=parametersDigitalSurface())
static CountedPtr< DigitalSurface > makeDigitalSurface(CountedPtr< TPointPredicate > bimage, const KSpace &K, const Parameters ¶ms=parametersDigitalSurface())
std::vector< RealVector > RealVectors
static bool saveBinaryImage(CountedPtr< BinaryImage > bimage, std::string output)
static Parameters defaultParameters()
static CountedPtr< IdxDigitalSurface > makeIdxDigitalSurface(CountedPtr< BinaryImage > bimage, const KSpace &K, const Parameters ¶ms=parametersDigitalSurface())
static ColorMap getColorMap(Scalar min, Scalar max, const Parameters ¶ms=parametersUtilities())
static bool saveOBJ(CountedPtr< ::DGtal::DigitalSurface< TDigitalSurfaceContainer > > digsurf, const TCellEmbedder &embedder, const RealVectors &normals, const Colors &diffuse_colors, std::string objfile, const Color &ambient_color=Color(32, 32, 32), const Color &diffuse_color=Color(200, 200, 255), const Color &specular_color=Color::White)
static CountedPtr< BinaryImage > makeBinaryImage(Domain shapeDomain)
static CountedPtr< ImplicitShape3D > makeImplicitShape3D(const Parameters ¶ms=parametersImplicitShape3D())
static CountedPtr< TriangulatedSurface > makeTriangulatedSurface(CountedPtr< Mesh > aMesh)
void beginBlock(const std::string &keyword="")
CountedPtr< SH3::DigitalSurface > surface
CountedPtr< SH3::BinaryImage > binary_image
DGtal is the top-level namespace which contains all DGtal functions and types.