Medical Imaging Interaction Toolkit  2022.04.99-194dd5d8
Medical Imaging Interaction Toolkit
mitkLinearSplitting.h
Go to the documentation of this file.
1 /*============================================================================
2 
3 The Medical Imaging Interaction Toolkit (MITK)
4 
5 Copyright (c) German Cancer Research Center (DKFZ)
6 All rights reserved.
7 
8 Use of this source code is governed by a 3-clause BSD license that can be
9 found in the LICENSE file.
10 
11 ============================================================================*/
12 
13 #ifndef mitkLinearSplitting_h
14 #define mitkLinearSplitting_h
15 
16 #include <vigra/multi_array.hxx>
17 #include <vigra/random_forest.hxx>
18 #include <mitkAdditionalRFData.h>
19 
20 namespace mitk
21 {
22  template<class TLossAccumulator>
24  {
25  public:
26  typedef typename TLossAccumulator::WeightContainerType TWeightContainer;
27  typedef TWeightContainer WeightContainerType;
28 
30 
31  template <class T>
32  LinearSplitting(vigra::ProblemSpec<T> const &ext);
33 
34  void UsePointWeights(bool pointWeight);
35  bool IsUsingPointWeights();
36 
37  void UseRandomSplit(bool randomSplit);
38  bool IsUsingRandomSplit();
39 
40  void SetPointWeights(WeightContainerType weight);
41  WeightContainerType GetPointWeights();
42 
45 
46  template <class T>
47  void set_external_parameters(vigra::ProblemSpec<T> const &ext);
48 
49  template <class TDataSourceFeature,
50  class TDataSourceLabel,
51  class TDataIterator,
52  class TArray>
53  void operator()(TDataSourceFeature const &column,
54  TDataSourceLabel const &labels,
55  TDataIterator &begin,
56  TDataIterator &end,
57  TArray const &regionResponse);
58 
59  template <class TDataSourceLabel,
60  class TDataIterator,
61  class TArray>
62  double LossOfRegion(TDataSourceLabel const & labels,
63  TDataIterator &begin,
64  TDataIterator &end,
65  TArray const & regionResponse);
66 
67  double GetMinimumLoss()
68  {
69  return m_MinimumLoss;
70  }
71 
73  {
74  return m_MinimumThreshold;
75  }
76 
77  std::ptrdiff_t GetMinimumIndex()
78  {
79  return m_MinimumIndex;
80  }
81 
82  vigra::ArrayVector<double>* GetBestCurrentCounts()
83  {
84  return m_BestCurrentCounts;
85  }
86 
87  private:
88  bool m_UsePointWeights;
89  bool m_UseRandomSplit;
90  WeightContainerType m_PointWeights;
91  // From original code
92  vigra::ArrayVector<double> m_ClassWeights;
93  vigra::ArrayVector<double> m_BestCurrentCounts[2];
94  double m_MinimumLoss;
95  double m_MinimumThreshold;
96  std::ptrdiff_t m_MinimumIndex;
97  vigra::ProblemSpec<> m_ExtParameter;
98  AdditionalRFDataAbstract* m_AdditionalData;
99  };
100 }
101 
102 #include <../src/Splitter/mitkLinearSplitting.cpp>
103 #endif //mitkLinearSplitting_h
void operator()(TDataSourceFeature const &column, TDataSourceLabel const &labels, TDataIterator &begin, TDataIterator &end, TArray const &regionResponse)
void SetPointWeights(WeightContainerType weight)
AdditionalRFDataAbstract * GetAdditionalData() const
std::ptrdiff_t GetMinimumIndex()
void set_external_parameters(vigra::ProblemSpec< T > const &ext)
WeightContainerType GetPointWeights()
void UseRandomSplit(bool randomSplit)
void UsePointWeights(bool pointWeight)
DataCollection - Class to facilitate loading/accessing structured data.
void SetAdditionalData(AdditionalRFDataAbstract *data)
TLossAccumulator::WeightContainerType TWeightContainer
TWeightContainer WeightContainerType
vigra::ArrayVector< double > * GetBestCurrentCounts()
double LossOfRegion(TDataSourceLabel const &labels, TDataIterator &begin, TDataIterator &end, TArray const &regionResponse)