octree_pointcloud.h
/*
* Software License Agreement (BSD License)
*
* Point Cloud Library (PCL) - www.pointclouds.org
* Copyright (c) 2010-2011, Willow Garage, Inc.
*
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above
* copyright notice, this list of conditions and the following
* disclaimer in the documentation and/or other materials provided
* with the distribution.
* * Neither the name of Willow Garage, Inc. nor the names of its
* contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
* $Id$
*/
#ifndef PCL_OCTREE_POINTCLOUD_H
#define PCL_OCTREE_POINTCLOUD_H
#include <pcl/octree/octree_base.h>
#include <pcl/point_cloud.h>
#include <pcl/point_types.h>
#include <vector>
namespace pcl
{
namespace octree
{
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/** \brief @b Octree pointcloud class
* \note Octree implementation for pointclouds. Only indices are stored by the octree leaf nodes (zero-copy).
* \note The octree pointcloud class needs to be initialized with its voxel resolution. Its bounding box is automatically adjusted
* \note according to the pointcloud dimension or it can be predefined.
* \note Note: The tree depth equates to the resolution and the bounding box dimensions of the octree.
* \note
* \note typename: PointT: type of point used in pointcloud
* \note typename: LeafContainerT: leaf node container (
* \note typename: BranchContainerT: branch node container
* \note typename: OctreeT: octree implementation ()
* \ingroup octree
* \author Julius Kammerl (julius@kammerl.de)
*/
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
template<typename PointT, typename LeafContainerT = OctreeContainerPointIndices,
typename BranchContainerT = OctreeContainerEmpty,
typename OctreeT = OctreeBase<LeafContainerT, BranchContainerT> >
class OctreePointCloud : public OctreeT
{
// iterators are friends
friend class OctreeIteratorBase<OctreeT> ;
friend class OctreeDepthFirstIterator<OctreeT> ;
friend class OctreeBreadthFirstIterator<OctreeT> ;
friend class OctreeLeafNodeIterator<OctreeT> ;
public:
typedef OctreeT Base;
typedef typename OctreeT::LeafNode LeafNode;
typedef typename OctreeT::BranchNode BranchNode;
// Octree default iterators
typedef OctreeDepthFirstIterator<OctreeT> Iterator;
typedef const OctreeDepthFirstIterator<OctreeT> ConstIterator;
// Octree leaf node iterators
typedef OctreeLeafNodeIterator<OctreeT> LeafNodeIterator;
typedef const OctreeLeafNodeIterator<OctreeT> ConstLeafNodeIterator;
// Octree depth-first iterators
typedef OctreeDepthFirstIterator<OctreeT> DepthFirstIterator;
typedef const OctreeDepthFirstIterator<OctreeT> ConstDepthFirstIterator;
// Octree breadth-first iterators
typedef OctreeBreadthFirstIterator<OctreeT> BreadthFirstIterator;
typedef const OctreeBreadthFirstIterator<OctreeT> ConstBreadthFirstIterator;
/** \brief Octree pointcloud constructor.
* \param[in] resolution_arg octree resolution at lowest octree level
*/
OctreePointCloud (const double resolution_arg);
/** \brief Empty deconstructor. */
virtual
~OctreePointCloud ();
// public typedefs
typedef boost::shared_ptr<std::vector<int> > IndicesPtr;
typedef boost::shared_ptr<const std::vector<int> > IndicesConstPtr;
typedef pcl::PointCloud<PointT> PointCloud;
typedef boost::shared_ptr<PointCloud> PointCloudPtr;
typedef boost::shared_ptr<const PointCloud> PointCloudConstPtr;
// public typedefs for single/double buffering
typedef OctreePointCloud<PointT, LeafContainerT, BranchContainerT, OctreeBase<LeafContainerT> > SingleBuffer;
// typedef OctreePointCloud<PointT, LeafContainerT, BranchContainerT, Octree2BufBase<LeafContainerT> > DoubleBuffer;
// Boost shared pointers
typedef boost::shared_ptr<OctreePointCloud<PointT, LeafContainerT, BranchContainerT, OctreeT> > Ptr;
typedef boost::shared_ptr<const OctreePointCloud<PointT, LeafContainerT, BranchContainerT, OctreeT> > ConstPtr;
// Eigen aligned allocator
typedef std::vector<PointT, Eigen::aligned_allocator<PointT> > AlignedPointTVector;
typedef std::vector<PointXYZ, Eigen::aligned_allocator<PointXYZ> > AlignedPointXYZVector;
/** \brief Provide a pointer to the input data set.
* \param[in] cloud_arg the const boost shared pointer to a PointCloud message
* \param[in] indices_arg the point indices subset that is to be used from \a cloud - if 0 the whole point cloud is used
*/
inline void setInputCloud (const PointCloudConstPtr &cloud_arg,
const IndicesConstPtr &indices_arg = IndicesConstPtr ())
{
input_ = cloud_arg;
indices_ = indices_arg;
}
/** \brief Get a pointer to the vector of indices used.
* \return pointer to vector of indices used.
*/
inline IndicesConstPtr const getIndices () const
{
return (indices_);
}
/** \brief Get a pointer to the input point cloud dataset.
* \return pointer to pointcloud input class.
*/
inline PointCloudConstPtr getInputCloud () const
{
return (input_);
}
/** \brief Set the search epsilon precision (error bound) for nearest neighbors searches.
* \param[in] eps precision (error bound) for nearest neighbors searches
*/
inline void setEpsilon (double eps)
{
epsilon_ = eps;
}
/** \brief Get the search epsilon precision (error bound) for nearest neighbors searches. */
inline double getEpsilon () const
{
return (epsilon_);
}
/** \brief Set/change the octree voxel resolution
* \param[in] resolution_arg side length of voxels at lowest tree level
*/
inline void setResolution (double resolution_arg)
{
// octree needs to be empty to change its resolution
assert( this->leaf_count_ == 0);
resolution_ = resolution_arg;
getKeyBitSize ();
}
/** \brief Get octree voxel resolution
* \return voxel resolution at lowest tree level
*/
inline double getResolution () const
{
return (resolution_);
}
/** \brief Get the maximum depth of the octree.
* \return depth_arg: maximum depth of octree
* */
inline unsigned int getTreeDepth () const
{
return this->octree_depth_;
}
/** \brief Add points from input point cloud to octree. */
void
addPointsFromInputCloud ();
/** \brief Add point at given index from input point cloud to octree. Index will be also added to indices vector.
* \param[in] point_idx_arg index of point to be added
* \param[in] indices_arg pointer to indices vector of the dataset (given by \a setInputCloud)
*/
void
addPointFromCloud (const int point_idx_arg, IndicesPtr indices_arg);
/** \brief Add point simultaneously to octree and input point cloud.
* \param[in] point_arg point to be added
* \param[in] cloud_arg pointer to input point cloud dataset (given by \a setInputCloud)
*/
void
addPointToCloud (const PointT& point_arg, PointCloudPtr cloud_arg);
/** \brief Add point simultaneously to octree and input point cloud. A corresponding index will be added to the indices vector.
* \param[in] point_arg point to be added
* \param[in] cloud_arg pointer to input point cloud dataset (given by \a setInputCloud)
* \param[in] indices_arg pointer to indices vector of the dataset (given by \a setInputCloud)
*/
void
addPointToCloud (const PointT& point_arg, PointCloudPtr cloud_arg, IndicesPtr indices_arg);
/** \brief Check if voxel at given point exist.
* \param[in] point_arg point to be checked
* \return "true" if voxel exist; "false" otherwise
*/
bool
isVoxelOccupiedAtPoint (const PointT& point_arg) const;
/** \brief Delete the octree structure and its leaf nodes.
* */
void deleteTree ()
{
// reset bounding box
min_x_ = min_y_ = max_y_ = min_z_ = max_z_ = 0;
this->bounding_box_defined_ = false;
OctreeT::deleteTree ();
}
/** \brief Check if voxel at given point coordinates exist.
* \param[in] point_x_arg X coordinate of point to be checked
* \param[in] point_y_arg Y coordinate of point to be checked
* \param[in] point_z_arg Z coordinate of point to be checked
* \return "true" if voxel exist; "false" otherwise
*/
bool
isVoxelOccupiedAtPoint (const double point_x_arg, const double point_y_arg, const double point_z_arg) const;
/** \brief Check if voxel at given point from input cloud exist.
* \param[in] point_idx_arg point to be checked
* \return "true" if voxel exist; "false" otherwise
*/
bool
isVoxelOccupiedAtPoint (const int& point_idx_arg) const;
/** \brief Get a PointT vector of centers of all occupied voxels.
* \param[out] voxel_center_list_arg results are written to this vector of PointT elements
* \return number of occupied voxels
*/
int
getOccupiedVoxelCenters (AlignedPointTVector &voxel_center_list_arg) const;
/** \brief Get a PointT vector of centers of voxels intersected by a line segment.
* This returns a approximation of the actual intersected voxels by walking
* along the line with small steps. Voxels are ordered, from closest to
* furthest w.r.t. the origin.
* \param[in] origin origin of the line segment
* \param[in] end end of the line segment
* \param[out] voxel_center_list results are written to this vector of PointT elements
* \param[in] precision determines the size of the steps: step_size = octree_resolution x precision
* \return number of intersected voxels
*/
int
getApproxIntersectedVoxelCentersBySegment (
const Eigen::Vector3f& origin, const Eigen::Vector3f& end,
AlignedPointTVector &voxel_center_list, float precision = 0.2);
/** \brief Delete leaf node / voxel at given point
* \param[in] point_arg point addressing the voxel to be deleted.
*/
void
deleteVoxelAtPoint (const PointT& point_arg);
/** \brief Delete leaf node / voxel at given point from input cloud
* \param[in] point_idx_arg index of point addressing the voxel to be deleted.
*/
void
deleteVoxelAtPoint (const int& point_idx_arg);
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// Bounding box methods
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/** \brief Investigate dimensions of pointcloud data set and define corresponding bounding box for octree. */
void
defineBoundingBox ();
/** \brief Define bounding box for octree
* \note Bounding box cannot be changed once the octree contains elements.
* \param[in] min_x_arg X coordinate of lower bounding box corner
* \param[in] min_y_arg Y coordinate of lower bounding box corner
* \param[in] min_z_arg Z coordinate of lower bounding box corner
* \param[in] max_x_arg X coordinate of upper bounding box corner
* \param[in] max_y_arg Y coordinate of upper bounding box corner
* \param[in] max_z_arg Z coordinate of upper bounding box corner
*/
void
defineBoundingBox (const double min_x_arg, const double min_y_arg, const double min_z_arg,
const double max_x_arg, const double max_y_arg, const double max_z_arg);
/** \brief Define bounding box for octree
* \note Lower bounding box point is set to (0, 0, 0)
* \note Bounding box cannot be changed once the octree contains elements.
* \param[in] max_x_arg X coordinate of upper bounding box corner
* \param[in] max_y_arg Y coordinate of upper bounding box corner
* \param[in] max_z_arg Z coordinate of upper bounding box corner
*/
void
defineBoundingBox (const double max_x_arg, const double max_y_arg, const double max_z_arg);
/** \brief Define bounding box cube for octree
* \note Lower bounding box corner is set to (0, 0, 0)
* \note Bounding box cannot be changed once the octree contains elements.
* \param[in] cubeLen_arg side length of bounding box cube.
*/
void
defineBoundingBox (const double cubeLen_arg);
/** \brief Get bounding box for octree
* \note Bounding box cannot be changed once the octree contains elements.
* \param[in] min_x_arg X coordinate of lower bounding box corner
* \param[in] min_y_arg Y coordinate of lower bounding box corner
* \param[in] min_z_arg Z coordinate of lower bounding box corner
* \param[in] max_x_arg X coordinate of upper bounding box corner
* \param[in] max_y_arg Y coordinate of upper bounding box corner
* \param[in] max_z_arg Z coordinate of upper bounding box corner
*/
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;
/** \brief Calculates the squared diameter of a voxel at given tree depth
* \param[in] tree_depth_arg depth/level in octree
* \return squared diameter
*/
double
getVoxelSquaredDiameter (unsigned int tree_depth_arg) const;
/** \brief Calculates the squared diameter of a voxel at leaf depth
* \return squared diameter
*/
inline double
getVoxelSquaredDiameter () const
{
return getVoxelSquaredDiameter (this->octree_depth_);
}
/** \brief Calculates the squared voxel cube side length at given tree depth
* \param[in] tree_depth_arg depth/level in octree
* \return squared voxel cube side length
*/
double
getVoxelSquaredSideLen (unsigned int tree_depth_arg) const;
/** \brief Calculates the squared voxel cube side length at leaf level
* \return squared voxel cube side length
*/
inline double getVoxelSquaredSideLen () const
{
return getVoxelSquaredSideLen (this->octree_depth_);
}
/** \brief Generate bounds of the current voxel of an octree iterator
* \param[in] iterator: octree iterator
* \param[out] min_pt lower bound of voxel
* \param[out] max_pt upper bound of voxel
*/
inline void
getVoxelBounds (const OctreeIteratorBase<OctreeT>& iterator, Eigen::Vector3f &min_pt, Eigen::Vector3f &max_pt) const
{
this->genVoxelBoundsFromOctreeKey (iterator.getCurrentOctreeKey (),
iterator.getCurrentOctreeDepth (), min_pt, max_pt);
}
/** \brief Enable dynamic octree structure
* \note Leaf nodes are kept as close to the root as possible and are only expanded if the number of DataT objects within a leaf node exceeds a fixed limit.
* \param maxObjsPerLeaf: maximum number of DataT objects per leaf
* */
inline void
enableDynamicDepth ( size_t maxObjsPerLeaf )
{
assert(this->leaf_count_==0);
max_objs_per_leaf_ = maxObjsPerLeaf;
this->dynamic_depth_enabled_ = static_cast<bool> (max_objs_per_leaf_>0);
}
protected:
/** \brief Add point at index from input pointcloud dataset to octree
* \param[in] point_idx_arg the index representing the point in the dataset given by \a setInputCloud to be added
*/
virtual void
addPointIdx (const int point_idx_arg);
/** \brief Add point at index from input pointcloud dataset to octree
* \param[in] leaf_node to be expanded
* \param[in] parent_branch parent of leaf node to be expanded
* \param[in] child_idx child index of leaf node (in parent branch)
* \param[in] depth_mask of leaf node to be expanded
*/
void
expandLeafNode (LeafNode* leaf_node, BranchNode* parent_branch, unsigned char child_idx, unsigned int depth_mask);
/** \brief Get point at index from input pointcloud dataset
* \param[in] index_arg index representing the point in the dataset given by \a setInputCloud
* \return PointT from input pointcloud dataset
*/
const PointT&
getPointByIndex (const unsigned int index_arg) const;
/** \brief Find octree leaf node at a given point
* \param[in] point_arg query point
* \return pointer to leaf node. If leaf node does not exist, pointer is 0.
*/
LeafContainerT*
findLeafAtPoint (const PointT& point_arg) const
{
OctreeKey key;
// generate key for point
this->genOctreeKeyforPoint (point_arg, key);
return (this->findLeaf (key));
}
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// Protected octree methods based on octree keys
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/** \brief Define octree key setting and octree depth based on defined bounding box. */
void
getKeyBitSize ();
/** \brief Grow the bounding box/octree until point fits
* \param[in] point_idx_arg point that should be within bounding box;
*/
void
adoptBoundingBoxToPoint (const PointT& point_idx_arg);
/** \brief Checks if given point is within the bounding box of the octree
* \param[in] point_idx_arg point to be checked for bounding box violations
* \return "true" - no bound violation
*/
inline bool isPointWithinBoundingBox (const PointT& point_idx_arg) const
{
return (! ( (point_idx_arg.x < min_x_) || (point_idx_arg.y < min_y_)
|| (point_idx_arg.z < min_z_) || (point_idx_arg.x >= max_x_)
|| (point_idx_arg.y >= max_y_) || (point_idx_arg.z >= max_z_)));
}
/** \brief Generate octree key for voxel at a given point
* \param[in] point_arg the point addressing a voxel
* \param[out] key_arg write octree key to this reference
*/
void
genOctreeKeyforPoint (const PointT & point_arg,
OctreeKey &key_arg) const;
/** \brief Generate octree key for voxel at a given point
* \param[in] point_x_arg X coordinate of point addressing a voxel
* \param[in] point_y_arg Y coordinate of point addressing a voxel
* \param[in] point_z_arg Z coordinate of point addressing a voxel
* \param[out] key_arg write octree key to this reference
*/
void
genOctreeKeyforPoint (const double point_x_arg, const double point_y_arg, const double point_z_arg,
OctreeKey & key_arg) const;
/** \brief Virtual method for generating octree key for a given point index.
* \note This method enables to assign indices to leaf nodes during octree deserialization.
* \param[in] data_arg index value representing a point in the dataset given by \a setInputCloud
* \param[out] key_arg write octree key to this reference
* \return "true" - octree keys are assignable
*/
virtual bool
genOctreeKeyForDataT (const int& data_arg, OctreeKey & key_arg) const;
/** \brief Generate a point at center of leaf node voxel
* \param[in] key_arg octree key addressing a leaf node.
* \param[out] point_arg write leaf node voxel center to this point reference
*/
void
genLeafNodeCenterFromOctreeKey (const OctreeKey & key_arg,
PointT& point_arg) const;
/** \brief Generate a point at center of octree voxel at given tree level
* \param[in] key_arg octree key addressing an octree node.
* \param[in] tree_depth_arg octree depth of query voxel
* \param[out] point_arg write leaf node center point to this reference
*/
void
genVoxelCenterFromOctreeKey (const OctreeKey & key_arg,
unsigned int tree_depth_arg, PointT& point_arg) const;
/** \brief Generate bounds of an octree voxel using octree key and tree depth arguments
* \param[in] key_arg octree key addressing an octree node.
* \param[in] tree_depth_arg octree depth of query voxel
* \param[out] min_pt lower bound of voxel
* \param[out] max_pt upper bound of voxel
*/
void
genVoxelBoundsFromOctreeKey (const OctreeKey & key_arg,
unsigned int tree_depth_arg, Eigen::Vector3f &min_pt,
Eigen::Vector3f &max_pt) const;
/** \brief Recursively search the tree for all leaf nodes and return a vector of voxel centers.
* \param[in] node_arg current octree node to be explored
* \param[in] key_arg octree key addressing a leaf node.
* \param[out] voxel_center_list_arg results are written to this vector of PointT elements
* \return number of voxels found
*/
int
getOccupiedVoxelCentersRecursive (const BranchNode* node_arg,
const OctreeKey& key_arg,
AlignedPointTVector &voxel_center_list_arg) const;
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// Globals
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/** \brief Pointer to input point cloud dataset. */
PointCloudConstPtr input_;
/** \brief A pointer to the vector of point indices to use. */
IndicesConstPtr indices_;
/** \brief Epsilon precision (error bound) for nearest neighbors searches. */
double epsilon_;
/** \brief Octree resolution. */
double resolution_;
// Octree bounding box coordinates
double min_x_;
double max_x_;
double min_y_;
double max_y_;
double min_z_;
double max_z_;
/** \brief Flag indicating if octree has defined bounding box. */
bool bounding_box_defined_;
/** \brief Amount of DataT objects per leafNode before expanding branch
* \note zero indicates a fixed/maximum depth octree structure
* **/
std::size_t max_objs_per_leaf_;
};
}
}
#ifdef PCL_NO_PRECOMPILE
#include <pcl/octree/impl/octree_pointcloud.hpp>
#endif
#endif
pcl::octree::OctreePointCloud::min_z_
double min_z_
Definition: octree_pointcloud.h:557
pcl::octree::OctreePointCloud
Octree pointcloud class
Definition: octree_pointcloud.h:73
pcl::octree::OctreePointCloud::getVoxelBounds
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.
Definition: octree_pointcloud.h:385
pcl::octree::OctreePointCloud::PointCloud
pcl::PointCloud< PointT > PointCloud
Definition: octree_pointcloud.h:116
pcl::octree::OctreePointCloud::addPointsFromInputCloud
void addPointsFromInputCloud()
Add points from input point cloud to octree.
Definition: octree_pointcloud.hpp:65
pcl::octree::OctreePointCloud::getApproxIntersectedVoxelCentersBySegment
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.
Definition: octree_pointcloud.hpp:204
pcl::octree::OctreePointCloud::~OctreePointCloud
virtual ~OctreePointCloud()
Empty deconstructor.
Definition: octree_pointcloud.hpp:59
pcl::octree::OctreePointCloud::getIndices
IndicesConstPtr const getIndices() const
Get a pointer to the vector of indices used.
Definition: octree_pointcloud.h:146
pcl::octree::OctreePointCloud::genLeafNodeCenterFromOctreeKey
void genLeafNodeCenterFromOctreeKey(const OctreeKey &key_arg, PointT &point_arg) const
Generate a point at center of leaf node voxel.
Definition: octree_pointcloud.hpp:723
pcl::octree::OctreePointCloud::addPointToCloud
void addPointToCloud(const PointT &point_arg, PointCloudPtr cloud_arg)
Add point simultaneously to octree and input point cloud.
Definition: octree_pointcloud.hpp:106
pcl
Definition: convolution.h:45
pcl::octree::OctreePointCloud::PointCloudPtr
boost::shared_ptr< PointCloud > PointCloudPtr
Definition: octree_pointcloud.h:117
pcl::octree::OctreePointCloud::getPointByIndex
const PointT & getPointByIndex(const unsigned int index_arg) const
Get point at index from input pointcloud dataset.
Definition: octree_pointcloud.hpp:600
pcl::octree::OctreePointCloud::isPointWithinBoundingBox
bool isPointWithinBoundingBox(const PointT &point_idx_arg) const
Checks if given point is within the bounding box of the octree.
Definition: octree_pointcloud.h:462
pcl::octree::OctreePointCloud::addPointIdx
virtual void addPointIdx(const int point_idx_arg)
Add point at index from input pointcloud dataset to octree.
Definition: octree_pointcloud.hpp:556
pcl::octree::OctreePointCloud::AlignedPointTVector
std::vector< PointT, Eigen::aligned_allocator< PointT > > AlignedPointTVector
Definition: octree_pointcloud.h:129
pcl::octree::OctreePointCloud::PointCloudConstPtr
boost::shared_ptr< const PointCloud > PointCloudConstPtr
Definition: octree_pointcloud.h:118
pcl::octree::OctreePointCloud::OctreePointCloud
OctreePointCloud(const double resolution_arg)
Octree pointcloud constructor.
Definition: octree_pointcloud.hpp:49
pcl::octree::OctreePointCloud::adoptBoundingBoxToPoint
void adoptBoundingBoxToPoint(const PointT &point_idx_arg)
Grow the bounding box/octree until point fits.
Definition: octree_pointcloud.hpp:417
pcl::octree::OctreePointCloud::getBoundingBox
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.
Definition: octree_pointcloud.hpp:400
pcl::octree::OctreePointCloud::BreadthFirstIterator
OctreeBreadthFirstIterator< OctreeT > BreadthFirstIterator
Definition: octree_pointcloud.h:100
pcl::octree::OctreePointCloud::setInputCloud
void setInputCloud(const PointCloudConstPtr &cloud_arg, const IndicesConstPtr &indices_arg=IndicesConstPtr())
Provide a pointer to the input data set.
Definition: octree_pointcloud.h:136
pcl::octree::OctreeLeafNodeIterator
Octree leaf node iterator class.
Definition: octree_iterator.h:534
pcl::octree::OctreePointCloud::indices_
IndicesConstPtr indices_
A pointer to the vector of point indices to use.
Definition: octree_pointcloud.h:542
pcl::octree::OctreePointCloud::getInputCloud
PointCloudConstPtr getInputCloud() const
Get a pointer to the input point cloud dataset.
Definition: octree_pointcloud.h:154
pcl::octree::OctreePointCloud::enableDynamicDepth
void enableDynamicDepth(size_t maxObjsPerLeaf)
Enable dynamic octree structure.
Definition: octree_pointcloud.h:396
pcl::octree::OctreePointCloud::max_y_
double max_y_
Definition: octree_pointcloud.h:555
pcl::octree::OctreePointCloud::Iterator
OctreeDepthFirstIterator< OctreeT > Iterator
Definition: octree_pointcloud.h:88
pcl::octree::OctreePointCloud::input_
PointCloudConstPtr input_
Pointer to input point cloud dataset.
Definition: octree_pointcloud.h:539
pcl::octree::OctreeBreadthFirstIterator
Octree iterator class
Definition: octree_iterator.h:452
pcl::octree::OctreePointCloud::defineBoundingBox
void defineBoundingBox()
Investigate dimensions of pointcloud data set and define corresponding bounding box for octree...
Definition: octree_pointcloud.hpp:265
pcl::octree::OctreeIteratorBase::getCurrentOctreeDepth
unsigned int getCurrentOctreeDepth() const
Get the current depth level of octree.
Definition: octree_iterator.h:179
point_types.h
Defines all the PCL implemented PointT point type structures.
pcl::octree::OctreePointCloud::ConstPtr
boost::shared_ptr< const OctreePointCloud< PointT, LeafContainerT, BranchContainerT, OctreeT > > ConstPtr
Definition: octree_pointcloud.h:126
pcl::octree::OctreePointCloud::LeafNodeIterator
OctreeLeafNodeIterator< OctreeT > LeafNodeIterator
Definition: octree_pointcloud.h:92
pcl::octree::OctreePointCloud::genVoxelBoundsFromOctreeKey
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.
Definition: octree_pointcloud.hpp:746
pcl::octree::OctreePointCloud::ConstBreadthFirstIterator
const OctreeBreadthFirstIterator< OctreeT > ConstBreadthFirstIterator
Definition: octree_pointcloud.h:101
pcl::octree::OctreePointCloud::getOccupiedVoxelCentersRecursive
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.
Definition: octree_pointcloud.hpp:790
pcl::octree::OctreePointCloud::getResolution
double getResolution() const
Get octree voxel resolution.
Definition: octree_pointcloud.h:189
pcl::octree::OctreePointCloud::ConstDepthFirstIterator
const OctreeDepthFirstIterator< OctreeT > ConstDepthFirstIterator
Definition: octree_pointcloud.h:97
pcl::octree::OctreePointCloud::AlignedPointXYZVector
std::vector< PointXYZ, Eigen::aligned_allocator< PointXYZ > > AlignedPointXYZVector
Definition: octree_pointcloud.h:130
pcl::octree::OctreePointCloud::getTreeDepth
unsigned int getTreeDepth() const
Get the maximum depth of the octree.
Definition: octree_pointcloud.h:197
pcl::octree::OctreePointCloud::DepthFirstIterator
OctreeDepthFirstIterator< OctreeT > DepthFirstIterator
Definition: octree_pointcloud.h:96
pcl::octree::OctreePointCloud::getKeyBitSize
void getKeyBitSize()
Define octree key setting and octree depth based on defined bounding box.
Definition: octree_pointcloud.hpp:609
pcl::octree::OctreeDepthFirstIterator
Octree iterator class
Definition: octree_iterator.h:366
pcl::PointCloud
PointCloud represents the base class in PCL for storing collections of 3D points. ...
Definition: projection_matrix.h:53
pcl::octree::OctreePointCloud::Ptr
boost::shared_ptr< OctreePointCloud< PointT, LeafContainerT, BranchContainerT, OctreeT > > Ptr
Definition: octree_pointcloud.h:125
pcl::octree::OctreePointCloud::Base
OctreeT Base
Definition: octree_pointcloud.h:82
pcl::octree::OctreePointCloud::max_objs_per_leaf_
std::size_t max_objs_per_leaf_
Amount of DataT objects per leafNode before expanding branch.
Definition: octree_pointcloud.h:566
pcl::octree::OctreeKey
Octree key class
Definition: octree_key.h:51
pcl::octree::OctreePointCloud::addPointFromCloud
void addPointFromCloud(const int point_idx_arg, IndicesPtr indices_arg)
Add point at given index from input point cloud to octree.
Definition: octree_pointcloud.hpp:97
pcl::octree::OctreeIteratorBase::getCurrentOctreeKey
const OctreeKey & getCurrentOctreeKey() const
Get octree key for the current iterator octree node.
Definition: octree_iterator.h:167
pcl::octree::OctreePointCloud::deleteTree
void deleteTree()
Delete the octree structure and its leaf nodes.
Definition: octree_pointcloud.h:237
pcl::octree::OctreePointCloud::genVoxelCenterFromOctreeKey
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.
Definition: octree_pointcloud.hpp:733
pcl::octree::OctreePointCloud::isVoxelOccupiedAtPoint
bool isVoxelOccupiedAtPoint(const PointT &point_arg) const
Check if voxel at given point exist.
Definition: octree_pointcloud.hpp:130
pcl::octree::OctreePointCloud::expandLeafNode
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.
Definition: octree_pointcloud.hpp:507
pcl::octree::OctreePointCloud::ConstLeafNodeIterator
const OctreeLeafNodeIterator< OctreeT > ConstLeafNodeIterator
Definition: octree_pointcloud.h:93
pcl::octree::OctreePointCloud::LeafNode
OctreeT::LeafNode LeafNode
Definition: octree_pointcloud.h:84
pcl::octree::OctreePointCloud::findLeafAtPoint
LeafContainerT * findLeafAtPoint(const PointT &point_arg) const
Find octree leaf node at a given point.
Definition: octree_pointcloud.h:434
pcl::octree::OctreePointCloud::IndicesConstPtr
boost::shared_ptr< const std::vector< int > > IndicesConstPtr
Definition: octree_pointcloud.h:114
pcl::octree::OctreePointCloud::SingleBuffer
OctreePointCloud< PointT, LeafContainerT, BranchContainerT, OctreeBase< LeafContainerT > > SingleBuffer
Definition: octree_pointcloud.h:121
pcl::octree::OctreeIteratorBase
Abstract octree iterator class
Definition: octree_iterator.h:75
pcl::octree::OctreePointCloud::min_y_
double min_y_
Definition: octree_pointcloud.h:554
pcl::octree::OctreePointCloud::IndicesPtr
boost::shared_ptr< std::vector< int > > IndicesPtr
Definition: octree_pointcloud.h:113
pcl::octree::OctreePointCloud::max_x_
double max_x_
Definition: octree_pointcloud.h:552
pcl::octree::OctreePointCloud::BranchNode
OctreeT::BranchNode BranchNode
Definition: octree_pointcloud.h:85
pcl::octree::OctreePointCloud::getVoxelSquaredSideLen
double getVoxelSquaredSideLen() const
Calculates the squared voxel cube side length at leaf level.
Definition: octree_pointcloud.h:374
pcl::octree::OctreePointCloud::min_x_
double min_x_
Definition: octree_pointcloud.h:551
pcl::PointXYZRGB
A point structure representing Euclidean xyz coordinates, and the RGB color.
Definition: point_types.hpp:606
pcl::octree::OctreePointCloud::epsilon_
double epsilon_
Epsilon precision (error bound) for nearest neighbors searches.
Definition: octree_pointcloud.h:545
pcl::octree::OctreePointCloud::deleteVoxelAtPoint
void deleteVoxelAtPoint(const PointT &point_arg)
Delete leaf node / voxel at given point.
Definition: octree_pointcloud.hpp:167
pcl::octree::OctreePointCloud::setEpsilon
void setEpsilon(double eps)
Set the search epsilon precision (error bound) for nearest neighbors searches.
Definition: octree_pointcloud.h:162
pcl::octree::OctreePointCloud::ConstIterator
const OctreeDepthFirstIterator< OctreeT > ConstIterator
Definition: octree_pointcloud.h:89
pcl::octree::OctreePointCloud::bounding_box_defined_
bool bounding_box_defined_
Flag indicating if octree has defined bounding box.
Definition: octree_pointcloud.h:561
pcl::octree::OctreePointCloud::max_z_
double max_z_
Definition: octree_pointcloud.h:558
pcl::octree::OctreePointCloud::getVoxelSquaredDiameter
double getVoxelSquaredDiameter() const
Calculates the squared diameter of a voxel at leaf depth.
Definition: octree_pointcloud.h:359
pcl::octree::OctreePointCloud::resolution_
double resolution_
Octree resolution.
Definition: octree_pointcloud.h:548
pcl::octree::OctreePointCloud::genOctreeKeyForDataT
virtual bool genOctreeKeyForDataT(const int &data_arg, OctreeKey &key_arg) const
Virtual method for generating octree key for a given point index.
Definition: octree_pointcloud.hpp:711
pcl::octree::OctreePointCloud::getOccupiedVoxelCenters
int getOccupiedVoxelCenters(AlignedPointTVector &voxel_center_list_arg) const
Get a PointT vector of centers of all occupied voxels.
Definition: octree_pointcloud.hpp:190
pcl::octree::OctreePointCloud::genOctreeKeyforPoint
void genOctreeKeyforPoint(const PointT &point_arg, OctreeKey &key_arg) const
Generate octree key for voxel at a given point.
Definition: octree_pointcloud.hpp:680
pcl::octree::OctreePointCloud::setResolution
void setResolution(double resolution_arg)
Set/change the octree voxel resolution.
Definition: octree_pointcloud.h:176
pcl::octree::OctreePointCloud::getEpsilon
double getEpsilon() const
Get the search epsilon precision (error bound) for nearest neighbors searches.
Definition: octree_pointcloud.h:168