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/PolyscopeViewer.h"
50#include "DGtal/images/ImageSelector.h"
51#include "DGtal/shapes/Shapes.h"
52#include "DGtal/helpers/StdDefs.h"
54#include "DGtal/geometry/surfaces/estimation/LocalEstimatorFromSurfelFunctorAdapter.h"
55#include "DGtal/geometry/surfaces/estimation/estimationFunctors/ElementaryConvolutionNormalVectorEstimator.h"
56#include "DGtal/geometry/volumes/distance/LpMetric.h"
73 trace.beginBlock (
"Testing convolution neighborhood ..." );
75 std::string filename = testPath +
"samples/cat10.vol";
85 bool space_ok = ks.
init (
image.domain().lowerBound(),
86 image.domain().upperBound(),
true );
89 trace.error() <<
"Error in the Khamisky space construction."<<std::endl;
94 MySurfelAdjacency surfAdj (
true );
96 trace.beginBlock (
"Set up digital surface." );
117 Functor, ConvFunctor> MyEstimator;
118 ConvFunctor kernel(1.0);
119 Functor estimator(embedder, 1.0);
121 MyEstimator myNormalEstimator;
122 myNormalEstimator.attach(digSurf);
123 myNormalEstimator.setParams(l1, estimator, kernel, 5.0);
124 myNormalEstimator.init(1.0, digSurf.
begin(), digSurf.
end());
126 MyEstimator::Quantity res = myNormalEstimator.eval ( it );
127 trace.info() <<
"Normal vector at begin() : "<< res << std::endl;
135 itbis!=itend; ++itbis )
138 MyEstimator::Quantity normal = myNormalEstimator.eval ( itbis );
145 Functor, ConvFunctorGaussian> MyEstimatorGaussian;
147 ConvFunctorGaussian kernelGaussian(14.0);
148 Functor estimatorGaussian(embedder, 1.0);
150 MyEstimatorGaussian myNormalEstimatorG;
151 myNormalEstimatorG.attach(digSurf);
152 myNormalEstimatorG.setParams(l1, estimatorGaussian, kernelGaussian, 15.0);
153 myNormalEstimatorG.init(1.0, digSurf.
begin(), digSurf.
end());
155 MyEstimatorGaussian::Quantity res2 = myNormalEstimatorG.eval ( it );
156 trace.info() <<
"Normal vector at begin() : "<< res2 << std::endl;
161 itbis!=itend; ++itbis )
164 MyEstimatorGaussian::Quantity normal = myNormalEstimatorG.eval ( itbis );
175int main (
int argc,
char** argv )
177 trace.beginBlock (
"Testing class LocalConvolutionNormalVectorEstimator" );
178 trace.info() <<
"Args:";
179 for (
int i = 0; i < argc; ++i )
180 trace.info() <<
" " << argv[ i ];
181 trace.info() << endl;
184 trace.emphase() << ( res ?
"Passed." :
"Error." ) << endl;
175int main (
int argc,
char** argv ) {
…}
Structure representing an RGB triple with alpha component.
const KSpace & space() const
Aim: Represents a set of n-1-cells in a nD space, together with adjacency relation between these cell...
DigitalSurfaceContainer::Surfel Surfel
const DigitalSurfaceContainer & container() const
DigitalSurfaceContainer::SurfelConstIterator ConstIterator
ConstIterator begin() const
ConstIterator end() const
std::string newQuadList(const std::string &name)
Aim: implements association bewteen points lying in a digital domain and values.
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...
Aim: this class adapts any local functor on digital surface element to define a local estimator....
Aim: implements l_p metrics.
void show() override
Starts the event loop and display of elements.
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...
Aim: Define a simple functor that returns a constant value (0 by default).
Aim: Estimates normal vector by convolution of elementary normal vector to adjacent surfel.
DigitalSurface< MyDigitalSurfaceContainer > MyDigitalSurface
DigitalSetBoundary< KSpace, DigitalSet > MyDigitalSurfaceContainer
Z3i this namespace gathers the standard of types for 3D imagery.
KhalimskySpaceND< 3, Integer > KSpace
DigitalSetSelector< Domain, BIG_DS+HIGH_BEL_DS >::Type DigitalSet
DGtal is the top-level namespace which contains all DGtal functions and types.
Aim: A trivial embedder for signed cell, which corresponds to the canonic injection of cell centroids...
ImageContainerBySTLVector< Domain, Value > Type
static void append(Set &aSet, const ForegroundPredicate &isForeground, typename Image::Domain::ConstIterator itBegin, typename Image::Domain::ConstIterator itEnd)
static ImageContainer importVol(const std::string &filename, const Functor &aFunctor=Functor())
Attach a property to an element.
Aim: defines a functor on double numbers which corresponds to a Gaussian convolution kernel....
bool testLocalConvolutionNormalVectorEstimator(int argc, char **argv)