Point Cloud Library (PCL)  1.14.1-dev
List of all members | Public Types | Public Member Functions | Protected Member Functions | Protected Attributes | Friends
pcl::outofcore::OutofcoreOctreeBaseMetadata Class Reference

Encapsulated class to read JSON metadata into memory, and write the JSON metadata associated with the octree root node. More...

#include <pcl/outofcore/outofcore_base_data.h>

+ Inheritance diagram for pcl::outofcore::OutofcoreOctreeBaseMetadata:
+ Collaboration diagram for pcl::outofcore::OutofcoreOctreeBaseMetadata:

Public Types

using Ptr = shared_ptr< OutofcoreOctreeBaseMetadata >
 
using ConstPtr = shared_ptr< const OutofcoreOctreeBaseMetadata >
 

Public Member Functions

 OutofcoreOctreeBaseMetadata ()
 Empty constructor. More...
 
 OutofcoreOctreeBaseMetadata (const boost::filesystem::path &path_arg)
 Load metadata from disk. More...
 
 ~OutofcoreOctreeBaseMetadata () override
 Default destructor. More...
 
 OutofcoreOctreeBaseMetadata (const OutofcoreOctreeBaseMetadata &orig)
 Copy constructor. More...
 
int getOutofcoreVersion () const
 et the outofcore version read from the "version" field of the JSON object More...
 
void setOutofcoreVersion (const int version)
 Set the outofcore version stored in the "version" field of the JSON object. More...
 
boost::filesystem::path getMetadataFilename () const
 Gets the name of the JSON file. More...
 
void setMetadataFilename (const boost::filesystem::path &path_to_metadata)
 Sets the name of the JSON file. More...
 
void serializeMetadataToDisk () override
 Writes the data to a JSON file located at metadata_filename_. More...
 
virtual int loadMetadataFromDisk ()
 Loads the data from a JSON file located at metadata_filename_. More...
 
int loadMetadataFromDisk (const boost::filesystem::path &path_to_metadata) override
 Loads the data from a JSON file located at metadata_filename_. More...
 
virtual std::string getOctreeName ()
 Returns the name of the tree; this is not the same as the filename. More...
 
virtual void setOctreeName (const std::string &name_arg)
 Sets the name of the tree. More...
 
virtual std::string getPointType ()
 
virtual void setPointType (const std::string &point_type_arg)
 Sets a single string identifying the point type of this tree. More...
 
virtual std::vector< std::uint64_t > & getLODPoints ()
 
virtual std::vector< std::uint64_t > getLODPoints () const
 
virtual std::uint64_t getLODPoints (const std::uint64_t &depth_index) const
 Get the number of points at the given depth. More...
 
virtual void setLODPoints (const std::uint64_t &depth)
 Initialize the LOD vector with points all 0. More...
 
virtual void setLODPoints (std::vector< std::uint64_t > &lod_points_arg)
 Copy a vector of LOD points into this metadata (dangerous!) More...
 
virtual void setLODPoints (const std::uint64_t &lod_index_arg, const std::uint64_t &num_points_arg, const bool increment=true)
 Set the number of points at lod_index_arg manually. More...
 
virtual void setCoordinateSystem (const std::string &coordinate_system)
 Set information about the coordinate system. More...
 
virtual const std::string & getCoordinateSystem () const
 Get metadata information about the coordinate system. More...
 
virtual void setDepth (const std::uint64_t &depth_arg)
 Set the depth of the tree corresponding to JSON "lod:number". More...
 
virtual std::uint64_t getDepth () const
 

Protected Member Functions

void writeMetadataString (std::vector< char > &buf) override
 Writes the JSON metadata to a string. More...
 

Protected Attributes

boost::filesystem::path metadata_filename_
 Metadata (JSON) file pathname (octree extension JSON file) More...
 
int outofcore_version_
 Outofcore library version identifier; maps to JSON "version":int. More...
 
std::string coordinate_system_
 Coordinate system; maps to JSON "coord_sys":string. More...
 
std::string tree_name_
 Name of the tree (which could be used, for example, as the name of a layer); maps to JSON "name":string. More...
 
std::string point_type_
 Delineates the point types of the field; maps to JSON "pointtype":string: More...
 
std::uint64_t levels_of_depth_
 Depth of the tree (which is the number of levels of depth); maps to JSON "lod":int. More...
 
std::vector< std::uint64_t > LOD_num_points_
 Vector of number of points at each LOD. More...
 

Friends

std::ostream & operator<< (std::ostream &os, const OutofcoreOctreeBaseMetadata &metadata_arg)
 Provide operator overload to stream ascii file data. More...
 

Detailed Description

Encapsulated class to read JSON metadata into memory, and write the JSON metadata associated with the octree root node.

This is global information that is not the same as the metadata for the root node. Inherits OutofcoreAbstractMetadata interface for metadata in pcl_outofcore.

