Point Cloud Library (PCL)  1.14.0-dev
List of all members | Public Types | Public Member Functions | Static Public Member Functions
pcl::outofcore::OutofcoreOctreeDiskContainer< PointT > Class Template Reference

Class responsible for serialization and deserialization of out of core point data. More...

#include <pcl/outofcore/octree_disk_container.h>

+ Inheritance diagram for pcl::outofcore::OutofcoreOctreeDiskContainer< PointT >:
+ Collaboration diagram for pcl::outofcore::OutofcoreOctreeDiskContainer< PointT >:

Public Types

using AlignedPointTVector = typename OutofcoreAbstractNodeContainer< PointT >::AlignedPointTVector
 
- Public Types inherited from pcl::outofcore::OutofcoreAbstractNodeContainer< pcl::PointXYZ >
using AlignedPointTVector = std::vector< pcl::PointXYZ, Eigen::aligned_allocator< pcl::PointXYZ > >
 

Public Member Functions

 OutofcoreOctreeDiskContainer ()
 Empty constructor creates disk container and sets filename from random uuid string. More...
 
 OutofcoreOctreeDiskContainer (const boost::filesystem::path &dir)
 Creates uuid named file or loads existing file. More...
 
 ~OutofcoreOctreeDiskContainer () override
 flushes write buffer, then frees memory More...
 
PointT operator[] (std::uint64_t idx) const override
 provides random access to points based on a linear index More...
 
void push_back (const PointT &p)
 Adds a single point to the buffer to be written to disk when the buffer grows sufficiently large, the object is destroyed, or the write buffer is manually flushed. More...
 
void insertRange (const AlignedPointTVector &src)
 Inserts a vector of points into the disk data structure. More...
 
void insertRange (const pcl::PCLPointCloud2::Ptr &input_cloud)
 Inserts a PCLPointCloud2 object directly into the disk container. More...
 
void insertRange (const PointT *const *start, const std::uint64_t count) override
 
void insertRange (const PointT *start, const std::uint64_t count) override
 This is the primary method for serialization of blocks of point data. More...
 
void readRange (const std::uint64_t start, const std::uint64_t count, AlignedPointTVector &dst) override
 Reads count points into memory from the disk container. More...
 
void readRange (const std::uint64_t, const std::uint64_t, pcl::PCLPointCloud2::Ptr &dst)
 
int read (pcl::PCLPointCloud2::Ptr &output_cloud)
 Reads the entire point contents from disk into output_cloud. More...
 
void readRangeSubSample (const std::uint64_t start, const std::uint64_t count, const double percent, AlignedPointTVector &dst) override
 grab percent*count random points. More...
 
void readRangeSubSample_bernoulli (const std::uint64_t start, const std::uint64_t count, const double percent, AlignedPointTVector &dst)
 Use bernoulli trials to select points. More...
 
std::uint64_t size () const override
 Returns the total number of points for which this container is responsible, filelen_ + points in writebuff_ that have not yet been flushed to the disk. More...
 
bool empty () const override
 STL-like empty test. More...
 
void flush (const bool force_cache_dealloc)
 Exposed functionality for manually flushing the write buffer during tree creation. More...
 
std::string & path ()
 Returns this objects path name. More...
 
void clear () override
 
void convertToXYZ (const boost::filesystem::path &path) override
 write points to disk as ascii More...
 
std::uint64_t getDataSize () const
 Returns the number of points in the PCD file by reading the PCD header. More...
 
- Public Member Functions inherited from pcl::outofcore::OutofcoreAbstractNodeContainer< pcl::PointXYZ >
 OutofcoreAbstractNodeContainer ()
 
 OutofcoreAbstractNodeContainer (const boost::filesystem::path &)
 
virtual ~OutofcoreAbstractNodeContainer ()=default
 
virtual void insertRange (const pcl::PointXYZ *start, const std::uint64_t count)=0
 
