Medical Imaging Interaction Toolkit  2024.06.00
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 <itkeigen/Eigen/Dense>
24 
25 // STD Includes
26 
27 // MITK includes
29 
30 namespace mitk
31 {
33 {
34 public:
35 
37 
43  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
mitk::AbstractClassifier::SetRequestedRegionToLargestPossibleRegion
void SetRequestedRegionToLargestPossibleRegion() override
Set the RequestedRegion to the LargestPossibleRegion.
Definition: mitkAbstractClassifier.h:172
mitk::AbstractClassifier::SetRequestedRegion
void SetRequestedRegion(const itk::DataObject *) override
Set the requested region from this data object to match the requested region of the data object passe...
Definition: mitkAbstractClassifier.h:176
mitk::AbstractClassifier::SetPointWiseWeight
virtual void SetPointWiseWeight(const Eigen::MatrixXd &W)
SetPointWiseWeight.
Definition: mitkAbstractClassifier.h:89
mitk::TimeGeometry
Definition: mitkTimeGeometry.h:45
mitk::AbstractClassifier::IsEmpty
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...
Definition: mitkAbstractClassifier.h:180
mitk::AbstractClassifier::VerifyRequestedRegion
bool VerifyRequestedRegion() override
Verify that the RequestedRegion is within the LargestPossibleRegion.
Definition: mitkAbstractClassifier.h:174
mitk::AbstractClassifier::m_PointWiseWeight
Eigen::MatrixXd m_PointWiseWeight
Definition: mitkAbstractClassifier.h:113
mitk::AbstractClassifier::GetPointWiseProbabilities
virtual Eigen::MatrixXd & GetPointWiseProbabilities()
GetPointWiseWeightCopy.
Definition: mitkAbstractClassifier.h:131
mitk::AbstractClassifier::GetLabels
Eigen::MatrixXi & GetLabels()
GetPointWiseWeightCopy.
Definition: mitkAbstractClassifier.h:56
MITKCLCORE_EXPORT
#define MITKCLCORE_EXPORT
Definition: MitkCLCoreExports.h:15
mitk::AbstractClassifier::m_OutProbability
Eigen::MatrixXd m_OutProbability
Definition: mitkAbstractClassifier.h:155
mitk::AbstractClassifier::UsePointWiseWeight
virtual void UsePointWiseWeight(bool value)
UsePointWiseWeight.
Definition: mitkAbstractClassifier.h:98
mitk
Find image slices visible on a given plane.
Definition: RenderingTests.dox:1
mitk::AbstractClassifier::m_OutLabel
Eigen::MatrixXi m_OutLabel
Definition: mitkAbstractClassifier.h:62
mitk::AbstractClassifier::IsUsingPointWiseWeight
virtual bool IsUsingPointWiseWeight()
IsUsingPointWiseWeight.
Definition: mitkAbstractClassifier.h:107
mitk::AbstractClassifier::m_IsUsingPointWiseProbability
bool m_IsUsingPointWiseProbability
Definition: mitkAbstractClassifier.h:156
mitk::BaseData
Base of all data objects.
Definition: mitkBaseData.h:42
mitkConfigurationHolder.h
MitkCLCoreExports.h
mitk::AbstractClassifier
Definition: mitkAbstractClassifier.h:32
mitkBaseData.h
mitk::AbstractClassifier::UsePointWiseProbability
virtual void UsePointWiseProbability(bool value)
UsePointWiseProbabilities.
Definition: mitkAbstractClassifier.h:140
mitkClassMacro
#define mitkClassMacro(className, SuperClassName)
Definition: mitkCommon.h:36
mitk::AbstractClassifier::m_IsUsingPointWiseWeight
bool m_IsUsingPointWiseWeight
Definition: mitkAbstractClassifier.h:114
mitk::AbstractClassifier::GetPointWiseWeight
virtual Eigen::MatrixXd & GetPointWiseWeight()
GetPointWiseWeightCopy.
Definition: mitkAbstractClassifier.h:80
mitk::AbstractClassifier::RequestedRegionIsOutsideOfTheBufferedRegion
bool RequestedRegionIsOutsideOfTheBufferedRegion() override
Determine whether the RequestedRegion is outside of the BufferedRegion.
Definition: mitkAbstractClassifier.h:173
mitk::AbstractClassifier::IsUsingPointWiseProbability
virtual bool IsUsingPointWiseProbability()
IsUsingPointWiseProbabilities.
Definition: mitkAbstractClassifier.h:149