This class encapsulates the outofcore base metadata serialization/deserialization. At the time it was written, this depended on cJSON to write JSON objects to disk. This class can be extended to have arbitrary JSON ascii metadata fields saved to the metadata object file on disk. The class has been encapuslated to abstract the detailso of the on-disk format from the outofcore implementation. For example, the format could be changed to XML/YAML, or any dynamic format at some point.

The JSON file is formatted in the following way:

{
  "name": "nameoftree",
  "version": 3,
  "pointtype": "urp",               #(needs to be changed*)
  "lod": 3,                         #(depth of the tree
  "numpts":  [X0, X1, X2, ..., XD], #total number of points at each LOD
  "coord_system": "ECEF"            #the tree is not affected by this value
}

Any properties not stored in the metadata file are computed when the file is loaded. By convention, and for historical reasons from the original Urban Robotics implementation, the JSON file representing the overall tree is a JSON file named with the ".octree" extension.

Author
Stephen Fox (foxst.nosp@m.ephe.nosp@m.nd@gm.nosp@m.ail..nosp@m.com)

Definition at line 99 of file outofcore_base_data.h.

Member Typedef Documentation

◆ ConstPtr

Definition at line 103 of file outofcore_base_data.h.

◆ Ptr

Definition at line 102 of file outofcore_base_data.h.

Constructor & Destructor Documentation

◆ OutofcoreOctreeBaseMetadata() [1/3]

pcl::outofcore::OutofcoreOctreeBaseMetadata::OutofcoreOctreeBaseMetadata ( )

Empty constructor.

◆ OutofcoreOctreeBaseMetadata() [2/3]

pcl::outofcore::OutofcoreOctreeBaseMetadata::OutofcoreOctreeBaseMetadata ( const boost::filesystem::path &  path_arg)

Load metadata from disk.

Parameters
[in]path_argLocation of JSON metadata file to load from disk

◆ ~OutofcoreOctreeBaseMetadata()

pcl::outofcore::OutofcoreOctreeBaseMetadata::~OutofcoreOctreeBaseMetadata ( )
override

Default destructor.

◆ OutofcoreOctreeBaseMetadata() [3/3]

pcl::outofcore::OutofcoreOctreeBaseMetadata::OutofcoreOctreeBaseMetadata ( const OutofcoreOctreeBaseMetadata orig)

Copy constructor.

Member Function Documentation

◆ getCoordinateSystem()

virtual const std::string& pcl::outofcore::OutofcoreOctreeBaseMetadata::getCoordinateSystem ( ) const
virtual

Get metadata information about the coordinate system.

◆ getDepth()

virtual std::uint64_t pcl::outofcore::OutofcoreOctreeBaseMetadata::getDepth ( ) const
virtual

◆ getLODPoints() [1/3]

virtual std::vector<std::uint64_t>& pcl::outofcore::OutofcoreOctreeBaseMetadata::getLODPoints ( )
virtual

◆ getLODPoints() [2/3]

virtual std::vector<std::uint64_t> pcl::outofcore::OutofcoreOctreeBaseMetadata::getLODPoints ( ) const
virtual

◆ getLODPoints() [3/3]

virtual std::uint64_t pcl::outofcore::OutofcoreOctreeBaseMetadata::getLODPoints ( const std::uint64_t &  depth_index) const
virtual

Get the number of points at the given depth.

◆ getMetadataFilename()

boost::filesystem::path pcl::outofcore::OutofcoreOctreeBaseMetadata::getMetadataFilename ( ) const

Gets the name of the JSON file.

◆ getOctreeName()

virtual std::string pcl::outofcore::OutofcoreOctreeBaseMetadata::getOctreeName ( )
virtual

Returns the name of the tree; this is not the same as the filename.

◆ getOutofcoreVersion()

int pcl::outofcore::OutofcoreOctreeBaseMetadata::getOutofcoreVersion ( ) const

et the outofcore version read from the "version" field of the JSON object

◆ getPointType()

virtual std::string pcl::outofcore::OutofcoreOctreeBaseMetadata::getPointType ( )
virtual

◆ loadMetadataFromDisk() [1/2]

virtual int pcl::outofcore::OutofcoreOctreeBaseMetadata::loadMetadataFromDisk ( )
virtual

Loads the data from a JSON file located at metadata_filename_.

◆ loadMetadataFromDisk() [2/2]

int pcl::outofcore::OutofcoreOctreeBaseMetadata::loadMetadataFromDisk ( const boost::filesystem::path &  path_to_metadata)
overridevirtual

Loads the data from a JSON file located at metadata_filename_.

Implements pcl::outofcore::OutofcoreAbstractMetadata.

◆ serializeMetadataToDisk()

void pcl::outofcore::OutofcoreOctreeBaseMetadata::serializeMetadataToDisk ( )
overridevirtual

Writes the data to a JSON file located at metadata_filename_.

Implements pcl::outofcore::OutofcoreAbstractMetadata.