virtual void insertRange (const pcl::PointXYZ *const *start, const std::uint64_t count)=0
 
virtual void readRange (const std::uint64_t start, const std::uint64_t count, AlignedPointTVector &v)=0
 
virtual void readRangeSubSample (const std::uint64_t start, const std::uint64_t count, const double percent, AlignedPointTVector &v)=0
 

Static Public Member Functions

static void getRandomUUIDString (std::string &s)
 Generate a universally unique identifier (UUID) More...
 

Additional Inherited Members

- Protected Member Functions inherited from pcl::outofcore::OutofcoreAbstractNodeContainer< pcl::PointXYZ >
 OutofcoreAbstractNodeContainer (const OutofcoreAbstractNodeContainer &rval)
 
- Protected Attributes inherited from pcl::outofcore::OutofcoreAbstractNodeContainer< pcl::PointXYZ >
AlignedPointTVector container_
 
- Static Protected Attributes inherited from pcl::outofcore::OutofcoreAbstractNodeContainer< pcl::PointXYZ >
static std::mutex rng_mutex_
 

Detailed Description

template<typename PointT = pcl::PointXYZ>
class pcl::outofcore::OutofcoreOctreeDiskContainer< PointT >

Class responsible for serialization and deserialization of out of core point data.

Note
Code was adapted from the Urban Robotics out of core octree implementation. Contact Jacob Schloss jacob.nosp@m..sch.nosp@m.loss@.nosp@m.urba.nosp@m.nrobo.nosp@m.tics.nosp@m..net with any questions. http://www.urbanrobotics.net/
Author
Jacob Schloss (jacob.nosp@m..sch.nosp@m.loss@.nosp@m.urba.nosp@m.nrobo.nosp@m.tics.nosp@m..net)

Definition at line 75 of file octree_disk_container.h.

Member Typedef Documentation

◆ AlignedPointTVector

Definition at line 79 of file octree_disk_container.h.

Constructor & Destructor Documentation

◆ OutofcoreOctreeDiskContainer() [1/2]

Empty constructor creates disk container and sets filename from random uuid string.

Definition at line 103 of file octree_disk_container.hpp.

References pcl::outofcore::OutofcoreOctreeDiskContainer< PointT >::getRandomUUIDString().

◆ OutofcoreOctreeDiskContainer() [2/2]

template<typename PointT >
pcl::outofcore::OutofcoreOctreeDiskContainer< PointT >::OutofcoreOctreeDiskContainer ( const boost::filesystem::path &  dir)

Creates uuid named file or loads existing file.

If dir is a directory, this constructor will create a new uuid named file; if dir is an existing file, it will load the file metadata for accessing the tree.

Parameters
[in]dirPath to the tree. If it is a directory, it will create the metadata. If it is a file, it will load the metadata into memory.

Definition at line 113 of file octree_disk_container.hpp.

References pcl::outofcore::OutofcoreOctreeDiskContainer< PointT >::getRandomUUIDString(), pcl::PCLPointCloud2::height, pcl::outofcore::OutofcoreOctreeDiskContainer< PointT >::path(), pcl::PCDReader::readHeader(), and pcl::PCLPointCloud2::width.

◆ ~OutofcoreOctreeDiskContainer()

flushes write buffer, then frees memory

Definition at line 159 of file octree_disk_container.hpp.

Member Function Documentation

◆ clear()

template<typename PointT = pcl::PointXYZ>
void pcl::outofcore::OutofcoreOctreeDiskContainer< PointT >::clear ( )
inlineoverridevirtual

◆ convertToXYZ()

template<typename PointT = pcl::PointXYZ>
void pcl::outofcore::OutofcoreOctreeDiskContainer< PointT >::convertToXYZ ( const boost::filesystem::path &  path)
inlineoverridevirtual

◆ empty()

