#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< PlutoMapMaterial > | getMaterials () |
Returns materials as PlutoMapMaterial. More... | |
vector< float > | getRoughness () |
Returns the roughness as float vector. More... | |
vector< PlutoMapImage > | getTextures () |
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" |
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.
lvr2::PlutoMapIO::PlutoMapIO | ( | string | filename | ) |
Opens a Pluto map file for reading and writing.
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).
lvr2::PlutoMapIO::~PlutoMapIO | ( | ) |
Closes main groups and makes sure all buffers are flushed to the file on disc.
void lvr2::PlutoMapIO::addHeightDifference | ( | vector< float > & | diff | ) |
Adds the height difference to the attributes group.
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.
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 '_'.
void lvr2::PlutoMapIO::addMaterials | ( | vector< PlutoMapMaterial > & | materials, |
vector< uint32_t > & | matFaceIndices | ||
) |
Add materials as PlutoMapMaterial and the corresponding material <-> face indices.
void lvr2::PlutoMapIO::addRoughness | ( | vector< float > & | roughness | ) |
Adds the roughness to the attributes group.
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
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'.
hf::DataSet lvr2::PlutoMapIO::addVertexColors | ( | vector< uint8_t > & | colors | ) |
Add vertex colors to the attributes group.
hf::DataSet lvr2::PlutoMapIO::addVertexNormals | ( | vector< float > & | normals | ) |
Add normals to the attributes group.
void lvr2::PlutoMapIO::addVertexTextureCoords | ( | vector< float > & | coords | ) |
Add vertex texture coordinates to the textures group.
void lvr2::PlutoMapIO::flush | ( | ) |
Flushes the file. All opened buffers are saved to disc.
vector<string> lvr2::PlutoMapIO::getAllLabelsOfGroup | ( | string | groupName | ) |
Returns all labels inside the given group.
vector<uint32_t> lvr2::PlutoMapIO::getFaceIds | ( | ) |
Returns face ids vector.
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.
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.
vector<float> lvr2::PlutoMapIO::getHeightDifference | ( | ) |
Returns the height difference as float vector.
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.
vector<string> lvr2::PlutoMapIO::getLabelGroups | ( | ) |
Returns all available label groups.
vector<uint32_t> lvr2::PlutoMapIO::getMaterialFaceIndices | ( | ) |
Returns material <-> face indices.
vector<PlutoMapMaterial> lvr2::PlutoMapIO::getMaterials | ( | ) |
Returns materials as PlutoMapMaterial.
vector<float> lvr2::PlutoMapIO::getRoughness | ( | ) |
Returns the roughness as float vector.
vector<PlutoMapImage> lvr2::PlutoMapIO::getTextures | ( | ) |
Returns textures vector.
vector<uint8_t> lvr2::PlutoMapIO::getVertexColors | ( | ) |
Returns vertex colors vector.
vector<float> lvr2::PlutoMapIO::getVertexNormals | ( | ) |
Returns vertex normals vector.
vector<float> lvr2::PlutoMapIO::getVertexTextureCoords | ( | ) |
Returns vertex texture coordinates.
vector<float> lvr2::PlutoMapIO::getVertices | ( | ) |
Returns vertices vector.
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.
|
staticconstexprprivate |
Definition at line 269 of file PlutoMapIO.hpp.
|
staticconstexprprivate |
Definition at line 270 of file PlutoMapIO.hpp.
|
staticconstexprprivate |
Definition at line 268 of file PlutoMapIO.hpp.
|
staticconstexprprivate |
Definition at line 272 of file PlutoMapIO.hpp.
|
private |
Definition at line 276 of file PlutoMapIO.hpp.
|
private |
Definition at line 277 of file PlutoMapIO.hpp.
|
private |
Definition at line 264 of file PlutoMapIO.hpp.
|
private |
Definition at line 275 of file PlutoMapIO.hpp.
|
private |
Definition at line 279 of file PlutoMapIO.hpp.
|
private |
Definition at line 278 of file PlutoMapIO.hpp.
|
staticconstexprprivate |
Definition at line 271 of file PlutoMapIO.hpp.