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

#include <HDF5IO.hpp>

Public Member Functions

template<typename T >
void addArray (std::string groupName, std::string datasetName, std::vector< size_t > &dimensions, boost::shared_array< T > data)
 
template<typename T >
void addArray (std::string groupName, std::string datasetName, std::vector< size_t > &dimensions, std::vector< hsize_t > &chunkSize, boost::shared_array< T > data)
 
template<typename T >
void addArray (std::string groupName, std::string datasetName, unsigned int size, boost::shared_array< T > data)
 
void addFloatChannelToRawScan (std::string name, int nr, size_t n, unsigned w, floatArr data)
 
void addImage (std::string groupName, std::string name, cv::Mat &img)
 
void addRawCamData (int scan_id, int img_id, ScanImage &cam_data)
 add recorded image referenced to a scan pose More...
 
void addRawDataHeader (std::string description, Matrix4< BaseVector< float >> &referenceFrame)
 
void addRawScan (int nr, ScanPtr scan)
 
size_t chunkSize ()
 
bool compress ()
 
bool deleteDataset (const char *name)
 deletes a dataset permanently from the hdf file More...
 
template<typename T >
boost::shared_array< T > getArray (std::string groupName, std::string datasetName, std::vector< size_t > &dim)
 
template<typename T >
boost::shared_array< T > getArray (std::string groupName, std::string datasetName, unsigned int &size)
 
floatArr getFloatChannelFromRawScan (std::string name, int nr, unsigned int &n, unsigned &w)
 
Texture getImage (std::string groupName, std::string datasetName)
 
std::vector< std::vector< ScanImage > > getRawCamData (bool load_image_data=true)
 
std::vector< ScanPtrgetRawScans (bool load_points=true)
 
ScanImage getSingleRawCamData (int scan_id, int img_id, bool load_image_data=true)
 
ScanPtr getSingleRawScan (int nr, bool load_points=true)
 
 HDF5IO ()
 Construct a new HDF5IO object. Do not use this. Only used by ModelFactory. More...
 
 HDF5IO (const std::string filename, const std::string part_name, int open_flags=HighFive::File::ReadOnly)
 Constructs a HDFIO io object to read a HDF5 file with the given filename. It accesses the mesh or point cloud with the given part name. The selected part can then be read and write to and from a Model pointer. This will automatically load and store all provided channels. The channels will be loaded if one accessing them in a lazy fashion. More...
 
 HDF5IO (HDF5KernelPtr kernel, HDF5SchemaPtr schema)
 
 HDF5IO (std::string filename, int open_flags=HighFive::File::ReadWrite)
 
ScanProjectPtr loadScanProject ()
 
bool open (std::string filename, int open_flag)
 
virtual ModelPtr read (std::string filename)
 Parse the given file and load supported elements. More...
 
ModelPtr read (std::string filename, size_t scanNr)
 
bool readMesh (ModelPtr model_ptr)
 
bool readPointCloud (ModelPtr model_ptr)
 
virtual void save (ModelPtr model, std::string filename)
 
virtual void save (std::string filename)
 Save the loaded elements to the given file. More...
 
bool saveMesh (ModelPtr model_ptr)
 
void saveScanProject (ScanProjectPtr project)
 
void setChunkSize (const size_t &size)
 
void setCompress (bool compress)
 
void setPreviewReductionFactor (const unsigned int factor)
 
void setUsePreviews (bool use)
 
virtual ~HDF5IO ()
 

Static Public Attributes

static const std::string indices_name = "indices"
 
static const std::string meshes_group = "meshes"
 
static const std::string vertices_name = "vertices"
 

Private Member Functions

template<typename T >
void addArray (HighFive::Group &g, std::string datasetName, std::vector< size_t > &dim, std::vector< hsize_t > &chunkSize, boost::shared_array< T > &data)
 
template<typename T >
bool addChannel (const std::string group, const std::string name, const AttributeChannel< T > &channel)
 
virtual bool addChannel (const std::string group, const std::string name, const FloatChannel &channel)
 addChannel Writes a float attribute channel from the given group with the given name More...
 
