Medical Imaging Interaction Toolkit  2016.11.0
Medical Imaging Interaction Toolkit
mitkThresholdSplit.h
Go to the documentation of this file.
1 #ifndef mitkThresholdSplit_h
2 #define mitkThresholdSplit_h
3 
4 #include <vigra/multi_array.hxx>
5 #include <vigra/random_forest.hxx>
6 
7 namespace mitk
8 {
9  template<class TColumnDecisionFunctor, class TFeatureCalculator, class TTag = vigra::ClassificationTag>
10  class ThresholdSplit: public vigra::SplitBase<TTag>
11  {
12  public:
14 // ThresholdSplit(const ThresholdSplit & other);
15 
16  void SetFeatureCalculator(TFeatureCalculator processor);
17  TFeatureCalculator GetFeatureCalculator() const;
18 
19  void SetCalculatingFeature(bool calculate);
20  bool IsCalculatingFeature() const;
21 
22  void UsePointBasedWeights(bool weightsOn);
23  bool IsUsingPointBasedWeights() const;
24 
25  void UseRandomSplit(bool split) {m_UseRandomSplit = split;}
26  bool IsUsingRandomSplit() const { return m_UseRandomSplit; }
27 
28  void SetPrecision(double value);
29  double GetPrecision() const;
30 
31  void SetMaximumTreeDepth(int value);
32  virtual int GetMaximumTreeDepth() const;
33 
34  void SetWeights(vigra::MultiArrayView<2, double> weights);
35  vigra::MultiArrayView<2, double> GetWeights() const;
36 
37  // From vigra::ThresholdSplit
38  double minGini() const;
39  int bestSplitColumn() const;
40  double bestSplitThreshold() const;
41 
42  template<class T>
43  void set_external_parameters(vigra::ProblemSpec<T> const & in);
44 
45  template<class T, class C, class T2, class C2, class Region, class Random>
46  int findBestSplit(vigra::MultiArrayView<2, T, C> features,
47  vigra::MultiArrayView<2, T2, C2> labels,
48  Region & region,
49  vigra::ArrayVector<Region>& childRegions,
50  Random & randint);
51 
52  double region_gini_;
53 
54  private:
55 
56  // From vigra::ThresholdSplit
57  typedef vigra::SplitBase<TTag> SB;
58 
59  // splitter parameters (used by copy constructor)
60  bool m_CalculatingFeature;
61  bool m_UseWeights;
62  bool m_UseRandomSplit;
63  double m_Precision;
64  int m_MaximumTreeDepth;
65  TFeatureCalculator m_FeatureCalculator;
66  vigra::MultiArrayView<2, double> m_Weights;
67 
68  // variabels to work with
69  vigra::ArrayVector<vigra::Int32> splitColumns;
70  TColumnDecisionFunctor bgfunc;
71  vigra::ArrayVector<double> min_gini_;
72  vigra::ArrayVector<std::ptrdiff_t> min_indices_;
73  vigra::ArrayVector<double> min_thresholds_;
74  int bestSplitIndex;
75 
76  };
77 }
78 
79 
80 #include <../src/Splitter/mitkThresholdSplit.cpp>
81 #endif //mitkThresholdSplit_h
bool IsUsingPointBasedWeights() const
void SetFeatureCalculator(TFeatureCalculator processor)
void set_external_parameters(vigra::ProblemSpec< T > const &in)
void UseRandomSplit(bool split)
vigra::MultiArrayView< 2, double > GetWeights() const
TFeatureCalculator GetFeatureCalculator() const
virtual int GetMaximumTreeDepth() const
DataCollection - Class to facilitate loading/accessing structured data.
void UsePointBasedWeights(bool weightsOn)
double GetPrecision() const
double bestSplitThreshold() const
void SetWeights(vigra::MultiArrayView< 2, double > weights)
void SetPrecision(double value)
void SetMaximumTreeDepth(int value)
static bool in(Reader::Char c, Reader::Char c1, Reader::Char c2, Reader::Char c3, Reader::Char c4)
Definition: jsoncpp.cpp:244
const char features[]
void SetCalculatingFeature(bool calculate)
bool IsUsingRandomSplit() const
static std::vector< std::string > & split(const std::string &s, char delim, std::vector< std::string > &elems)
int findBestSplit(vigra::MultiArrayView< 2, T, C > features, vigra::MultiArrayView< 2, T2, C2 > labels, Region &region, vigra::ArrayVector< Region > &childRegions, Random &randint)
bool IsCalculatingFeature() const