Loading [MathJax]/extensions/TeX/AMSsymbols.js
DGtal 2.0.0
exampleArithDSS3d.cpp
Go to the documentation of this file.
1
16
28
44
45
46
47
48#include <iostream>
49
50#include "DGtal/io/viewers/PolyscopeViewer.h"
51
52#include "DGtal/io/readers/PointListReader.h"
53
54#include "DGtal/base/Common.h"
55#include "DGtal/helpers/StdDefs.h"
56#include "ConfigExamples.h"
57
58#include "DGtal/geometry/curves/StandardDSS6Computer.h"
59#include "DGtal/geometry/curves/GreedySegmentation.h"
60
61
62using namespace std;
63using namespace DGtal;
64using namespace Z3i;
65
66
67// Standard services - public :
68
69int main( int argc, char** argv )
70{
71
73 typedef std::vector<Point>::iterator Iterator;
75 typedef GreedySegmentation<SegmentComputer> Decomposition;
76
77 string inputFilename = examplesPath + "samples/sinus.dat";
78 vector<Point> sequence = PointListReader<Point>::getPointsFromFile(inputFilename);
79
80
81 SegmentComputer algo;
82 Decomposition theDecomposition(sequence.begin(), sequence.end(), algo);
83
85 //display
86 Point p;
87
88#ifdef DGTAL_WITH_POLYSCOPE
89
90 PolyscopeViewer viewer;
91 viewer.allowReuseList = true; // groups segments
92 viewer.drawAsGrid();
93#endif
94
95 unsigned int c = 0;
96 Decomposition::SegmentComputerIterator i = theDecomposition.begin();
97 for ( ; i != theDecomposition.end(); ++i) {
98 SegmentComputer currentSegmentComputer(*i);
99 #ifdef DGTAL_WITH_POLYSCOPE
100 viewer.drawAsBalls();
101 viewer << currentSegmentComputer;
102 viewer.defaultStyle();
103 viewer << currentSegmentComputer;
104 #endif
105 c++;
106 }
107
108
109 #ifdef DGTAL_WITH_POLYSCOPE
110 viewer.show();
111 #endif
112
113}
114
void drawAsGrid(bool toggle=true)
Aim: Computes the greedy segmentation of a range given by a pair of ConstIterators....
Aim: Implements basic operations that will be used in Point and Vector classes.
void show() override
Starts the event loop and display of elements.
Aim: Dynamic recognition of a 3d-digital straight segment (DSS)
Z3i this namespace gathers the standard of types for 3D imagery.
DGtal is the top-level namespace which contains all DGtal functions and types.
STL namespace.
static std::vector< TPoint > getPointsFromFile(const std::string &filename, std::vector< unsigned int > aVectPosition=std::vector< unsigned int >())
ArithmeticalDSSComputer< std::vector< Z2i::Point >::const_iterator, int, 4 > SegmentComputer
int main()
Definition testBits.cpp:56