Point Cloud Library (PCL)
1.11.1-dev
|
46 #include <pcl/common/io.h>
47 #include <pcl/PCLPointCloud2.h>
49 #include <pcl/outofcore/boost.h>
50 #include <pcl/outofcore/octree_base.h>
51 #include <pcl/outofcore/octree_disk_container.h>
52 #include <pcl/outofcore/outofcore_node_data.h>
54 #include <pcl/octree/octree_nodes.h>
61 template<
typename ContainerT,
typename Po
intT>
64 template<
typename ContainerT,
typename Po
intT>
72 template<
typename ContainerT,
typename Po
intT>
void
73 queryBBIntersects_noload (
const boost::filesystem::path &root_node,
const Eigen::Vector3d &min,
const Eigen::Vector3d &max,
const std::uint32_t query_depth, std::list<std::string> &bin_name);
76 template<
typename ContainerT,
typename Po
intT>
void
94 template<
typename ContainerT = OutofcoreOctreeDiskContainer<pcl::Po
intXYZ>,
typename Po
intT = pcl::Po
intXYZ>
104 queryBBIntersects_noload<ContainerT, PointT> (
const boost::filesystem::path &rootnode,
const Eigen::Vector3d &min,
const Eigen::Vector3d &max,
const std::uint32_t query_depth, std::list<std::string> &bin_name);
107 queryBBIntersects_noload<ContainerT, PointT> (
OutofcoreOctreeBaseNode<ContainerT, PointT>* current,
const Eigen::Vector3d &min,
const Eigen::Vector3d &max,
const std::uint32_t query_depth, std::list<std::string> &bin_name);
146 const boost::filesystem::path&
152 const boost::filesystem::path&
159 queryFrustum (
const double planes[24], std::list<std::string>& file_names);
162 queryFrustum (
const double planes[24], std::list<std::string>& file_names,
const std::uint32_t query_depth,
const bool skip_vfc_check =
false);
165 queryFrustum (
const double planes[24],
const Eigen::Vector3d &eye,
const Eigen::Matrix4d &view_projection_matrix, std::list<std::string>& file_names,
const std::uint32_t query_depth,
const bool skip_vfc_check =
false);
205 queryBBIntersects (
const Eigen::Vector3d &min_bb,
const Eigen::Vector3d &max_bb,
const std::uint32_t query_depth, std::list<std::string> &file_names);
217 virtual std::uint64_t
220 virtual std::uint64_t
221 addDataToLeaf (
const std::vector<const PointT*> &p,
const bool skip_bb_check =
true);
228 virtual std::uint64_t
232 virtual std::uint64_t
240 virtual std::uint64_t
267 PCL_THROW_EXCEPTION (
PCLException,
"Not implemented\n");
271 virtual inline std::size_t
298 virtual std::uint64_t
418 inBoundingBox (
const Eigen::Vector3d &min_bb,
const Eigen::Vector3d &max_bb)
const;
426 pointInBoundingBox (
const Eigen::Vector3d &min_bb,
const Eigen::Vector3d &max_bb,
const Eigen::Vector3d &point);
444 pointInBoundingBox (
const Eigen::Vector3d &min_bb,
const Eigen::Vector3d &max_bb,
const double x,
const double y,
const double z);
529 enlargeToCube (Eigen::Vector3d &bb_min, Eigen::Vector3d &bb_max);
virtual std::size_t countNumLoadedChildren() const
Counts the number of loaded chilren by testing the children_ array; used to update num_loaded_chilren...
static std::mutex rng_mutex_
Random number generator mutex.
void flushToDiskRecursive()
virtual void getBoundingBox(Eigen::Vector3d &min_bb, Eigen::Vector3d &max_bb) const
gets the minimum and maximum corner of the bounding box represented by this node
virtual std::uint64_t addDataToLeaf_and_genLOD(const AlignedPointTVector &p, const bool skip_bb_check)
Recursively add points to the leaf and children subsampling LODs on the way down.
void copyAllCurrentAndChildPointsRec(std::list< PointT > &v)
Copies points from this and all children into a single point container (std::list)
std::uint64_t num_children_
Number of children on disk.
virtual void queryBBIncludes(const Eigen::Vector3d &min_bb, const Eigen::Vector3d &max_bb, std::size_t query_depth, AlignedPointTVector &dst)
Recursively add points that fall into the queried bounding box up to the query_depth.
std::uint64_t addDataAtMaxDepth(const AlignedPointTVector &p, const bool skip_bb_check=true)
Add data to the leaf when at max depth of tree.
void subdividePoint(const PointT &point, std::vector< AlignedPointTVector > &c)
Subdivide a single point into a specific child node.
std::vector< PointT, Eigen::aligned_allocator< PointT > > AlignedPointTVector
void writeVPythonVisual(std::ofstream &file)
Write a python visual script to file.
virtual std::uint64_t addPointCloud_and_genLOD(const pcl::PCLPointCloud2::Ptr input_cloud)
Add a single PCLPointCloud2 into the octree and build the subsampled LOD during construction; this me...
shared_ptr< ::pcl::PCLPointCloud2 > Ptr
virtual void queryBBIntersects(const Eigen::Vector3d &min_bb, const Eigen::Vector3d &max_bb, const std::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...
OutofcoreOctreeBaseNode Class internally representing nodes of an outofcore octree,...
virtual std::size_t getDepth() const
virtual std::uint64_t getDataSize() const
Gets the number of points available in the PCD file.
void queryFrustum(const double planes[24], std::list< std::string > &file_names)
virtual void queryBBIncludes_subsample(const Eigen::Vector3d &min_bb, const Eigen::Vector3d &max_bb, std::uint64_t query_depth, const double percent, AlignedPointTVector &v)
Recursively add points that fall into the queried bounding box up to the query_depth.
const static double sample_percent_
void copyAllCurrentAndChildPointsRec_sub(std::list< PointT > &v, const double percent)
const static std::string node_index_basename
virtual std::size_t getNumChildren() const
Returns the total number of children on disk.
~OutofcoreOctreeBaseNode()
Will recursively delete all children calling recFreeChildrein.
pcl::octree::node_type_t node_type_t
void convertToXYZRecursive()
Recursively converts data files to ascii XZY files.
const boost::filesystem::path & getPCDFilename() const
void createChild(const std::size_t idx)
Creates child node idx.
virtual std::size_t countNumChildren() const
Counts the number of child directories on disk; used to update num_children_.
A point structure representing Euclidean xyz coordinates, and the RGB color.
static std::mt19937 rng_
Mersenne Twister: A 623-dimensionally equidistributed uniform pseudo-random number generator.
Abstract octree node class
OutofcoreOctreeNodeMetadata::Ptr node_metadata_
OutofcoreOctreeBaseNode & operator=(const OutofcoreOctreeBaseNode &rval)
Operator= is not implemented.
void saveIdx(bool recursive)
Save node's metadata to file.
const static std::string node_container_basename
std::size_t depth_
Depth in the tree, root is 0, root's children are 1, ...
OutofcoreOctreeBaseNode * deepCopy() const override
void queryBBIntersects_noload(const boost::filesystem::path &root_node, const Eigen::Vector3d &min, const Eigen::Vector3d &max, const std::uint32_t query_depth, std::list< std::string > &bin_name)
Non-class method which performs a bounding box query without loading any of the point cloud data from...
void enlargeToCube(Eigen::Vector3d &bb_min, Eigen::Vector3d &bb_max)
Enlarges the shortest two sidelengths of the bounding box to a cubic shape; operation is done in plac...
bool intersectsWithBoundingBox(const Eigen::Vector3d &min_bb, const Eigen::Vector3d &max_bb) const
Tests whether the input bounding box intersects with the current node's bounding box.
virtual void printBoundingBox(const std::size_t query_depth) const
Write the voxel size to stdout at query_depth.
node_type_t getNodeType() const override
const static std::string node_index_extension
const static std::string node_container_extension
void randomSample(const AlignedPointTVector &p, AlignedPointTVector &insertBuff, const bool skip_bb_check)
Randomly sample point data.
std::shared_ptr< ContainerT > payload_
what holds the points.
OutofcoreOctreeBaseNode()
Empty constructor; sets pointers for children and for bounding boxes to 0.
virtual std::size_t getNumLoadedChildren() const
Count loaded chilren.
OutofcoreOctreeBaseNode * parent_
super-node
void subdividePoints(const AlignedPointTVector &p, std::vector< AlignedPointTVector > &c, const bool skip_bb_check)
Subdivide points to pass to child nodes.
bool pointInBoundingBox(const Eigen::Vector3d &min_bb, const Eigen::Vector3d &max_bb, const Eigen::Vector3d &point)
Tests whether point falls within the input bounding box.
void sortOctantIndices(const pcl::PCLPointCloud2::Ptr &input_cloud, std::vector< std::vector< int > > &indices, const Eigen::Vector3d &mid_xyz)
Sorts the indices based on x,y,z fields and pushes the index into the proper octant's vector; This co...
virtual std::uint64_t addDataToLeaf(const AlignedPointTVector &p, const bool skip_bb_check=true)
add point to this node if we are a leaf, or find the leaf below us that is supposed to take the point
bool hasUnloadedChildren() const
Returns whether or not a node has unloaded children data.
virtual OutofcoreOctreeBaseNode * getChildPtr(std::size_t index_arg) const
Returns a pointer to the child in octant index_arg.
A base class for all pcl exceptions which inherits from std::runtime_error.
OutofcoreOctreeBaseNode< ContainerT, PointT > * makenode_norec(const boost::filesystem::path &path, OutofcoreOctreeBaseNode< ContainerT, PointT > *super)
Non-class function which creates a single child leaf; used with queryBBIntersects_noload to avoid loa...
const boost::filesystem::path & getMetadataFilename() const
OutofcoreOctreeBase< ContainerT, PointT > * m_tree_
The tree we belong to.
std::uint64_t size() const
Number of points in the payload.
void init_root_node(const Eigen::Vector3d &bb_min, const Eigen::Vector3d &bb_max, OutofcoreOctreeBase< ContainerT, PointT > *const tree, const boost::filesystem::path &rootname)
Create root node and directory.
This code defines the octree used for point storage at Urban Robotics.
virtual void loadChildren(bool recursive)
Load nodes child data creating new nodes for each.
void saveMetadataToFile(const boost::filesystem::path &path)
Write JSON metadata for this node to file.
OutofcoreOctreeBaseNode * root_node_
The root node of the tree we belong to.
bool inBoundingBox(const Eigen::Vector3d &min_bb, const Eigen::Vector3d &max_bb) const
Tests whether the input bounding box falls inclusively within this node's bounding box.
std::vector< OutofcoreOctreeBaseNode * > children_
The children of this node.
virtual std::uint64_t addPointCloud(const pcl::PCLPointCloud2::Ptr &input_cloud, const bool skip_bb_check=false)
Add a single PCLPointCloud2 object into the octree.
void getOccupiedVoxelCentersRecursive(AlignedPointTVector &voxel_centers, const std::size_t query_depth)
Gets a vector of occupied voxel centers.
virtual int read(pcl::PCLPointCloud2::Ptr &output_cloud)
void loadFromFile(const boost::filesystem::path &path, OutofcoreOctreeBaseNode *super)
Loads the nodes metadata from the JSON file.
const static std::string pcd_extension
Extension for this class to find the pcd files on disk.
void recFreeChildren()
Method which recursively free children of this node.
std::uint64_t num_loaded_children_
Number of loaded children this node has.