LSROptionsYamlExtensions.hpp
Go to the documentation of this file.
1 
35 #ifndef LVR2_LSR_OPTIONS_YAML_EXTENSIONS
36 #define LVR2_LSR_OPTIONS_YAML_EXTENSIONS
37 
38 #include <yaml-cpp/yaml.h>
39 
41 
42 namespace YAML
43 {
44 template<>
45 struct convert<lvr2::LSROptions>
46 {
47  static Node encode(const lvr2::LSROptions& options)
48  {
49  Node node;
50 
51  node["bigMesh"] = options.bigMesh;
52  node["debugChunks"] = options.debugChunks;
53  node["useGPU"] = options.useGPU;
54  node["voxelSizes"] = options.voxelSizes;
55  node["bgVoxelSize"] = options.bgVoxelSize;
56  node["scale"] = options.scale;
57  node["nodeSize"] = options.nodeSize;
58  node["partMethod"] = options.partMethod;
59  node["ki"] = options.ki;
60  node["kd"] = options.kd;
61  node["kn"] = options.kn;
62  node["flipPoint"] = options.flipPoint;
63  node["useRansac"] = options.useRansac;
64  node["extrude"] = options.extrude;
65  node["removeDanglingArtifacts"] = options.removeDanglingArtifacts;
66  node["cleanContours"] = options.cleanContours;
67  node["fillHoles"] = options.fillHoles;
68  node["optimizePlanes"] = options.optimizePlanes;
69  node["planeNormalThreshold"] = options.planeNormalThreshold;
70  node["planeIterations"] = options.planeIterations;
71  node["minPlaneSize"] = options.minPlaneSize;
72  node["smallRegionThreshold"] = options.smallRegionThreshold;
73  node["retesselate"] = options.retesselate;
74  node["lineFusionThreshold"] = options.lineFusionThreshold;
75 
76  return node;
77  }
78 
79  static bool decode(const Node& node, lvr2::LSROptions& options)
80  {
81  if (!node.IsMap())
82  {
83  return false;
84  }
85 
86  if (node["bigMesh"])
87  {
88  options.bigMesh = node["bigMesh"].as<bool>();
89  }
90 
91  if (node["debugChunks"])
92  {
93  options.debugChunks = node["debugChunks"].as<bool>();
94  }
95 
96  if (node["useGPU"])
97  {
98  options.useGPU = node["useGPU"].as<bool>();
99  }
100 
101  if (node["voxelSizes"])
102  {
103  options.voxelSizes = node["voxelSizes"].as<std::vector<float>>();
104  }
105 
106  if (node["bgVoxelSize"])
107  {
108  options.bgVoxelSize = node["bgVoxelSize"].as<float>();
109  }
110 
111  if (node["scale"])
112  {
113  options.scale = node["scale"].as<float>();
114  }
115 
116  if (node["nodeSize"])
117  {
118  options.nodeSize = node["nodeSize"].as<uint>();
119  }
120 
121  if (node["partMethod"])
122  {
123  options.partMethod = node["partMethod"].as<int>();
124  }
125 
126  if (node["ki"])
127  {
128  options.ki = node["ki"].as<int>();
129  }
130 
131  if (node["kd"])
132  {
133  options.kd = node["kd"].as<int>();
134  }
135 
136  if (node["kn"])
137  {
138  options.kn = node["kn"].as<int>();
139  }
140 
141  if (node["useRansac"])
142  {
143  options.useRansac = node["useRansac"].as<bool>();
144  }
145 
146  if (node["flipPoint"])
147  {
148  options.flipPoint = node["flipPoint"].as<std::vector<float>>();
149  }
150 
151  if (node["extrude"])
152  {
153  options.extrude = node["extrude"].as<bool>();
154  }
155 
156  if (node["removeDanglingArtifacts"])
157  {
158  options.removeDanglingArtifacts = node["removeDanglingArtifacts"].as<int>();
159  }
160 
161  if (node["cleanContours"])
162  {
163  options.cleanContours = node["cleanContours"].as<int>();
164  }
165 
166  if (node["fillHoles"])
167  {
168  options.fillHoles = node["fillHoles"].as<int>();
169  }
170 
171  if (node["optimizePlanes"])
172  {
173  options.optimizePlanes = node["optimizePlanes"].as<bool>();
174  }
175 
176  if (node["planeNormalThreshold"])
177  {
178  options.planeNormalThreshold = node["planeNormalThreshold"].as<float>();
179  }
180 
181  if (node["planeIterations"])
182  {
183  options.planeIterations = node["planeIterations"].as<int>();
184  }
185 
186  if (node["minPlaneSize"])
187  {
188  options.minPlaneSize = node["minPlaneSize"].as<int>();
189  }
190 
191  if (node["smallRegionThreshold"])
192  {
193  options.smallRegionThreshold = node["smallRegionThreshold"].as<int>();
194  }
195 
196  if (node["retesselate"])
197  {
198  options.retesselate = node["retesselate"].as<bool>();
199  }
200 
201  if (node["lineFusionThreshold"])
202  {
203  options.lineFusionThreshold = node["lineFusionThreshold"].as<float>();
204  }
205 
206  return true;
207  }
208 };
209 } // namespace YAML
210 
211 #endif
lvr2::LSROptions
Definition: LargeScaleReconstruction.hpp:40
YAML
Definition: LSROptionsYamlExtensions.hpp:42
YAML::convert< lvr2::LSROptions >::encode
static Node encode(const lvr2::LSROptions &options)
Definition: LSROptionsYamlExtensions.hpp:47
options
const kaboom::Options * options
Definition: src/tools/lvr2_kaboom/Main.cpp:45
YAML::convert< lvr2::LSROptions >::decode
static bool decode(const Node &node, lvr2::LSROptions &options)
Definition: LSROptionsYamlExtensions.hpp:79
lvr2::convert
void convert(COORD_SYSTEM from, COORD_SYSTEM to, float *point)
Definition: CoordinateTransform.cpp:46
LargeScaleReconstruction.hpp
lvr2
Definition: BaseBufferManipulators.hpp:39
uint
unsigned int uint
Definition: Model.hpp:46


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