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" 65 using namespace DGtal;
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." );
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" );
179 int 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;
void beginBlock(const std::string &keyword="")
Aim: A model of CDigitalSurfaceContainer which defines the digital surface as the boundary of an impl...
Aim: implements association bewteen points lying in a digital domain and values.
DigitalSurfaceContainer::SurfelConstIterator ConstIterator
Aim: Computes the normal vector at a surface element by convolution of elementary normal vector to ad...
Aim: A utility class for constructing surfaces (i.e. set of (n-1)-cells).
Aim: Represents a set of n-1-cells in a nD space, together with adjacency relation between these cell...
Aim: A model of CDigitalSurfaceContainer which defines the digital surface as the boundary of a given...
ConstIterator begin() const
Aim: A trivial embedder for digital surfaces, which corresponds to the canonic injection of cell cent...
void exportAs3DNOFF(std::ostream &out, const SCellEmbedderWithGradientMap &scembedder) const
bool init(const Point &lower, const Point &upper, bool isClosed)
Specifies the upper and lower bounds for the maximal cells in this space.
Aim: implements methods to read a "Vol" file format.
int main(int argc, char **argv)
DGtal is the top-level namespace which contains all DGtal functions and types.
Aim: A wrapper class around a STL associative container for storing sets of digital points within som...
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.
ImageContainerBySTLVector< Domain, Value > Image
Aim: implement a trivial constant convolution kernel which returns 1 to each distance.
Aim: Represents the concept of estimator of normal vector along digital surfaces.
DigitalSetBoundary< KSpace, DigitalSet > MyDigitalSurfaceContainer
Aim: implement a Gaussian centered convolution kernel.
Aim: Combines a digital surface embedder with a normal vector estimator to get a model of CDigitalSur...
bool testLocalConvolutionNormalVectorEstimator(int, char **)
Aim: This class is a model of CCellularGridSpaceND. It represents the cubical grid as a cell complex,...
DigitalSurface< MyDigitalSurfaceContainer > MyDigitalSurface