virtual bool addChannel (const std::string group, const std::string name, const IndexChannel &channel)
 addChannel Writes an index attribute channel from the given group with the given name More...
 
virtual bool addChannel (const std::string group, const std::string name, const UCharChannel &channel)
 addChannel Writes an unsigned char attribute channel from the given group with the given name More...
 
void addImage (HighFive::Group &g, std::string datasetName, cv::Mat &img)
 
virtual bool addIndices (const IndexChannel &channel_ptr)
 Persistence layer interface, Writes the face indices of the mesh to the persistence layer. More...
 
virtual bool addVertices (const FloatChannel &channel_ptr)
 Persistence layer interface, Writes the vertices of the mesh to the persistence layer. More...
 
bool exist (const std::string &groupName)
 
template<typename T >
boost::shared_array< T > getArray (HighFive::Group &g, std::string datasetName, std::vector< size_t > &dim)
 
template<typename T >
bool getChannel (const std::string group, const std::string name, boost::optional< AttributeChannel< T >> &channel)
 
virtual bool getChannel (const std::string group, const std::string name, FloatChannelOptional &channel)
 getChannel Reads a float attribute channel in the given group with the given name More...
 
virtual bool getChannel (const std::string group, const std::string name, IndexChannelOptional &channel)
 getChannel Reads an index attribute channel in the given group with the given name More...
 
virtual bool getChannel (const std::string group, const std::string name, UCharChannelOptional &channel)
 getChannel Reads an unsigned char attribute channel in the given group with the given name More...
 
HighFive::Group getGroup (const std::string &groupName, bool create=true)
 
HighFive::Group getGroup (HighFive::Group &g, const std::string &groupName, bool create=true)
 
Texture getImage (HighFive::Group &g, std::string datasetName)
 
void getImage (HighFive::Group &g, std::string datasetName, cv::Mat &img)
 
virtual IndexChannelOptional getIndices ()
 Persistence layer interface, Accesses the face indices of the mesh in the persistence layer. More...
 
boost::optional< HighFive::GroupgetMeshGroup (bool create=false)
 
virtual FloatChannelOptional getVertices ()
 Persistence layer interface, Accesses the vertices of the mesh in the persistence layer. More...
 
bool isGroup (HighFive::Group grp, std::string objName)
 
template<typename T >
boost::shared_array< T > reduceData (boost::shared_array< T > data, size_t dataCount, size_t dataWidth, unsigned int reductionFactor, size_t *reducedDataCount)
 
std::vector< std::string > splitGroupNames (const std::string &groupName)
 
void write_base_structure ()
 

Private Attributes

size_t m_chunkSize
 
bool m_compress
 
HighFive::Filem_hdf5_file
 
HDF5KernelPtr m_kernel
 
std::string m_mesh_path
 
std::string m_part_name
 
unsigned int m_previewReductionFactor
 
HDF5SchemaPtr m_schema
 
bool m_usePreviews
 

Detailed Description

Definition at line 13 of file descriptions/HDF5IO.hpp.

Constructor & Destructor Documentation

◆ HDF5IO() [1/4]

lvr2::HDF5IO::HDF5IO ( HDF5KernelPtr  kernel,
HDF5SchemaPtr  schema 
)

Definition at line 6 of file descriptions/HDF5IO.cpp.

◆ HDF5IO() [2/4]

lvr2::HDF5IO::HDF5IO ( )
inline

Construct a new HDF5IO object. Do not use this. Only used by ModelFactory.

Definition at line 93 of file HDF5IO.hpp.

◆ HDF5IO() [3/4]

lvr2::HDF5IO::HDF5IO ( std::string  filename,
int  open_flags = HighFive::File::ReadWrite 
)

Definition at line 59 of file HDF5IO.cpp.

◆ HDF5IO() [4/4]

lvr2::HDF5IO::HDF5IO ( const std::string  filename,
const std::string  part_name,
int  open_flags = HighFive::File::ReadOnly 
)

