HDF5MetaDescriptionV2.cpp
Go to the documentation of this file.
4 
5 namespace lvr2
6 {
7 
10  const YAML::Node& n) const
11 {
12 
13 }
14 
16  HighFive::Group &g,
17  const YAML::Node &n) const
18 {
19 
20 }
21 
23  HighFive::Group &g,
24  const YAML::Node &n) const
25 {
26  YAML::Node config;
27  config = n["config"];
28 
29  vector<size_t> dim = {2, 1};
30 
31  // Phi min/max
32  doubleArr phi(new double[2]);
33  phi[0] = 0.0;
34  phi[1] = 0.0;
35  if(config["phi"] && config["phi"].size() == 2)
36  {
37  phi[0] = config["phi"][0].as<double>();
38  phi[1] = config["phi"][1].as<double>();
39  }
40  hdf5util::addArray<double>(g, "phi", dim, phi);
41 
42  // Theta min/max
43  doubleArr theta(new double[2]);
44  theta[0] = 0.0;
45  theta[1] = 0.0;
46  if(config["theta"] && config["theta"].size() == 2)
47  {
48  theta[0] = config["theta"][0].as<double>();
49  theta[1] = config["theta"][1].as<double>();
50  }
51  hdf5util::addArray<double>(g, "theta", dim, theta);
52 
53  // Horizontal and vertical resolution
54  doubleArr resolution(new double[2]);
55  resolution[0] = 0.0;
56  resolution[1] = 0.0;
57  if(config["h_res"])
58  {
59  resolution[0] = config["h_res"].as<double>();
60  }
61  if(config["v_res"])
62  {
63  resolution[1] = config["v_res"].as<double>();
64  }
65  hdf5util::addArray<double>(g, "resolution", dim, resolution);
66 
67  // Pose estimation and registration
68  Transformd p_transform;
69  if(n["pose_estimate"])
70  {
71  p_transform = n["pose_estimate"].as<Transformd>();
72  }
73  hdf5util::addMatrix<double>(g, "poseEstimation", p_transform);
74 
75  Transformd r_transform;
76  if(n["registration"])
77  {
78  r_transform = n["registration"].as<Transformd>();
79  }
80  hdf5util::addMatrix<double>(g, "registration", r_transform);
81 
82  // Timestamps
83  doubleArr timestamps(new double[2]);
84  timestamps[0] = 0.0;
85  timestamps[1] = 0.0;
86  if(n["start_time"])
87  {
88  timestamps[0] = n["start_time"].as<double>();
89  }
90  if(n["end_time"])
91  {
92  timestamps[1] = n["end_time"].as<double>();
93  }
94  hdf5util::addArray<double>(g, "timestamps", dim, timestamps);
95 
96 }
97 
99  HighFive::Group &g,
100  const YAML::Node &n) const
101 {
102  // GPS position
103  doubleArr gps(new double[3]);
104  gps[0] = 0.0;
105  gps[1] = 0.0;
106  gps[2] = 0.0;
107  if(n["latitude"])
108  {
109  gps[0] = n["latitude"].as<double>();
110  }
111  if(n["longitude"])
112  {
113  gps[1] = n["longitude"].as<double>();
114  }
115  if(n["altitude"])
116  {
117  gps[1] = n["altitude"].as<double>();
118  }
119  hdf5util::addArray<double>(g, "gpsPosition", 3, gps);
120 
121  // Pose estimation and registration
122  Transformd p_transform;
123  if(n["pose_estimate"])
124  {
125  p_transform = n["pose_estimate"].as<Transformd>();
126  }
127  hdf5util::addMatrix<double>(g, "poseEstimation", p_transform);
128 
129  Transformd r_transform;
130  if(n["registration"])
131  {
132  r_transform = n["registration"].as<Transformd>();
133  }
134  hdf5util::addMatrix<double>(g, "registration", r_transform);
135 
136  // Timestamp
137  doubleArr ts(new double[1]);
138  ts[0] = 0.0;
139  if(n["timestamp"])
140  {
141  ts[0] = n["timestamp"].as<double>();
142  }
143  hdf5util::addArray<double>(g, "timestamp", 1, ts);
144 }
145 
147  HighFive::Group &g,
148  const YAML::Node &n) const
149 {
150  std::cout << timestamp << "HDF5MetaDescriptionV2::saveScanProject() not implemented..." << std::endl;
151 
152 }
153 
155  HighFive::Group &g,
156  const YAML::Node& n) const
157 {
158  std::cout << timestamp << "HDF5MetaDescriptionV2::saveScanCamera() not implemented..." << std::endl;
159 }
160 
162  HighFive::Group &g,
163  const YAML::Node &n) const
164 {
165  std::cout << timestamp << "HDF5MetaDescriptionV2::saveScanImage() not implemented..." << std::endl;
166 }
167 
169 {
170  std::cout << timestamp << "HDF5MetaDescriptionV2::hyperspectralCamera() not implemented..." << std::endl;
171  YAML::Node node;
172  return node;
173 }
174 
176 {
177  std::cout << timestamp << "HDF5MetaDescriptionV2::hyperspectralPanoramaChannel() not implemented..." << std::endl;
178  YAML::Node node;
179  return node;
180 }
181 
182 YAML::Node HDF5MetaDescriptionV2::scan(const HighFive::Group &g) const
183 {
184  YAML::Node node;
185 
186  // Get start and end time
187  std::vector<size_t> timesDim;
188  doubleArr times = hdf5util::getArray<double>(g, "timestamps", timesDim);
189  if(times && timesDim.size() == 2 && timesDim[0] == 2 && timesDim[1] == 1)
190  {
191  std::cout << timestamp << "YAML timestamp..." << std::endl;
192  node["start_time"] = times[0];
193  node["end_time"] = times[1];
194  }
195 
196  // Get pose estimation and registration
197  boost::optional<Transformd> poseEstimate =
198  hdf5util::getMatrix<Transformd>(g, "poseEstimation");
199  if(poseEstimate)
200  {
201  node["pose_estimate"] = *poseEstimate;
202  }
203 
204  boost::optional<Transformd> registration =
205  hdf5util::getMatrix<Transformd>(g, "registration");
206  if(poseEstimate)
207  {
208  node["registration"] = *registration;
209  }
210 
211  // Configuration parameters
212  YAML::Node config;
213  std::vector<size_t> resDim;
214  doubleArr phi = hdf5util::getArray<double>(g, "phi", resDim);
215  if(phi && resDim.size() == 2 && resDim[0] == 2 && resDim[1] == 1)
216  {
217  std::cout << timestamp << "YAML phi..." << std::endl;
218  config["phi"] = YAML::Load("[]");
219  config["phi"].push_back(phi[0]);
220  config["phi"].push_back(phi[1]);
221  }
222  resDim.clear();
223 
224  doubleArr theta = hdf5util::getArray<double>(g, "theta", resDim);
225  if(theta && resDim.size() == 2 && resDim[0] == 2 && resDim[1] == 1)
226  {
227  std::cout << timestamp << "YAML theta..." << std::endl;
228  config["theta"] = YAML::Load("[]");
229  config["theta"].push_back(theta[0]);
230  config["theta"].push_back(theta[1]);
231  }
232  resDim.clear();
233 
234  doubleArr res = hdf5util::getArray<double>(g, "resolution", resDim);
235  if(res && resDim.size() == 2 && resDim[0] == 2 && resDim[1] == 1)
236  {
237  std::cout << timestamp << "YAML resolution..." << std::endl;
238  config["v_res"] = theta[0];
239  config["h_res"] = theta[1];
240  }
241  resDim.clear();
242 
243  vector<size_t> v = hdf5util::getDimensions<float>(g, "points");
244  if(v.size() == 2)
245  {
246  config["num_points"] = v[0];
247  }
248 
249  node["config"] = config;
250  return node;
251 }
252 
254 {
255  YAML::Node node;
256 
257  // Get GPS information
258  std::vector<size_t> dim;
259  doubleArr gps = hdf5util::getArray<double>(g, "gpsPosition", dim);
260  if(gps && dim.size() == 2 && dim[0] == 3 && dim[1] == 1)
261  {
262  std::cout << timestamp << "YAML GPS..." << std::endl;
263  node["latitude"] = gps[0];
264  node["longitude"] = gps[1];
265  node["altitude"] = gps[2];
266  }
267  dim.clear();
268 
269  // Get timestamp
270  doubleArr ts = hdf5util::getArray<double>(g, "gpsPosition", dim);
271  if(gps && dim.size() == 2 && dim[0] == 1 && dim[1] == 1)
272  {
273  std::cout << timestamp << "YAML timestamp..." << std::endl;
274  node["timestamp"] = ts[0];
275  }
276  dim.clear();
277 
278  // Get pose estimation and registration
279  boost::optional<Transformd> poseEstimate =
280  hdf5util::getMatrix<Transformd>(g, "poseEstimation");
281  if(poseEstimate)
282  {
283  node["pose_estimate"] = *poseEstimate;
284  }
285 
286  boost::optional<Transformd> registration =
287  hdf5util::getMatrix<Transformd>(g, "registration");
288  if(poseEstimate)
289  {
290  node["registration"] = *registration;
291  }
292 
293  return node;
294 }
295 
297 {
298  std::cout << timestamp << "HDF5MetaDescriptionV2::scanProject() not implemented..." << std::endl;
299  YAML::Node node;
300  return node;
301 }
302 
304 {
305  std::cout << timestamp << "HDF5MetaDescriptionV2::scanCamera() not implemented..." << std::endl;
306  YAML::Node node;
307  return node;
308 }
309 
311 {
312  std::cout << timestamp << "HDF5MetaDescriptionV2::scanImage() not implemented..." << std::endl;
313  YAML::Node node;
314  return node;
315 }
316 
317 
318 } // namespace lvr2
virtual YAML::Node scanProject(const HighFive::Group &g) const override
virtual void saveScanPosition(HighFive::Group &g, const YAML::Node &n) const override
static Timestamp timestamp
A global time stamp object for program runtime measurement.
Definition: Timestamp.hpp:116
virtual void saveScanProject(HighFive::Group &g, const YAML::Node &n) const override
boost::shared_array< double > doubleArr
Definition: DataStruct.hpp:134
Transform< double > Transformd
4x4 double precision transformation matrix
Definition: MatrixTypes.hpp:71
virtual YAML::Node hyperspectralCamera(const HighFive::Group &g) const override
virtual YAML::Node scan(const HighFive::Group &g) const override
virtual void saveScanImage(HighFive::Group &g, const YAML::Node &n) const override
virtual YAML::Node hyperspectralPanoramaChannel(const HighFive::Group &g) const override
virtual YAML::Node scanCamera(const HighFive::Group &g) const override
virtual void saveScanCamera(HighFive::Group &g, const YAML::Node &n) const override
virtual YAML::Node scanPosition(const HighFive::Group &g) const override
virtual YAML::Node scanImage(const HighFive::Group &g) const override
virtual void saveScan(HighFive::Group &g, const YAML::Node &n) const override
virtual void saveHyperspectralCamera(HighFive::Group &g, const YAML::Node &n) const override
virtual void saveHyperspectralPanoramaChannel(HighFive::Group &g, const YAML::Node &n) const override


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:06