7 const std::string &group,
8 const std::string &container,
12 if(!boost::filesystem::exists(p.parent_path()))
14 boost::filesystem::create_directories(p.parent_path());
18 model->m_mesh = buffer;
19 std::cout <<
timestamp <<
"Directory Kernel::saveMeshBuffer(): " << p.string() << std::endl;
24 const std::string &group,
25 const std::string &container,
29 if(!boost::filesystem::exists(p.parent_path()))
31 boost::filesystem::create_directories(p.parent_path());
34 model->m_pointCloud = buffer;
35 std::cout <<
timestamp <<
"Directory Kernel::savePointBuffer(): " << p.string() << std::endl;
40 const std::string &group,
41 const std::string &container,
42 const cv::Mat &image)
const 45 if(!boost::filesystem::exists(p.parent_path()))
47 boost::filesystem::create_directories(p.parent_path());
49 std::cout <<
timestamp <<
"Directory Kernel::saveImage(): " << p.string() << std::endl;
51 cv::imwrite(p.string(), image);
55 const std::string &group,
56 const std::string &container,
57 const YAML::Node &node)
const 60 if(!boost::filesystem::exists(p.parent_path()))
62 boost::filesystem::create_directories(p.parent_path());
64 std::cout <<
timestamp <<
"Directory Kernel::saveMetaYAML(): " << p.string() << std::endl;
71 const std::string &group,
72 const std::string container)
const 75 std::cout <<
timestamp <<
"Directory Kernel::loadMeshBuffer(): " << p.string() << std::endl;
84 const std::string &group,
85 const std::string &container)
const 88 std::cout <<
timestamp <<
"Directory Kernel::loadPointBuffer(): " << p.string() << std::endl;
92 std::cout << model->m_pointCloud << std::endl;
93 std::cout << model->m_pointCloud->numPoints() << std::endl;
94 return model->m_pointCloud;
99 const std::string &group,
100 const std::string &container)
const 103 boost::optional<cv::Mat> opt;
104 std::cout <<
timestamp <<
"Directory Kernel::loadImage: " << p.string() << std::endl;
105 if(boost::filesystem::exists(p))
107 opt = cv::imread(p.string());
118 const std::string &group,
119 const std::string &container,
123 std::cout <<
timestamp <<
"Directory Kernel::loadMetaYAML: " << p.string() << std::endl;
146 boost::filesystem::directory_iterator it(groupPath);
147 while (it != boost::filesystem::directory_iterator{})
149 if (boost::filesystem::is_directory(*it))
151 subGroupNames.push_back(it->path().string());
159 boost::filesystem::directory_iterator it(groupPath);
160 while (it != boost::filesystem::directory_iterator{})
162 if (boost::filesystem::is_directory(*it))
164 std::string currentName = it->path().string();
165 if (std::regex_match(currentName, filter))
167 subGroupNames.push_back(currentName);
175 boost::filesystem::path groupPath(group);
176 boost::filesystem::path namePath(name);
178 boost::filesystem::path ret = rootPath / groupPath / namePath;
186 return loadArray<unsigned char>(group, container, dims);
191 return loadArray<float>(group, container, dims);
196 return loadArray<double>(group, container, dims);
199 void DirectoryKernel::saveFloatArray(
const std::string& groupName,
const std::string& datasetName,
const std::vector<size_t>& dimensions,
const boost::shared_array<float>& data)
const 201 saveArray<float>(groupName, datasetName, dimensions, data);
204 void DirectoryKernel::saveDoubleArray(
const std::string& groupName,
const std::string& datasetName,
const std::vector<size_t>& dimensions,
const boost::shared_array<double>& data)
const 206 saveArray<double>(groupName, datasetName, dimensions, data);
209 void DirectoryKernel::saveUCharArray(
const std::string& groupName,
const std::string& datasetName,
const std::vector<size_t>& dimensions,
const boost::shared_array<unsigned char>& data)
const 211 saveArray<unsigned char>(groupName, datasetName, dimensions, data);
virtual void saveFloatArray(const std::string &groupName, const std::string &datasetName, const std::vector< size_t > &dimensions, const boost::shared_array< float > &data) const
virtual ucharArr loadUCharArray(const std::string &group, const std::string &container, std::vector< size_t > &dims) const
std::shared_ptr< MeshBuffer > MeshBufferPtr
virtual doubleArr loadDoubleArray(const std::string &group, const std::string &container, std::vector< size_t > &dims) const
static Timestamp timestamp
A global time stamp object for program runtime measurement.
static ModelPtr readModel(std::string filename)
boost::shared_array< double > doubleArr
boost::filesystem::path getAbsolutePath(const std::string &group, const std::string &name) const
boost::shared_array< unsigned char > ucharArr
virtual void savePointBuffer(const std::string &group, const std::string &container, const PointBufferPtr &buffer) const
std::shared_ptr< PointBuffer > PointBufferPtr
virtual void saveMeshBuffer(const std::string &group, const std::string &container, const MeshBufferPtr &buffer) const
virtual void saveMetaYAML(const std::string &group, const std::string &metaName, const YAML::Node &node) const
virtual void subGroupNames(const std::string &group, std::vector< string > &subGroupNames) const
virtual void saveImage(const std::string &group, const std::string &container, const cv::Mat &image) const
boost::shared_array< float > floatArr
virtual void loadMetaYAML(const std::string &group, const std::string &container, YAML::Node &node) const
virtual PointBufferPtr loadPointBuffer(const std::string &group, const std::string &container) const
void filter(lvr2::PointBufferPtr &cloud, lvr2::indexArray &inlier, size_t j)
virtual bool exists(const std::string &group) const
std::shared_ptr< Model > ModelPtr
virtual void saveUCharArray(const std::string &groupName, const std::string &datasetName, const std::vector< size_t > &dimensions, const boost::shared_array< unsigned char > &data) const
YAML::Node loadMetaInformation(const std::string &in)
virtual floatArr loadFloatArray(const std::string &group, const std::string &container, std::vector< size_t > &dims) const
void saveMetaInformation(const std::string &outfile, const YAML::Node &node)
virtual void saveDoubleArray(const std::string &groupName, const std::string &datasetName, const std::vector< size_t > &dimensions, const boost::shared_array< double > &data) const
std::string m_fileResourceName
virtual MeshBufferPtr loadMeshBuffer(const std::string &group, const std::string container) const
static void saveModel(ModelPtr m, std::string file)
virtual boost::optional< cv::Mat > loadImage(const std::string &group, const std::string &container) const