DGtal 1.3.0
No Matches

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/Viewer3D.h"
#include "DGtal/io/boards/Board3DTo2D.h"
#include "DGtal/io/DrawWithDisplay3DModifier.h"
#include "DGtal/io/readers/PointListReader.h"
#include "DGtal/io/CDrawableWithDisplay3D.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);
bool flag = true;
Point p;
QApplication application(argc,argv);
Viewer3D<> viewer;
viewer << SetMode3D(p.className(), "Grid");
Board3DTo2D<> boardViewer;
boardViewer << SetMode3D(p.className(), "Grid");
boardViewer << CameraPosition(-23.500000, 12.500000, 42.078199)
<< CameraDirection(0.7200000, -0.280000, -0.620000)
<< CameraUpVector(0.1900000, 0.950000, -0.200000);
boardViewer << CameraZNearFar(21.578200, 105.578199);
unsigned int c = 0;
Decomposition::SegmentComputerIterator i = theDecomposition.begin();
for ( ; i != theDecomposition.end(); ++i) {
SegmentComputer currentSegmentComputer(*i);
viewer << SetMode3D(currentSegmentComputer.className(), "Points");
viewer << currentSegmentComputer;
viewer << SetMode3D(currentSegmentComputer.className(), "BoundingBox");
viewer << currentSegmentComputer;
boardViewer << SetMode3D(currentSegmentComputer.className(), "Points");
boardViewer << currentSegmentComputer;
boardViewer << SetMode3D(currentSegmentComputer.className(), "BoundingBox");
boardViewer << currentSegmentComputer;
viewer << Viewer3D<>::updateDisplay;
flag = application.exec();
boardViewer.saveCairo("exampleArithDSS3d.pdf", Board3DTo2D<>::CairoPDF, 600*2, 400*2);
return flag;
Class for PDF, PNG, PS, EPS, SVG export drawings with Cairo with 3D->2D projection.
Definition: Board3DTo2D.h:71
void saveCairo(const char *filename, CairoType type, int bWidth, int bHeight)
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.
Definition: PointVector.h:593
Aim: Dynamic recognition of a 3d-digital straight segment (DSS)
virtual void show()
Overload QWidget method in order to add a call to updateList() method (to ensure that the lists are w...
DGtal is the top-level namespace which contains all DGtal functions and types.
STL namespace.
CameraDirection class to set camera direction.
CameraPosition class to set camera position.
CameraUpVector class to set camera up-vector.
CameraZNearFar class to set near and far distance.
Aim: Implements method to read a set of points represented in each line of a file.
Modifier class in a Display3D stream. Useful to choose your own mode for a given class....
ArithmeticalDSSComputer< std::vector< Z2i::Point >::const_iterator, int, 4 > SegmentComputer
int main()
Definition: testBits.cpp:56
MyPointD Point
Definition: testClone2.cpp:383