34 HitTable(
const int nx,
const int ny) {
38 for (
int j = 0; j < Nphi; j++) {
39 data.at(j).resize(Ntheta);
42 HitTable(
const int nx,
const int ny,
const datatype initval) {
46 for (
int j = 0; j < Nphi; j++) {
47 data.at(j).resize(Ntheta, initval);
51 datatype get(
const int i,
const int j)
const {
52 if (i >= 0 && i < Ntheta && j >= 0 && j < Nphi) {
53 return data.at(j).at(i);
55 std::cerr <<
"ERROR (hit_map.get): get index out of range. Attempting to get index map at (" << i <<
"," << j <<
"), but size of scan is " << Ntheta <<
" x " << Nphi <<
"." << std::endl;
59 void set(
const int i,
const int j,
const datatype value) {
60 if (i >= 0 && i < Ntheta && j >= 0 && j < Nphi) {
61 data.at(j).at(i) = value;
63 std::cerr <<
"ERROR (hit_map.set): set index out of range. Attempting to set index map at (" << i <<
"," << j <<
"), but size of scan is " << Ntheta <<
" x " << Nphi <<
"." << std::endl;
67 void resize(
const int nx,
const int ny,
const datatype initval) {
71 for (
int j = 0; j < Nphi; j++) {
72 data.at(j).resize(Ntheta);
73 for (
int i = 0; i < Ntheta; i++) {
74 data.at(j).at(i) = initval;
80 std::vector<std::vector<datatype>> data;
88 std::map<std::string, double> data;
92 position = helios::make_vec3(0, 0, 0);
93 direction = helios::make_SphericalCoord(0, 0);
95 color = helios::RGB::red;
101 position = __position;
102 direction = __direction;
103 row_column = __row_column;
117 vertex0 = helios::make_vec3(0, 0, 0);
118 vertex1 = helios::make_vec3(0, 0, 0);
119 vertex2 = helios::make_vec3(0, 0, 0);
125 color = helios::RGB::green;
136 gridcell = __gridcell;
147 float s = 0.5f * (a + b + c);
149 area = sqrt(s * (s - a) * (s - b) * (s - c));
272 std::vector<ScanMetadata> scans;
274 std::vector<HitPoint> hits;
276 std::vector<GridCell> grid_cells;
278 std::vector<Triangulation> triangles;
281 std::vector<HitTable<int>> hit_tables;
284 bool hitgridcellcomputed;
287 bool triangulationcomputed;
300 std::vector<std::vector<Triangulation>> reconstructed_triangles;
302 std::vector<std::vector<Triangulation>> reconstructed_trunk_triangles;
304 std::vector<helios::vec3> reconstructed_alphamasks_center;
305 std::vector<helios::vec2> reconstructed_alphamasks_size;
306 std::vector<helios::SphericalCoord> reconstructed_alphamasks_rotation;
307 std::vector<uint> reconstructed_alphamasks_gridcell;
308 std::string reconstructed_alphamasks_maskfile;
309 std::vector<uint> reconstructed_alphamasks_direct_flag;
311 void leafReconstructionFloodfill();
313 void backfillLeavesAlphaMask(
const std::vector<float> &leaf_size,
float leaf_aspect_ratio,
float solidfraction,
const std::vector<bool> &group_filter_flag);
315 void calculateLeafAngleCDF(
uint Nbins, std::vector<std::vector<float>> &CDF_theta, std::vector<std::vector<float>> &CDF_phi);
317 void floodfill(
size_t t, std::vector<Triangulation> &cloud_triangles, std::vector<int> &fill_flag, std::vector<std::vector<int>> &nodes,
int tag,
int depth,
int maxdepth);
326 std::vector<float> LAD_inversion(std::vector<float> &P, std::vector<float> &Gtheta, std::vector<std::vector<float>> &dr_array,
bool fillAnalytic);
337 void computeGtheta(
uint Ncells,
uint Nscans,
338 std::vector<float> &Gtheta, std::vector<float> &Gtheta_bar);
351 bool invertLAD(
uint voxel_index,
float P,
float Gtheta,
352 const std::vector<float> &dr_samples,
int min_voxel_hits,
365 const std::vector<helios::vec3> &ray_endpoints,
368 std::vector<uint> &filtered_indices);
381 void calculateVoxelPathLengths(
const helios::vec3 &scan_origin,
382 const std::vector<helios::vec3> &ray_directions,
383 const std::vector<helios::vec3> &voxel_centers,
384 const std::vector<helios::vec3> &voxel_sizes,
385 const std::vector<float> &voxel_rotations,
386 std::vector<std::vector<float>> &dr_agg,
387 std::vector<float> &hit_before_agg,
388 std::vector<float> &hit_after_agg);
396 bool isMultiReturnData()
const;
399 struct BeamGrouping {
401 std::vector<std::vector<uint>> beam_array;
409 BeamGrouping groupHitsByTimestamp(
const std::vector<uint>& scan_indices)
const;
420 std::vector<uint> loadTreeQSM_impl(
helios::Context *context,
const std::string &filename,
uint radial_subdivisions,
bool use_colormap,
const std::string &colormap_or_texture);
430 static int selfTest(
int argc = 0,
char **argv =
nullptr);
432 void validateRayDirections();
688 void loadXML(
const char *filename);
695 void loadXML(
const char *filename,
bool load_grid_only);
927 void xyzFilter(
float xmin,
float xmax,
float ymin,
float ymax,
float zmin,
float zmax);
940 void xyzFilter(
float xmin,
float xmax,
float ymin,
float ymax,
float zmin,
float zmax,
bool deleteOutside);
957 void scalarFilter(
const char *scalar_field,
float threshold,
const char *comparator);
1006 void triangulateHitPoints(
float Lmax,
float max_aspect_ratio,
const char *scalar_field,
float threshold,
const char *comparator);
1127 void syntheticScan(
helios::Context *context,
int rays_per_pulse,
float pulse_distance_threshold,
bool scan_grid_only,
bool record_misses);
1139 void syntheticScan(
helios::Context *context,
int rays_per_pulse,
float pulse_distance_threshold,
bool scan_grid_only,
bool record_misses,
bool append);
1207 std::vector<helios::vec3>
gapfillMisses(
uint scanID,
const bool gapfill_grid_only,
const bool add_flags);
1228 [[deprecated(
"Use calculateLeafArea() instead. GPU functionality is now provided by the CollisionDetection plugin.")]]
1237 [[deprecated(
"Use calculateLeafArea(context, min_voxel_hits) instead. GPU functionality is now provided by the CollisionDetection plugin.")]]
1258 void leafReconstructionAlphaMask(
float minimum_leaf_group_area,
float maximum_leaf_group_area,
float leaf_aspect_ratio,
const char *mask_file);
1268 void leafReconstructionAlphaMask(
float minimum_leaf_group_area,
float maximum_leaf_group_area,
float leaf_aspect_ratio,
float leaf_length_constant,
const char *mask_file);
1288 std::vector<uint>
loadTreeQSM(
helios::Context *context,
const std::string &filename,
uint radial_subdivisions,
const std::string &texture_file =
"");