43#include "DGtal/base/Common.h"
44#include "DGtal/base/Exceptions.h"
45#include "DGtal/io/boards/Board2D.h"
47#include "DGtal/topology/KhalimskySpaceND.h"
49#include "DGtal/geometry/curves/GridCurve.h"
50#include "DGtal/geometry/curves/ArithmeticalDSSComputer.h"
51#include "DGtal/geometry/curves/estimation/MostCenteredMaximalSegmentEstimator.h"
52#include "DGtal/geometry/curves/estimation/CCurveLocalGeometricEstimator.h"
55#include "ConfigTest.h"
71bool test(
const I& itb,
const I& ite)
77 typedef typename SCEstimator::Quantity
Value;
87 unsigned int nbok = 0;
88 std::vector<Value> v1, v2, v3;
91 trace.
info() <<
"Eval at one element" << endl;
97 Value q = e.eval(it,1.);
107 trace.
info() <<
"Eval for each element between begin and end " << endl;
108 e.eval(itb, ite, std::back_inserter(v2));
110 for (
typename std::vector<Value>::iterator i = v2.begin(); i != v2.end(); ++i) {
116 nbok += ( ( v1.size() == v2.size() ) &&
117 ( std::equal(v1.begin(), v1.end(), v2.begin() ) ) )?1:0;
120 trace.
info() <<
"(" << nbok <<
"/" << nb <<
")" << std::endl;
122 if ( (ite-itb) >= 10)
125 trace.
info() <<
"Eval for each element between begin+4 and begin+9 " << endl;
127 e.eval((itb+4),(itb+9),std::back_inserter(v3));
129 for (
typename vector<Value>::iterator i = v3.begin(); i != v3.end(); ++i) {
134 nbok += ( (v3.size() == 5) &&
135 ( std::equal( (v1.begin()+4), (v1.begin()+9), v3.begin()) ) )?1:0;
138 trace.
info() <<
"(" << nbok <<
"/" << nb <<
")" << std::endl;
152 trace.
info() <<
"Reading GridCurve from " << filename << endl;
155 instream.open (filename.c_str(), ifstream::in);
160 Range r = c.getPointsRange();
162 trace.
info() <<
"Building Estimator (process range as";
163 trace.
info() << ( (c.isClosed())?
"closed":
"open" ) <<
")" << endl;
166 return test(r.c(), r.c());
168 return test(r.begin(), r.end());
179 trace.
beginBlock (
"Testing class MostCenteredMaximalSegmentEstimator" );
181 for (
int i = 0; i < argc; ++i )
185 std::string sinus2D4 = testPath +
"samples/sinus2D4.dat";
186 std::string square = testPath +
"samples/smallSquare.dat";
187 std::string dss = testPath +
"samples/DSS.dat";
194 trace.
emphase() << ( res ?
"Passed." :
"Error." ) << endl;
Aim: This class is a wrapper around ArithmeticalDSS that is devoted to the dynamic recognition of dig...
Aim: model of CConstBidirectionalRange that adapts any range of elements bounded by two iterators [it...
Aim: describes, in a cellular space of dimension n, a closed or open sequence of signed d-cells (or d...
bool initFromVectorStream(std::istream &in)
Aim: This class is a model of CCellularGridSpaceND. It represents the cubical grid as a cell complex,...
Aim: A model of CLocalCurveGeometricEstimator that assigns to each element of a (sub)range a quantity...
Aim: model of CBidirectionalRangeFromPoint that adapts any range of elements bounded by two iterators...
void beginBlock(const std::string &keyword="")
PlaneProbingParallelepipedEstimator< DigitalPlane, ProbingMode::R1 > Estimator
MyDigitalSurface::ConstIterator ConstIterator
DGtal is the top-level namespace which contains all DGtal functions and types.
bool isNotEmpty(const IC &itb, const IC &ite)
Aim: This concept describes an object that can process a range so as to return one estimated quantity...
ArithmeticalDSSComputer< std::vector< Z2i::Point >::const_iterator, int, 4 > SegmentComputer
bool testEval(string filename)
bool test(const I &itb, const I &ite)