Helios++
Helios software for LiDAR simulations
|
Import point cloud files abstracting them to a set of voxels. More...
#include <XYZPointCloudFileLoader.h>
Public Member Functions | |
XYZPointCloudFileLoader () | |
Constructor for point cloud loader. More... | |
ScenePart * | run () |
![]() | |
AbstractGeometryFilter (ScenePart *parts_) | |
Base constructor for asset loading filters. More... | |
std::shared_ptr< Material > | getMaterial (std::string materialName) |
Retrieve requested material by name. More... | |
std::vector< std::shared_ptr< Material > > | parseMaterials () |
Parse materials specified through "matfile", which can be concreted through "matname" parameter. It can also handle random materials when parameter "randomMaterials" is set. More... | |
Static Public Attributes | |
static int const | minPointsForSafeNormalEstimation = 3 |
How many points are necessary for the normal estimation to be reliable. | |
static size_t const | batchSize = 10000000 |
How many points consider per batch when estimating normals. | |
static int const | voxelPopulationThreshold = 40000 |
How many points can be contained inside a voxel without triggering a warning due to excessive population. | |
Private Member Functions | |
void | parse (std::string const &filePath) |
Parse XYZ file. More... | |
void | firstPass (string const &filePathString, ifstream &ifs) |
First pass of input file used to find essential information needed to successfully abstract the point cloud to voxels. More... | |
void | secondPass (string const &filePathString, string const &matName, ifstream &ifs) |
Second pass where the input file is read as many times as needed to build necessary voxels. More... | |
void | loadMaterial () |
void | prepareVoxelsGrid (int &estimateNormals, double &halfVoxelSize) |
Prepare voxels grid computation. More... | |
void | fillVoxelsGrid (ifstream &ifs, int estimateNormals, double halfVoxelSize, string const &filePathString) |
Fill voxels grid. More... | |
bool | correctNormal (double &x, double &y, double &z) |
Correct normal if necessary. Only non valid normals will be corrected. More... | |
void | digestVoxel (int estimateNormals, double halfVoxelSize, double x, double y, double z, double r, double g, double b, double xnorm, double ynorm, double znorm) |
Digest a voxel when filling voxels grid. This implies the voxel will be created in the grid if it does not exist. If the voxel already existed, then it will be populated with given new data. | |
void | postProcess (string const &matName, int estimateNormals) |
Post process already filled voxels grid. More... | |
void | estimateNormals (ifstream &ifs) |
Estimate voxels normal as the orthonormal of best fitting plane for points inside voxel. | |
void | estimateNormalsBatch (ifstream &ifs) |
Estimate voxels normals in batch mode, which implies reading input file as many times as specified by numBatches variable. The output generated by this function is the same than the one that should be generated by estimateNormals function. More... | |
void | _estimateNormals (size_t start, size_t end) |
Assists estimateNormals function. Normals for filled matrices are computed at this function. More... | |
void | voxelsGridToScenePart () |
Compose the scene part considering voxels at voxels grid. | |
size_t | indexFromCoordinates (double x, double y, double z, size_t &I, size_t &J, size_t &K) |
Obtain voxel-grid index for given coordinates. More... | |
Static Private Member Functions | |
static bool | isLineComment (string const &line) |
Check if given line is a comment or not. More... | |
static void | restartInputFileStream (ifstream &ifs) |
Reset given input file stream so it points to file start. More... | |
Private Attributes | |
std::string | separator = " " |
Field separator specification used by the point cloud file. | |
double | voxelSize = 1 |
Size for each voxel. | |
double | maxColorValue = 0 |
Max value with respect to used color codification. | |
bool | snapNeighborNormal = false |
Snap neighbor normal instead of average when enabled (true). | |
bool | assignDefaultNormal = false |
Specify whether default normal must be assigned to voxels which normal cannot be safely determined (True) or not (False). | |
glm::dvec3 | defaultNormal = glm::dvec3(0,0,0) |
The default normal to be used when needed to fill missing ones. | |
size_t | unsafeNormalEstimations = 0 |
How many voxels normals could not be safely estimated because there was not enough data inside the voxel. | |
size_t | discardedPointsByNormal = 0 |
How many points were discarded because they were expected to have a correct normal but they did not. More... | |
size_t | n |
The number of points in the point cloud. | |
double | minX |
Minimum X coordinate considering all points. | |
double | minY |
Minimum Y coordinate considering all points. | |
double | minZ |
Minimum Z coordinate considering all points. | |
double | maxX |
Maximum X coordinate considering all points. | |
double | maxY |
Maximum Y coordinate considering all points. | |
double | maxZ |
Maximum Z coordinate considering all points. | |
size_t | nx |
Number of partitions along x-axis. | |
size_t | ny |
Number of partitions along y-axis. | |
size_t | nz |
Number of partitions along z-axis. | |
size_t | nynz |
Product \(ny \cdot nz\). Stored in a variable because of its recurrent usage. | |
double | xCoeff |
Coefficient ( \(K_{x}\)) to compute \(I\) voxel index for a given \(x\) coordinate. More... | |
double | yCoeff |
Coefficient ( \(K_{y}\)) to compute \(J\) voxel index for a given \(y\) coordinate. More... | |
double | zCoeff |
Coefficient ( \(K_{z}\)) to compute \(K\) voxel index for a given \(z\) coordinate. More... | |
VoxelGridCell * | voxels = nullptr |
Full voxels grid. | |
size_t | maxNVoxels |
Total size of full voxels grid. More... | |
size_t | numBatches |
How many batches are necessary to estimate normals. | |
size_t | lastNumVoxels |
Used to correctly report number of voxels for each part when reading multiple files at once (i.e. efilepath is given) | |
Additional Inherited Members | |
![]() | |
OGRSpatialReference * | sourceCRS |
std::map< std::string, ObjectT > | params |
Available parameters. | |
std::map< std::string, Material > | materials |
Available materials. | |
ScenePart * | primsOut = nullptr |
ScenePart used to build the output. Not strictly necessary for any filter. | |
Import point cloud files abstracting them to a set of voxels.
|
inlineexplicit |
Constructor for point cloud loader.
|
private |
Assists estimateNormals function. Normals for filled matrices are computed at this function.
start | Specifies the start index in the voxel grid |
end | Specified the end index in the voxel grid |
|
private |
Correct normal if necessary. Only non valid normals will be corrected.
x | Normal x component |
y | Normal y component |
z | Normal z component |
|
private |
Estimate voxels normals in batch mode, which implies reading input file as many times as specified by numBatches variable. The output generated by this function is the same than the one that should be generated by estimateNormals function.
|
private |
Fill voxels grid.
estimateNormals | Used to specified normal estimation method. A value of 0 means no normal estimation, a value of 1 means normal estimation will be performed entirely in memory and a value of 2 means normal estimation will be performed through multiple runs over the input file |
|
private |
First pass of input file used to find essential information needed to successfully abstract the point cloud to voxels.
filePathString | Path to the input file |
ifs | Stream used to read from input file |
|
private |
Obtain voxel-grid index for given coordinates.
[out] | I | Used to output I index (x axis) |
[out] | J | Used to output J index (y axis) |
[out] | K | Used to output K index (z axis) |
|
staticprivate |
Check if given line is a comment or not.
line | Line to be checked |
|
private |
Parse XYZ file.
filePath | Path to XYZ file to be parsed |
|
private |
Post process already filled voxels grid.
estimateNormals | Used to specify if normals must be estimated (>0) or not (0) |
|
private |
Prepare voxels grid computation.
[out] | estimateNormals | Used to return normals estimation specification |
[out] | halfVoxelSize | Used to return half of the voxel size |
|
staticprivate |
Reset given input file stream so it points to file start.
ifs | Input file stream to be resetted. |
|
virtual |
Implements AbstractGeometryFilter.
|
private |
Second pass where the input file is read as many times as needed to build necessary voxels.
filePathString | Path to the input file |
matName | Name of the material to be used for voxels |
ifs | Stream used to read from input file |
|
private |
How many points were discarded because they were expected to have a correct normal but they did not.
|
private |
Total size of full voxels grid.
|
private |
Coefficient ( \(K_{x}\)) to compute \(I\) voxel index for a given \(x\) coordinate.
\[ I = (x - x_{min}) \cdot K_{x} \]
|
private |
Coefficient ( \(K_{y}\)) to compute \(J\) voxel index for a given \(y\) coordinate.
\[ J = (y - y_{min}) \cdot K_{y} \]
|
private |
Coefficient ( \(K_{z}\)) to compute \(K\) voxel index for a given \(z\) coordinate.
\[ K = (z - z_{min}) \cdot K_{z} \]