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
const kaboom::Options * options
options_description m_descr
The internally used option description.
Options(int argc, char **argv)
Ctor. Parses the command parameters given to the main function of the program.
variables_map m_variables
The internally used variable map.
positional_options_description m_pdescr
The internally used positional option desription.
char ** argv


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 Mon Feb 28 2022 22:46:08