Medical Imaging Interaction Toolkit  2022.04.99-7b8c4c8a
Medical Imaging Interaction Toolkit
mitkThresholdSplit.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 mitkThresholdSplit_h
14 #define mitkThresholdSplit_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 TColumnDecisionFunctor, class TFeatureCalculator, class TTag = vigra::ClassificationTag>
23  class ThresholdSplit: public vigra::SplitBase<TTag>
24  {
25  public:
27 // ThresholdSplit(const ThresholdSplit & other);
28 
29  void SetFeatureCalculator(TFeatureCalculator processor);
30  TFeatureCalculator GetFeatureCalculator() const;
31 
32  void SetCalculatingFeature(bool calculate);
33  bool IsCalculatingFeature() const;
34 
35  void UsePointBasedWeights(bool weightsOn);
36  bool IsUsingPointBasedWeights() const;
37 
38  void UseRandomSplit(bool split) {m_UseRandomSplit = split;}
39  bool IsUsingRandomSplit() const { return m_UseRandomSplit; }
40 
41  void SetPrecision(double value);
42  double GetPrecision() const;
43 
44  void SetMaximumTreeDepth(int value);
45  int GetMaximumTreeDepth() const override;
46 
49 
50  void SetWeights(vigra::MultiArrayView<2, double> weights);
51  vigra::MultiArrayView<2, double> GetWeights() const;
52 
53  // From vigra::ThresholdSplit
54  double minGini() const;
55  int bestSplitColumn() const;
56  double bestSplitThreshold() const;
57 
58  template<class T>
59  void set_external_parameters(vigra::ProblemSpec<T> const & in);
60 
61  template<class T, class C, class T2, class C2, class Region, class Random>
62  int findBestSplit(vigra::MultiArrayView<2, T, C> features,
63  vigra::MultiArrayView<2, T2, C2> labels,
64  Region & region,
65  vigra::ArrayVector<Region>& childRegions,
66  Random & randint);
67 
68  double region_gini_;
69 
70  private:
71 
72  // From vigra::ThresholdSplit
73  typedef vigra::SplitBase<TTag> SB;
74 
75  // splitter parameters (used by copy constructor)
76  bool m_CalculatingFeature;
77  bool m_UseWeights;
78  bool m_UseRandomSplit;
79  double m_Precision;
80  int m_MaximumTreeDepth;
81  TFeatureCalculator m_FeatureCalculator;
82  vigra::MultiArrayView<2, double> m_Weights;
83 
84  // variabels to work with
85  vigra::ArrayVector<vigra::Int32> splitColumns;
86  TColumnDecisionFunctor bgfunc;
87  vigra::ArrayVector<double> min_gini_;
88  vigra::ArrayVector<std::ptrdiff_t> min_indices_;
89  vigra::ArrayVector<double> min_thresholds_;
90  int bestSplitIndex;
91  AdditionalRFDataAbstract* m_AdditionalData;
92 
93  };
94 }
95 
96 
97 #include <../src/Splitter/mitkThresholdSplit.cpp>
98 #endif //mitkThresholdSplit_h
mitk::ThresholdSplit::IsCalculatingFeature
bool IsCalculatingFeature() const
mitk::ThresholdSplit::SetMaximumTreeDepth
void SetMaximumTreeDepth(int value)
mitkAdditionalRFData.h
mitk::ThresholdSplit::region_gini_
double region_gini_
Definition: mitkThresholdSplit.h:68
mitk::ThresholdSplit::minGini
double minGini() const
mitk::ThresholdSplit::SetPrecision
void SetPrecision(double value)
mitk::ThresholdSplit::GetWeights
vigra::MultiArrayView< 2, double > GetWeights() const
mitk::ThresholdSplit::SetWeights
void SetWeights(vigra::MultiArrayView< 2, double > weights)
mitk::ThresholdSplit::GetAdditionalData
AdditionalRFDataAbstract * GetAdditionalData() const
mitk
DataCollection - Class to facilitate loading/accessing structured data.
Definition: RenderingTests.dox:1
mitk::ThresholdSplit::SetCalculatingFeature
void SetCalculatingFeature(bool calculate)
mitk::ThresholdSplit::SetAdditionalData
void SetAdditionalData(AdditionalRFDataAbstract *data)
mitk::AdditionalRFDataAbstract
Definition: mitkAdditionalRFData.h:21
mitk::ThresholdSplit::ThresholdSplit
ThresholdSplit()
mitk::ThresholdSplit::UseRandomSplit
void UseRandomSplit(bool split)
Definition: mitkThresholdSplit.h:38
mitk::ThresholdSplit::GetFeatureCalculator
TFeatureCalculator GetFeatureCalculator() const
mitk::ThresholdSplit::findBestSplit
int findBestSplit(vigra::MultiArrayView< 2, T, C > features, vigra::MultiArrayView< 2, T2, C2 > labels, Region &region, vigra::ArrayVector< Region > &childRegions, Random &randint)
mitk::ThresholdSplit::SetFeatureCalculator
void SetFeatureCalculator(TFeatureCalculator processor)
mitk::ThresholdSplit::IsUsingRandomSplit
bool IsUsingRandomSplit() const
Definition: mitkThresholdSplit.h:39
mitk::ThresholdSplit::bestSplitColumn
int bestSplitColumn() const
mitk::ThresholdSplit
Definition: mitkThresholdSplit.h:23
mitk::ThresholdSplit::UsePointBasedWeights
void UsePointBasedWeights(bool weightsOn)
mitk::ThresholdSplit::set_external_parameters
void set_external_parameters(vigra::ProblemSpec< T > const &in)
mitk::ThresholdSplit::GetMaximumTreeDepth
int GetMaximumTreeDepth() const override
mitk::ThresholdSplit::GetPrecision
double GetPrecision() const
mitk::ThresholdSplit::IsUsingPointBasedWeights
bool IsUsingPointBasedWeights() const
mitk::ThresholdSplit::bestSplitThreshold
double bestSplitThreshold() const