Public Member Functions | Private Attributes | Static Private Attributes | List of all members
lvr2::PlutoMapIO Class Reference

#include <PlutoMapIO.hpp>

Public Member Functions

void addHeightDifference (vector< float > &diff)
 Adds the height difference to the attributes group. More...
 
void addImage (hf::Group group, string name, const uint32_t width, const uint32_t height, const uint8_t *pixelBuffer)
 Adds an image with given data set name to the given group. More...
 
void addLabel (string groupName, string labelName, vector< uint32_t > &faceIds)
 Adds the label (labelName) to the label group with the given faces. E.g.: tree_1 -> groupName=tree; labelName=1; separated by the '_'. More...
 
void addMaterials (vector< PlutoMapMaterial > &materials, vector< uint32_t > &matFaceIndices)
 Add materials as PlutoMapMaterial and the corresponding material <-> face indices. More...
 
void addRoughness (vector< float > &roughness)
 Adds the roughness to the attributes group. More...
 
void addTexture (int index, uint32_t width, uint32_t height, uint8_t *data)
 
template<typename BaseVecT >
void addTextureKeypointsMap (unordered_map< BaseVecT, std::vector< float >> &keypoints_map)
 Adds the keypoints with their corresponding positions to the attributes_group. The position is saved to the entry via an attribute called 'vector'. More...
 
hf::DataSet addVertexColors (vector< uint8_t > &colors)
 Add vertex colors to the attributes group. More...
 
hf::DataSet addVertexNormals (vector< float > &normals)
 Add normals to the attributes group. More...
 
void addVertexTextureCoords (vector< float > &coords)
 Add vertex texture coordinates to the textures group. More...
 
void flush ()
 Flushes the file. All opened buffers are saved to disc. More...
 
vector< string > getAllLabelsOfGroup (string groupName)
 Returns all labels inside the given group. More...
 
vector< uint32_t > getFaceIds ()
 Returns face ids vector. More...
 
vector< uint32_t > getFaceIdsOfLabel (string groupName, string labelName)
 Returns face ids for the given label inside the group. E.g: label=tree_1 -> groupName=tree; labelName=1. More...
 
unordered_map< Vec, vector< float > > getFeatures ()
 Returns an map which keys are representing the features point in space and the values are an vector of floats representing the keypoints. More...
 
vector< float > getHeightDifference ()
 Returns the height difference as float vector. More...
 
PlutoMapImage getImage (hf::Group group, string name)
 Returns the image in the group, if it exists. If not an empty struct is returned. More...
 
vector< string > getLabelGroups ()
 Returns all available label groups. More...
 
vector< uint32_t > getMaterialFaceIndices ()
 Returns material <-> face indices. More...
 
vector< PlutoMapMaterialgetMaterials ()
 Returns materials as PlutoMapMaterial. More...
 
vector< float > getRoughness ()
 Returns the roughness as float vector. More...
 
vector< PlutoMapImagegetTextures ()
 Returns textures vector. More...
 
vector< uint8_t > getVertexColors ()
 Returns vertex colors vector. More...
 
vector< float > getVertexNormals ()
 Returns vertex normals vector. More...
 
vector< float > getVertexTextureCoords ()
 Returns vertex texture coordinates. More...
 
vector< float > getVertices ()
 Returns vertices vector. More...
 
 PlutoMapIO (string filename)
 Opens a Pluto map file for reading and writing. More...
 
 PlutoMapIO (string filename, const vector< float > &vertices, const vector< uint32_t > &face_ids)
 Creates a Pluto map file (or truncates if the file already exists). More...
 
bool removeAllLabels ()
 
 ~PlutoMapIO ()
 Closes main groups and makes sure all buffers are flushed to the file on disc. More...
 

Private Attributes

hf::Group m_attributesGroup
 
hf::Group m_clusterSetsGroup
 
hf::File m_file
 
hf::Group m_geometryGroup
 
hf::Group m_labelsGroup
 
hf::Group m_texturesGroup
 

Static Private Attributes

static constexpr const char * ATTRIBUTES_GROUP = "/attributes"
 
static constexpr const char * CLUSTERSETS_GROUP = "/clustersets"
 
static constexpr const char * GEOMETRY_GROUP = "/geometry"
 
static constexpr const char * LABELS_GROUP = "/labels"
 
static constexpr const char * TEXTURES_GROUP = "/textures"
 

