Medical Imaging Interaction Toolkit  2016.11.0
Medical Imaging Interaction Toolkit
mitkAbstractClassifier.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,
6 Division of Medical and Biological Informatics.
7 All rights reserved.
8 
9 This software is distributed WITHOUT ANY WARRANTY; without
10 even the implied warranty of MERCHANTABILITY or FITNESS FOR
11 A PARTICULAR PURPOSE.
12 
13 See LICENSE.txt or http://www.mitk.org for details.
14 
15 ===================================================================*/
16 
17 
18 #ifndef mitkAbstractClassifier_h
19 #define mitkAbstractClassifier_h
20 
21 #include <MitkCLCoreExports.h>
22 
23 
24 #include <mitkBaseData.h>
25 
26 // Eigen
27 #include <Eigen/Dense>
28 
29 // STD Includes
30 
31 // MITK includes
33 
34 namespace mitk
35 {
37 {
38 public:
39 
41 
42 
43  virtual void Train(const Eigen::MatrixXd &X, const Eigen::MatrixXi &Y) = 0;
48 
54  virtual Eigen::MatrixXi Predict(const Eigen::MatrixXd &X) = 0;
55 
60  Eigen::MatrixXi & GetLabels()
61  {
62  return m_OutLabel;
63  }
64 
65 protected:
66  Eigen::MatrixXi m_OutLabel;
67 
68 
69 public:
70  // * --------------- *
71  // PointWiseWeight
72  // * --------------- *
73 
78  virtual bool SupportsPointWiseWeight() = 0;
79 
84  virtual Eigen::MatrixXd & GetPointWiseWeight()
85  {
86  return m_PointWiseWeight;
87  }
88 
93  virtual void SetPointWiseWeight(const Eigen::MatrixXd& W)
94  {
95  this->m_PointWiseWeight = W;
96  }
97 
102  virtual void UsePointWiseWeight(bool value)
103  {
104  this->m_IsUsingPointWiseWeight = value;
105  }
106 
111  virtual bool IsUsingPointWiseWeight()
112  {
113  return this->m_IsUsingPointWiseWeight;
114  }
115 
116 protected:
117  Eigen::MatrixXd m_PointWiseWeight;
119 
120  // * --------------- *
121  // PointWiseProbabilities
122  // * --------------- *
123 
124 public:
129  virtual bool SupportsPointWiseProbability() = 0;
130 
135  virtual Eigen::MatrixXd & GetPointWiseProbabilities()
136  {
137  return m_OutProbability;
138  }
139 
144  virtual void UsePointWiseProbability(bool value)
145  {
146  m_IsUsingPointWiseProbability = value;
147  }
148 
154  {
155  return m_IsUsingPointWiseProbability;
156  }
157 
158 protected:
159  Eigen::MatrixXd m_OutProbability;
161 
162 private:
163  void MethodForBuild();
164 
165 public:
166 
167 
168  void SetNthItems(const char *val, unsigned int idx);
169  std::string GetNthItems(unsigned int idx) const;
170 
171  void SetItemList(std::vector<std::string>);
172  std::vector<std::string> GetItemList() const;
173 
174 #ifndef DOXYGEN_SKIP
175 
177  virtual bool RequestedRegionIsOutsideOfTheBufferedRegion(){return true;}
178  virtual bool VerifyRequestedRegion(){return false;}
179 
180  virtual void SetRequestedRegion(const itk::DataObject* /*data*/){}
181 
182 
183  // Override
184  virtual bool IsEmpty() const override
185  {
186  if(IsInitialized() == false)
187  return true;
188  const TimeGeometry* timeGeometry = const_cast<AbstractClassifier*>(this)->GetUpdatedTimeGeometry();
189  if(timeGeometry == NULL)
190  return true;
191  return false;
192  }
193 
194 #endif // Skip Doxygen
195 
196 };
197 }
198 
199 #endif //mitkAbstractClassifier_h
virtual bool RequestedRegionIsOutsideOfTheBufferedRegion()
Determine whether the RequestedRegion is outside of the BufferedRegion.
virtual bool IsUsingPointWiseWeight()
IsUsingPointWiseWeight.
Base of all data objects.
Definition: mitkBaseData.h:39
DataCollection - Class to facilitate loading/accessing structured data.
Eigen::MatrixXi & GetLabels()
GetPointWiseWeightCopy.
#define MITKCLCORE_EXPORT
virtual void SetRequestedRegion(const itk::DataObject *)
Set the requested region from this data object to match the requested region of the data object passe...
virtual bool IsEmpty() const override
Check whether object contains data (at least at one point in time), e.g., a set of points may be empt...
virtual Eigen::MatrixXd & GetPointWiseWeight()
GetPointWiseWeightCopy.
virtual bool VerifyRequestedRegion()
Verify that the RequestedRegion is within the LargestPossibleRegion.
#define mitkClassMacro(className, SuperClassName)
Definition: mitkCommon.h:44
virtual void SetRequestedRegionToLargestPossibleRegion()
Set the RequestedRegion to the LargestPossibleRegion.
virtual void UsePointWiseWeight(bool value)
UsePointWiseWeight.
virtual Eigen::MatrixXd & GetPointWiseProbabilities()
GetPointWiseWeightCopy.
virtual void UsePointWiseProbability(bool value)
UsePointWiseProbabilities.
virtual void SetPointWiseWeight(const Eigen::MatrixXd &W)
SetPointWiseWeight.
virtual bool IsUsingPointWiseProbability()
IsUsingPointWiseProbabilities.