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);
244 addDataToLeaf (
const AlignedPointTVector &p);
253 addPointCloud (PointCloudConstPtr point_cloud);
288 addPointCloud_and_genLOD (PointCloudConstPtr point_cloud);
295 addDataToLeaf_and_genLOD (AlignedPointTVector &p);
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;
336 queryBBIncludes (
const Eigen::Vector3d &min,
const Eigen::Vector3d &max,
const boost::uint64_t query_depth, AlignedPointTVector &dst)
const;
346 queryBBIncludes (
const Eigen::Vector3d &min,
const Eigen::Vector3d &max,
const boost::uint64_t query_depth,
const pcl::PCLPointCloud2::Ptr &dst_blob)
const;
358 queryBBIncludes_subsample (
const Eigen::Vector3d &min,
const Eigen::Vector3d &max, uint64_t query_depth,
const double percent, AlignedPointTVector &dst)
const;
373 queryBoundingBox (
const Eigen::Vector3d &min,
const Eigen::Vector3d &max,
const int query_depth,
const pcl::PCLPointCloud2::Ptr &dst_blob,
double percent = 1.0);
382 queryBoundingBox (
const Eigen::Vector3d &min,
const Eigen::Vector3d &max,
const int query_depth, std::list<std::string> &filenames)
const 384 boost::shared_lock < boost::shared_mutex > lock (read_write_mutex_);
386 this->root_node_->queryBBIntersects (min, max, query_depth, filenames);
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>&
428 return (metadata_->getLODPoints ());
433 inline boost::uint64_t
436 return (metadata_->getDepth ());
439 inline boost::uint64_t
442 return (this->getDepth ());
448 getBinDimension (
double &x,
double &y)
const;
455 getVoxelSideLength (
const boost::uint64_t& depth)
const;
463 return (this->getVoxelSideLength (metadata_->getDepth ()));
471 return (metadata_->getCoordinateSystem ());
485 printBoundingBox (
const size_t query_depth)
const;
489 printBoundingBox (OutofcoreNodeType& node)
const;
496 this->printBoundingBox (metadata_->getDepth ());
504 getOccupiedVoxelCenters(AlignedPointTVector &voxel_centers,
size_t query_depth)
const;
511 getOccupiedVoxelCenters(std::vector<Eigen::Vector3d, Eigen::aligned_allocator<Eigen::Vector3d> > &voxel_centers,
size_t query_depth)
const;
517 getOccupiedVoxelCenters(voxel_centers, metadata_->getDepth ());
526 getOccupiedVoxelCenters(voxel_centers, metadata_->getDepth ());
539 writeVPythonVisual (
const boost::filesystem::path filename);
542 getBranchChildPtr (
const BranchNode& branch_arg,
unsigned char childIdx_arg)
const;
548 getLODFilter ()
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);
583 inline OutofcoreNodeType*
586 return (this->root_node_);
591 DeAllocEmptyNodeCache (OutofcoreNodeType* current);
599 buildLODRecursive (
const std::vector<BranchNode*>& current_branch);
604 incrementPointsInLOD (boost::uint64_t depth, boost::uint64_t inc);
611 checkExtension (
const boost::filesystem::path& path_name);
630 DeAllocEmptyNodeCache ();
638 boost::shared_ptr<OutofcoreOctreeBaseMetadata>
metadata_;
646 const static uint64_t LOAD_COUNT_ =
static_cast<uint64_t
>(2e9);
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::shared_ptr< const OutofcoreOctreeBase< ContainerT, PointT > > ConstPtr
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...
std::string node_container_extension_
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 printBoundingBox() const
Prints size of the bounding boxes to stdou.
This file defines compatibility wrappers for low level I/O functions.
OutofcoreOctreeBaseNode< ContainerT, PointT > BranchNode
OutofcoreOctreeBaseNode< OutofcoreOctreeRamContainer< PointT >, PointT > octree_ram_node
boost::shared_ptr< PointCloud > PointCloudPtr
boost::shared_ptr< OutofcoreOctreeBaseMetadata > metadata_
std::string node_index_extension_
OutofcoreBreadthFirstIterator< PointT, ContainerT > BreadthFirstIterator
boost::uint64_t getTreeDepth() const
std::string node_container_basename_
boost::shared_ptr< ::pcl::PCLPointCloud2 > Ptr
std::string node_index_basename_
void setSamplePercent(const double sample_percent_arg)
Sets the sampling percent for constructing LODs.
OutofcoreIteratorBase & operator=(const OutofcoreIteratorBase &src)
OutofcoreOctreeBaseNode< ContainerT, PointT > LeafNode
const OutofcoreDepthFirstIterator< PointT, ContainerT > ConstIterator
Filter represents the base filter class.
boost::shared_ptr< const std::vector< int > > IndicesConstPtr
boost::shared_ptr< std::vector< int > > IndicesPtr
boost::shared_ptr< OutofcoreOctreeBase< ContainerT, PointT > > Ptr
std::vector< PointT, Eigen::aligned_allocator< PointT > > AlignedPointTVector
OutofcoreOctreeBase< OutofcoreOctreeDiskContainer< PointT >, PointT > octree_disk
void getOccupiedVoxelCenters(AlignedPointTVector &voxel_centers) const
Gets the voxel centers of all occupied/existing leaves of the tree.
const OutofcoreBreadthFirstIterator< PointT, ContainerT > BreadthFirstConstIterator
static const std::string TREE_EXTENSION_
defined as ".octree" to append to treepath files
PointCloud represents the base class in PCL for storing collections of 3D points. ...
OutofcoreOctreeBaseNode Class internally representing nodes of an outofcore octree, with accessors to its data via the pcl::outofcore::OutofcoreOctreeDiskContainer class or pcl::outofcore::OutofcoreOctreeRamContainer class, whichever it is templated against.
pcl::PointCloud< PointT > PointCloud
double getSamplePercent() const
Returns the sample_percent_ used when constructing the LOD.
const std::vector< boost::uint64_t > & getNumPointsVector() const
Get number of points at each LOD.
boost::shared_ptr< const PointCloud > PointCloudConstPtr
double getVoxelSideLength() const
Gets the smallest (assumed) cubic voxel side lengths.
Abstract octree iterator class.
OutofcoreNodeType * root_node_
Pointer to the root node of the octree data structure.
static const int OUTOFCORE_VERSION_
boost::uint64_t getNumPointsAtDepth(const boost::uint64_t &depth_index) const
Get number of points at specified LOD.
const OutofcoreDepthFirstIterator< PointT, ContainerT > DepthFirstConstIterator
OutofcoreDepthFirstIterator< PointT, ContainerT > DepthFirstIterator
OutofcoreOctreeBase< OutofcoreOctreeRamContainer< PointT >, PointT > octree_ram
A point structure representing Euclidean xyz coordinates, and the RGB color.
OutofcoreOctreeBaseNode< OutofcoreOctreeDiskContainer< PointT >, PointT > octree_disk_node
OutofcoreNodeType * getRootNode()
This code defines the octree used for point storage at Urban Robotics.
RandomSample applies a random sampling with uniform probability.
OutofcoreDepthFirstIterator< PointT, ContainerT > Iterator
boost::shared_mutex read_write_mutex_
shared mutex for controlling read/write access to disk
OutofcoreOctreeBaseNode< ContainerT, PointT > OutofcoreNodeType
boost::uint64_t getDepth() const
Get number of LODs, which is the height of the tree.
const std::string & getCoordSystem() const
Get coordinate system tag from the JSON metadata file.