Point Cloud Library (PCL)
1.9.1
|
40 #ifndef PCL_OUTOFCORE_OUTOFCOREOCTREEBASE_H_
41 #define PCL_OUTOFCORE_OUTOFCOREOCTREEBASE_H_
43 #include <pcl/outofcore/boost.h>
44 #include <pcl/common/io.h>
47 #include <pcl/outofcore/octree_base_node.h>
48 #include <pcl/outofcore/octree_disk_container.h>
49 #include <pcl/outofcore/octree_ram_container.h>
52 #include <pcl/outofcore/outofcore_iterator_base.h>
53 #include <pcl/outofcore/outofcore_breadth_first_iterator.h>
54 #include <pcl/outofcore/outofcore_depth_first_iterator.h>
55 #include <pcl/outofcore/impl/outofcore_breadth_first_iterator.hpp>
56 #include <pcl/outofcore/impl/outofcore_depth_first_iterator.hpp>
59 #include <pcl/outofcore/metadata.h>
60 #include <pcl/outofcore/outofcore_base_data.h>
62 #include <pcl/filters/filter.h>
63 #include <pcl/filters/random_sample.h>
65 #include <pcl/PCLPointCloud2.h>
148 template<
typename ContainerT = OutofcoreOctreeDiskContainer<pcl::Po
intXYZ>,
typename Po
intT = pcl::Po
intXYZ>
177 typedef boost::shared_ptr<OutofcoreOctreeBase<ContainerT, PointT> >
Ptr;
178 typedef boost::shared_ptr<const OutofcoreOctreeBase<ContainerT, PointT> >
ConstPtr;
218 OutofcoreOctreeBase (
const Eigen::Vector3d& min,
const Eigen::Vector3d& max,
const double resolution_arg,
const boost::filesystem::path &root_node_name,
const std::string &coord_sys);
233 OutofcoreOctreeBase (
const boost::uint64_t max_depth,
const Eigen::Vector3d &min,
const Eigen::Vector3d &max,
const boost::filesystem::path &root_node_name,
const std::string &coord_sys);
300 queryFrustum (
const double *planes, std::list<std::string>& file_names)
const;
303 queryFrustum (
const double *planes, std::list<std::string>& file_names,
const boost::uint32_t query_depth)
const;
306 queryFrustum (
const double *planes,
const Eigen::Vector3d &eye,
const Eigen::Matrix4d &view_projection_matrix,
307 std::list<std::string>& file_names,
const boost::uint32_t query_depth)
const;
322 queryBBIntersects (
const Eigen::Vector3d &min,
const Eigen::Vector3d &max,
const boost::uint32_t query_depth, std::list<std::string> &bin_name)
const;
382 queryBoundingBox (
const Eigen::Vector3d &min,
const Eigen::Vector3d &max,
const int query_depth, std::list<std::string> &filenames)
const
398 getBoundingBox (Eigen::Vector3d &min, Eigen::Vector3d &max)
const;
404 inline boost::uint64_t
407 return (
metadata_->getLODPoints (depth_index));
419 queryBoundingBoxNumPoints (
const Eigen::Vector3d& min,
const Eigen::Vector3d& max,
const int query_depth,
bool load_from_disk =
true);
425 inline const std::vector<boost::uint64_t>&
433 inline boost::uint64_t
439 inline boost::uint64_t
471 return (
metadata_->getCoordinateSystem ());
511 getOccupiedVoxelCenters(std::vector<Eigen::Vector3d, Eigen::aligned_allocator<Eigen::Vector3d> > &voxel_centers,
size_t query_depth)
const;
558 return (sample_percent_);
566 this->sample_percent_ = std::fabs (sample_percent_arg) > 1.0 ? 1.0 : std::fabs (sample_percent_arg);
571 init (
const boost::uint64_t& depth,
const Eigen::Vector3d& min,
const Eigen::Vector3d& max,
const boost::filesystem::path& root_name,
const std::string& coord_sys);
638 boost::shared_ptr<OutofcoreOctreeBaseMetadata>
metadata_;
652 enlargeToCube (Eigen::Vector3d &bb_min, Eigen::Vector3d &bb_max);
656 calculateDepth (
const Eigen::Vector3d& min_bb,
const Eigen::Vector3d& max_bb,
const double leaf_resolution);
658 double sample_percent_;
667 #endif // PCL_OUTOFCORE_OUTOFCOREOCTREEBASE_H_
boost::uint64_t getDepth() const
Get number of LODs, which is the height of the tree.
boost::uint64_t addPointCloud(PointCloudConstPtr point_cloud)
Copies the points from the point_cloud falling within the bounding box of the octree to the out-of-co...
This file defines compatibility wrappers for low level I/O functions.
OutofcoreOctreeBase(const boost::filesystem::path &root_node_name, const bool load_all)
Load an existing tree.
Abstract octree iterator class.
void getOccupiedVoxelCenters(AlignedPointTVector &voxel_centers, size_t query_depth) const
Returns the voxel centers of all existing voxels at query_depth.
boost::shared_ptr< const OutofcoreOctreeBase< ContainerT, PointT > > ConstPtr
boost::uint64_t queryBoundingBoxNumPoints(const Eigen::Vector3d &min, const Eigen::Vector3d &max, const int query_depth, bool load_from_disk=true)
Queries the number of points in a bounding box.
OutofcoreOctreeBaseNode< ContainerT, PointT > BranchNode
OutofcoreDepthFirstIterator< PointT, ContainerT > Iterator
boost::uint64_t addDataToLeaf(const AlignedPointTVector &p)
Recursively add points to the tree.
OutofcoreOctreeBaseNode< OutofcoreOctreeRamContainer< PointT >, PointT > octree_ram_node
OutofcoreOctreeBase< OutofcoreOctreeRamContainer< PointT >, PointT > octree_ram
void saveToFile()
Write octree definition ".octree" (defined by octree_extension_) to disk.
const typedef OutofcoreDepthFirstIterator< PointT, ContainerT > ConstIterator
virtual void queryBoundingBox(const Eigen::Vector3d &min, const Eigen::Vector3d &max, const int query_depth, const pcl::PCLPointCloud2::Ptr &dst_blob, double percent=1.0)
Query all points falling within the input bounding box at query_depth and return a PCLPointCloud2 obj...
boost::shared_ptr< PointCloud > PointCloudPtr
OutofcoreOctreeBaseNode Class internally representing nodes of an outofcore octree,...
std::string node_container_basename_
boost::uint64_t addPointCloud_and_genLOD(pcl::PCLPointCloud2::Ptr &input_cloud)
Recursively add points to the tree.
OutofcoreBreadthFirstIterator< PointT, ContainerT > BreadthFirstIterator
double getSamplePercent() const
Returns the sample_percent_ used when constructing the LOD.
std::string node_index_basename_
boost::uint64_t addDataToLeaf_and_genLOD(AlignedPointTVector &p)
Recursively add points to the tree subsampling LODs on the way.
void getOccupiedVoxelCenters(AlignedPointTVector &voxel_centers) const
Gets the voxel centers of all occupied/existing leaves of the tree.
void queryBBIncludes(const Eigen::Vector3d &min, const Eigen::Vector3d &max, const boost::uint64_t query_depth, AlignedPointTVector &dst) const
Get Points in BB, only points inside BB.
void DeAllocEmptyNodeCache()
DEPRECATED - Flush empty nodes only.
OutofcoreOctreeBaseNode< ContainerT, PointT > LeafNode
const typedef OutofcoreDepthFirstIterator< PointT, ContainerT > DepthFirstConstIterator
boost::shared_mutex read_write_mutex_
shared mutex for controlling read/write access to disk
void incrementPointsInLOD(boost::uint64_t depth, boost::uint64_t inc)
Increment current depths (LOD for branch nodes) point count; called by addDataAtMaxDepth in Outofcore...
void queryBBIncludes_subsample(const Eigen::Vector3d &min, const Eigen::Vector3d &max, uint64_t query_depth, const double percent, AlignedPointTVector &dst) const
Returns a random subsample of points within the given bounding box at query_depth.
bool getBinDimension(double &x, double &y) const
Computes the expected voxel dimensions at the leaves.
double getVoxelSideLength() const
Gets the smallest (assumed) cubic voxel side lengths.
PointCloud represents the base class in PCL for storing collections of 3D points.
std::string node_container_extension_
A point structure representing Euclidean xyz coordinates, and the RGB color.
boost::shared_ptr< OutofcoreOctreeBase< ContainerT, PointT > > Ptr
void flushToDiskLazy()
DEPRECATED - Flush all non leaf nodes' cache.
virtual ~OutofcoreOctreeBase()
void printBoundingBox() const
Prints size of the bounding boxes to stdou.
bool getBoundingBox(Eigen::Vector3d &min, Eigen::Vector3d &max) const
Get the overall bounding box of the outofcore octree; this is the same as the bounding box of the roo...
const std::vector< boost::uint64_t > & getNumPointsVector() const
Get number of points at each LOD.
bool checkExtension(const boost::filesystem::path &path_name)
Auxiliary function to validate path_name extension is .octree.
boost::shared_ptr< OutofcoreOctreeBaseMetadata > metadata_
void convertToXYZ()
Save each .bin file as an XYZ file.
void queryFrustum(const double *planes, std::list< std::string > &file_names) const
void buildLOD()
Generate multi-resolution LODs for the tree, which are a uniform random sampling all child leafs belo...
const static std::string TREE_EXTENSION_
defined as ".octree" to append to treepath files
std::vector< PointT, Eigen::aligned_allocator< PointT > > AlignedPointTVector
void flushToDisk()
DEPRECATED - Flush all nodes' cache.
virtual void queryBoundingBox(const Eigen::Vector3d &min, const Eigen::Vector3d &max, const int query_depth, std::list< std::string > &filenames) const
Returns list of pcd files from nodes whose bounding boxes intersect with the input bounding box.
boost::shared_ptr< std::vector< int > > IndicesPtr
Filter represents the base filter class.
boost::uint64_t getTreeDepth() const
void buildLODRecursive(const std::vector< BranchNode * > ¤t_branch)
recursive portion of lod builder
OutofcoreNodeType * getRootNode()
const std::string & getCoordSystem() const
Get coordinate system tag from the JSON metadata file.
const typedef OutofcoreBreadthFirstIterator< PointT, ContainerT > BreadthFirstConstIterator
OutofcoreOctreeBase< OutofcoreOctreeDiskContainer< PointT >, PointT > octree_disk
void queryBBIntersects(const Eigen::Vector3d &min, const Eigen::Vector3d &max, const boost::uint32_t query_depth, std::list< std::string > &bin_name) const
Get a list of file paths at query_depth that intersect with your bounding box specified by min and ma...
virtual void queryBBIntersects(const Eigen::Vector3d &min_bb, const Eigen::Vector3d &max_bb, const boost::uint32_t query_depth, std::list< std::string > &file_names)
Recursive acquires PCD paths to any node with which the queried bounding box intersects (at query_dep...
pcl::PointCloud< PointT > PointCloud
const static int OUTOFCORE_VERSION_
OutofcoreDepthFirstIterator< PointT, ContainerT > DepthFirstIterator
void writeVPythonVisual(const boost::filesystem::path filename)
Write a python script using the vpython module containing all the bounding boxes.
boost::shared_ptr< const std::vector< int > > IndicesConstPtr
OutofcoreOctreeBaseNode< ContainerT, PointT > OutofcoreNodeType
OutofcoreNodeType * root_node_
Pointer to the root node of the octree data structure.
boost::uint64_t getNumPointsAtDepth(const boost::uint64_t &depth_index) const
Get number of points at specified LOD.
void getOccupiedVoxelCenters(std::vector< Eigen::Vector3d, Eigen::aligned_allocator< Eigen::Vector3d > > &voxel_centers) const
Returns the voxel centers of all occupied/existing leaves of the tree.
void init(const boost::uint64_t &depth, const Eigen::Vector3d &min, const Eigen::Vector3d &max, const boost::filesystem::path &root_name, const std::string &coord_sys)
This code defines the octree used for point storage at Urban Robotics.
OutofcoreOctreeBaseNode< OutofcoreOctreeDiskContainer< PointT >, PointT > octree_disk_node
boost::shared_ptr< const PointCloud > PointCloudConstPtr
RandomSample applies a random sampling with uniform probability.
std::string node_index_extension_
void setLODFilter(const pcl::Filter< pcl::PCLPointCloud2 >::Ptr &filter_arg)
Sets the filter to use when building the levels of depth.
OutofcoreOctreeBase & operator=(OutofcoreOctreeBase &rval)
void setSamplePercent(const double sample_percent_arg)
Sets the sampling percent for constructing LODs.
const static uint64_t LOAD_COUNT_
OutofcoreNodeType * getBranchChildPtr(const BranchNode &branch_arg, unsigned char childIdx_arg) const
pcl::Filter< pcl::PCLPointCloud2 >::Ptr getLODFilter()
boost::shared_ptr< ::pcl::PCLPointCloud2 > Ptr