DGtal 1.4.2
Loading...
Searching...
No Matches
digitalSetFromPointList.cpp File Reference
#include "DGtal/base/Common.h"
#include "DGtal/io/readers/PointListReader.h"
#include "DGtal/io/DrawWithDisplay3DModifier.h"
#include "DGtal/io/viewers/Viewer3D.h"
#include "DGtal/io/Color.h"
#include "DGtal/helpers/StdDefs.h"
#include "ConfigExamples.h"
Include dependency graph for digitalSetFromPointList.cpp:

Go to the source code of this file.

Functions

int main (int argc, char **argv)
 

Detailed Description

This program is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this program. If not, see http://www.gnu.org/licenses/.

Author
Bertrand Kerautret (kerau.nosp@m.tre@.nosp@m.loria.nosp@m..fr ) LORIA (CNRS, UMR 7503), University of Nancy, France
Date
2011/04/01

An example file named digitalSetFromPointList.

This file is part of the DGtal library.

Definition in file digitalSetFromPointList.cpp.

Function Documentation

◆ main()

int main ( int argc,
char ** argv )

Definition at line 59 of file digitalSetFromPointList.cpp.

60{
61 std::string inputFilename = examplesPath + "samples/pointList3d.pl";
62 QApplication application(argc,argv);
63 Viewer3D<> viewer;
64 viewer.show();
65 // Importing the 3d set of points contained with the default index (0, 1, 2);
66 vector<Z3i::Point> vectPoints= PointListReader<Z3i::Point>::getPointsFromFile(inputFilename);
67 for(unsigned int i=0; i<vectPoints.size();i++){
68 viewer << vectPoints.at(i);
69 }
70
71 // Importing the 3d set of points with another index definition (0, 2, 1);
72 vector<unsigned int> vPos;
73 vPos.push_back(0);
74 vPos.push_back(2);
75 vPos.push_back(1);
76 vectPoints= PointListReader<Z3i::Point>::getPointsFromFile(inputFilename, vPos);
77 viewer<< CustomColors3D(Color(255,0,0), Color(255,0,0));
78 for(unsigned int i=0; i<vectPoints.size();i++){
79 viewer << vectPoints.at(i);
80 }
81
82 viewer << Viewer3D<>::updateDisplay;
83 return application.exec();
84}
Structure representing an RGB triple with alpha component.
Definition Color.h:68
virtual void show()
Overload QWidget method in order to add a call to updateList() method (to ensure that the lists are w...
static std::vector< TPoint > getPointsFromFile(const std::string &filename, std::vector< unsigned int > aVectPosition=std::vector< unsigned int >())

References DGtal::PointListReader< TPoint >::getPointsFromFile(), and DGtal::Viewer3D< TSpace, TKSpace >::show().