Medical Imaging Interaction Toolkit  2022.04.99-7b8c4c8a
Medical Imaging Interaction Toolkit
mitkImpurityLoss.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 mitkImpurityLoss_h
14 #define mitkImpurityLoss_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 TLossFunction = vigra::GiniCriterion, class TLabelContainer = vigra::MultiArrayView<2, int>, class TWeightContainer = vigra::MultiArrayView<2, double> >
24  {
25  public:
26  typedef TLabelContainer LabelContainerType;
27  typedef TWeightContainer WeightContainerType;
28 
29  template <class T>
30  ImpurityLoss(TLabelContainer const &labels,
31  vigra::ProblemSpec<T> const &ext,
33 
34  void Reset();
35 
36  template <class TDataIterator>
37  double Increment(TDataIterator begin, TDataIterator end);
38 
39  template <class TDataIterator>
40  double Decrement(TDataIterator begin, TDataIterator end);
41 
42  template <class TArray>
43  double Init(TArray initCounts);
44 
45  vigra::ArrayVector<double> const& Response();
46 
47  void UsePointWeights(bool useWeights);
48  bool IsUsingPointWeights();
49 
50  void SetPointWeights(TWeightContainer weight);
52 
53  private:
54  bool m_UsePointWeights;
55  TWeightContainer m_PointWeights;
56 
57  //Variable of origin
58  TLabelContainer const& m_Labels;
59  vigra::ArrayVector<double> m_Counts;
60  vigra::ArrayVector<double> m_ClassWeights;
61  double m_TotalCount;
62  TLossFunction m_LossFunction;
63  };
64 
65 }
66 
67 #include <../src/Splitter/mitkImpurityLoss.cpp>
68 
69 #endif //mitkImpurityLoss_h
mitk::ImpurityLoss::LabelContainerType
TLabelContainer LabelContainerType
Definition: mitkImpurityLoss.h:26
mitk::ImpurityLoss::Response
vigra::ArrayVector< double > const & Response()
mitkAdditionalRFData.h
mitk::ImpurityLoss::IsUsingPointWeights
bool IsUsingPointWeights()
mitk::ImpurityLoss::SetPointWeights
void SetPointWeights(TWeightContainer weight)
mitk
DataCollection - Class to facilitate loading/accessing structured data.
Definition: RenderingTests.dox:1
mitk::ImpurityLoss::ImpurityLoss
ImpurityLoss(TLabelContainer const &labels, vigra::ProblemSpec< T > const &ext, AdditionalRFDataAbstract *data)
mitk::AdditionalRFDataAbstract
Definition: mitkAdditionalRFData.h:21
mitk::ImpurityLoss::Init
double Init(TArray initCounts)
mitk::ImpurityLoss::Reset
void Reset()
mitk::ImpurityLoss::WeightContainerType
TWeightContainer WeightContainerType
Definition: mitkImpurityLoss.h:27
mitk::ImpurityLoss
Definition: mitkImpurityLoss.h:23
mitk::ImpurityLoss::Decrement
double Decrement(TDataIterator begin, TDataIterator end)
mitk::ImpurityLoss::GetPointWeights
WeightContainerType GetPointWeights()
mitk::ImpurityLoss::Increment
double Increment(TDataIterator begin, TDataIterator end)
mitk::ImpurityLoss::UsePointWeights
void UsePointWeights(bool useWeights)