Constructs a HDFIO io object to read a HDF5 file with the given filename. It accesses the mesh or point cloud with the given part name. The selected part can then be read and write to and from a Model pointer. This will automatically load and store all provided channels. The channels will be loaded if one accessing them in a lazy fashion.

Parameters
filenameThe HDF5 file filename
part_nameThe part in the HDF5 file which should be saved or loaded.
open_flagOpen flags: See the HighFive::File open flags

Definition at line 43 of file HDF5IO.cpp.

◆ ~HDF5IO()

lvr2::HDF5IO::~HDF5IO ( )
virtual

Definition at line 70 of file HDF5IO.cpp.

Member Function Documentation

◆ addArray() [1/4]

template<typename T >
void lvr2::HDF5IO::addArray ( HighFive::Group g,
std::string  datasetName,
std::vector< size_t > &  dim,
std::vector< hsize_t > &  chunkSize,
boost::shared_array< T > &  data 
)
private

◆ addArray() [2/4]

template<typename T >
void lvr2::HDF5IO::addArray ( std::string  groupName,
std::string  datasetName,
std::vector< size_t > &  dimensions,
boost::shared_array< T >  data 
)

◆ addArray() [3/4]

template<typename T >
void lvr2::HDF5IO::addArray ( std::string  groupName,
std::string  datasetName,
std::vector< size_t > &  dimensions,
std::vector< hsize_t > &  chunkSize,
boost::shared_array< T >  data 
)

◆ addArray() [4/4]

template<typename T >
void lvr2::HDF5IO::addArray ( std::string  groupName,
std::string  datasetName,
unsigned int  size,
boost::shared_array< T >  data 
)

◆ addChannel() [1/4]

template<typename T >
bool lvr2::HDF5IO::addChannel ( const std::string  group,
const std::string  name,
const AttributeChannel< T > &  channel 
)
private

◆ addChannel() [2/4]

bool lvr2::HDF5IO::addChannel ( const std::string  group,
const std::string  name,
const FloatChannel channel 
)
privatevirtual

addChannel Writes a float attribute channel from the given group with the given name

Parameters
groupThe associated attribute group
nameThe associated attribute name
channelThe pointer to the float channel which should be written
Returns
true if the channel has been written successfully, false otherwise

Definition at line 1214 of file HDF5IO.cpp.

◆ addChannel() [3/4]

virtual bool lvr2::HDF5IO::addChannel ( const std::string  group,
const std::string  name,
const IndexChannel channel 
)
privatevirtual

addChannel Writes an index attribute channel from the given group with the given name

Parameters
groupThe associated attribute group
nameThe associated attribute name
channelThe pointer to the index channel which should be written
Returns
true if the channel has been written successfully, false otherwise

◆ addChannel() [4/4]

virtual bool lvr2::HDF5IO::addChannel ( const std::string  group,
const std::string  name,
const UCharChannel channel 
)
privatevirtual

addChannel Writes an unsigned char attribute channel from the given group with the given name

Parameters
groupThe associated attribute group
nameThe associated attribute name
channelThe pointer to the unsigned char channel which should be written
Returns
true if the channel has been written successfully, false otherwise

◆ addFloatChannelToRawScan()

void lvr2::HDF5IO::addFloatChannelToRawScan ( std::string  name,
int  nr,
size_t  n,
unsigned  w,
floatArr  data 
)

Definition at line 720 of file HDF5IO.cpp.

◆ addImage() [1/2]

void lvr2::HDF5IO::addImage ( HighFive::Group g,
std::string  datasetName,
cv::Mat &  img 
)
private

Definition at line 683 of file HDF5IO.cpp.

◆ addImage() [2/2]

void lvr2::HDF5IO::addImage ( std::string  groupName,
std::string  name,
cv::Mat &  img 
)

Definition at line 674 of file HDF5IO.cpp.

◆ addIndices()

bool lvr2::HDF5IO::addIndices ( const IndexChannel channel_ptr)
privatevirtual

Persistence layer interface, Writes the face indices of the mesh to the persistence layer.