template<typename PointT = pcl::PointXYZ>
bool pcl::outofcore::OutofcoreOctreeDiskContainer< PointT >::empty ( ) const
inlineoverridevirtual

STL-like empty test.

Returns
true if container has no data on disk or waiting to be written in writebuff_

Implements pcl::outofcore::OutofcoreAbstractNodeContainer< pcl::PointXYZ >.

Definition at line 187 of file octree_disk_container.h.

◆ flush()

template<typename PointT = pcl::PointXYZ>
void pcl::outofcore::OutofcoreOctreeDiskContainer< PointT >::flush ( const bool  force_cache_dealloc)
inline

Exposed functionality for manually flushing the write buffer during tree creation.

Definition at line 194 of file octree_disk_container.h.

◆ getDataSize()

template<typename PointT >
std::uint64_t pcl::outofcore::OutofcoreOctreeDiskContainer< PointT >::getDataSize

Returns the number of points in the PCD file by reading the PCD header.

Definition at line 671 of file octree_disk_container.hpp.

References pcl::PCLPointCloud2::height, pcl::PCDReader::readHeader(), and pcl::PCLPointCloud2::width.

◆ getRandomUUIDString()

template<typename PointT >
void pcl::outofcore::OutofcoreOctreeDiskContainer< PointT >::getRandomUUIDString ( std::string &  s)
static

◆ insertRange() [1/4]

template<typename PointT >
void pcl::outofcore::OutofcoreOctreeDiskContainer< PointT >::insertRange ( const AlignedPointTVector src)

◆ insertRange() [2/4]

template<typename PointT >
void pcl::outofcore::OutofcoreOctreeDiskContainer< PointT >::insertRange ( const pcl::PCLPointCloud2::Ptr input_cloud)

Inserts a PCLPointCloud2 object directly into the disk container.

Definition at line 510 of file octree_disk_container.hpp.

References pcl::concatenate(), pcl::utils::ignore(), pcl::PCDReader::read(), and pcl::PCDWriter::writeBinaryCompressed().

◆ insertRange() [3/4]

template<typename PointT >
void pcl::outofcore::OutofcoreOctreeDiskContainer< PointT >::insertRange ( const PointT *const *  start,
const std::uint64_t  count 
)
override

Definition at line 608 of file octree_disk_container.hpp.

◆ insertRange() [4/4]

template<typename PointT >
void pcl::outofcore::OutofcoreOctreeDiskContainer< PointT >::insertRange ( const PointT start,
const std::uint64_t  count 
)
override

This is the primary method for serialization of blocks of point data.

This is called by the outofcore octree interface, opens the binary file for appending data, and writes it to disk.

Parameters
[in]startaddress of the first point to insert
[in]countoffset from start of the last point to insert

Definition at line 627 of file octree_disk_container.hpp.

References pcl::PointCloud< PointT >::height, pcl::utils::ignore(), pcl::PointCloud< PointT >::push_back(), pcl::PCDReader::read(), pcl::PointCloud< PointT >::size(), pcl::PointCloud< PointT >::width, and pcl::PCDWriter::writeBinaryCompressed().

◆ operator[]()

template<typename PointT >
PointT pcl::outofcore::OutofcoreOctreeDiskContainer< PointT >::operator[] ( std::uint64_t  idx) const
inlineoverridevirtual

provides random access to points based on a linear index

Implements pcl::outofcore::OutofcoreAbstractNodeContainer< pcl::PointXYZ >.

Definition at line 197 of file octree_disk_container.hpp.

References pcl::utils::ignore().

◆ path()

template<typename PointT = pcl::PointXYZ>
std::string& pcl::outofcore::OutofcoreOctreeDiskContainer< PointT >::path ( )
inline

◆ push_back()

template<typename PointT >
void pcl::outofcore::OutofcoreOctreeDiskContainer< PointT >::push_back ( const PointT p)
inline

