DGtal 2.0.0
Loading...
Searching...
No Matches
geometry/curves/exampleArithDSS3d.cpp

This example outputs a greedy segmentation of an open and 6-connected 3d digital curve into DSSs.

$ ./examples/geometry/curves/exampleArithDSS3d
Greedy segmentation of a 3d digital curve into DSSs
See also
Analysis of one-dimensional discrete structures
#include <iostream>
#include "DGtal/io/viewers/PolyscopeViewer.h"
#include "DGtal/io/readers/PointListReader.h"
#include "DGtal/base/Common.h"
#include "DGtal/helpers/StdDefs.h"
#include "ConfigExamples.h"
#include "DGtal/geometry/curves/StandardDSS6Computer.h"
#include "DGtal/geometry/curves/GreedySegmentation.h"
using namespace std;
using namespace DGtal;
using namespace Z3i;
// Standard services - public :
int main( int argc, char** argv )
{
typedef std::vector<Point>::iterator Iterator;
typedef GreedySegmentation<SegmentComputer> Decomposition;
string inputFilename = examplesPath + "samples/sinus.dat";
vector<Point> sequence = PointListReader<Point>::getPointsFromFile(inputFilename);
Decomposition theDecomposition(sequence.begin(), sequence.end(), algo);
//display
Point p;
#ifdef DGTAL_WITH_POLYSCOPE
viewer.allowReuseList = true; // groups segments
viewer.drawAsGrid();
#endif
unsigned int c = 0;
Decomposition::SegmentComputerIterator i = theDecomposition.begin();
for ( ; i != theDecomposition.end(); ++i) {
SegmentComputer currentSegmentComputer(*i);
#ifdef DGTAL_WITH_POLYSCOPE
viewer.drawAsBalls();
viewer << currentSegmentComputer;
viewer.defaultStyle();
viewer << currentSegmentComputer;
#endif
c++;
}
#ifdef DGTAL_WITH_POLYSCOPE
viewer.show();
#endif
}
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)
DGtal is the top-level namespace which contains all DGtal functions and types.
STL namespace.
Aim: Implements method to read a set of points represented in each line of a file.
ArithmeticalDSSComputer< std::vector< Z2i::Point >::const_iterator, int, 4 > SegmentComputer
int main()
Definition testBits.cpp:56
MyPointD Point