PointCloudCrafter
Loading...
Searching...
No Matches
pointcloudmodifierlib::Modifier Class Reference

Modifier class for point cloud processing. More...

#include <pointcloudmodifier.hpp>

Public Types

using ProgressCallback = std::function<void (const std::string &, size_t, size_t)>
 Callback invoked to report split() progress: (stage, current, total).

Public Member Functions

bool load (const std::string &file_path, pointcloudcrafter::tools::formats::FileFormat format)
 Load a point cloud file based on the specified format.
bool save (const std::string &file_path, pointcloudcrafter::tools::formats::FileFormat format)
 Save point cloud to file based on the specified format.
Modifier & cropBox (const std::vector< double > &box_params, const bool &negative=false)
 Crop box filter.
Modifier & cropSphere (const double &sphere_params, const bool &negative=false)
 Crop sphere filter.
Modifier & cropCylinder (const double &zylinder_params, const bool &negative=false)
 Crop cylinder filter.
Modifier & voxelFilter (const std::vector< double > &voxel)
 Voxel grid filter with subvoxel handling.
Modifier & outlierRadiusFilter (const double &radius, const int &min_neighbors)
 Outlier radius filter.
Modifier & outlierStatFilter (const double &threshold, const int &mean)
 Outlier statistical filter.
Modifier & transform (const Eigen::Affine3d &transformation)
 Apply transformation to the point cloud.
std::map< std::pair< int, int >, Modifier > split (const double &grid_size, const ProgressCallback &on_progress=nullptr)
 Split the point cloud into grid cells along x and y.
Modifier & timestampAnalyzer (const std::string &file_path)
 Save timestamps to a file and print basic statistics.
void visualize ()
 Visualize input and output point clouds.
void setCloud (const PointCloud::Ptr &cloud)
 Set point cloud directly.
const PointCloud::Ptr getInputCloud () const
 Get input point cloud.
const PointCloud::Ptr getOutputCloud () const
 Get output point cloud.

Static Public Member Functions

static bool writeGridMetadata (const std::map< std::pair< int, int >, Modifier > &cells, const double &grid_size, const std::string &file_path, const std::string &extension=".pcd")
 Write a metadata YAML for a grid split result.

Detailed Description

Modifier class for point cloud processing.

Member Function Documentation

◆ cropBox()

Modifier & pointcloudmodifierlib::Modifier::cropBox ( const std::vector< double > & box_params,
const bool & negative = false )
inline

Crop box filter.

Parameters
box_paramsVector of 6 doubles defining the min and max points of the box
negativeIf true, removes points inside the box
Returns
Reference to the Modifier object

◆ cropCylinder()

Modifier & pointcloudmodifierlib::Modifier::cropCylinder ( const double & zylinder_params,
const bool & negative = false )
inline

Crop cylinder filter.

Parameters
zylinder_paramsRadius of the cylinder
negativeIf true, removes points inside the cylinder
Returns
Reference to the Modifier object

◆ cropSphere()

Modifier & pointcloudmodifierlib::Modifier::cropSphere ( const double & sphere_params,
const bool & negative = false )
inline

Crop sphere filter.

Parameters
sphere_paramsRadius of the sphere
negativeIf true, removes points inside the sphere
Returns
Reference to the Modifier object

◆ getInputCloud()

const PointCloud::Ptr pointcloudmodifierlib::Modifier::getInputCloud ( ) const
inline

Get input point cloud.

Returns
Pointer to the input point cloud

◆ getOutputCloud()

const PointCloud::Ptr pointcloudmodifierlib::Modifier::getOutputCloud ( ) const
inline

Get output point cloud.

Returns
Pointer to the output point cloud

◆ load()

bool pointcloudmodifierlib::Modifier::load ( const std::string & file_path,
pointcloudcrafter::tools::formats::FileFormat format )
inline

Load a point cloud file based on the specified format.

Parameters
file_pathPath to the file
formatThe file format
Returns
True if successful, false otherwise

◆ outlierRadiusFilter()

Modifier & pointcloudmodifierlib::Modifier::outlierRadiusFilter ( const double & radius,
const int & min_neighbors )
inline

Outlier radius filter.

Parameters
radiusRadius for the filter
min_neighborsMinimum number of neighbors to be considered an inlier
Returns
Reference to the Modifier object

◆ outlierStatFilter()

Modifier & pointcloudmodifierlib::Modifier::outlierStatFilter ( const double & threshold,
const int & mean )
inline

Outlier statistical filter.

Parameters
thresholdStandard deviation multiplier threshold
meanNumber of nearest neighbors to use for mean distance estimation
Returns
Reference to the Modifier object

◆ save()

bool pointcloudmodifierlib::Modifier::save ( const std::string & file_path,
pointcloudcrafter::tools::formats::FileFormat format )
inline

Save point cloud to file based on the specified format.

Parameters
file_pathPath to save the file
formatThe file format
Returns
True if successful, false otherwise

◆ setCloud()

void pointcloudmodifierlib::Modifier::setCloud ( const PointCloud::Ptr & cloud)
inline

Set point cloud directly.

Parameters
cloudPoint cloud to set

◆ split()

std::map< std::pair< int, int >, Modifier > pointcloudmodifierlib::Modifier::split ( const double & grid_size,
const ProgressCallback & on_progress = nullptr )
inline

Split the point cloud into grid cells along x and y.

Parameters
grid_sizeSize of each grid cell
on_progressOptional callback reporting progress within each stage
Returns
Map from grid cell index pair (ix, iy)

◆ timestampAnalyzer()

Modifier & pointcloudmodifierlib::Modifier::timestampAnalyzer ( const std::string & file_path)
inline

Save timestamps to a file and print basic statistics.

Parameters
file_pathPath to save the timestamps
Returns
Reference to the Modifier object

◆ transform()

Modifier & pointcloudmodifierlib::Modifier::transform ( const Eigen::Affine3d & transformation)
inline

Apply transformation to the point cloud.

Parameters
transformationEigen Affine3d transformation matrix
Returns
Reference to the Modifier object

◆ voxelFilter()

Modifier & pointcloudmodifierlib::Modifier::voxelFilter ( const std::vector< double > & voxel)
inline

Voxel grid filter with subvoxel handling.

Parameters
voxelVector of 3 doubles defining the voxel size in x, y, z
Returns
Reference to the Modifier object

◆ writeGridMetadata()

bool pointcloudmodifierlib::Modifier::writeGridMetadata ( const std::map< std::pair< int, int >, Modifier > & cells,
const double & grid_size,
const std::string & file_path,
const std::string & extension = ".pcd" )
inlinestatic

Write a metadata YAML for a grid split result.

Parameters
cellsResult map from split()
grid_sizeGrid size used in split()
file_pathFull path for the output YAML file
extensionFile extension for cell filenames (default ".pcd")
Returns
True if successful, false otherwise

The documentation for this class was generated from the following file: