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/graph/BreadthFirstVisitor.h"
41#include "DGtal/topology/helpers/FrontierPredicate.h"
42#include "DGtal/topology/helpers/BoundaryPredicate.h"
43#include "DGtal/graph/CUndirectedSimpleLocalGraph.h"
44#include "DGtal/graph/CUndirectedSimpleGraph.h"
46#include "DGtal/io/readers/VolReader.h"
47#include "DGtal/images/imagesSetsUtils/SetFromImage.h"
49#include "DGtal/io/viewers/Viewer3D.h"
50#include "DGtal/images/ImageSelector.h"
51#include "DGtal/shapes/Shapes.h"
52#include "DGtal/helpers/StdDefs.h"
55#include "DGtal/geometry/surfaces/estimation/BasicConvolutionWeights.h"
56#include "DGtal/geometry/surfaces/estimation/LocalConvolutionNormalVectorEstimator.h"
75 QApplication application ( argc,argv );
77 std::string filename = testPath +
"samples/cat10.vol";
87 bool space_ok = ks.
init ( image.domain().lowerBound(),
88 image.domain().upperBound(),
true );
91 trace.
error() <<
"Error in the Khamisky space construction."<<std::endl;
96 MySurfelAdjacency surfAdj (
true );
116 MyEstimator myNormalEstimator ( digSurf, kernel );
118 myNormalEstimator.init ( 1.0, 5 );
120 MyEstimator::Quantity res = myNormalEstimator.eval ( it );
121 trace.
info() <<
"Normal vector at begin() : "<< res << std::endl;
129 itbis!=itend; ++itbis )
131 viewer << ks.
unsigns ( *itbis );
134 MyEstimator::Quantity normal = myNormalEstimator.eval ( itbis );
138 center[1]-3*normal[1],
139 center[2]-3*normal[2]) );
142 viewer<< Viewer3D<>::updateDisplay;
150 MyEstimatorGaussian myNormalEstimatorG ( digSurf, Gkernel );
152 myNormalEstimatorG.init ( 1.0, 15 );
154 MyEstimatorGaussian::Quantity res2 = myNormalEstimatorG.eval ( it );
155 trace.
info() <<
"Normal vector at begin() : "<< res2 << std::endl;
161 itbis!=itend; ++itbis )
163 viewer << ks.
unsigns ( *itbis );
166 MyEstimatorGaussian::Quantity normal = myNormalEstimatorG.eval ( itbis );
169 center[1]-3*normal[1],
170 center[2]-3*normal[2]) );
173 viewer<< Viewer3D<>::updateDisplay;
175 return application.exec();
181int main (
int argc,
char** argv )
183 trace.
beginBlock (
"Testing class LocalConvolutionNormalVectorEstimator" );
185 for (
int i = 0; i < argc; ++i )
190 trace.
emphase() << ( res ?
"Passed." :
"Error." ) << endl;
Structure representing an RGB triple with alpha component.
Aim: A model of CDigitalSurfaceContainer which defines the digital surface as the boundary of a given...
Aim: A wrapper class around a STL associative container for storing sets of digital points within som...
Aim: Represents a set of n-1-cells in a nD space, together with adjacency relation between these cell...
DigitalSurfaceContainer::SurfelConstIterator ConstIterator
ConstIterator begin() const
ConstIterator end() const
virtual DGtal::Color getLineColor()
virtual void setLineColor(DGtal::Color aColor)
void addLine(const RealPoint &p1, const RealPoint &p2, const double width=0.03)
Aim: implements association bewteen points lying in a digital domain and values.
Aim: This class is a model of CCellularGridSpaceND. It represents the cubical grid as a cell complex,...
bool init(const Point &lower, const Point &upper, bool isClosed)
Specifies the upper and lower bounds for the maximal cells in this space.
Cell unsigns(const SCell &p) const
Creates an unsigned cell from a signed one.
Point sCoords(const SCell &c) const
Return its digital coordinates.
Aim: A model of CDigitalSurfaceContainer which defines the digital surface as the boundary of an impl...
static SCell findABel(const KSpace &K, const PointPredicate &pp, unsigned int nbtries=1000)
Aim: Represent adjacencies between surfel elements, telling if it follows an interior to exterior ord...
void beginBlock(const std::string &keyword="")
virtual void show()
Overload QWidget method in order to add a call to updateList() method (to ensure that the lists are w...
Aim: implement a trivial constant convolution kernel which returns 1 to each distance.
Aim: implement a Gaussian centered convolution kernel.
Aim: Computes the normal vector at a surface element by convolution of elementary normal vector to ad...
DigitalSurface< MyDigitalSurfaceContainer > MyDigitalSurface
DigitalSetBoundary< KSpace, DigitalSet > MyDigitalSurfaceContainer
DGtal is the top-level namespace which contains all DGtal functions and types.
ImageContainerBySTLVector< Domain, Value > Type
Aim: Define utilities to convert a digital set into an image.
Represents a signed cell in a cellular grid space by its Khalimsky coordinates and a boolean value.
static ImageContainer importVol(const std::string &filename, const Functor &aFunctor=Functor())
bool testLocalConvolutionNormalVectorEstimator(int argc, char **argv)