DGtal 2.1.0
Loading...
Searching...
No Matches
digitalSetFromPointList.cpp File Reference
#include "DGtal/base/Common.h"
#include "DGtal/io/readers/PointListReader.h"
#include "DGtal/io/viewers/PolyscopeViewer.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 ()
 

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 ( void  )

Definition at line 58 of file digitalSetFromPointList.cpp.

59{
60 std::string inputFilename = examplesPath + "samples/pointList3d.pl";
61 PolyscopeViewer<> viewer;
62 // Importing the 3d set of points contained with the default index (0, 1, 2);
63 vector<Z3i::Point> vectPoints= PointListReader<Z3i::Point>::getPointsFromFile(inputFilename);
64 for(unsigned int i=0; i<vectPoints.size();i++){
65 viewer << vectPoints.at(i);
66 }
67
68 // Importing the 3d set of points with another index definition (0, 2, 1);
69 vector<unsigned int> vPos;
70 vPos.push_back(0);
71 vPos.push_back(2);
72 vPos.push_back(1);
73 vectPoints= PointListReader<Z3i::Point>::getPointsFromFile(inputFilename, vPos);
74 viewer<< Color(255,0,0);
75 for(unsigned int i=0; i<vectPoints.size();i++){
76 viewer << vectPoints.at(i);
77 }
78
79 viewer.show();
80 return 0;
81}
Structure representing an RGB triple with alpha component.
Definition Color.h:77
void show() override
Starts the event loop and display of elements.
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::PolyscopeViewer< Space, KSpace >::show().