Medical Imaging Interaction Toolkit  2021.10.99-9c07a326
Medical Imaging Interaction Toolkit
mitkModelFitFunctorBase.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 MODEL_FIT_FUNCTOR_BASE_H
14 #define MODEL_FIT_FUNCTOR_BASE_H
15 
16 #include <itkObject.h>
17 
18 #include <mitkVector.h>
19 
20 #include "mitkModelBase.h"
22 
23 #include "MitkModelFitExports.h"
24 
25 namespace mitk
26 {
27 
28  class MITKMODELFIT_EXPORT ModelFitFunctorBase: public ::itk::Object
29  {
30  public:
32  typedef itk::Object Superclass;
35 
36  itkTypeMacro(ModelFitFunctorBase, itk::Object);
37 
39  typedef std::vector<ParameterImagePixelType> InputPixelArrayType;
40  typedef std::vector<ParameterImagePixelType> OutputPixelArrayType;
41 
54  OutputPixelArrayType Compute(const InputPixelArrayType& value, const ModelBase* model,
55  const ModelBase::ParametersType& initialParameters) const;
56 
60  unsigned int GetNumberOfOutputs(const ModelBase* model) const;
61 
63 
65  ParameterNamesType GetEvaluationParameterNames() const;
66  void ResetEvaluationParameters();
67  void RegisterEvaluationParameter(const std::string& parameterName,
68  SVModelFitCostFunction* evaluationCostFunction);
69  const SVModelFitCostFunction* GetEvaluationParameterCostFunction(const std::string& parameterName)
70  const;
71 
73  virtual ParameterNamesType GetCriterionNames() const = 0 ;
74 
77  ParameterNamesType GetDebugParameterNames() const;
78 
79  itkBooleanMacro(DebugParameterMaps);
80  itkSetMacro(DebugParameterMaps, bool);
81  itkGetConstMacro(DebugParameterMaps, bool);
82 
83  protected:
84 
87 
89 
90  ~ModelFitFunctorBase() override;
91 
94  virtual OutputPixelArrayType GetCriteria(const ModelBase* model, const ParametersType& parameters,
95  const SignalType& sample) const = 0;
96 
99  OutputPixelArrayType GetDerivedParameters(const ModelBase* model,
100  const ParametersType& parameters) const;
101 
105  OutputPixelArrayType GetEvaluationParameters(const ModelBase* model,
106  const ParametersType& parameters, const SignalType& sample) const;
107 
108  typedef std::map<std::string, ParameterImagePixelType> DebugParameterMapType;
109 
118  virtual ParametersType DoModelFit(const SignalType& value, const ModelBase* model,
119  const ModelBase::ParametersType& initialParameters,
120  DebugParameterMapType& debugParameters) const = 0;
121 
124  virtual ParameterNamesType DefineDebugParameterNames()const = 0;
125 
126  private:
127 
128  typedef std::map<std::string, SVModelFitCostFunction::Pointer> CostFunctionMapType;
129  CostFunctionMapType m_CostFunctionMap;
130  bool m_DebugParameterMaps;
131  ::itk::SimpleFastMutexLock m_Mutex;
132  };
133 
134 }
135 
136 
137 #endif // MODEL_FIT_FUNCTOR_BASE_H
Base class for (dynamic) models. A model can be used to calculate its signal given the discrete time ...
Definition: mitkModelBase.h:47
ModelTraitsInterface::ParametersType ParametersType
Definition: mitkModelBase.h:59
double ScalarType
std::vector< ParameterImagePixelType > InputPixelArrayType
std::map< std::string, ParameterImagePixelType > DebugParameterMapType
DataCollection - Class to facilitate loading/accessing structured data.
ModelBase::ParameterNamesType ParameterNamesType
#define MITKMODELFIT_EXPORT
itk::SmartPointer< const Self > ConstPointer
ModelFitCostFunctionInterface::SignalType SignalType
ModelBase::ParametersType ParametersType
std::vector< ParameterImagePixelType > OutputPixelArrayType
itk::SmartPointer< Self > Pointer
ModelTraitsInterface::ParameterNamesType ParameterNamesType
Definition: mitkModelBase.h:64