32#include "DGtal/base/Common.h"
34#include "DGtal/kernel/SpaceND.h"
35#include "DGtal/kernel/domains/HyperRectDomain.h"
36#include "DGtal/kernel/sets/DigitalSetSelector.h"
37#include "DGtal/topology/KhalimskySpaceND.h"
38#include "DGtal/topology/SurfelAdjacency.h"
39#include "DGtal/topology/SurfelNeighborhood.h"
42#include "DGtal/geometry/curves/GridCurve.h"
43#include "DGtal/geometry/2d/L1LengthEstimator.h"
44#include "DGtal/geometry/2d/TwoStepLocalLengthEstimator.h"
45#include "DGtal/geometry/2d/MLPLengthEstimator.h"
46#include "DGtal/geometry/2d/FPLengthEstimator.h"
47#include "DGtal/geometry/2d/DSSLengthEstimator.h"
49#include "ConfigTest.h"
67 trace.
info() <<
"Reading GridCurve " << endl;
70 instream.open (filename.c_str(), ifstream::in);
80 l1length.init(1, ra.
begin(), ra.
end(), c.isClosed());
81 trace.
info() <<
"L1 length (h=1) = "<< l1length.
eval()<<std::endl;
83 l1length.init(10, ra.
begin(), ra.
end(), c.isClosed());
84 trace.
info() <<
"L1 length (h=10) = "<< l1length.
eval()<<std::endl;
89 localength.init(1, ra.
begin(), ra.
end(), c.isClosed());
90 trace.
info() <<
"Local length (h=1) = "<< localength.eval()<<std::endl;
97 MLPlength.init(1, rp.
begin(), rp.
end(), c.isClosed());
98 trace.
info() <<
"MLP Length (h=1) = "<< MLPlength.
eval()<<std::endl;
100 MLPlength.init(10, rp.
begin(), rp.
end(), c.isClosed());
101 trace.
info() <<
"MLP Length (h=10) = "<< MLPlength.
eval()<<std::endl;
106 FPlength.init(1, rp.
begin(), rp.
end(), c.isClosed());
107 trace.
info() <<
"FP Length (h=1) = "<< FPlength.
eval()<<std::endl;
109 FPlength.init(10, rp.
begin(), rp.
end(), c.isClosed());
110 trace.
info() <<
"FP Length (h=10) = "<< FPlength.
eval()<<std::endl;
115 DSSlength.init(1, rp.
begin(), rp.
end(), c.isClosed());
116 trace.
info() <<
"DSS Length (h=1) = "<< DSSlength.
eval()<<std::endl;
118 DSSlength.init(10, rp.
begin(), rp.
end(), c.isClosed());
119 trace.
info() <<
"DSS Length (h=10) = "<< DSSlength.
eval()<<std::endl;
129int main(
int argc,
char** argv )
133 for (
int i = 0; i < argc; ++i )
137 std::string sinus2D4 = testPath +
"samples/sinus2D4.dat";
142 trace.
emphase() << ( res ?
"Passed." :
"Error." ) << endl;
Aim: a model of CGlobalCurveEstimator that segments the digital curve into DSS and computes the lengt...
Quantity eval(const ConstIterator &itb, const ConstIterator &ite, const double h=1.) const
Aim: a model of CGlobalCurveEstimator that computes the length of a digital curve using its FP (faith...
Quantity eval(const ConstIterator &itb, const ConstIterator &ite, const double h=1.) const
Aim: describes, in a cellular space of dimension n, a closed or open sequence of signed d-cells (or d...
ConstIterator begin() const
bool initFromVectorStream(std::istream &in)
PointsRange getPointsRange() const
ArrowsRange getArrowsRange() const
ConstIterator end() const
Aim: a simple model of CGlobalCurveEstimator that compute the length of a curve using the l_1 metric ...
Quantity eval(const ConstIterator &itb, const ConstIterator &ite, const double h) const
Aim: a model of CGlobalCurveEstimator that computes the length of a digital curve using its MLP (give...
Quantity eval(const ConstIterator &itb, const ConstIterator &ite, const double h=1.) const
void beginBlock(const std::string &keyword="")
Aim: a simple model of CGlobalCurveEstimator that compute the length of a curve using the l_1 metric ...
DGtal is the top-level namespace which contains all DGtal functions and types.
bool testL1LengthEstimator(std::string &filename)