39#ifndef PCL_OCTREE_2BUF_BASE_HPP
40#define PCL_OCTREE_2BUF_BASE_HPP
45template <
typename LeafContainerT,
typename BranchContainerT>
52, tree_dirty_flag_(
false)
54, dynamic_depth_enabled_(
false)
58template <
typename LeafContainerT,
typename BranchContainerT>
67template <
typename LeafContainerT,
typename BranchContainerT>
87template <
typename LeafContainerT,
typename BranchContainerT>
100 max_key_.x = max_key_.y = max_key_.z = (1 <<
depth_arg) - 1;
104template <
typename LeafContainerT,
typename BranchContainerT>
114 return (findLeaf(key));
118template <
typename LeafContainerT,
typename BranchContainerT>
128 return (createLeaf(key));
132template <
typename LeafContainerT,
typename BranchContainerT>
142 return existLeaf(key);
146template <
typename LeafContainerT,
typename BranchContainerT>
156 return (this->removeLeaf(key));
160template <
typename LeafContainerT,
typename BranchContainerT>
166 deleteBranch(*root_node_);
170 tree_dirty_flag_ =
false;
177template <
typename LeafContainerT,
typename BranchContainerT>
181 if (tree_dirty_flag_) {
183 treeCleanUpRecursive(root_node_);
187 buffer_selector_ = !buffer_selector_;
190 tree_dirty_flag_ =
true;
196 root_node_->setChildPtr(buffer_selector_,
child_idx,
nullptr);
201template <
typename LeafContainerT,
typename BranchContainerT>
212 serializeTreeRecursive(
216 tree_dirty_flag_ =
false;
220template <
typename LeafContainerT,
typename BranchContainerT>
236 serializeTreeRecursive(root_node_,
244 tree_dirty_flag_ =
false;
248template <
typename LeafContainerT,
typename BranchContainerT>
260 serializeTreeRecursive(
264 tree_dirty_flag_ =
false;
268template <
typename LeafContainerT,
typename BranchContainerT>
282 deserializeTreeRecursive(root_node_,
293 tree_dirty_flag_ =
false;
297template <
typename LeafContainerT,
typename BranchContainerT>
321 deserializeTreeRecursive(root_node_,
332 tree_dirty_flag_ =
false;
336template <
typename LeafContainerT,
typename BranchContainerT>
347 serializeTreeRecursive(
351 tree_dirty_flag_ =
false;
355template <
typename LeafContainerT,
typename BranchContainerT>
416 return createLeafRecursive(
key_arg,
447 child_leaf = createLeafChild(*branch_arg, child_idx);
466template <
typename LeafContainerT,
typename BranchContainerT>
502template <
typename LeafContainerT,
typename BranchContainerT>
543 for (child_idx = 0; child_idx < 8; child_idx++) {
544 bNoChilds = branch_arg->hasChild(buffer_selector_, child_idx);
554template <
typename LeafContainerT,
typename BranchContainerT>
567 getBranchBitPattern(*
branch_arg, buffer_selector_);
571 getBranchBitPattern(*
branch_arg, !buffer_selector_);
639template <
typename LeafContainerT,
typename BranchContainerT>
787template <
typename LeafContainerT,
typename BranchContainerT>
794 getBranchBitPattern(*
branch_arg, !buffer_selector_);
832#define PCL_INSTANTIATE_Octree2BufBase(T) \
833 template class PCL_EXPORTS pcl::octree::Octree2BufBase<T>;
Iterator class for point clouds with or without given indices.
void serializeLeafs(std::vector< LeafContainerT * > &leaf_container_vector_arg)
Outputs a vector of all DataT elements that are stored within the octree leaf nodes.
void switchBuffers()
Switch buffers and reset current octree structure.
uindex_t createLeafRecursive(const OctreeKey &key_arg, uindex_t depth_mask_arg, BranchNode *branch_arg, LeafNode *&return_leaf_arg, BranchNode *&parent_of_leaf_arg, bool branch_reset_arg=false)
Create a leaf node at octree key.
void serializeTree(std::vector< char > &binary_tree_out_arg, bool do_XOR_encoding_arg=false)
Serialize octree into a binary output vector describing its branch node structure.
void treeCleanUpRecursive(BranchNode *branch_arg)
Recursively explore the octree and remove unused branch and leaf nodes.
void deleteTree()
Delete the octree structure and its leaf nodes.
void serializeTreeRecursive(BranchNode *branch_arg, OctreeKey &key_arg, std::vector< char > *binary_tree_out_arg, typename std::vector< LeafContainerT * > *leaf_container_vector_arg, bool do_XOR_encoding_arg=false, bool new_leafs_filter_arg=false)
Recursively explore the octree and output binary octree description together with a vector of leaf no...
bool existLeaf(uindex_t idx_x_arg, uindex_t idx_y_arg, uindex_t idx_z_arg) const
Check for the existence of leaf node at (idx_x_arg, idx_y_arg, idx_z_arg).
void deserializeTree(std::vector< char > &binary_tree_in_arg, bool do_XOR_decoding_arg=false)
Deserialize a binary octree description vector and create a corresponding octree structure.
LeafContainerT * createLeaf(uindex_t idx_x_arg, uindex_t idx_y_arg, uindex_t idx_z_arg)
Create new leaf node at (idx_x_arg, idx_y_arg, idx_z_arg).
void setTreeDepth(uindex_t depth_arg)
Set the maximum depth of the octree.
void setMaxVoxelIndex(uindex_t max_voxel_index_arg)
Set the maximum amount of voxels per dimension.
void removeLeaf(uindex_t idx_x_arg, uindex_t idx_y_arg, uindex_t idx_z_arg)
Remove leaf node at (idx_x_arg, idx_y_arg, idx_z_arg).
bool deleteLeafRecursive(const OctreeKey &key_arg, uindex_t depth_mask_arg, BranchNode *branch_arg)
Recursively search and delete leaf node.
LeafContainerT * findLeaf(uindex_t idx_x_arg, uindex_t idx_y_arg, uindex_t idx_z_arg)
Find leaf node at (idx_x_arg, idx_y_arg, idx_z_arg).
void serializeNewLeafs(std::vector< LeafContainerT * > &leaf_container_vector_arg)
Outputs a vector of all DataT elements from leaf nodes, that do not exist in the previous octree buff...
Octree2BufBase()
Empty constructor.
void findLeafRecursive(const OctreeKey &key_arg, uindex_t depth_mask_arg, BranchNode *branch_arg, LeafContainerT *&result_arg) const
Recursively search for a given leaf node and return a pointer.
virtual ~Octree2BufBase()
Empty deconstructor.
void deserializeTreeRecursive(BranchNode *branch_arg, uindex_t depth_mask_arg, OctreeKey &key_arg, typename std::vector< char >::const_iterator &binary_tree_in_it_arg, typename std::vector< char >::const_iterator &binary_tree_in_it_end_arg, typename std::vector< LeafContainerT * >::const_iterator *leaf_container_vector_it_arg, typename std::vector< LeafContainerT * >::const_iterator *leaf_container_vector_it_end_arg, bool branch_reset_arg=false, bool do_XOR_decoding_arg=false)
Rebuild an octree based on binary XOR octree description and DataT objects for leaf node initializati...
Octree container class that does store a vector of point indices.
static const unsigned char maxDepth
Abstract octree leaf class
Abstract octree node class
detail::int_type_t< detail::index_type_size, false > uindex_t
Type used for an unsigned index in PCL.