Returns
true if the channel has been written successfully

Definition at line 1194 of file HDF5IO.cpp.

◆ addRawCamData()

void lvr2::HDF5IO::addRawCamData ( int  scan_id,
int  img_id,
ScanImage cam_data 
)

add recorded image referenced to a scan pose

Definition at line 927 of file HDF5IO.cpp.

◆ addRawDataHeader()

void lvr2::HDF5IO::addRawDataHeader ( std::string  description,
Matrix4< BaseVector< float >> &  referenceFrame 
)

Definition at line 979 of file HDF5IO.cpp.

◆ addRawScan()

void lvr2::HDF5IO::addRawScan ( int  nr,
ScanPtr  scan 
)

Definition at line 799 of file HDF5IO.cpp.

◆ addVertices()

bool lvr2::HDF5IO::addVertices ( const FloatChannel channel_ptr)
privatevirtual

Persistence layer interface, Writes the vertices of the mesh to the persistence layer.

Returns
true if the channel has been written successfully

Definition at line 1187 of file HDF5IO.cpp.

◆ chunkSize()

size_t lvr2::HDF5IO::chunkSize ( )

Definition at line 116 of file HDF5IO.cpp.

◆ compress()

bool lvr2::HDF5IO::compress ( )

Definition at line 105 of file HDF5IO.cpp.

◆ deleteDataset()

bool lvr2::HDF5IO::deleteDataset ( const char *  name)

deletes a dataset permanently from the hdf file

Parameters
namename of the dataset that gets deleted
Returns
true if deletion was successful else false

Definition at line 110 of file HDF5IO.cpp.

◆ exist()

bool lvr2::HDF5IO::exist ( const std::string &  groupName)
private

Definition at line 1092 of file HDF5IO.cpp.

◆ getArray() [1/3]

template<typename T >
boost::shared_array<T> lvr2::HDF5IO::getArray ( HighFive::Group g,
std::string  datasetName,
std::vector< size_t > &  dim 
)
private

◆ getArray() [2/3]

template<typename T >
boost::shared_array<T> lvr2::HDF5IO::getArray ( std::string  groupName,
std::string  datasetName,
std::vector< size_t > &  dim 
)

◆ getArray() [3/3]

template<typename T >
boost::shared_array<T> lvr2::HDF5IO::getArray ( std::string  groupName,
std::string  datasetName,
unsigned int &  size 
)

◆ getChannel() [1/4]

template<typename T >
bool lvr2::HDF5IO::getChannel ( const std::string  group,
const std::string  name,
boost::optional< AttributeChannel< T >> &  channel 
)
private

◆ getChannel() [2/4]

bool lvr2::HDF5IO::getChannel ( const std::string  group,
const std::string  name,
FloatChannelOptional channel 
)
privatevirtual

getChannel Reads a float attribute channel in the given group with the given name

Parameters
groupThe associated attribute group
nameThe associated attribute name
channelThe pointer to the float channel
Returns
true if the channel has been loaded successfully, false otherwise

Definition at line 1202 of file HDF5IO.cpp.

◆ getChannel() [3/4]

bool lvr2::HDF5IO::getChannel ( const std::string  group,
const std::string  name,
IndexChannelOptional channel 
)
privatevirtual

getChannel Reads an index attribute channel in the given group with the given name

Parameters
groupThe associated attribute group
nameThe associated attribute name
channelThe pointer to the index channel
Returns
true if the channel has been loaded successfully, false otherwise

Definition at line 1206 of file HDF5IO.cpp.

◆ getChannel() [4/4]

virtual bool lvr2::HDF5IO::getChannel ( const std::string  group,
const std::string  name,
UCharChannelOptional channel 
)
privatevirtual

getChannel Reads an unsigned char attribute channel in the given group with the given name

Parameters
groupThe associated attribute group
nameThe associated attribute name
channelThe pointer to the unsigned char channel
Returns
true if the channel has been loaded successfully, false otherwise

◆ getFloatChannelFromRawScan()

