35#include "DGtal/base/Common.h"
36#include "ConfigTest.h"
37#include "DGtal/helpers/StdDefs.h"
38#include "DGtal/io/readers/PointListReader.h"
39#include "DGtal/geometry/curves/Naive3DDSSComputer.h"
40#include "DGtal/geometry/curves/estimation/LambdaMST3D.h"
41#include "DGtal/geometry/curves/estimation/FunctorsLambdaMST.h"
42#include "DGtal/geometry/curves/SaturatedSegmentation.h"
49using namespace functors;
59 typedef std::vector < Point >
Range;
60 typedef std::list < Point2D > Range2D;
62 typedef Range2D::const_iterator ConstIterator2D;
65 typedef ArithmeticalDSSComputer < ConstIterator2D, int, 8 > SegmentComputer2D;
73 inputStream.open ( (testPath +
"samples/sinus3D.dat").c_str(), std::ios::in );
81 bool lambda64ByPoint ()
84 LambdaMST3D < Segmentation > lmst64;
85 lmst64.
attach ( segmenter );
86 lmst64.
init ( curve.begin(), curve.end() );
87 for (
ConstIterator it = curve.begin(); it != curve.end(); ++it )
94 LambdaMST3D < Segmentation > lmst64;
95 lmst64.
attach ( segmenter );
96 lmst64.
init ( curve.begin(), curve.end() );
97 vector < RealVector > tangent;
98 lmst64.
eval < back_insert_iterator< vector < RealVector > > > ( curve.begin(), curve.end(), back_insert_iterator< vector < RealVector > > ( tangent ) );
102 bool lambda64Filtered()
105 LambdaMST3D < Segmentation, Lambda64Function, DSSLengthLessEqualFilter < SegmentComputer > > lmst64;
106 lmst64.
attach ( segmenter );
108 lmst64.
init ( curve.begin(), curve.end() );
109 for (
ConstIterator it = curve.begin(); it != curve.end(); ++it )
114 bool lambdaSinByPoint ()
117 LambdaMST3D < Segmentation, LambdaSinFromPiFunction > lmst;
118 lmst.
attach ( segmenter );
119 lmst.
init ( curve.begin(), curve.end() );
120 for (
ConstIterator it = curve.begin(); it != curve.end(); ++it )
128 LambdaMST3D < Segmentation, LambdaSinFromPiFunction > lmst;
129 lmst.
attach ( segmenter );
130 lmst.
init ( curve.begin(), curve.end() );
131 vector < RealVector > tangent;
132 lmst.
eval < back_insert_iterator< vector < RealVector > > > ( curve.begin(), curve.end(), back_insert_iterator< vector < RealVector > > ( tangent ) );
136 bool lambdaExpByPoint ()
139 LambdaMST3D < Segmentation, LambdaExponentialFunction > lmst;
140 lmst.
attach ( segmenter );
141 lmst.
init ( curve.begin(), curve.end() );
142 for (
ConstIterator it = curve.begin(); it != curve.end(); ++it )
150 LambdaMST3D < Segmentation, LambdaExponentialFunction > lmst;
151 lmst.
attach ( segmenter );
152 lmst.
init ( curve.begin(), curve.end() );
153 vector < RealVector > tangent;
154 lmst.
eval < back_insert_iterator< vector < RealVector > > > ( curve.begin(), curve.end(), back_insert_iterator< vector < RealVector > > ( tangent ) );
166 testLambdaMST3D testLMST;
169 res &= testLMST.lambda64ByPoint();
170 res &= testLMST.lambda64Filtered();
171 res &= testLMST.lambdaSinByPoint();
172 res &= testLMST.lambdaExpByPoint();
175 res &= testLMST.lambda64();
176 res &= testLMST.lambdaSin();
177 res &= testLMST.lambdaExp();
180 trace.
emphase() << ( res ?
"Passed." :
"Error." ) << endl;
void attach(Alias< TSegmentation > segmentComputer)
RealVector eval(const Point &p)
void init(ConstIterator itb, ConstIterator ite)
DSSFilter & getDSSFilter()
Aim: Computes the saturated segmentation, that is the whole set of maximal segments within a range gi...
void beginBlock(const std::string &keyword="")
MyDigitalSurface::ConstIterator ConstIterator
DGtal is the top-level namespace which contains all DGtal functions and types.
static std::vector< TPoint > getPointsFromInputStream(std::istream &in, std::vector< unsigned int > aVectPosition=std::vector< unsigned int >())
SaturatedSegmentation< SegmentComputer > Segmentation