32#include "DGtal/base/Common.h"
35#include "DGtal/kernel/SpaceND.h"
36#include "DGtal/kernel/domains/HyperRectDomain.h"
37#include "DGtal/topology/KhalimskySpaceND.h"
40#include "DGtal/shapes/ShapeFactory.h"
41#include "DGtal/shapes/Shapes.h"
42#include "DGtal/helpers/StdDefs.h"
43#include "DGtal/topology/helpers/Surfaces.h"
45#include "DGtal/shapes/GaussDigitizer.h"
46#include "DGtal/geometry/curves/GridCurve.h"
49#include "DGtal/geometry/curves/estimation/TrueLocalEstimatorOnPoints.h"
50#include "DGtal/geometry/curves/estimation/TrueGlobalEstimatorOnPoints.h"
51#include "DGtal/geometry/curves/estimation/ParametricShapeCurvatureFunctor.h"
52#include "DGtal/geometry/curves/estimation/ParametricShapeTangentFunctor.h"
53#include "DGtal/geometry/curves/estimation/ParametricShapeArcLengthFunctor.h"
55#include "DGtal/geometry/curves/estimation/L1LengthEstimator.h"
56#include "DGtal/geometry/curves/estimation/TwoStepLocalLengthEstimator.h"
57#include "DGtal/geometry/curves/estimation/BLUELocalLengthEstimator.h"
58#include "DGtal/geometry/curves/estimation/RosenProffittLocalLengthEstimator.h"
60#include "DGtal/geometry/curves/estimation/MLPLengthEstimator.h"
61#include "DGtal/geometry/curves/estimation/FPLengthEstimator.h"
62#include "DGtal/geometry/curves/estimation/DSSLengthEstimator.h"
64#include "ConfigTest.h"
66#include "DGtal/io/boards/Board2D.h"
78bool testLengthEstimatorsOnBall(
double radius,
double h)
97 trace.
info() <<
"#ball created, r=" << radius << endl;
104 dig.
init( xLow, xUp, h );
114 <<
" error in creating KSpace." << std::endl;
127 <<
" error in finding a bel." << std::endl;
132 std::vector<Point> points;
138 trace.
info() <<
"#grid curve created, h=" << h << endl;
145 double trueValue = M_PI*2*radius;
154 trace.
info() <<
"#Estimations" <<std::endl;
155 trace.
info() <<
"#h true naive 1-sqrt(2) BLUE RosenProffitt DSS MLP FP " <<std::endl;
157 <<
" " << l1length.
eval(rp.c(), rp.c(), h)
158 <<
" " << locallength.eval(ra.begin(), ra.end(), h)
159 <<
" " << BLUElength.
eval(ra.begin(), ra.end(), h)
160 <<
" " << RosenProffittlength.
eval(ra.begin(), ra.end(), h)
161 <<
" " << DSSlength.
eval(rp.c(), rp.c(), h)
162 <<
" " << MLPlength.
eval(rp.c(), rp.c(), h)
163 <<
" " << FPlength.
eval(rp.c(), rp.c(), h)
190 trace.
info() <<
"#ball created, r=" << radius << endl;
197 dig.
init( xLow, xUp, h );
207 <<
" error in creating KSpace." << std::endl;
216 std::vector<Point> points;
222 trace.
info() <<
"#grid curve created, h=" << h << endl;
236 board.
saveSVG(
"Ranges-Set.svg" );
244 board.
saveSVG(
"Ranges-Points.svg" );
253 board.
saveSVG(
"Ranges-SCells.svg" );
268 board.
saveSVG(
"Ranges-Arrows.svg" );
274 <<
" error in finding a bel." << std::endl;
286int main(
int argc,
char** argv )
290 for (
int i = 0; i < argc; ++i )
295 bool res = testLengthEstimatorsOnBall(r,1)
296 && testLengthEstimatorsOnBall(r,0.1)
297 && testLengthEstimatorsOnBall(r,0.01)
298 && testLengthEstimatorsOnBall(r,0.001)
302 trace.
emphase() << ( res ?
"Passed." :
"Error." ) << endl;
Aim: Best Linear Unbiased Two step length estimator.
Aim: Model of the concept StarShaped represents any circle in the plane.
Aim: This class specializes a 'Board' class so as to display DGtal objects more naturally (with <<)....
Aim: model of CConstBidirectionalRange that adapts any range of elements bounded by two iterators [it...
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 wrapper class around a STL associative container for storing sets of digital points within som...
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: A class for computing the Gauss digitization of some Euclidean shape, i.e. its intersection with...
const Point & getUpperBound() const
void attach(ConstAlias< EuclideanShape > shape)
const Point & getLowerBound() const
void init(const RealPoint &xLow, const RealPoint &xUp, typename RealVector::Component gridStep)
Aim: describes, in a cellular space of dimension n, a closed or open sequence of signed d-cells (or d...
SCellsRange getSCellsRange() const
PointsRange getPointsRange() const
ArrowsRange getArrowsRange() const
bool initFromVector(const std::vector< Point > &aVectorOfPoints)
Aim: Parallelepidec region of a digital space, model of a 'CDomain'.
Aim: This class is a model of CCellularGridSpaceND. It represents the cubical grid as a cell complex,...
bool init(const Point &lower, const Point &upper, bool isClosed)
Specifies the upper and lower bounds for the maximal cells in this space.
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
Aim: Rosen-Proffitt Length Estimator.
static void euclideanShaper(TDigitalSet &aSet, const TShapeFunctor &aFunctor, const double h=1.0)
TInteger Integer
Arithmetic ring induced by (+,-,*) and Integer numbers.
static void track2DBoundaryPoints(std::vector< Point > &aVectorOfPoints, const KSpace &K, const SurfelAdjacency< KSpace::dimension > &surfel_adj, const PointPredicate &pp, const SCell &start_surfel)
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...
void beginBlock(const std::string &keyword="")
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=1.) const
void clear(const DGtal::Color &color=DGtal::Color::None)
void saveSVG(const char *filename, PageSize size=Board::BoundingBox, double margin=10.0) const
Point::Coordinate Integer
DGtal is the top-level namespace which contains all DGtal functions and types.
Represents a signed cell in a cellular grid space by its Khalimsky coordinates and a boolean value.
HyperRectDomain< Space > Domain
PointVector< 3, double > RealPoint