Medical Imaging Interaction Toolkit  2018.4.99-12ad79a3
Medical Imaging Interaction Toolkit
mitkAbstractGlobalImageFeature.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 mitkAbstractGlobalImageFeature_h
15 #define mitkAbstractGlobalImageFeature_h
16 
17 #include <MitkCLCoreExports.h>
18 
19 #include <mitkBaseData.h>
20 #include <mitkImage.h>
21 
22 #include <mitkCommandLineParser.h>
23 
25 
26 // STD Includes
27 
28 // Eigen
29 #include <Eigen/Dense>
30 
31 // MITK includes
33 
34 namespace mitk
35 {
125 {
126 public:
128 
129  typedef std::vector< std::pair<std::string, double> > FeatureListType;
130  typedef std::vector< std::string> FeatureNameListType;
131  typedef std::map<std::string, us::Any> ParameterTypes;
132 
136  virtual FeatureListType CalculateFeatures(const Image::Pointer & feature, const Image::Pointer &mask) = 0;
137 
141  FeatureListType CalculateFeaturesSlicewise(const Image::Pointer & feature, const Image::Pointer &mask, int sliceID);
142 
146  virtual void CalculateFeaturesSliceWiseUsingParameters(const Image::Pointer & feature, const Image::Pointer &mask, int sliceID, FeatureListType &featureList);
147 
151  virtual void CalculateFeaturesUsingParameters(const Image::Pointer & feature, const Image::Pointer &mask, const Image::Pointer &maskNoNAN, FeatureListType &featureList) = 0;
152 
156  virtual FeatureNameListType GetFeatureNames() = 0;
157 
161  virtual std::string GetCurrentFeatureEncoding();
162 
171  std::string FeatureDescriptionPrefix();
172 
173  itkSetMacro(Prefix, std::string);
174  itkSetMacro(ShortName, std::string);
175  itkSetMacro(LongName, std::string);
176  itkSetMacro(FeatureClassName, std::string);
177  itkSetMacro(Direction, int);
178  void SetParameter(ParameterTypes param) { m_Parameter=param; };
179 
180  itkGetConstMacro(Prefix, std::string);
181  itkGetConstMacro(ShortName, std::string);
182  itkGetConstMacro(LongName, std::string);
183  itkGetConstMacro(FeatureClassName, std::string);
184  itkGetConstMacro(Parameter, ParameterTypes);
185 
186  itkSetMacro(UseQuantifier, bool);
187  itkGetConstMacro(UseQuantifier, bool);
188  itkSetMacro(Quantifier, IntensityQuantifier::Pointer);
189  itkGetMacro(Quantifier, IntensityQuantifier::Pointer);
190 
191  itkGetConstMacro(Direction, int);
192 
193  itkSetMacro(MinimumIntensity, double);
194  itkSetMacro(UseMinimumIntensity, bool);
195  itkSetMacro(MaximumIntensity, double);
196  itkSetMacro(UseMaximumIntensity, bool);
197  itkGetConstMacro(MinimumIntensity, double);
198  itkGetConstMacro(UseMinimumIntensity, bool);
199  itkGetConstMacro(MaximumIntensity, double);
200  itkGetConstMacro(UseMaximumIntensity, bool);
201 
202 
203  itkSetMacro(Binsize, double);
204  itkSetMacro(UseBinsize, bool);
205  itkGetConstMacro(Binsize, double);
206  itkGetConstMacro(UseBinsize, bool);
207 
208  itkSetMacro(MorphMask, mitk::Image::Pointer);
209  itkGetConstMacro(MorphMask, mitk::Image::Pointer);
210 
211  itkSetMacro(Bins, int);
212  itkSetMacro(UseBins, bool);
213  itkGetConstMacro(UseBins, bool);
214  itkGetConstMacro(Bins, int);
215 
216  itkSetMacro(IgnoreMask, bool);
217  itkGetConstMacro(IgnoreMask, bool);
218 
219  itkSetMacro(EncodeParameters, bool);
220  itkGetConstMacro(EncodeParameters, bool);
221 
222  std::string GetOptionPrefix() const
223  {
224  if (m_Prefix.length() > 0)
225  return m_Prefix + "::" + m_ShortName;
226  return m_ShortName;
227 
228  }
229 
230  virtual void AddArguments(mitkCommandLineParser &parser) = 0;
231  std::vector<double> SplitDouble(std::string str, char delimiter);
232 
233  void AddQuantifierArguments(mitkCommandLineParser &parser);
234  void InitializeQuantifierFromParameters(const Image::Pointer & feature, const Image::Pointer &mask,unsigned int defaultBins = 256);
235  void InitializeQuantifier(const Image::Pointer & feature, const Image::Pointer &mask, unsigned int defaultBins = 256);
236  std::string QuantifierParameterString();
237 
238 public:
239 
240 //#ifndef DOXYGEN_SKIP
241 
243  bool RequestedRegionIsOutsideOfTheBufferedRegion() override { return true; };
244  bool VerifyRequestedRegion() override { return false; };
245  void SetRequestedRegion (const itk::DataObject * /*data*/) override {};
246 
247  // Override
248  bool IsEmpty() const override
249  {
250  if(IsInitialized() == false)
251  return true;
252  const TimeGeometry* timeGeometry = const_cast<AbstractGlobalImageFeature*>(this)->GetUpdatedTimeGeometry();
253  if(timeGeometry == nullptr)
254  return true;
255  return false;
256  }
257 
258 
259 private:
260  std::string m_Prefix; // Prefix before all input parameters
261  std::string m_ShortName; // Name of all variables
262  std::string m_LongName; // Long version of the name (For turning on)
263  std::string m_FeatureClassName;
264  ParameterTypes m_Parameter; // Parameter setting
265 
266  bool m_UseQuantifier = false;
267  IntensityQuantifier::Pointer m_Quantifier;
268 
269  double m_MinimumIntensity = 0;
270  bool m_UseMinimumIntensity = false;
271  double m_MaximumIntensity = 100;
272  bool m_UseMaximumIntensity = false;
273  bool m_EncodeParameters = false;
274 
275  double m_Binsize = 1;
276  bool m_UseBinsize = false;
277 
278  int m_Bins = 256;
279  bool m_UseBins = true;
280  int m_Direction = 0;
281 
282  bool m_IgnoreMask = false;
283  bool m_CalculateWithParameter = false;
284 
285  mitk::Image::Pointer m_MorphMask = nullptr;
286 //#endif // Skip Doxygen
287 
288 };
289 }
290 
291 #endif //mitkAbstractGlobalImageFeature_h
void SetRequestedRegion(const itk::DataObject *) override
Set the requested region from this data object to match the requested region of the data object passe...
Base of all data objects.
Definition: mitkBaseData.h:37
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...
DataCollection - Class to facilitate loading/accessing structured data.
bool VerifyRequestedRegion() override
Verify that the RequestedRegion is within the LargestPossibleRegion.
bool RequestedRegionIsOutsideOfTheBufferedRegion() override
Determine whether the RequestedRegion is outside of the BufferedRegion.
#define MITKCLCORE_EXPORT
void SetRequestedRegionToLargestPossibleRegion() override
Set the RequestedRegion to the LargestPossibleRegion.
#define mitkClassMacro(className, SuperClassName)
Definition: mitkCommon.h:40
std::map< std::string, us::Any > ParameterTypes
mitkClassMacro(AbstractGlobalImageFeature, BaseData) typedef std typedef std::vector< std::string > FeatureNameListType
mitk::Image::Pointer mask
void CalculateFeatures(mitk::CoocurenceMatrixHolder &holder, mitk::CoocurenceMatrixFeatures &results)