44{
   45  unsigned int nb = 0, nbok = 0;
   46  
   48 
   49  
   50  trace.beginBlock ( 
"Load vol file -> noisify -> save as vol file." );
 
   51  {
   54    
   56                                           params( "noise", 0.3 ) );
   59    ++nb; nbok += ok ? 1 : 0;
   60  }
   62  trace.beginBlock ( 
"Load vol file -> build main connected digital surface." );
 
   63  {
   69    trace.info() << 
"#surfels=" << 
surface->size() << std::endl;
 
   71    ++nb; nbok += 
surface->size() == 21239 ? 1 : 0;
 
   72  }
   74 
   75  trace.beginBlock ( 
"Load vol file -> extract 2 isosurfaces -> build mesh" );
 
   76  {
   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;
   90  }
   92 
   93  trace.beginBlock ( 
"Load vol file -> extract 2 triangulated isosurfaces -> save as OBJ." );
 
   94  {
   97    params( "faceSubdivision", "Centroid" )( "surfelAdjacency", 1);
  102                                   "lobster-40.obj", 
  105                                   "lobster-150.obj", 
  108    ++nb; nbok += ok40  ? 1 : 0;
  109    ++nb; nbok += ok150 ? 1 : 0;
  110  }
  112 
  113  trace.beginBlock ( 
"Load vol file -> build main digital surface -> breadth first traversal -> save OBJ with colored distance." );
 
  114  {
  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;
  129  }
  131 
  132  trace.beginBlock ( 
"Build polynomial shape -> digitize -> noisify -> save as vol file." );
 
  133  {
  136    params( "polynomial", "3*x^2+2*y^2+z^2-90" )( "gridstep", 0.25 ) 
  137      ( "noise", 0.3 );
  143    ++nb; nbok += ok ? 1 : 0;
  144  }
  146 
  147  trace.beginBlock ( 
"Build polynomial shape -> digitize -> build digital surface -> save primal surface as obj." );
 
  148  {
  151    params( "polynomial", "goursat" )( "gridstep", 0.25 );
  159    ++nb; nbok += ok ? 1 : 0;
  160  }
  162 
  163  trace.beginBlock ( 
"Build polynomial shape -> digitize -> build indexed surface on a subpart." );
 
  164  {
  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 );
 
  176                                                 params );
  178    trace.info() << 
"#surfels=" << 
surface->size() << std::endl;
 
  180    ++nb; nbok += 
surface->size() > 1000 ? 1 : 0;
 
  181  }
  183 
  184  trace.beginBlock ( 
"Build polynomial shape -> digitize -> noisify -> count components -> save OBJ with different colors." );
 
  185  {
  188    params( "polynomial", "leopold" )( "gridstep", 0.25 )
  189      ( "minAABB", -12.0 )( "maxAABB", 12.0 )
  190      ( "surfaceComponents", "All" )( "noise", 0.5 );
  196                                                params );
  197    
  199    
  201    trace.info() << 
"#connected components = " << vec_surfs.size() << std::endl;
 
  202    std::map< SH3::Surfel, unsigned int> label;
  203    unsigned int n = 0;
  204    for ( auto&& surf : vec_surfs ) {
  206      for ( auto&& s : surfels ) label[ s ] = n;
  207      n += 1;
  208    }
  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;
  217  }
  219  
  220  trace.info() << nbok << 
"/" << nb << 
" passed tests." << std::endl;
 
  221  
  222  return 0;
  223}
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())
HyperRectDomain< Space > Domain
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)
CountedPtr< SH3::DigitalSurface > surface
CountedPtr< SH3::BinaryImage > binary_image