32 #include "ConfigTest.h" 
   33 #include "DGtal/base/Common.h" 
   34 #include "DGtal/topology/DigitalSurface.h" 
   35 #include "DGtal/topology/DigitalSetBoundary.h" 
   36 #include "DGtal/topology/ImplicitDigitalSurface.h" 
   37 #include "DGtal/topology/LightImplicitDigitalSurface.h" 
   38 #include "DGtal/topology/ExplicitDigitalSurface.h" 
   39 #include "DGtal/topology/LightExplicitDigitalSurface.h" 
   40 #include "DGtal/topology/BreadthFirstVisitor.h" 
   41 #include "DGtal/topology/helpers/FrontierPredicate.h" 
   42 #include "DGtal/topology/helpers/BoundaryPredicate.h" 
   43 #include "DGtal/topology/CUndirectedSimpleLocalGraph.h" 
   44 #include "DGtal/topology/CUndirectedSimpleGraph.h" 
   46 #include "DGtal/io/readers/VolReader.h" 
   47 #include "DGtal/images/imagesSetsUtils/SetFromImage.h" 
   49 #include "DGtal/images/ImageSelector.h" 
   50 #include "DGtal/shapes/Shapes.h" 
   51 #include "DGtal/helpers/StdDefs.h" 
   52 #include <QtGui/qapplication.h> 
   54 #include "DGtal/io/viewers/Viewer3D.h" 
   55 #include "DGtal/geometry/surfaces/estimation/BasicConvolutionWeights.h" 
   57 #include "DGtal/geometry/surfaces/estimation/LocalConvolutionNormalVectorEstimator.h" 
   61 using namespace DGtal;
 
   71 bool testLocalConvolutionNormalVectorEstimator ( 
int argc, 
char**argv )
 
   73     unsigned int nbok = 0;
 
   78     QApplication application ( argc,argv );
 
   81     std::string filename = testPath + 
"samples/cat10.vol";
 
   92     bool space_ok = ks.init ( image.domain().lowerBound(),
 
   93                               image.domain().upperBound(), true );
 
   96         trace.
error() << 
"Error in the Khamisky space construction."<<std::endl;
 
  101     MySurfelAdjacency surfAdj ( 
true ); 
 
  108     MyDigitalSurfaceContainer* ptrSurfContainer =
 
  109         new MyDigitalSurfaceContainer ( ks, set3dPredicate, surfAdj, bel );
 
  110     MyDigitalSurface digSurf ( ptrSurfContainer ); 
 
  121     MyEstimator myNormalEstimator ( digSurf, kernel );
 
  123     myNormalEstimator.init ( 1.0, 5 );
 
  125     MyEstimator::Quantity res = myNormalEstimator.eval ( it );
 
  126     trace.
info() << 
"Normal vector at begin() : "<< res << std::endl;
 
  131             itbis!=itend; ++itbis )
 
  133         viewer << ks.unsigns ( *itbis );
 
  135         Point center = ks.sCoords ( *itbis );
 
  136         MyEstimator::Quantity normal = myNormalEstimator.eval ( itbis );
 
  137         viewer.
addLine ( center[0],center[1],center[2],
 
  138                          center[0]-3*normal[0],center[1]-3*normal[1],center[2]-3*normal[2],
 
  141     viewer<< Viewer3D::updateDisplay;
 
  149     MyEstimatorGaussian myNormalEstimatorG ( digSurf, Gkernel );
 
  151     myNormalEstimatorG.init ( 1.0, 15 );
 
  153     MyEstimatorGaussian::Quantity res2 = myNormalEstimatorG.eval ( it );
 
  154     trace.
info() << 
"Normal vector at begin() : "<< res2 << std::endl;
 
  158             itbis!=itend; ++itbis )
 
  160         viewer << ks.unsigns ( *itbis );
 
  162         Point center = ks.sCoords ( *itbis );
 
  163         MyEstimatorGaussian::Quantity normal = myNormalEstimatorG.eval ( itbis );
 
  164         viewer.
addLine ( center[0],center[1],center[2],
 
  165                          center[0]-3*normal[0],center[1]-3*normal[1],center[2]-3*normal[2],
 
  168     viewer<< Viewer3D::updateDisplay;
 
  171     nbok += 
true ? 1 : 0;
 
  173     trace.
info() << 
"(" << nbok << 
"/" << nb << 
") " 
  174                  << 
"true == true" << std::endl;
 
  177     return application.exec();
 
  183 int main ( 
int argc, 
char** argv )
 
  185     trace.
beginBlock ( 
"Testing class LocalConvolutionNormalVectorEstimator" );
 
  187     for ( 
int i = 0; i < argc; ++i )
 
  191     bool res = testLocalConvolutionNormalVectorEstimator ( argc,argv ); 
 
  192     trace.
emphase() << ( res ? 
"Passed." : 
"Error." ) << endl;