Point Cloud Library (PCL)  1.9.1-dev
List of all members | 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:

Public Member Functions

 OutofcoreOctreeBaseMetadata ()
 Empty constructor. More...
 
 OutofcoreOctreeBaseMetadata (const boost::filesystem::path &path_arg)
 Load metadata from disk. More...
 
 ~OutofcoreOctreeBaseMetadata ()
 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...
 
virtual void serializeMetadataToDisk ()
 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...
 
virtual int loadMetadataFromDisk (const boost::filesystem::path &path_to_metadata)
 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< boost::uint64_t > & getLODPoints ()
 
virtual std::vector< boost::uint64_t > getLODPoints () const
 
virtual boost::uint64_t getLODPoints (const boost::uint64_t &depth_index) const
 Get the number of points at the given depth. More...
 
virtual void setLODPoints (const boost::uint64_t &depth)
 Initialize the LOD vector with points all 0. More...
 
virtual void setLODPoints (std::vector< boost::uint64_t > &lod_points_arg)
 Copy a vector of LOD points into this metadata (dangerous!) More...
 
virtual void setLODPoints (const boost::uint64_t &lod_index_arg, const boost::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 std::string getCoordinateSystem () const
 Get metadata information about the coordinate system. More...
 
virtual void setDepth (const boost::uint64_t &depth_arg)
 Set the depth of the tree corresponding to JSON "lod:number". More...
 
virtual boost::uint64_t getDepth () const
 

Protected Member Functions

virtual void writeMetadataString (std::vector< char > &buf)
 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...
 
boost::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< boost::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 96 of file outofcore_base_data.h.

Constructor & Destructor Documentation

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

Empty constructor.

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
pcl::outofcore::OutofcoreOctreeBaseMetadata::~OutofcoreOctreeBaseMetadata ( )

Default destructor.

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

Copy constructor.

Member Function Documentation

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

Get metadata information about the coordinate system.

virtual boost::uint64_t pcl::outofcore::OutofcoreOctreeBaseMetadata::getDepth ( ) const
virtual
virtual std::vector<boost::uint64_t>& pcl::outofcore::OutofcoreOctreeBaseMetadata::getLODPoints ( )
virtual
virtual std::vector<boost::uint64_t> pcl::outofcore::OutofcoreOctreeBaseMetadata::getLODPoints ( ) const
virtual
virtual boost::uint64_t pcl::outofcore::OutofcoreOctreeBaseMetadata::getLODPoints ( const boost::uint64_t &  depth_index) const
virtual

Get the number of points at the given depth.

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

Gets the name of the JSON file.

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

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

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

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

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

Loads the data from a JSON file located at metadata_filename_.

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

Loads the data from a JSON file located at metadata_filename_.

Implements pcl::outofcore::OutofcoreAbstractMetadata.

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

Writes the data to a JSON file located at metadata_filename_.

Implements pcl::outofcore::OutofcoreAbstractMetadata.

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

Set information about the coordinate system.

virtual void pcl::outofcore::OutofcoreOctreeBaseMetadata::setDepth ( const boost::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

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

Initialize the LOD vector with points all 0.

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

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

virtual void pcl::outofcore::OutofcoreOctreeBaseMetadata::setLODPoints ( const boost::uint64_t &  lod_index_arg,
const boost::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
void pcl::outofcore::OutofcoreOctreeBaseMetadata::setMetadataFilename ( const boost::filesystem::path &  path_to_metadata)

Sets the name of the JSON file.

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

Sets the name of the tree.

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

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

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

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

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

Writes the JSON metadata to a string.

Implements pcl::outofcore::OutofcoreAbstractMetadata.

Friends And Related Function Documentation

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

Provide operator overload to stream ascii file data.

Member Data Documentation

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

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

Definition at line 199 of file outofcore_base_data.h.

boost::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 210 of file outofcore_base_data.h.

std::vector<boost::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 213 of file outofcore_base_data.h.

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

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

Definition at line 193 of file outofcore_base_data.h.

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

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

Definition at line 196 of file outofcore_base_data.h.

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 207 of file outofcore_base_data.h.

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 202 of file outofcore_base_data.h.


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