39 #ifndef PCL_OCTREE_POINTCLOUD_H
40 #define PCL_OCTREE_POINTCLOUD_H
42 #include <pcl/octree/octree_base.h>
44 #include <pcl/point_cloud.h>
45 #include <pcl/point_types.h>
69 template<
typename PointT,
typename LeafContainerT = OctreeContainerPointIndices,
70 typename BranchContainerT = OctreeContainerEmpty,
71 typename OctreeT = OctreeBase<LeafContainerT, BranchContainerT> >
103 typedef boost::shared_ptr<OctreePointCloud<PointT, LeafContainerT, BranchContainerT, OctreeT> >
Ptr;
104 typedef boost::shared_ptr<const OctreePointCloud<PointT, LeafContainerT, BranchContainerT, OctreeT> >
ConstPtr;
115 const IndicesConstPtr &indices_arg = IndicesConstPtr ())
157 assert( this->leaf_count_ == 0);
177 return this->octree_depth_;
221 OctreeT::deleteTree ();
231 isVoxelOccupiedAtPoint (
const double point_x_arg,
const double point_y_arg,
const double point_z_arg)
const;
259 const Eigen::Vector3f& origin,
const Eigen::Vector3f& end,
260 AlignedPointTVector &voxel_center_list,
float precision = 0.2);
292 defineBoundingBox (
const double min_x_arg,
const double min_y_arg,
const double min_z_arg,
293 const double max_x_arg,
const double max_y_arg,
const double max_z_arg);
303 defineBoundingBox (
const double max_x_arg,
const double max_y_arg,
const double max_z_arg);
323 getBoundingBox (
double& min_x_arg,
double& min_y_arg,
double& min_z_arg,
324 double& max_x_arg,
double& max_y_arg,
double& max_z_arg)
const;
376 assert(this->leaf_count_==0);
398 expandLeafNode (LeafNode* leaf_node, BranchNode* parent_branch,
unsigned char child_idx,
unsigned int depth_mask);
419 return (this->findLeaf (key));
442 return (! ( (point_idx_arg.x <
min_x_) || (point_idx_arg.y <
min_y_)
443 || (point_idx_arg.z <
min_z_) || (point_idx_arg.x >=
max_x_)
444 || (point_idx_arg.y >=
max_y_) || (point_idx_arg.z >=
max_z_)));
462 genOctreeKeyforPoint (
const double point_x_arg,
const double point_y_arg,
const double point_z_arg,
489 unsigned int tree_depth_arg,
PointT& point_arg)
const;
499 unsigned int tree_depth_arg, Eigen::Vector3f &min_pt,
500 Eigen::Vector3f &max_pt)
const;
511 AlignedPointTVector &voxel_center_list_arg)
const;
550 #ifdef PCL_NO_PRECOMPILE
551 #include <pcl/octree/impl/octree_pointcloud.hpp>
const PointT & getPointByIndex(const unsigned int index_arg) const
Get point at index from input pointcloud dataset.
void genOctreeKeyforPoint(const PointT &point_arg, OctreeKey &key_arg) const
Generate octree key for voxel at a given point.
pcl::PointCloud< PointT > PointCloud
void addPointsFromInputCloud()
Add points from input point cloud to octree.
int getApproxIntersectedVoxelCentersBySegment(const Eigen::Vector3f &origin, const Eigen::Vector3f &end, AlignedPointTVector &voxel_center_list, float precision=0.2)
Get a PointT vector of centers of voxels intersected by a line segment.
virtual ~OctreePointCloud()
Empty deconstructor.
void addPointToCloud(const PointT &point_arg, PointCloudPtr cloud_arg)
Add point simultaneously to octree and input point cloud.
This file defines compatibility wrappers for low level I/O functions.
double getEpsilon() const
Get the search epsilon precision (error bound) for nearest neighbors searches.
boost::shared_ptr< PointCloud > PointCloudPtr
virtual void addPointIdx(const int point_idx_arg)
Add point at index from input pointcloud dataset to octree.
std::vector< PointT, Eigen::aligned_allocator< PointT > > AlignedPointTVector
double getVoxelSquaredDiameter() const
Calculates the squared diameter of a voxel at leaf depth.
boost::shared_ptr< const PointCloud > PointCloudConstPtr
OctreePointCloud(const double resolution_arg)
Octree pointcloud constructor.
void adoptBoundingBoxToPoint(const PointT &point_idx_arg)
Grow the bounding box/octree until point fits.
void setInputCloud(const PointCloudConstPtr &cloud_arg, const IndicesConstPtr &indices_arg=IndicesConstPtr())
Provide a pointer to the input data set.
IndicesConstPtr indices_
A pointer to the vector of point indices to use.
void enableDynamicDepth(size_t maxObjsPerLeaf)
Enable dynamic octree structure.
PointCloudConstPtr input_
Pointer to input point cloud dataset.
LeafContainerT * findLeafAtPoint(const PointT &point_arg) const
Find octree leaf node at a given point.
void defineBoundingBox()
Investigate dimensions of pointcloud data set and define corresponding bounding box for octree...
int getOccupiedVoxelCenters(AlignedPointTVector &voxel_center_list_arg) const
Get a PointT vector of centers of all occupied voxels.
const OctreeKey & getCurrentOctreeKey() const
Get octree key for the current iterator octree node.
void getBoundingBox(double &min_x_arg, double &min_y_arg, double &min_z_arg, double &max_x_arg, double &max_y_arg, double &max_z_arg) const
Get bounding box for octree.
boost::shared_ptr< const OctreePointCloud< PointT, LeafContainerT, BranchContainerT, OctreeT > > ConstPtr
void genVoxelBoundsFromOctreeKey(const OctreeKey &key_arg, unsigned int tree_depth_arg, Eigen::Vector3f &min_pt, Eigen::Vector3f &max_pt) const
Generate bounds of an octree voxel using octree key and tree depth arguments.
std::vector< PointXYZ, Eigen::aligned_allocator< PointXYZ > > AlignedPointXYZVector
bool isPointWithinBoundingBox(const PointT &point_idx_arg) const
Checks if given point is within the bounding box of the octree.
void genLeafNodeCenterFromOctreeKey(const OctreeKey &key_arg, PointT &point_arg) const
Generate a point at center of leaf node voxel.
void getKeyBitSize()
Define octree key setting and octree depth based on defined bounding box.
boost::shared_ptr< OctreePointCloud< PointT, LeafContainerT, BranchContainerT, OctreeT > > Ptr
PointCloud represents the base class in PCL for storing collections of 3D points. ...
std::size_t max_objs_per_leaf_
Amount of DataT objects per leafNode before expanding branch.
void addPointFromCloud(const int point_idx_arg, IndicesPtr indices_arg)
Add point at given index from input point cloud to octree.
unsigned int getCurrentOctreeDepth() const
Get the current depth level of octree.
void deleteTree()
Delete the octree structure and its leaf nodes.
int getOccupiedVoxelCentersRecursive(const BranchNode *node_arg, const OctreeKey &key_arg, AlignedPointTVector &voxel_center_list_arg) const
Recursively search the tree for all leaf nodes and return a vector of voxel centers.
void genVoxelCenterFromOctreeKey(const OctreeKey &key_arg, unsigned int tree_depth_arg, PointT &point_arg) const
Generate a point at center of octree voxel at given tree level.
double getResolution() const
Get octree voxel resolution.
void expandLeafNode(LeafNode *leaf_node, BranchNode *parent_branch, unsigned char child_idx, unsigned int depth_mask)
Add point at index from input pointcloud dataset to octree.
virtual bool genOctreeKeyForDataT(const int &data_arg, OctreeKey &key_arg) const
Virtual method for generating octree key for a given point index.
bool isVoxelOccupiedAtPoint(const PointT &point_arg) const
Check if voxel at given point exist.
OctreeT::LeafNode LeafNode
boost::shared_ptr< const std::vector< int > > IndicesConstPtr
OctreePointCloud< PointT, LeafContainerT, BranchContainerT, OctreeBase< LeafContainerT > > SingleBuffer
Abstract octree iterator class
boost::shared_ptr< std::vector< int > > IndicesPtr
void getVoxelBounds(const OctreeIteratorBase< OctreeT > &iterator, Eigen::Vector3f &min_pt, Eigen::Vector3f &max_pt) const
Generate bounds of the current voxel of an octree iterator.
OctreeT::BranchNode BranchNode
double getVoxelSquaredSideLen() const
Calculates the squared voxel cube side length at leaf level.
A point structure representing Euclidean xyz coordinates, and the RGB color.
double epsilon_
Epsilon precision (error bound) for nearest neighbors searches.
void deleteVoxelAtPoint(const PointT &point_arg)
Delete leaf node / voxel at given point.
void setEpsilon(double eps)
Set the search epsilon precision (error bound) for nearest neighbors searches.
bool bounding_box_defined_
Flag indicating if octree has defined bounding box.
PointCloudConstPtr getInputCloud() const
Get a pointer to the input point cloud dataset.
double resolution_
Octree resolution.
IndicesConstPtr const getIndices() const
Get a pointer to the vector of indices used.
void setResolution(double resolution_arg)
Set/change the octree voxel resolution.
unsigned int getTreeDepth() const
Get the maximum depth of the octree.