curfil  ..
 All Classes Functions Variables Typedefs Friends Groups Pages
import.h
1 #ifndef CURFIL_IMPORT_HPP
2 #define CURFIL_IMPORT_HPP
3 
4 #include <boost/date_time/posix_time/posix_time.hpp>
5 #include <boost/filesystem.hpp>
6 #include <boost/property_tree/ptree.hpp>
7 #include <string>
8 
9 #include "random_forest_image.h"
10 
11 namespace curfil {
12 
20 
21 
22 public:
23 
27  static TrainingConfiguration readJSON(const std::string& filename, boost::shared_ptr<RandomTreeImage>& tree,
28  std::string& hostname,
29  boost::filesystem::path& folderTraining,
30  boost::posix_time::ptime& date);
31 
32 private:
33 
34  static XY readXY(const boost::property_tree::ptree& pt);
35 
36  static SplitFunction<PixelInstance, ImageFeatureFunction> parseSplit(const boost::property_tree::ptree& pt);
37 
38  static boost::shared_ptr<RandomTree<PixelInstance, ImageFeatureFunction> > readTree(
39  const boost::property_tree::ptree& pt,
40  const boost::shared_ptr<RandomTree<PixelInstance, ImageFeatureFunction> >& parent = boost::shared_ptr<
42 
43  template<class T>
44  static std::vector<T> fromPropertyTree(const boost::optional<boost::property_tree::ptree&>& propertyTree,
45  const std::vector<T> defaultValue = std::vector<T>()) {
46 
47  std::vector<T> values = defaultValue;
48 
49  if (propertyTree) {
50  boost::property_tree::ptree::const_iterator it;
51  for (it = propertyTree.get().begin(); it != propertyTree.get().end(); it++) {
52  values.push_back(it->second.get_value<T>());
53  }
54  }
55 
56  return values;
57  }
58 
59  static cuv::ndarray<WeightType, cuv::host_memory_space> readClassLabelPriorDistribution(
60  const boost::property_tree::ptree& p);
61 
62 };
63 
64 }
65 
66 #endif