38#include "DGtal/base/Common.h"
39#include "DGtal/helpers/StdDefs.h"
40#include "ConfigExamples.h"
44#include "DGtal/base/BasicFunctors.h"
45#include "DGtal/kernel/BasicPointPredicates.h"
46#include "DGtal/io/readers/PGMReader.h"
47#include "DGtal/images/ImageContainerBySTLVector.h"
51#include "DGtal/topology/helpers/Surfaces.h"
55#include "DGtal/geometry/curves/estimation/DSSLengthEstimator.h"
59#include "DGtal/io/boards/Board2D.h"
62#include "DGtal/geometry/curves/GreedySegmentation.h"
73 std::string filename = examplesPath +
"samples/contourS.pgm";
85 ks.
init(
image.domain().lowerBound(),
image.domain().upperBound(),
true );
91 std::vector< std::vector< Z2i::SCell > > contours;
96 if (contours.size() > 0)
114 trace.info() <<
"Length: " << DSSlength.
eval(r.
c(), r.
c(), 1.) << std::endl;
122 Segmentation::SegmentComputerIterator i = theSegmentation.
begin();
123 Segmentation::SegmentComputerIterator end = theSegmentation.
end();
126 aBoard <<
SetMode(
"PointVector",
"Grid");
127 for ( ; i != end; ++i) {
132 aBoard.
saveEPS(
"DisplayDSSSegmentationTuto3.eps");
134 }
else trace.info() <<
"no contour" << std::endl;
Aim: This class is a wrapper around ArithmeticalDSS that is devoted to the dynamic recognition of dig...
std::string className() const
Aim: This class specializes a 'Board' class so as to display DGtal objects more naturally (with <<)....
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: Computes the greedy segmentation of a range given by a pair of ConstIterators....
PointsRange getPointsRange() const
ConstRangeAdapter< typename Storage::const_iterator, functors::SCellToPoint< KSpace >, Point > PointsRange
bool initFromSCellsVector(const std::vector< SCell > &aVectorOfSCells)
Aim: implements association bewteen points lying in a digital domain and values.
bool init(const Point &lower, const Point &upper, bool isClosed)
Specifies the upper and lower bounds for the maximal cells in this space.
SaturatedSegmentation::SegmentComputerIterator end() const
SaturatedSegmentation::SegmentComputerIterator begin() const
Aim: A utility class for constructing surfaces (i.e. set of (n-1)-cells).
Aim: Represent adjacencies between surfel elements, telling if it follows an interior to exterior ord...
Aim: A small functor with an operator () that compares one value to an interval.
void saveEPS(const char *filename, PageSize size=Board::BoundingBox, double margin=10.0) const
KhalimskySpaceND< 2, Integer > KSpace
functors namespace gathers all DGtal functors.
DGtal is the top-level namespace which contains all DGtal functions and types.
static ImageContainer importPGM(const std::string &aFilename, const Functor &aFunctor=Functor(), bool topbotomOrder=true)
Modifier class in a Board2D stream. Useful to choose your own mode for a given class....
Aim: The predicate returns true when the predicate returns true for the value assigned to a given poi...
ArithmeticalDSSComputer< std::vector< Z2i::Point >::const_iterator, int, 4 > SegmentComputer
SaturatedSegmentation< SegmentComputer > Segmentation