src/tools/lvr2_kaboom/Options.cpp
Go to the documentation of this file.
1 
28  /*
29  * Options.cpp
30  *
31  * Created on: Aug 7, 2013
32  * Author: Thomas Wiemann
33  */
34 
35 #include "Options.hpp"
36 
37 namespace kaboom
38 {
39 
40 Options::Options(int argc, char** argv) : lvr2::BaseOption(argc, argv), m_descr("Supported options")
41 {
42 
43  // Create option descriptions
44 
45  m_descr.add_options()
46  ("help", "Produce help message")
47  ("inputDir", value<string>()->default_value("./"), "A directory containing several scan files for batch conversion.")
48  ("inputFile", value<string>()->default_value(""), "A single file to convert.")
49  ("outputFile", value<string>()->default_value(""), "The name of a single output file if scans are merged. If the format can be deduced frim the file extension, the specification of --outputFormat is optional.")
50  ("outputDir", value<string>()->default_value("./"), "The target directory for converted data.")
51  ("outputFormat", value<string>()->default_value(""), "Specify the output format. Possible values are ASCII, PLY, DAT, LAS. If left empty, the format is deduced from the extension of the input files.")
52  ("filter", value<bool>()->default_value(false), "Filter input data.")
53  ("exportScanPositions", value<bool>()->default_value(false), "Exports the original scan positions to 'scanpositions.txt'.")
54  ("k", value<int>()->default_value(1), "k neighborhood for filtering.")
55  ("sigma", value<float>()->default_value(1.0), "Deviation for outlier filter.")
56  ("targetSize", value<int>()->default_value(0), "Target size (reduction) for the input scans.")
57  ("transformBefore", value<bool>()->default_value(false), "Transform the scans before frames/pose-transformation.")
58  ("rPos,r", value<int>()->default_value(-1), "Position of the red color component in the input data lines. (-1) means no color information")
59  ("gPos,g", value<int>()->default_value(-1), "Position of the green color component in the input data lines. (-1) means no color information")
60  ("bPos,b", value<int>()->default_value(-1), "Position of the blue color component in the input data lines. (-1) means no color information")
61  ("start,s", value<int>()->default_value(0), "start at scan NR")
62  ("end,e", value<int>()->default_value(0), "end at scan NR")
63  ("voxelSize,v", value<double>()->default_value(0.1), "Voxel size for octree reduction")
64  ("minPointsPerVoxel", value<size_t>()->default_value(5), "Minimum number of points per voxel in octree reduction")
65  ("scanPrefix", value<std::string>()->default_value("scan"), "Prexfix for scan files. E.g., scan for using scan001, scan002 etc.")
66  ("posePrefix", value<std::string>()->default_value("scan"), "Prexfix for files with 4x4 pose estimation in row-majow format. E.g., pose for using pose001, pose002 etc.")
67  ("scanExtension", value<std::string>()->default_value(".3d"), "File extension for parsed files containing point cloud data")
68  ("poseExtension", value<std::string>()->default_value(".dat"), "File extension for parsed files containing pose estimates")
69  ("convertToLVR", value<bool>()->default_value(false), "Convert a file in SLAM coordinates to LVR coordinates")
70  ;
71 
72  m_pdescr.add("inputFile", -1);
73 
74  // Parse command line and generate variables map
75  store(command_line_parser(argc, argv).options(m_descr).positional(m_pdescr).run(), m_variables);
76  notify(m_variables);
77 
78  if(m_variables.count("help")) {
79  ::std::cout<< m_descr << ::std::endl;
80  exit(-1);
81  }
82 
83 
84 }
85 
86 
87 
88 string Options::getOutputFile() const
89 {
90  return m_variables["outputFile"].as<string>();
91 }
92 
93 string Options::getInputFile() const
94 {
95  return m_variables["inputFile"].as<string>();
96 }
97 
98 string Options::getInputDir() const
99 {
100  return m_variables["inputDir"].as<string>();
101 }
102 
103 string Options::getOutputDir() const
104 {
105  return m_variables["outputDir"].as<string>();
106 }
107 
109 {
110  return m_variables["outputFormat"].as<string>();
111 }
112 
114 {
115  return m_variables["convertToLVR"].as<bool>();
116 }
117 
118 
120 {
121  return m_variables["exportScanPositions"].as<bool>();
122 }
123 
124 bool Options::filter() const
125 {
126  return m_variables["filter"].as<bool>();
127 }
128 
130 {
131  return m_variables["transformBefore"].as<bool>();
132 }
133 
134 int Options::getK() const
135 {
136  return m_variables["k"].as<int>();
137 }
138 
139 float Options::getSigma() const
140 {
141  return m_variables["sigma"].as<float>();
142 }
143 
145 {
146  return m_variables["targetSize"].as<int>();
147 }
148 
149 double Options::getVoxelSize() const
150 {
151  return m_variables["voxelSize"].as<double>();
152 }
153 
155 {
156  return m_variables["minPointsPerVoxel"].as<size_t>();
157 }
158 
159 
161  // TODO Auto-generated destructor stub
162 }
163 
164 } // namespace reconstruct
kaboom::Options::getVoxelSize
double getVoxelSize() const
Definition: src/tools/lvr2_kaboom/Options.cpp:149
kaboom::Options::m_variables
variables_map m_variables
The internally used variable map.
Definition: src/tools/lvr2_kaboom/Options.hpp:124
kaboom::Options::exportScanPositions
bool exportScanPositions() const
Definition: src/tools/lvr2_kaboom/Options.cpp:119
kaboom::Options::getMinPointsPerVoxel
size_t getMinPointsPerVoxel() const
Definition: src/tools/lvr2_kaboom/Options.cpp:154
Options.hpp
kaboom::Options::getInputDir
string getInputDir() const
Definition: src/tools/lvr2_kaboom/Options.cpp:98
kaboom::Options::convertToLVR
bool convertToLVR() const
Definition: src/tools/lvr2_kaboom/Options.cpp:113
kaboom::Options::getInputFile
string getInputFile() const
Definition: src/tools/lvr2_kaboom/Options.cpp:93
kaboom::Options::m_descr
options_description m_descr
The internally used option description.
Definition: src/tools/lvr2_kaboom/Options.hpp:127
options
const kaboom::Options * options
Definition: src/tools/lvr2_kaboom/Main.cpp:45
kaboom::Options::filter
bool filter() const
Definition: src/tools/lvr2_kaboom/Options.cpp:124
kaboom::Options::getOutputFile
string getOutputFile() const
Definition: src/tools/lvr2_kaboom/Options.cpp:88
kaboom
Definition: src/tools/lvr2_kaboom/Options.cpp:37
kaboom::Options::transformBefore
bool transformBefore() const
Definition: src/tools/lvr2_kaboom/Options.cpp:129
argc
int argc
Definition: tests_high_five_parallel.cpp:27
kaboom::Options::getSigma
float getSigma() const
Definition: src/tools/lvr2_kaboom/Options.cpp:139
kaboom::Options::getK
int getK() const
Definition: src/tools/lvr2_kaboom/Options.cpp:134
kaboom::Options::getOutputFormat
string getOutputFormat() const
Definition: src/tools/lvr2_kaboom/Options.cpp:108
kaboom::Options::getTargetSize
int getTargetSize() const
Definition: src/tools/lvr2_kaboom/Options.cpp:144
kaboom::Options::Options
Options(int argc, char **argv)
Ctor. Parses the command parameters given to the main function of the program.
Definition: src/tools/lvr2_kaboom/Options.cpp:40
lvr2
Definition: BaseBufferManipulators.hpp:39
kaboom::Options::~Options
virtual ~Options()
Definition: src/tools/lvr2_kaboom/Options.cpp:160
kaboom::Options::m_pdescr
positional_options_description m_pdescr
The internally used positional option desription.
Definition: src/tools/lvr2_kaboom/Options.hpp:130
kaboom::Options::getOutputDir
string getOutputDir() const
Definition: src/tools/lvr2_kaboom/Options.cpp:103
argv
char ** argv
Definition: tests_high_five_parallel.cpp:28


lvr2
Author(s): Thomas Wiemann , Sebastian Pütz , Alexander Mock , Lars Kiesow , Lukas Kalbertodt , Tristan Igelbrink , Johan M. von Behren , Dominik Feldschnieders , Alexander Löhr
autogenerated on Wed Mar 2 2022 00:37:24