Loading...
Searching...
No Matches
pcl::outofcore::OutofcoreOctreeDiskContainer< PointT > Class Template Reference
Module outofcore

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 >:

## Public Types

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

## Public Member Functions

| OutofcoreOctreeDiskContainer ()
| Empty constructor creates disk container and sets filename from random uuid string.
| OutofcoreOctreeDiskContainer (const boost::filesystem::path &dir)
| Creates uuid named file or loads existing file.
| ~OutofcoreOctreeDiskContainer () override
| flushes write buffer, then frees memory
PointT | operator[] (std::uint64_t idx) const override
| provides random access to points based on a linear index
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.
void | insertRange (const AlignedPointTVector &src)
| Inserts a vector of points into the disk data structure.
void | insertRange (const pcl::PCLPointCloud2::Ptr &input_cloud)
| Inserts a PCLPointCloud2 object directly into the disk container.
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.
void | readRange (const std::uint64_t start, const std::uint64_t count, AlignedPointTVector &dst) override
| Reads count points into memory from the disk container.
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`.
void | readRangeSubSample (const std::uint64_t start, const std::uint64_t count, const double percent, AlignedPointTVector &dst) override
| grab percent*count random points.
void | readRangeSubSample_bernoulli (const std::uint64_t start, const std::uint64_t count, const double percent, AlignedPointTVector &dst)
| Use bernoulli trials to select points.
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.
bool | empty () const override
| STL-like empty test.
void | flush (const bool force_cache_dealloc)
| Exposed functionality for manually flushing the write buffer during tree creation.
std::string & | path ()
| Returns this objects path name.
void | clear () override
void | convertToXYZ (const boost::filesystem::path &path) override
| write points to disk as ascii
std::uint64_t | getDataSize () const
| Returns the number of points in the PCD file by reading the PCD header.
Public Member Functions inherited from pcl::outofcore::OutofcoreAbstractNodeContainer< PointT >
| OutofcoreAbstractNodeContainer ()
| OutofcoreAbstractNodeContainer (const boost::filesystem::path &)
virtual | ~OutofcoreAbstractNodeContainer ()=default

## Static Public Member Functions

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

## Additional Inherited Members

Protected Member Functions inherited from pcl::outofcore::OutofcoreAbstractNodeContainer< PointT >
| OutofcoreAbstractNodeContainer (const OutofcoreAbstractNodeContainer &rval)
Protected Attributes inherited from pcl::outofcore::OutofcoreAbstractNodeContainer< PointT >
AlignedPointTVector | container_
Static Protected Attributes inherited from pcl::outofcore::OutofcoreAbstractNodeContainer< PointT >
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 76 of file octree_disk_container.h.

## Member Typedef Documentation

## AlignedPointTVector

template<typename PointT = pcl::PointXYZ>

using pcl::outofcore::OutofcoreOctreeDiskContainer< PointT >::AlignedPointTVector = typename OutofcoreAbstractNodeContainer<PointT>::AlignedPointTVector

Definition at line 80 of file octree_disk_container.h.

## Constructor & Destructor Documentation

## OutofcoreOctreeDiskContainer() [1/2]

template<typename PointT >

pcl::outofcore::OutofcoreOctreeDiskContainer< PointT >::OutofcoreOctreeDiskContainer | ( |  | ) |

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

Definition at line 104 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] | dir | Path 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 114 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()

template<typename PointT >

pcl::outofcore::OutofcoreOctreeDiskContainer< PointT >::~OutofcoreOctreeDiskContainer | ( |  | ) |

override

flushes write buffer, then frees memory

Definition at line 160 of file octree_disk_container.hpp.

## Member Function Documentation

## clear()

template<typename PointT = pcl::PointXYZ>

void pcl::outofcore::OutofcoreOctreeDiskContainer< PointT >::clear | ( |  | ) |

inline override virtual

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

Definition at line 208 of file octree_disk_container.h.

## convertToXYZ()

template<typename PointT = pcl::PointXYZ>

void pcl::outofcore::OutofcoreOctreeDiskContainer< PointT >::convertToXYZ | ( | const boost::filesystem::path & | path | ) |

inline override virtual

write points to disk as ascii

Parameters

  [in] | path |

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

Definition at line 224 of file octree_disk_container.h.

References pcl::utils::ignore(), pcl::outofcore::OutofcoreOctreeDiskContainer< PointT >::path(), and pcl::outofcore::OutofcoreOctreeDiskContainer< PointT >::size().

## empty()

template<typename PointT = pcl::PointXYZ>

bool pcl::outofcore::OutofcoreOctreeDiskContainer< PointT >::empty | ( |  | ) | const

inline override virtual

STL-like empty test.

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

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

Definition at line 188 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 195 of file octree_disk_container.h.

## getDataSize()

template<typename PointT >

std::uint64_t pcl::outofcore::OutofcoreOctreeDiskContainer< PointT >::getDataSize | ( |  | ) | const

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

Definition at line 672 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

Generate a universally unique identifier (UUID)

A mutex lock happens to ensure uniqueness

Definition at line 89 of file octree_disk_container.hpp.

Referenced by pcl::outofcore::OutofcoreOctreeBaseNode< ContainerT, PointT >::init_root_node(), pcl::outofcore::OutofcoreOctreeBaseNode< ContainerT, PointT >::OutofcoreOctreeBaseNode(), pcl::outofcore::OutofcoreOctreeDiskContainer< PointT >::OutofcoreOctreeDiskContainer(), and pcl::outofcore::OutofcoreOctreeDiskContainer< PointT >::OutofcoreOctreeDiskContainer().

## insertRange() [1/4]

template<typename PointT >

void pcl::outofcore::OutofcoreOctreeDiskContainer< PointT >::insertRange | ( | const AlignedPointTVector & | src | ) |

Inserts a vector of points into the disk data structure.

Definition at line 466 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().

## 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 511 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 virtual

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

Definition at line 609 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 virtual

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] | start | address of the first point to insert
  [in] | count | offset from start of the last point to insert

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

Definition at line 628 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

inline override virtual

provides random access to points based on a linear index

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

Definition at line 198 of file octree_disk_container.hpp.

References pcl::utils::ignore().

## path()

template<typename PointT = pcl::PointXYZ>

std::string & pcl::outofcore::OutofcoreOctreeDiskContainer< PointT >::path | ( |  | ) |

inline

Returns this objects path name.

Definition at line 202 of file octree_disk_container.h.

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

## 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 455 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 576 of file octree_disk_container.hpp.

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

## 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 virtual

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] | start | index of first point to read from disk
  [in] | count | offset of last point to read from disk
  [out] | dst | std::vector as destination for points read from disk into memory

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

Definition at line 239 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 552 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 virtual

grab percent*count random points.

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

Parameters

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

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

Definition at line 358 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] | start | The starting index of points to select
  [in] | count | The length of the range of points from which to randomly sample (i.e. from start to start+count)
  [in] | percent | The percentage of count that is enough points to make up this random sample
  [out] | dst | std::vector as destination for randomly sampled points; size will be percentage*count

Definition at line 265 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

inline override virtual

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< PointT >.

Definition at line 180 of file octree_disk_container.h.

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

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

- pcl/outofcore/octree_disk_container.h
- pcl/outofcore/impl/octree_disk_container.hpp