floatArr lvr2::HDF5IO::getFloatChannelFromRawScan ( std::string  name,
int  nr,
unsigned int &  n,
unsigned &  w 
)

Definition at line 644 of file HDF5IO.cpp.

◆ getGroup() [1/2]

HighFive::Group lvr2::HDF5IO::getGroup ( const std::string &  groupName,
bool  create = true 
)
private

Definition at line 1012 of file HDF5IO.cpp.

◆ getGroup() [2/2]

HighFive::Group lvr2::HDF5IO::getGroup ( HighFive::Group g,
const std::string &  groupName,
bool  create = true 
)
private

Definition at line 1052 of file HDF5IO.cpp.

◆ getImage() [1/3]

Texture lvr2::HDF5IO::getImage ( HighFive::Group g,
std::string  datasetName 
)
private

Definition at line 377 of file HDF5IO.cpp.

◆ getImage() [2/3]

void lvr2::HDF5IO::getImage ( HighFive::Group g,
std::string  datasetName,
cv::Mat &  img 
)
private

Definition at line 700 of file HDF5IO.cpp.

◆ getImage() [3/3]

Texture lvr2::HDF5IO::getImage ( std::string  groupName,
std::string  datasetName 
)

Definition at line 360 of file HDF5IO.cpp.

◆ getIndices()

IndexChannelOptional lvr2::HDF5IO::getIndices ( )
privatevirtual

Persistence layer interface, Accesses the face indices of the mesh in the persistence layer.

Returns
An optional index channel, the channel is valid if the mesh indices have been read successfully

Definition at line 1172 of file HDF5IO.cpp.

◆ getMeshGroup()

boost::optional< HighFive::Group > lvr2::HDF5IO::getMeshGroup ( bool  create = false)
private

Definition at line 1146 of file HDF5IO.cpp.

◆ getRawCamData()

std::vector< std::vector< ScanImage > > lvr2::HDF5IO::getRawCamData ( bool  load_image_data = true)

Definition at line 466 of file HDF5IO.cpp.

◆ getRawScans()

std::vector< ScanPtr > lvr2::HDF5IO::getRawScans ( bool  load_points = true)

Definition at line 414 of file HDF5IO.cpp.

◆ getSingleRawCamData()

ScanImage lvr2::HDF5IO::getSingleRawCamData ( int  scan_id,
int  img_id,
bool  load_image_data = true 
)

Definition at line 591 of file HDF5IO.cpp.

◆ getSingleRawScan()

ScanPtr lvr2::HDF5IO::getSingleRawScan ( int  nr,
bool  load_points = true 
)

Definition at line 507 of file HDF5IO.cpp.

◆ getVertices()

FloatChannelOptional lvr2::HDF5IO::getVertices ( )
privatevirtual

Persistence layer interface, Accesses the vertices of the mesh in the persistence layer.

Returns
An optional float channel, the channel is valid if the mesh vertices have been read successfully

Definition at line 1156 of file HDF5IO.cpp.

◆ isGroup()

bool lvr2::HDF5IO::isGroup ( HighFive::Group  grp,
std::string  objName 
)
private

Definition at line 1129 of file HDF5IO.cpp.

◆ loadScanProject()

ScanProjectPtr lvr2::HDF5IO::loadScanProject ( )

Definition at line 21 of file descriptions/HDF5IO.cpp.

◆ open()

bool lvr2::HDF5IO::open ( std::string  filename,
int  open_flag 
)

Definition at line 232 of file HDF5IO.cpp.

◆ read() [1/2]

ModelPtr lvr2::HDF5IO::read ( std::string  filename)
virtual

Parse the given file and load supported elements.

Parameters
filenameThe file to read.

Definition at line 121 of file HDF5IO.cpp.

◆ read() [2/2]

ModelPtr lvr2::HDF5IO::read ( std::string  filename,
size_t  scanNr 
)

◆ readMesh()

bool lvr2::HDF5IO::readMesh ( ModelPtr  model_ptr)

Definition at line 191 of file HDF5IO.cpp.

◆ readPointCloud()

