Medical Imaging Interaction Toolkit  2023.04.00
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;
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 
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
mitk::LinearSplitting::GetMinimumThreshold
double GetMinimumThreshold()
Definition: mitkLinearSplitting.h:72
mitkAdditionalRFData.h
mitk::LinearSplitting::IsUsingPointWeights
bool IsUsingPointWeights()
mitk::LinearSplitting::GetAdditionalData
AdditionalRFDataAbstract * GetAdditionalData() const
mitk::LinearSplitting::GetMinimumLoss
double GetMinimumLoss()
Definition: mitkLinearSplitting.h:67
mitk
DataCollection - Class to facilitate loading/accessing structured data.
Definition: RenderingTests.dox:1
mitk::LinearSplitting::GetBestCurrentCounts
vigra::ArrayVector< double > * GetBestCurrentCounts()
Definition: mitkLinearSplitting.h:82
mitk::LinearSplitting::GetPointWeights
WeightContainerType GetPointWeights()
mitk::LinearSplitting::SetAdditionalData
void SetAdditionalData(AdditionalRFDataAbstract *data)
mitk::AdditionalRFDataAbstract
Definition: mitkAdditionalRFData.h:21
mitk::LinearSplitting::LinearSplitting
LinearSplitting()
mitk::LinearSplitting::set_external_parameters
void set_external_parameters(vigra::ProblemSpec< T > const &ext)
mitk::LinearSplitting::operator()
void operator()(TDataSourceFeature const &column, TDataSourceLabel const &labels, TDataIterator &begin, TDataIterator &end, TArray const &regionResponse)
mitk::LinearSplitting::GetMinimumIndex
std::ptrdiff_t GetMinimumIndex()
Definition: mitkLinearSplitting.h:77
mitk::LinearSplitting::SetPointWeights
void SetPointWeights(WeightContainerType weight)
mitk::LinearSplitting::UseRandomSplit
void UseRandomSplit(bool randomSplit)
mitk::LinearSplitting::LossOfRegion
double LossOfRegion(TDataSourceLabel const &labels, TDataIterator &begin, TDataIterator &end, TArray const &regionResponse)
mitk::LinearSplitting::WeightContainerType
TWeightContainer WeightContainerType
Definition: mitkLinearSplitting.h:27
mitk::LinearSplitting
Definition: mitkLinearSplitting.h:23
mitk::LinearSplitting::UsePointWeights
void UsePointWeights(bool pointWeight)
mitk::LinearSplitting::IsUsingRandomSplit
bool IsUsingRandomSplit()
mitk::LinearSplitting::TWeightContainer
TLossAccumulator::WeightContainerType TWeightContainer
Definition: mitkLinearSplitting.h:26