46 unsigned int nb = 0, nbok = 0;
51 trace.
beginBlock (
"Load vol file -> build digital surface -> estimate mean curvature -> save OBJ." );
55 params(
"colormap",
"Tics" );
65 std::transform( curv.cbegin(), curv.cend(), colors.begin(), cmap );
69 ++nb; nbok += ok ? 1 : 0;
73 trace.
beginBlock (
"Load vol file -> build digital surface -> estimate Gauss curvature -> save OBJ." );
76 params(
"colormap",
"Tics" );
84 std::transform( curv.cbegin(), curv.cend(), colors.begin(), cmap );
87 ++nb; nbok += ok ? 1 : 0;
91 trace.
beginBlock (
"Build polynomial shape -> digitize -> extract ground-truth geometry." );
95 params(
"polynomial",
"3*x^2+2*y^2+z^2-90" )(
"gridstep", 0.25 );
109 trace.
info() <<
" min(H)=" << stat_mean.min()
110 <<
" avg(H)=" << stat_mean.mean()
111 <<
" max(H)=" << stat_mean.max() << std::endl;
112 trace.
info() <<
" min(G)=" << stat_gauss.min()
113 <<
" avg(G)=" << stat_gauss.mean()
114 <<
" max(G)=" << stat_gauss.max() << std::endl;
115 ++nb; nbok += positions.size() == surfels.size() ? 1 : 0;
116 ++nb; nbok += normals.size() == surfels.size() ? 1 : 0;
117 ++nb; nbok += mean_curvs.size() == surfels.size() ? 1 : 0;
118 ++nb; nbok += gauss_curvs.size() == surfels.size() ? 1 : 0;
119 ++nb; nbok += stat_mean.min() > 0.08 ? 1 : 0;
120 ++nb; nbok += stat_gauss.min() > 0.0064 ? 1 : 0;
124 trace.
beginBlock (
"Build polynomial shape -> digitize -> get pointels -> save projected quadrangulated surface." );
128 const double h = 0.25;
129 params(
"polynomial",
"goursat" )(
"gridstep", h );
139 std::transform( pointels.cbegin(), pointels.cend(), pos.begin(),
140 [&] (
const SH3::Cell& c) { return h * embedder( c ); } );
143 [&] (
const SH3::Cell& c){
return ppos[ c2i[ c ] ];},
145 "goursat-quad-proj.obj" );
147 ++nb; nbok += ok ? 1 : 0;
151 trace.
beginBlock (
"Build polynomial shape -> digitize -> extract mean curvature -> save as OBJ with colors." );
155 params(
"polynomial",
"goursat" )(
"gridstep", 0.25 )(
"colormap",
"Tics" );
165 std::transform( mean_curv.cbegin(), mean_curv.cend(), colors.begin(), cmap );
169 ++nb; nbok += ok ? 1 : 0;
173 trace.
beginBlock (
"Build polynomial shape -> digitize -> extract ground-truth and estimated mean curvature -> display errors in OBJ with colors." );
177 params(
"polynomial",
"goursat" )(
"gridstep", 0.25 )(
"colormap",
"Tics" )
189 std::transform( t_curv.cbegin(), t_curv.cend(), colors.begin(), cmap );
191 std::transform( ii_curv.cbegin(), ii_curv.cend(), colors.begin(), cmap );
196 std::transform( errors.cbegin(), errors.cend(), colors.begin(), cmap_errors );
203 ++nb; nbok += ( ok_t && ok_ii && ok_err ) ? 1 : 0;
207 trace.
beginBlock (
"Build polynomial shape -> digitize -> build digital surface -> save primal surface with VCM normals as obj." );
211 params(
"polynomial",
"goursat" )(
"gridstep", 0.25 )
212 (
"surfaceTraversal",
"Default" );
221 "goursat-primal-vcm.obj" );
223 ++nb; nbok += ok ? 1 : 0;
227 trace.
beginBlock (
"Build polynomial shape -> digitize implicitly -> estimate II normals and curvature." );
231 params(
"polynomial",
"goursat" )(
"gridstep", .25 );
249 for (
SH3::Idx i = 0; i < colors.size(); i++ )
250 colors[ i ] = cmap( ii_mean_curv[ match[ i ] ] );
253 ++nb; nbok += ( ok_H && ii_mean_curv.size() == ii_mean_curv2.size() ) ? 1 : 0;
257 trace.
beginBlock (
"Build polynomial shape -> save several projected quadrangulated surface and digitized boundaries." );
260 std::vector<double> gridsteps {0.5, 0.25, 0.125};
261 for (
auto h : gridsteps ) {
262 params(
"polynomial",
"goursat" )(
"gridstep", h );
272 std::transform( pointels.cbegin(), pointels.cend(), pos.begin(),
273 [&] (
const SH3::Cell& c) { return h * embedder( c ); } );
275 auto fname = std::string(
"goursat-quad-" ) + std::to_string( h ) + std::string(
".obj" );
277 [&] (
const SH3::Cell& c){
return pos[ c2i[ c ] ];},
280 auto proj_fname = std::string(
"goursat-quad-proj-" ) + std::to_string( h ) + std::string(
".obj" );
282 [&] (
const SH3::Cell& c){
return ppos[ c2i[ c ] ];},
285 ++nb; nbok += ok ? 1 : 0;
286 ++nb; nbok += proj_ok ? 1 : 0;
291 trace.
beginBlock (
"Build polynomial shape -> digitize -> digital surface -> save primal surface and VCM normal field as obj." );
295 params(
"polynomial",
"goursat" )(
"gridstep", 0.5 )
296 (
"surfaceTraversal",
"Default" );
306 std::transform( surfels.cbegin(), surfels.cend(), positions.begin(),
307 [&] (
const SH3::SCell& c) { return embedder( c ); } );
309 "goursat-primal-vcm.obj" );
311 "goursat-primal-vcm-normals.obj",
314 ++nb, nbok += ok ? 1 : 0;
315 ++nb, nbok += ok2 ? 1 : 0;
319 trace.
beginBlock (
"Build polynomial shape -> digitize -> extract ground-truth curvatures -> display in OBJ." );
323 params(
"polynomial",
"goursat" )(
"gridstep", 0.25 )(
"colormap",
"Tics" );
336 std::transform( surfels.cbegin(), surfels.cend(), positions.begin(),
337 [&] (
const SH3::SCell& c) { return embedder( c ); } );
339 "goursat-primal.obj" );
343 std::transform( k1.cbegin(), k1.cend(), colors.begin(), cmap );
346 "goursat-primal-d1.obj", SH3::Color::Black );
347 std::transform( k2.cbegin(), k2.cend(), colors.begin(), cmap );
350 "goursat-primal-d2.obj", SH3::Color::Black );
351 ASSERT(ok_k1 && ok_d1 && ok_k2 && ok_d2);
357#if defined(WITH_EIGEN)
359 trace.
beginBlock (
"Load vol file -> build main digital surface -> II normals -> AT regularization -> save OBJ with colored normals." );
373 ii_normals, params );
376 for (
size_t i = 0; i < surfels.size(); i++ )
377 colors[ i ] =
SH3::Color( (
unsigned char) 255.0*fabs( at_normals[ i ][ 0 ] ),
378 (
unsigned char) 255.0*fabs( at_normals[ i ][ 1 ] ),
379 (
unsigned char) 255.0*fabs( at_normals[ i ][ 2 ] ) );
385 for (
size_t i = 0; i < linels.size(); i++ )
387 if ( features[ i ] < 0.5 )
393 f0.push_back( uembedder( p0 ) );
394 f1.push_back( uembedder( p1 ) - uembedder( p0 ) );
401 ++nb; nbok += ok1 ? 1 : 0;
402 ++nb; nbok += ok2 ? 1 : 0;
403 ++nb; nbok += ok3 ? 1 : 0;
409 trace.
info() << nbok <<
"/" << nb <<
" passed tests." << std::endl;