bool lvr2::HDF5IO::readPointCloud ( ModelPtr  model_ptr)

Definition at line 146 of file HDF5IO.cpp.

◆ reduceData()

template<typename T >
boost::shared_array<T> lvr2::HDF5IO::reduceData ( boost::shared_array< T >  data,
size_t  dataCount,
size_t  dataWidth,
unsigned int  reductionFactor,
size_t *  reducedDataCount 
)
private

◆ save() [1/2]

void lvr2::HDF5IO::save ( ModelPtr  model,
std::string  filename 
)
virtual

Definition at line 287 of file HDF5IO.cpp.

◆ save() [2/2]

void lvr2::HDF5IO::save ( std::string  filename)
virtual

Save the loaded elements to the given file.

Parameters
filenameFilename of the file to write.

Definition at line 282 of file HDF5IO.cpp.

◆ saveMesh()

bool lvr2::HDF5IO::saveMesh ( ModelPtr  model_ptr)

Definition at line 299 of file HDF5IO.cpp.

◆ saveScanProject()

void lvr2::HDF5IO::saveScanProject ( ScanProjectPtr  project)

Definition at line 12 of file descriptions/HDF5IO.cpp.

◆ setChunkSize()

void lvr2::HDF5IO::setChunkSize ( const size_t &  size)

Definition at line 83 of file HDF5IO.cpp.

◆ setCompress()

void lvr2::HDF5IO::setCompress ( bool  compress)

Definition at line 78 of file HDF5IO.cpp.

◆ setPreviewReductionFactor()

void lvr2::HDF5IO::setPreviewReductionFactor ( const unsigned int  factor)

Definition at line 88 of file HDF5IO.cpp.

◆ setUsePreviews()

void lvr2::HDF5IO::setUsePreviews ( bool  use)

Definition at line 100 of file HDF5IO.cpp.

◆ splitGroupNames()

std::vector< std::string > lvr2::HDF5IO::splitGroupNames ( const std::string &  groupName)
private

Definition at line 984 of file HDF5IO.cpp.

◆ write_base_structure()

void lvr2::HDF5IO::write_base_structure ( )
private

Definition at line 260 of file HDF5IO.cpp.

Member Data Documentation

◆ indices_name

const std::string lvr2::HDF5IO::indices_name = "indices"
static

Definition at line 60 of file HDF5IO.hpp.

◆ m_chunkSize

size_t lvr2::HDF5IO::m_chunkSize
private

Definition at line 320 of file HDF5IO.hpp.

◆ m_compress

bool lvr2::HDF5IO::m_compress
private

Definition at line 319 of file HDF5IO.hpp.

◆ m_hdf5_file

HighFive::File* lvr2::HDF5IO::m_hdf5_file
private

Definition at line 317 of file HDF5IO.hpp.

◆ m_kernel

HDF5KernelPtr lvr2::HDF5IO::m_kernel
private

Definition at line 22 of file descriptions/HDF5IO.hpp.

◆ m_mesh_path

std::string lvr2::HDF5IO::m_mesh_path
private

Definition at line 324 of file HDF5IO.hpp.

◆ m_part_name

std::string lvr2::HDF5IO::m_part_name
private

Definition at line 323 of file HDF5IO.hpp.

◆ m_previewReductionFactor

unsigned int lvr2::HDF5IO::m_previewReductionFactor
private

Definition at line 322 of file HDF5IO.hpp.

◆ m_schema

HDF5SchemaPtr lvr2::HDF5IO::m_schema
private

Definition at line 23 of file descriptions/HDF5IO.hpp.

◆ m_usePreviews

bool lvr2::HDF5IO::m_usePreviews
private

Definition at line 321 of file HDF5IO.hpp.

◆ meshes_group

const std::string lvr2::HDF5IO::meshes_group = "meshes"
static

Definition at line 61 of file HDF5IO.hpp.

◆ vertices_name

const std::string lvr2::HDF5IO::vertices_name = "vertices"
static

Definition at line 59 of file HDF5IO.hpp.


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


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