Medical Imaging Interaction Toolkit  2018.4.99-12ad79a3
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 (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 
14 #ifndef mitkAbstractClassifier_h
15 #define mitkAbstractClassifier_h
16 
17 #include <MitkCLCoreExports.h>
18 
19 
20 #include <mitkBaseData.h>
21 
22 // Eigen
23 #include <Eigen/Dense>
24 
25 // STD Includes
26 
27 // MITK includes
29 
30 namespace mitk
31 {
33 {
34 public:
35 
37 
38 
39  virtual void Train(const Eigen::MatrixXd &X, const Eigen::MatrixXi &Y) = 0;
44 
50  virtual Eigen::MatrixXi Predict(const Eigen::MatrixXd &X) = 0;
51 
56  Eigen::MatrixXi & GetLabels()
57  {
58  return m_OutLabel;
59  }
60 
61 protected:
62  Eigen::MatrixXi m_OutLabel;
63 
64 
65 public:
66  // * --------------- *
67  // PointWiseWeight
68  // * --------------- *
69 
74  virtual bool SupportsPointWiseWeight() = 0;
75 
80  virtual Eigen::MatrixXd & GetPointWiseWeight()
81  {
82  return m_PointWiseWeight;
83  }
84 
89  virtual void SetPointWiseWeight(const Eigen::MatrixXd& W)
90  {
91  this->m_PointWiseWeight = W;
92  }
93 
98  virtual void UsePointWiseWeight(bool value)
99  {
100  this->m_IsUsingPointWiseWeight = value;
101  }
102 
107  virtual bool IsUsingPointWiseWeight()
108  {
109  return this->m_IsUsingPointWiseWeight;
110  }
111 
112 protected:
113  Eigen::MatrixXd m_PointWiseWeight;
115 
116  // * --------------- *
117  // PointWiseProbabilities
118  // * --------------- *
119 
120 public:
125  virtual bool SupportsPointWiseProbability() = 0;
126 
131  virtual Eigen::MatrixXd & GetPointWiseProbabilities()
132  {
133  return m_OutProbability;
134  }
135 
140  virtual void UsePointWiseProbability(bool value)
141  {
142  m_IsUsingPointWiseProbability = value;
143  }
144 
150  {
151  return m_IsUsingPointWiseProbability;
152  }
153 
154 protected:
155  Eigen::MatrixXd m_OutProbability;
157 
158 private:
159  void MethodForBuild();
160 
161 public:
162 
163 
164  void SetNthItems(const char *val, unsigned int idx);
165  std::string GetNthItems(unsigned int idx) const;
166 
167  void SetItemList(std::vector<std::string>);
168  std::vector<std::string> GetItemList() const;
169 
170 #ifndef DOXYGEN_SKIP
171 
173  bool RequestedRegionIsOutsideOfTheBufferedRegion() override{return true;}
174  bool VerifyRequestedRegion() override{return false;}
175 
176  void SetRequestedRegion(const itk::DataObject* /*data*/) override{}
177 
178 
179  // Override
180  bool IsEmpty() const override
181  {
182  if(IsInitialized() == false)
183  return true;
184  const TimeGeometry* timeGeometry = const_cast<AbstractClassifier*>(this)->GetUpdatedTimeGeometry();
185  if(timeGeometry == nullptr)
186  return true;
187  return false;
188  }
189 
190 #endif // Skip Doxygen
191 
192 };
193 }
194 
195 #endif //mitkAbstractClassifier_h
virtual bool IsUsingPointWiseWeight()
IsUsingPointWiseWeight.
Base of all data objects.
Definition: mitkBaseData.h:37
DataCollection - Class to facilitate loading/accessing structured data.
Eigen::MatrixXi & GetLabels()
GetPointWiseWeightCopy.
#define MITKCLCORE_EXPORT
virtual Eigen::MatrixXd & GetPointWiseWeight()
GetPointWiseWeightCopy.
#define mitkClassMacro(className, SuperClassName)
Definition: mitkCommon.h:40
bool VerifyRequestedRegion() override
Verify that the RequestedRegion is within the LargestPossibleRegion.
virtual void UsePointWiseWeight(bool value)
UsePointWiseWeight.
virtual Eigen::MatrixXd & GetPointWiseProbabilities()
GetPointWiseWeightCopy.
void SetRequestedRegionToLargestPossibleRegion() override
Set the RequestedRegion to the LargestPossibleRegion.
void SetRequestedRegion(const itk::DataObject *) override
Set the requested region from this data object to match the requested region of the data object passe...
virtual void UsePointWiseProbability(bool value)
UsePointWiseProbabilities.
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 void SetPointWiseWeight(const Eigen::MatrixXd &W)
SetPointWiseWeight.
virtual bool IsUsingPointWiseProbability()
IsUsingPointWiseProbabilities.
bool RequestedRegionIsOutsideOfTheBufferedRegion() override
Determine whether the RequestedRegion is outside of the BufferedRegion.