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"
66 using namespace DGtal;
73 std::string filename = examplesPath +
"samples/contourS.pgm";
91 std::vector< std::vector< Z2i::SCell > > contours;
96 if (contours.size() > 0)
114 DSSlength.
init(1, r.
c(), r.
c());
122 Segmentation theSegmentation( r.
c(), r.
c(), SegmentComputer() );
123 Segmentation::SegmentComputerIterator i = theSegmentation.
begin();
124 Segmentation::SegmentComputerIterator end = theSegmentation.
end();
127 aBoard <<
SetMode(
"PointVector",
"Grid");
128 for ( ; i != end; ++i) {
129 SegmentComputer::Primitive dss = i->primitive();
130 aBoard <<
SetMode(dss.className(),
"Points") << dss;
131 aBoard <<
SetMode(dss.className(),
"BoundingBox") << dss;
133 aBoard.
saveEPS(
"DisplayDSSSegmentationTuto3.eps");
135 }
else trace.
info() <<
"no contour" << std::endl;
PointsRange getPointsRange() const
Aim: implements association bewteen points lying in a digital domain and values.
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...
functors namespace gathers all DGtal functors.
Aim: This class is a wrapper around ArithmeticalDSS that is devoted to the dynamic recognition of dig...
Aim: Computes the greedy segmentation of a range given by a pair of ConstIterators. The last element of a given segment is the first one one of the next segment.
Aim: model of CBidirectionalRangeFromPoint that adapts any range of elements bounded by two iterators...
static ImageContainer importPGM(const std::string &aFilename, const Functor &aFunctor=Functor(), bool topbotomOrder=true)
Aim: A small functor with an operator () that compares one value to an interval.
GreedySegmentation::SegmentComputerIterator begin() const
bool init(const Point &lower, const Point &upper, bool isClosed)
void init(const double h, const ConstIterator &itb, const ConstIterator &ite)
Aim: a model of CGlobalCurveEstimator that segments the digital curve into DSS and computes the lengt...
DGtal is the top-level namespace which contains all DGtal functions and types.
Aim: model of CConstBidirectionalRange that adapts any range of elements bounded by two iterators [it...
const ConstIterator end() const
void saveEPS(const char *filename, PageSize size=Board::BoundingBox, double margin=10.0) const
Modifier class in a Board2D stream. Useful to choose your own mode for a given class. Realizes the concept CDrawableWithBoard2D.
const Domain & domain() const
Aim: describes, in a cellular space of dimension n, a closed or open sequence of signed d-cells (or d...
bool initFromSCellsVector(const std::vector< SCell > &aVectorOfSCells)
Aim: This class is a model of CCellularGridSpaceND. It represents the cubical grid as a cell complex...
Aim: The predicate returns true when the predicate returns true for the value assigned to a given poi...
Aim: This class specializes a 'Board' class so as to display DGtal objects more naturally (with <<)...