Detailed Description

This class if responsible for the Pluto map format. It tries to abstract most if not all calls to the underlying HDF5 API and the HighFive wrapper. Furthermore it ensures the defined map format is always in place and not tinkered with.

NOTE: the map file is held open for the whole live time of this object. Thus it is possible that some data is only written to disc if the destructor is called or the program has ended. Also make sure the map file is not opened in any other way. (i.e. with the HDF5 Viewer). This will always lead to errors trying to access the file.

Definition at line 90 of file PlutoMapIO.hpp.

Constructor & Destructor Documentation

◆ PlutoMapIO() [1/2]

lvr2::PlutoMapIO::PlutoMapIO ( string  filename)

Opens a Pluto map file for reading and writing.

◆ PlutoMapIO() [2/2]

lvr2::PlutoMapIO::PlutoMapIO ( string  filename,
const vector< float > &  vertices,
const vector< uint32_t > &  face_ids 
)

Creates a Pluto map file (or truncates if the file already exists).

◆ ~PlutoMapIO()

lvr2::PlutoMapIO::~PlutoMapIO ( )

Closes main groups and makes sure all buffers are flushed to the file on disc.

Member Function Documentation

◆ addHeightDifference()

void lvr2::PlutoMapIO::addHeightDifference ( vector< float > &  diff)

Adds the height difference to the attributes group.

◆ addImage()

void lvr2::PlutoMapIO::addImage ( hf::Group  group,
string  name,
const uint32_t  width,
const uint32_t  height,
const uint8_t *  pixelBuffer 
)

Adds an image with given data set name to the given group.

◆ addLabel()

void lvr2::PlutoMapIO::addLabel ( string  groupName,
string  labelName,
vector< uint32_t > &  faceIds 
)

Adds the label (labelName) to the label group with the given faces. E.g.: tree_1 -> groupName=tree; labelName=1; separated by the '_'.

◆ addMaterials()

void lvr2::PlutoMapIO::addMaterials ( vector< PlutoMapMaterial > &  materials,
vector< uint32_t > &  matFaceIndices 
)

Add materials as PlutoMapMaterial and the corresponding material <-> face indices.

◆ addRoughness()

void lvr2::PlutoMapIO::addRoughness ( vector< float > &  roughness)

Adds the roughness to the attributes group.

◆ addTexture()

void lvr2::PlutoMapIO::addTexture ( int  index,
uint32_t  width,
uint32_t  height,
uint8_t *  data 
)

Add texture img with given index to the textures group. Texture CAN NOT be overridden

◆ addTextureKeypointsMap()

template<typename BaseVecT >
void lvr2::PlutoMapIO::addTextureKeypointsMap ( unordered_map< BaseVecT, std::vector< float >> &  keypoints_map)

Adds the keypoints with their corresponding positions to the attributes_group. The position is saved to the entry via an attribute called 'vector'.

◆ addVertexColors()

hf::DataSet lvr2::PlutoMapIO::addVertexColors ( vector< uint8_t > &  colors)

Add vertex colors to the attributes group.

◆ addVertexNormals()

hf::DataSet lvr2::PlutoMapIO::addVertexNormals ( vector< float > &  normals)

Add normals to the attributes group.

◆ addVertexTextureCoords()

void lvr2::PlutoMapIO::addVertexTextureCoords ( vector< float > &  coords)

Add vertex texture coordinates to the textures group.

◆ flush()

void lvr2::PlutoMapIO::flush ( )

Flushes the file. All opened buffers are saved to disc.

◆ getAllLabelsOfGroup()

vector<string> lvr2::PlutoMapIO::getAllLabelsOfGroup ( string  groupName)

Returns all labels inside the given group.

◆ getFaceIds()

vector<uint32_t> lvr2::PlutoMapIO::getFaceIds ( )

Returns face ids vector.

◆ getFaceIdsOfLabel()

vector<uint32_t> lvr2::PlutoMapIO::getFaceIdsOfLabel ( string  groupName,
string  labelName 
)

Returns face ids for the given label inside the group. E.g: label=tree_1 -> groupName=tree; labelName=1.

◆ getFeatures()

unordered_map<Vec, vector<float> > lvr2::PlutoMapIO::getFeatures ( )

Returns an map which keys are representing the features point in space and the values are an vector of floats representing the keypoints.

◆ getHeightDifference()

