Medical Imaging Interaction Toolkit  2018.4.99-389bf124
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);
51  WeightContainerType GetPointWeights();
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
void UsePointWeights(bool useWeights)
TLabelContainer LabelContainerType
vigra::ArrayVector< double > const & Response()
DataCollection - Class to facilitate loading/accessing structured data.
void SetPointWeights(TWeightContainer weight)
double Decrement(TDataIterator begin, TDataIterator end)
double Increment(TDataIterator begin, TDataIterator end)
WeightContainerType GetPointWeights()
double Init(TArray initCounts)
TWeightContainer WeightContainerType
ImpurityLoss(TLabelContainer const &labels, vigra::ProblemSpec< T > const &ext, AdditionalRFDataAbstract *data)