35#include "DGtal/base/Common.h"
36#include "ConfigTest.h"
37#include "DGtal/topology/CanonicDigitalSurfaceEmbedder.h"
38#include "DGtal/topology/DigitalSurface.h"
39#include "DGtal/topology/DigitalSetBoundary.h"
40#include "DGtal/topology/ImplicitDigitalSurface.h"
41#include "DGtal/topology/LightImplicitDigitalSurface.h"
42#include "DGtal/topology/ExplicitDigitalSurface.h"
43#include "DGtal/topology/LightExplicitDigitalSurface.h"
44#include "DGtal/graph/BreadthFirstVisitor.h"
45#include "DGtal/topology/helpers/FrontierPredicate.h"
46#include "DGtal/topology/helpers/BoundaryPredicate.h"
47#include "DGtal/graph/CUndirectedSimpleLocalGraph.h"
48#include "DGtal/graph/CUndirectedSimpleGraph.h"
50#include "DGtal/io/readers/VolReader.h"
51#include "DGtal/images/imagesSetsUtils/SetFromImage.h"
53#include "DGtal/images/ImageSelector.h"
54#include "DGtal/shapes/Shapes.h"
55#include "DGtal/helpers/StdDefs.h"
56#include "DGtal/kernel/CanonicEmbedder.h"
58#include "DGtal/geometry/surfaces/estimation/CNormalVectorEstimator.h"
59#include "DGtal/geometry/surfaces/estimation/BasicConvolutionWeights.h"
60#include "DGtal/geometry/surfaces/estimation/LocalConvolutionNormalVectorEstimator.h"
61#include "DGtal/geometry/surfaces/estimation/DigitalSurfaceEmbedderWithNormalVectorEstimator.h"
79 std::string filename = testPath +
"samples/cat10.vol";
89 bool space_ok = ks.
init ( image.domain().lowerBound(),
90 image.domain().upperBound(),
true );
93 trace.
error() <<
"Error in the Khamisky space construction."<<std::endl;
98 MySurfelAdjacency surfAdj (
true );
111 trace.
beginBlock (
"Compute and output surface <cat10-constant.off> with trivial normals." );
120 MyConstantEstimator myNormalEstimator ( digSurf, kernel );
124 SurfaceEmbedder surfaceEmbedder ( digSurf );
126 < SurfaceEmbedder, MyConstantEstimator > SurfaceEmbedderWithTrivialNormal;
127 SurfaceEmbedderWithTrivialNormal mySurfelEmbedder ( surfaceEmbedder,
131 myNormalEstimator.init ( 1.0, 2 );
133 MyConstantEstimator::Quantity res = myNormalEstimator.eval ( it );
134 trace.
info() <<
"Normal vector at begin() : "<< res << std::endl;
136 ofstream out (
"cat10-constant.off" );
142 trace.
beginBlock (
"Compute and output surface <cat10-gaussian.off> with gaussian convoluted normals." );
145 deprecated::GaussianConvolutionWeights < MyDigitalSurface::Size > Gkernel ( 4.0 );
151 MyGaussianEstimator myNormalEstimatorG ( digSurf, Gkernel );
155 SurfaceEmbedderWithGaussianNormal mySurfelEmbedderG ( surfaceEmbedder, myNormalEstimatorG );
158 myNormalEstimatorG.init ( 1.0, 5 );
160 MyGaussianEstimator::Quantity res2 = myNormalEstimatorG.eval ( it );
161 trace.
info() <<
"Normal vector at begin() : "<< res2 << std::endl;
162 std::vector<MyGaussianEstimator::Quantity> allNormals;
163 myNormalEstimatorG.evalAll ( std::back_inserter ( allNormals ) );
164 trace.
info() <<
"Normal vector field of size "<< allNormals.size() << std::endl;
166 ofstream out2 (
"cat10-gaussian.off" );
179int main (
int argc,
char** argv )
181 trace.
beginBlock (
"Testing class LocalConvolutionNormalVectorEstimator" );
183 for (
int i = 0; i < argc; ++i )
188 trace.
emphase() << ( res ?
"Passed." :
"Error." ) << endl;
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: Combines a digital surface embedder with a normal vector estimator to get a model of CDigitalSur...
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
void exportAs3DNOFF(std::ostream &out, const SCellEmbedderWithGradientMap &scembedder) const
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.
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="")
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.
Aim: A trivial embedder for digital surfaces, which corresponds to the canonic injection of cell cent...
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())
Aim: Represents the concept of estimator of normal vector along digital surfaces.
bool testLocalConvolutionNormalVectorEstimator(int, char **)