Adds a single point to the buffer to be written to disk when the buffer grows sufficiently large, the object is destroyed, or the write buffer is manually flushed.

Definition at line 454 of file octree_disk_container.hpp.

◆ read()

template<typename PointT >
int pcl::outofcore::OutofcoreOctreeDiskContainer< PointT >::read ( pcl::PCLPointCloud2::Ptr output_cloud)

Reads the entire point contents from disk into output_cloud.

Parameters
[out]output_cloud

Definition at line 575 of file octree_disk_container.hpp.

References pcl::concatenate(), pcl::utils::ignore(), and pcl::io::loadPCDFile().

◆ readRange() [1/2]

template<typename PointT >
void pcl::outofcore::OutofcoreOctreeDiskContainer< PointT >::readRange ( const std::uint64_t  start,
const std::uint64_t  count,
AlignedPointTVector dst 
)
override

Reads count points into memory from the disk container.

Reads count points into memory from the disk container, reading at most 2 million elements at a time

Parameters
[in]startindex of first point to read from disk
[in]countoffset of last point to read from disk
[out]dststd::vector as destination for points read from disk into memory

Definition at line 238 of file octree_disk_container.hpp.

References pcl::PointCloud< PointT >::cbegin(), pcl::PointCloud< PointT >::cend(), pcl::utils::ignore(), and pcl::PCDReader::read().

◆ readRange() [2/2]

template<typename PointT >
void pcl::outofcore::OutofcoreOctreeDiskContainer< PointT >::readRange ( const std::uint64_t  ,
const std::uint64_t  ,
pcl::PCLPointCloud2::Ptr dst 
)

Definition at line 551 of file octree_disk_container.hpp.

References pcl::utils::ignore(), and pcl::PCDReader::read().

◆ readRangeSubSample()

template<typename PointT >
void pcl::outofcore::OutofcoreOctreeDiskContainer< PointT >::readRangeSubSample ( const std::uint64_t  start,
const std::uint64_t  count,
const double  percent,
AlignedPointTVector dst 
)
override

grab percent*count random points.

points are not guaranteed to be unique (could have multiple identical points!)

Parameters
[in]startThe starting index of points to select
[in]countThe length of the range of points from which to randomly sample (i.e. from start to start+count)
[in]percentThe percentage of count that is enough points to make up this random sample
[out]dststd::vector as destination for randomly sampled points; size will be percentage*count

Definition at line 357 of file octree_disk_container.hpp.

References pcl::utils::ignore(), and pcl::outofcore::rand_gen_.

◆ readRangeSubSample_bernoulli()

template<typename PointT >
void pcl::outofcore::OutofcoreOctreeDiskContainer< PointT >::readRangeSubSample_bernoulli ( const std::uint64_t  start,
const std::uint64_t  count,
const double  percent,
AlignedPointTVector dst 
)

Use bernoulli trials to select points.

All points selected will be unique.

Parameters
[in]startThe starting index of points to select
[in]countThe length of the range of points from which to randomly sample (i.e. from start to start+count)
[in]percentThe percentage of count that is enough points to make up this random sample
[out]dststd::vector as destination for randomly sampled points; size will be percentage*count

Definition at line 264 of file octree_disk_container.hpp.

References pcl::utils::ignore(), and pcl::outofcore::rand_gen_.

◆ size()

template<typename PointT = pcl::PointXYZ>
std::uint64_t pcl::outofcore::OutofcoreOctreeDiskContainer< PointT >::size ( ) const
inlineoverridevirtual

Returns the total number of points for which this container is responsible, filelen_ + points in writebuff_ that have not yet been flushed to the disk.

Implements pcl::outofcore::OutofcoreAbstractNodeContainer< pcl::PointXYZ >.

Definition at line 179 of file octree_disk_container.h.

Referenced by pcl::outofcore::OutofcoreOctreeDiskContainer< PointT >::convertToXYZ().


The documentation for this class was generated from the following files: