Medical Imaging Interaction Toolkit  2016.11.0
Medical Imaging Interaction Toolkit
mitkLinearSplitting.h
Go to the documentation of this file.
1 #ifndef mitkLinearSplitting_h
2 #define mitkLinearSplitting_h
3 
4 #include <vigra/multi_array.hxx>
5 #include <vigra/random_forest.hxx>
6 
7 namespace mitk
8 {
9  template<class TLossAccumulator>
11  {
12  public:
13  typedef typename TLossAccumulator::WeightContainerType TWeightContainer;
14  typedef TWeightContainer WeightContainerType;
15 
17 
18  template <class T>
19  LinearSplitting(vigra::ProblemSpec<T> const &ext);
20 
21  void UsePointWeights(bool pointWeight);
22  bool IsUsingPointWeights();
23 
24  void UseRandomSplit(bool randomSplit);
25  bool IsUsingRandomSplit();
26 
27  void SetPointWeights(WeightContainerType weight);
28  WeightContainerType GetPointWeights();
29 
30  template <class T>
31  void set_external_parameters(vigra::ProblemSpec<T> const &ext);
32 
33  template <class TDataSourceFeature,
34  class TDataSourceLabel,
35  class TDataIterator,
36  class TArray>
37  void operator()(TDataSourceFeature const &column,
38  TDataSourceLabel const &labels,
39  TDataIterator &begin,
40  TDataIterator &end,
41  TArray const &regionResponse);
42 
43  template <class TDataSourceLabel,
44  class TDataIterator,
45  class TArray>
46  double LossOfRegion(TDataSourceLabel const & labels,
47  TDataIterator &begin,
48  TDataIterator &end,
49  TArray const & regionResponse);
50 
51  double GetMinimumLoss()
52  {
53  return m_MinimumLoss;
54  }
55 
57  {
58  return m_MinimumThreshold;
59  }
60 
61  std::ptrdiff_t GetMinimumIndex()
62  {
63  return m_MinimumIndex;
64  }
65 
66  vigra::ArrayVector<double>* GetBestCurrentCounts()
67  {
68  return m_BestCurrentCounts;
69  }
70 
71  private:
72  bool m_UsePointWeights;
73  bool m_UseRandomSplit;
74  WeightContainerType m_PointWeights;
75  // From original code
76  vigra::ArrayVector<double> m_ClassWeights;
77  vigra::ArrayVector<double> m_BestCurrentCounts[2];
78  double m_MinimumLoss;
79  double m_MinimumThreshold;
80  std::ptrdiff_t m_MinimumIndex;
81  vigra::ProblemSpec<> m_ExtParameter;
82  };
83 }
84 
85 #include <../src/Splitter/mitkLinearSplitting.cpp>
86 #endif //mitkLinearSplitting_h
void operator()(TDataSourceFeature const &column, TDataSourceLabel const &labels, TDataIterator &begin, TDataIterator &end, TArray const &regionResponse)
void SetPointWeights(WeightContainerType weight)
std::ptrdiff_t GetMinimumIndex()
void set_external_parameters(vigra::ProblemSpec< T > const &ext)
void UseRandomSplit(bool randomSplit)
void UsePointWeights(bool pointWeight)
DataCollection - Class to facilitate loading/accessing structured data.
WeightContainerType GetPointWeights()
TLossAccumulator::WeightContainerType TWeightContainer
TWeightContainer WeightContainerType
vigra::ArrayVector< double > * GetBestCurrentCounts()
double LossOfRegion(TDataSourceLabel const &labels, TDataIterator &begin, TDataIterator &end, TArray const &regionResponse)