57 boost::shared_array<size_t> amountArr(
new size_t[3] {amount.
x, amount.
y, amount.
z});
60 boost::shared_array<float> chunkSizeArr(
new float[1] {chunksize});
63 boost::shared_array<float> boundingBoxArr(
64 new float[6] {boundingBox.getMin()[0], boundingBox.getMin()[1], boundingBox.getMin()[2],
65 boundingBox.getMax()[0], boundingBox.getMax()[1], boundingBox.getMax()[2]});
66 std::vector<size_t> boundingBoxDim({2, 3});
73 std::string cellName = std::to_string(x) +
"_" + std::to_string(y) +
"_" + std::to_string(z);
74 if (!chunks.
exist(cellName))
86 size_t dimensionAmount;
87 boost::shared_array<size_t> amountArr
89 if(dimensionAmount != 3)
91 std::cout <<
"Error loading chunk data: amount has not the right dimension. Real: " 92 << dimensionAmount <<
"; Expected: 3" << std::endl;
104 size_t dimensionChunkSize;
105 boost::shared_array<float> chunkSizeArr
107 if(dimensionChunkSize != 1)
109 std::cout <<
"Error loading chunk data: chunkSize has not the right dimension. Real: " 110 << dimensionChunkSize <<
"; Expected: 1" << std::endl;
115 chunkSize = chunkSizeArr[0];
123 std::vector<size_t> dimensionBox;
124 boost::shared_array<float> boundingBoxArr
126 if(dimensionBox.at(0) != 2 && dimensionBox.at(1) != 3)
128 std::cout <<
"Error loading chunk data: bounding_box has not the right dimension. Real: {" 129 << dimensionBox.at(0) <<
", " << dimensionBox.at(1) <<
"}; Expected: {2, 3}" << std::endl;
153 boost::shared_array<float> voxelSizeArr(
new float[1] {voxelSize});
160 return voxelSize.get()[0];
165 boost::shared_array<float> centers,
166 boost::shared_array<bool> extruded,
167 boost::shared_array<float> queryPoints) {
170 if (!chunks.
exist(chunkName))
175 boost::shared_array<size_t> numCellsArr = boost::shared_array<size_t>(
new size_t[1]);
176 numCellsArr.get()[0] = csize;
178 std::vector<size_t> centersDim({csize, 3});
181 std::vector<size_t> queryPointsDim({csize, 8});
189 if (!chunks.
exist(chunkName))
192 return boost::shared_array<float>();
197 std::vector<size_t> dimensionCenters;
198 boost::shared_array<float> centersArr
199 =
m_hdf5IO.ArrayIO::load<
float>(single_chunk,
"centers", dimensionCenters);
200 if (dimensionCenters.at(1) != 3)
202 std::cout <<
"Error loading chunk/tsdf data: centers has not the right dimension. Real: {" 203 << dimensionCenters.at(0) <<
", " << dimensionCenters.at(1) <<
"}; Expected: {N, 3}" 205 return boost::shared_array<float>();
213 if (!chunks.
exist(chunkName))
221 std::vector<size_t> dimensionNumCells;
222 boost::shared_array<float> numCellsArr
223 =
m_hdf5IO.ArrayIO::load<
float>(single_chunk,
"numCells", dimensionNumCells);
224 return numCellsArr.get()[0];
230 if (!chunks.
exist(chunkName))
233 return boost::shared_array<float>();
238 std::vector<size_t> dimensionQueryPoints;
239 boost::shared_array<float> qpArr
240 =
m_hdf5IO.ArrayIO::load<
float>(single_chunk,
"queryPoints", dimensionQueryPoints);
241 if (dimensionQueryPoints.at(1) != 8)
243 std::cout <<
"Error loading chunk/tsdf data: queryPoints has not the right dimension. Real: {" 244 << dimensionQueryPoints.at(0) <<
", " << dimensionQueryPoints.at(1) <<
"}; Expected: {N, 8}" 246 return boost::shared_array<float>();
254 if (!chunks.
exist(chunkName))
257 return boost::shared_array<bool>();
260 std::vector<size_t> dimensionExtruded;
261 boost::shared_array<bool> extrudedArr
262 =
m_hdf5IO.ArrayIO::load<
bool>(single_chunk,
"extruded", dimensionExtruded);
BaseVector< size_t > loadAmount()
loads and returns a BaseVector with the amount of chunks in each dimension
void open(std::string filename)
std::shared_ptr< HighFive::File > m_hdf5_file
boost::shared_array< T > loadArray(std::string groupName, std::string datasetName, size_t &size)
std::shared_ptr< MeshBuffer > MeshBufferPtr
void writeTSDF(string cellName, size_t csize, boost::shared_array< float > centers, boost::shared_array< bool > extruded, boost::shared_array< float > queryPoints)
Writes the parameters in the HDF5 file.
void save(std::string groupName, std::string datasetName, size_t size, boost::shared_array< T > data)
void writeBasicStructure(BaseVector< std::size_t > amount, float chunksize, BoundingBox< BaseVector< float >> boundingBox)
write amount, chunksize and the bounding box in the hdf5 file
lvr2::MeshBufferPtr loadChunk(std::string chunkName)
load a mesh from a group with the given cellIndex
A dynamic bounding box class.
const std::string m_boundingBoxName
bool exist(const std::string &node_name) const
check a dataset or group exists in the current node / group
Group getGroup(const std::string &group_name) const
open an existing group with the name group_name
void writeVoxelSize(float voxelSize)
save reconstruction voxelsize in HDF5
BoundingBox< BaseVector< float > > loadBoundingBox()
loads and returns the bounding box for the complete original mesh (that got chunked) ...
float loadChunkSize()
loads and returns the chunksize
void writeChunk(lvr2::MeshBufferPtr mesh, size_t x, size_t y, size_t z)
write a mesh in a group with the given cellIndex
boost::shared_array< float > lsrLoadCenters(string chunkName)
loads and returns the centers for the cells/voxel in one chunk
boost::shared_array< float > lsrLoadQueryPoints(string chunkName)
loads and returns the Querypoint-distances for the cells/voxel of one chunk
const std::string m_chunkSizeName
Group createGroup(const std::string &group_name)
create a new group with the name group_name
size_t lsrLoadNumCells(string chunkName)
loads and returns the number of cells/voxel in the chunk
boost::shared_array< bool > lsrLoadExtruded(string chunkName)
load the extruded value for the cells/voxel of one chunk
const std::string m_amountName
HighFive::Group getGroup(std::shared_ptr< HighFive::File > hdf5_file, const std::string &groupName, bool create=true)
float readVoxelSize()
returns the voxelsize
const std::string m_chunkName