vector<float> lvr2::PlutoMapIO::getHeightDifference ( )

Returns the height difference as float vector.

◆ getImage()

PlutoMapImage lvr2::PlutoMapIO::getImage ( hf::Group  group,
string  name 
)

Returns the image in the group, if it exists. If not an empty struct is returned.

◆ getLabelGroups()

vector<string> lvr2::PlutoMapIO::getLabelGroups ( )

Returns all available label groups.

◆ getMaterialFaceIndices()

vector<uint32_t> lvr2::PlutoMapIO::getMaterialFaceIndices ( )

Returns material <-> face indices.

◆ getMaterials()

vector<PlutoMapMaterial> lvr2::PlutoMapIO::getMaterials ( )

Returns materials as PlutoMapMaterial.

◆ getRoughness()

vector<float> lvr2::PlutoMapIO::getRoughness ( )

Returns the roughness as float vector.

◆ getTextures()

vector<PlutoMapImage> lvr2::PlutoMapIO::getTextures ( )

Returns textures vector.

◆ getVertexColors()

vector<uint8_t> lvr2::PlutoMapIO::getVertexColors ( )

Returns vertex colors vector.

◆ getVertexNormals()

vector<float> lvr2::PlutoMapIO::getVertexNormals ( )

Returns vertex normals vector.

◆ getVertexTextureCoords()

vector<float> lvr2::PlutoMapIO::getVertexTextureCoords ( )

Returns vertex texture coordinates.

◆ getVertices()

vector<float> lvr2::PlutoMapIO::getVertices ( )

Returns vertices vector.

◆ removeAllLabels()

bool lvr2::PlutoMapIO::removeAllLabels ( )

Removes all labels from the file.
Be careful, this does not clear up the space of the labels. Use the cli tool 'h5repack' manually to clear up all wasted space if this method was used multiple times.

Returns
true if removing all labels successfully.

Member Data Documentation

◆ ATTRIBUTES_GROUP

constexpr const char* lvr2::PlutoMapIO::ATTRIBUTES_GROUP = "/attributes"
staticconstexprprivate

Definition at line 269 of file PlutoMapIO.hpp.

◆ CLUSTERSETS_GROUP

constexpr const char* lvr2::PlutoMapIO::CLUSTERSETS_GROUP = "/clustersets"
staticconstexprprivate

Definition at line 270 of file PlutoMapIO.hpp.

◆ GEOMETRY_GROUP

constexpr const char* lvr2::PlutoMapIO::GEOMETRY_GROUP = "/geometry"
staticconstexprprivate

Definition at line 268 of file PlutoMapIO.hpp.

◆ LABELS_GROUP

constexpr const char* lvr2::PlutoMapIO::LABELS_GROUP = "/labels"
staticconstexprprivate

Definition at line 272 of file PlutoMapIO.hpp.

◆ m_attributesGroup

hf::Group lvr2::PlutoMapIO::m_attributesGroup
private

Definition at line 276 of file PlutoMapIO.hpp.

◆ m_clusterSetsGroup

hf::Group lvr2::PlutoMapIO::m_clusterSetsGroup
private

Definition at line 277 of file PlutoMapIO.hpp.

◆ m_file

hf::File lvr2::PlutoMapIO::m_file
private

Definition at line 264 of file PlutoMapIO.hpp.

◆ m_geometryGroup

hf::Group lvr2::PlutoMapIO::m_geometryGroup
private

Definition at line 275 of file PlutoMapIO.hpp.

◆ m_labelsGroup

hf::Group lvr2::PlutoMapIO::m_labelsGroup
private

Definition at line 279 of file PlutoMapIO.hpp.

◆ m_texturesGroup

hf::Group lvr2::PlutoMapIO::m_texturesGroup
private

Definition at line 278 of file PlutoMapIO.hpp.

◆ TEXTURES_GROUP

constexpr const char* lvr2::PlutoMapIO::TEXTURES_GROUP = "/textures"
staticconstexprprivate

Definition at line 271 of file PlutoMapIO.hpp.


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


lvr2
Author(s): Thomas Wiemann , Sebastian Pütz , Alexander Mock , Lars Kiesow , Lukas Kalbertodt , Tristan Igelbrink , Johan M. von Behren , Dominik Feldschnieders , Alexander Löhr
autogenerated on Wed Mar 2 2022 00:37:27