◆ setCoordinateSystem()

virtual void pcl::outofcore::OutofcoreOctreeBaseMetadata::setCoordinateSystem ( const std::string &  coordinate_system)
virtual

Set information about the coordinate system.

◆ setDepth()

virtual void pcl::outofcore::OutofcoreOctreeBaseMetadata::setDepth ( const std::uint64_t &  depth_arg)
virtual

Set the depth of the tree corresponding to JSON "lod:number".

This should always be equal to LOD_num_points_.size()-1

◆ setLODPoints() [1/3]

virtual void pcl::outofcore::OutofcoreOctreeBaseMetadata::setLODPoints ( const std::uint64_t &  depth)
virtual

Initialize the LOD vector with points all 0.

◆ setLODPoints() [2/3]

virtual void pcl::outofcore::OutofcoreOctreeBaseMetadata::setLODPoints ( const std::uint64_t &  lod_index_arg,
const std::uint64_t &  num_points_arg,
const bool  increment = true 
)
virtual

Set the number of points at lod_index_arg manually.

Parameters
[in]lod_index_argthe depth at which this increments the number of LOD points
[in]num_points_argThe number of points to store at that LOD
[in]incrementIf true, increments the number of points at the LOD rather than overwriting the number of points

◆ setLODPoints() [3/3]

virtual void pcl::outofcore::OutofcoreOctreeBaseMetadata::setLODPoints ( std::vector< std::uint64_t > &  lod_points_arg)
virtual

Copy a vector of LOD points into this metadata (dangerous!)

◆ setMetadataFilename()

void pcl::outofcore::OutofcoreOctreeBaseMetadata::setMetadataFilename ( const boost::filesystem::path &  path_to_metadata)

Sets the name of the JSON file.

◆ setOctreeName()

virtual void pcl::outofcore::OutofcoreOctreeBaseMetadata::setOctreeName ( const std::string &  name_arg)
virtual

Sets the name of the tree.

◆ setOutofcoreVersion()

void pcl::outofcore::OutofcoreOctreeBaseMetadata::setOutofcoreVersion ( const int  version)

Set the outofcore version stored in the "version" field of the JSON object.

◆ setPointType()

virtual void pcl::outofcore::OutofcoreOctreeBaseMetadata::setPointType ( const std::string &  point_type_arg)
virtual

Sets a single string identifying the point type of this tree.

◆ writeMetadataString()

void pcl::outofcore::OutofcoreOctreeBaseMetadata::writeMetadataString ( std::vector< char > &  buf)
overrideprotectedvirtual

Writes the JSON metadata to a string.

Implements pcl::outofcore::OutofcoreAbstractMetadata.

Friends And Related Function Documentation

◆ operator<<

std::ostream& operator<< ( std::ostream &  os,
const OutofcoreOctreeBaseMetadata metadata_arg 
)
friend

Provide operator overload to stream ascii file data.

Member Data Documentation

◆ coordinate_system_

std::string pcl::outofcore::OutofcoreOctreeBaseMetadata::coordinate_system_
protected

Coordinate system; maps to JSON "coord_sys":string.

Definition at line 205 of file outofcore_base_data.h.

◆ levels_of_depth_

std::uint64_t pcl::outofcore::OutofcoreOctreeBaseMetadata::levels_of_depth_
protected

Depth of the tree (which is the number of levels of depth); maps to JSON "lod":int.

Definition at line 216 of file outofcore_base_data.h.

◆ LOD_num_points_

std::vector<std::uint64_t> pcl::outofcore::OutofcoreOctreeBaseMetadata::LOD_num_points_
protected

Vector of number of points at each LOD.

For a tree with no LOD, all fields will be zero except for the field indexed by LOD_points_[levels_of_depth]; maps to JSON "numpts":int array

Definition at line 219 of file outofcore_base_data.h.

◆ metadata_filename_

boost::filesystem::path pcl::outofcore::OutofcoreOctreeBaseMetadata::metadata_filename_
protected

Metadata (JSON) file pathname (octree extension JSON file)

Definition at line 199 of file outofcore_base_data.h.

◆ outofcore_version_

int pcl::outofcore::OutofcoreOctreeBaseMetadata::outofcore_version_
protected

Outofcore library version identifier; maps to JSON "version":int.

Definition at line 202 of file outofcore_base_data.h.

◆ point_type_

std::string pcl::outofcore::OutofcoreOctreeBaseMetadata::point_type_
protected

Delineates the point types of the field; maps to JSON "pointtype":string:

Note
This is inconsistent with "point type" fields used in PCLPointCloud2 and in other places in PCL

Definition at line 213 of file outofcore_base_data.h.

◆ tree_name_

std::string pcl::outofcore::OutofcoreOctreeBaseMetadata::tree_name_
protected

Name of the tree (which could be used, for example, as the name of a layer); maps to JSON "name":string.

Definition at line 208 of file outofcore_base_data.h.


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