50 unsigned int nb = 0, nbok = 0;
55 trace.
beginBlock (
"Load vol file -> build digital surface -> estimate mean curvature -> save OBJ." );
59 params(
"colormap",
"Tics" );
71 std::transform( curv.cbegin(), curv.cend(), colors.begin(), cmap );
75 ++nb; nbok += ok ? 1 : 0;
79 trace.
beginBlock (
"Load vol file -> build digital surface -> estimate Gauss curvature -> save OBJ." );
82 params(
"colormap",
"Tics" );
90 std::transform( curv.cbegin(), curv.cend(), colors.begin(), cmap );
93 ++nb; nbok += ok ? 1 : 0;
97 trace.
beginBlock (
"Build polynomial shape -> digitize -> extract ground-truth geometry." );
101 params(
"polynomial",
"3*x^2+2*y^2+z^2-90" )(
"gridstep", 0.25 );
115 trace.
info() <<
" min(H)=" << stat_mean.min()
116 <<
" avg(H)=" << stat_mean.mean()
117 <<
" max(H)=" << stat_mean.max() << std::endl;
118 trace.
info() <<
" min(G)=" << stat_gauss.min()
119 <<
" avg(G)=" << stat_gauss.mean()
120 <<
" max(G)=" << stat_gauss.max() << std::endl;
121 ++nb; nbok += positions.size() == surfels.size() ? 1 : 0;
122 ++nb; nbok += normals.size() == surfels.size() ? 1 : 0;
123 ++nb; nbok += mean_curvs.size() == surfels.size() ? 1 : 0;
124 ++nb; nbok += gauss_curvs.size() == surfels.size() ? 1 : 0;
125 ++nb; nbok += stat_mean.min() > 0.08 ? 1 : 0;
126 ++nb; nbok += stat_gauss.min() > 0.0064 ? 1 : 0;
130 trace.
beginBlock (
"Build polynomial shape -> digitize -> get pointels -> save projected quadrangulated surface." );
134 const double h = 0.25;
135 params(
"polynomial",
"goursat" )(
"gridstep", h );
145 std::transform( pointels.cbegin(), pointels.cend(), pos.begin(),
146 [&] (
const SH3::Cell& c) { return h * embedder( c ); } );
149 [&] (
const SH3::Cell& c){
return ppos[ c2i[ c ] ];},
151 "goursat-quad-proj.obj" );
153 ++nb; nbok += ok ? 1 : 0;
157 trace.
beginBlock (
"Build polynomial shape -> digitize -> extract mean curvature -> save as OBJ with colors." );
161 params(
"polynomial",
"goursat" )(
"gridstep", 0.25 )(
"colormap",
"Tics" );
171 std::transform( mean_curv.cbegin(), mean_curv.cend(), colors.begin(), cmap );
175 ++nb; nbok += ok ? 1 : 0;
179 trace.
beginBlock (
"Build polynomial shape -> digitize -> extract ground-truth and estimated mean curvature -> display errors in OBJ with colors." );
183 params(
"polynomial",
"goursat" )(
"gridstep", 0.25 )(
"colormap",
"Tics" )
195 std::transform( t_curv.cbegin(), t_curv.cend(), colors.begin(), cmap );
197 std::transform( ii_curv.cbegin(), ii_curv.cend(), colors.begin(), cmap );
202 std::transform( errors.cbegin(), errors.cend(), colors.begin(), cmap_errors );
209 ++nb; nbok += ( ok_t && ok_ii && ok_err ) ? 1 : 0;
213 trace.
beginBlock (
"Build polynomial shape -> digitize -> build digital surface -> save primal surface with VCM normals as obj." );
217 params(
"polynomial",
"goursat" )(
"gridstep", 0.25 )
218 (
"surfaceTraversal",
"Default" );
227 "goursat-primal-vcm.obj" );
229 ++nb; nbok += ok ? 1 : 0;
233 trace.
beginBlock (
"Build polynomial shape -> digitize implicitly -> estimate II normals and curvature." );
237 params(
"polynomial",
"goursat" )(
"gridstep", .25 );
255 for (
SH3::Idx i = 0; i < colors.size(); i++ )
256 colors[ i ] = cmap( ii_mean_curv[ match[ i ] ] );
259 ++nb; nbok += ( ok_H && ii_mean_curv.size() == ii_mean_curv2.size() ) ? 1 : 0;
263 trace.
beginBlock (
"Build polynomial shape -> save several projected quadrangulated surface and digitized boundaries." );
266 std::vector<double> gridsteps {0.5, 0.25, 0.125};
267 for (
auto h : gridsteps ) {
268 params(
"polynomial",
"goursat" )(
"gridstep", h );
278 std::transform( pointels.cbegin(), pointels.cend(), pos.begin(),
279 [&] (
const SH3::Cell& c) { return h * embedder( c ); } );
281 auto fname = std::string(
"goursat-quad-" ) + std::to_string( h ) + std::string(
".obj" );
283 [&] (
const SH3::Cell& c){
return pos[ c2i[ c ] ];},
286 auto proj_fname = std::string(
"goursat-quad-proj-" ) + std::to_string( h ) + std::string(
".obj" );
288 [&] (
const SH3::Cell& c){
return ppos[ c2i[ c ] ];},
291 ++nb; nbok += ok ? 1 : 0;
292 ++nb; nbok += proj_ok ? 1 : 0;
297 trace.
beginBlock (
"Build polynomial shape -> digitize -> digital surface -> save primal surface and VCM normal field as obj." );
301 params(
"polynomial",
"goursat" )(
"gridstep", 0.5 )
302 (
"surfaceTraversal",
"Default" );
312 std::transform( surfels.cbegin(), surfels.cend(), positions.begin(),
313 [&] (
const SH3::SCell& c) { return embedder( c ); } );
315 "goursat-primal-vcm.obj" );
317 "goursat-primal-vcm-normals.obj",
320 ++nb, nbok += ok ? 1 : 0;
321 ++nb, nbok += ok2 ? 1 : 0;
325 trace.
beginBlock (
"Build polynomial shape -> digitize -> extract ground-truth curvatures -> display in OBJ." );
329 params(
"polynomial",
"goursat" )(
"gridstep", 0.25 )(
"colormap",
"Tics" );
342 std::transform( surfels.cbegin(), surfels.cend(), positions.begin(),
343 [&] (
const SH3::SCell& c) { return embedder( c ); } );
345 "goursat-primal.obj" );
349 std::transform( k1.cbegin(), k1.cend(), colors.begin(), cmap );
352 "goursat-primal-d1.obj", SH3::Color::Black );
353 std::transform( k2.cbegin(), k2.cend(), colors.begin(), cmap );
356 "goursat-primal-d2.obj", SH3::Color::Black );
357 ASSERT(ok_k1 && ok_d1 && ok_k2 && ok_d2);
362 trace.
beginBlock(
"Load mesh file -> estimate mean/gaussian/principal curvatures -> display in obj" );
366 params(
"r-radius", 0.1);
376 std::transform( mcurv.cbegin(), mcurv.cend(), mcolors.begin(), cmap );
379 std::transform( gcurv.cbegin(), gcurv.cend(), gcolors.begin(), cmap );
382 std::transform( k1.begin(), k1.end(), k1colors.begin(), cmap);
385 std::transform( k2.begin(), k2.end(), k2colors.begin(), cmap);
400#if defined(DGTAL_WITH_EIGEN)
401 trace.
beginBlock (
"Load vol file -> build main digital surface -> II normals -> AT regularization -> save OBJ with colored normals." );
415 ii_normals, params );
418 for (
size_t i = 0; i < surfels.size(); i++ )
419 colors[ i ] =
SH3::Color( (
unsigned char) 255.0*fabs( at_normals[ i ][ 0 ] ),
420 (
unsigned char) 255.0*fabs( at_normals[ i ][ 1 ] ),
421 (
unsigned char) 255.0*fabs( at_normals[ i ][ 2 ] ) );
427 for (
size_t i = 0; i < linels.size(); i++ )
429 if ( features[ i ] < 0.5 )
435 f0.push_back( uembedder( p0 ) );
436 f1.push_back( uembedder( p1 ) - uembedder( p0 ) );
443 ++nb; nbok += ok1 ? 1 : 0;
444 ++nb; nbok += ok2 ? 1 : 0;
445 ++nb; nbok += ok3 ? 1 : 0;
451#if DGTAL_WITH_POLYSCOPE
452 trace.
beginBlock(
"Load vol file -> Compute VoronoiMap -> Display in Viewer" );
460 std::vector<SH3::Point> sites;
461 std::copy_if(
domain.begin(),
463 std::back_inserter(sites),
474 for (
auto it =
domain.begin(); it !=
domain.end(); ++it)
478 "L1 distance", vmap1(*it)
479 ),
"L2 distance", vmap2(*it)
491 trace.
info() << nbok <<
"/" << nb <<
" passed tests." << std::endl;