Point Cloud Library (PCL)
1.14.1-dev
|
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>
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 |
Public Member Functions inherited from pcl::outofcore::OutofcoreAbstractMetadata | |
OutofcoreAbstractMetadata ()=default | |
Empty constructor. More... | |
virtual | ~OutofcoreAbstractMetadata ()=default |
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... | |
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.
Definition at line 99 of file outofcore_base_data.h.
using pcl::outofcore::OutofcoreOctreeBaseMetadata::ConstPtr = shared_ptr<const OutofcoreOctreeBaseMetadata> |
Definition at line 103 of file outofcore_base_data.h.
using pcl::outofcore::OutofcoreOctreeBaseMetadata::Ptr = shared_ptr<OutofcoreOctreeBaseMetadata> |
Definition at line 102 of file outofcore_base_data.h.
pcl::outofcore::OutofcoreOctreeBaseMetadata::OutofcoreOctreeBaseMetadata | ( | ) |
Empty constructor.
pcl::outofcore::OutofcoreOctreeBaseMetadata::OutofcoreOctreeBaseMetadata | ( | const boost::filesystem::path & | path_arg | ) |
Load metadata from disk.
[in] | path_arg | Location of JSON metadata file to load from disk |
|
override |
Default destructor.
pcl::outofcore::OutofcoreOctreeBaseMetadata::OutofcoreOctreeBaseMetadata | ( | const OutofcoreOctreeBaseMetadata & | orig | ) |
Copy constructor.
|
virtual |
Get metadata information about the coordinate system.
|
virtual |
|
virtual |
|
virtual |
|
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 |
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 |
|
virtual |
Loads the data from a JSON file located at metadata_filename_.
|
overridevirtual |
Loads the data from a JSON file located at metadata_filename_.
Implements pcl::outofcore::OutofcoreAbstractMetadata.
|
overridevirtual |
Writes the data to a JSON file located at metadata_filename_.
Implements pcl::outofcore::OutofcoreAbstractMetadata.
|
virtual |
Set information about the coordinate system.
|
virtual |
Set the depth of the tree corresponding to JSON "lod:number".
This should always be equal to LOD_num_points_.size()-1
|
virtual |
Initialize the LOD vector with points all 0.
|
virtual |
Set the number of points at lod_index_arg manually.
[in] | lod_index_arg | the depth at which this increments the number of LOD points |
[in] | num_points_arg | The number of points to store at that LOD |
[in] | increment | If true, increments the number of points at the LOD rather than overwriting the number of points |
|
virtual |
Copy a vector of LOD points into this metadata (dangerous!)
void pcl::outofcore::OutofcoreOctreeBaseMetadata::setMetadataFilename | ( | const boost::filesystem::path & | path_to_metadata | ) |
Sets the name of the JSON file.
|
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 |
Sets a single string identifying the point type of this tree.
|
overrideprotectedvirtual |
Writes the JSON metadata to a string.
Implements pcl::outofcore::OutofcoreAbstractMetadata.
|
friend |
Provide operator overload to stream ascii file data.
|
protected |
Coordinate system; maps to JSON "coord_sys":string.
Definition at line 205 of file outofcore_base_data.h.
|
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.
|
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.
|
protected |
Metadata (JSON) file pathname (octree extension JSON file)
Definition at line 199 of file outofcore_base_data.h.
|
protected |
Outofcore library version identifier; maps to JSON "version":int.
Definition at line 202 of file outofcore_base_data.h.
|
protected |
Delineates the point types of the field; maps to JSON "pointtype":string:
Definition at line 213 of file outofcore_base_data.h.
|
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.