Medical Imaging Interaction Toolkit  2024.12.99-0da743f6
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 mitkModelFitFunctorBase_h
14 #define mitkModelFitFunctorBase_h
15 
16 #include <itkObject.h>
17 
18 #include <mitkVector.h>
19 
20 #include "mitkModelBase.h"
22 
23 #include "MitkModelFitExports.h"
24 
25 #include <mutex>
26 
27 namespace mitk
28 {
29 
30  class MITKMODELFIT_EXPORT ModelFitFunctorBase: public ::itk::Object
31  {
32  public:
34  typedef itk::Object Superclass;
37 
38  itkTypeMacro(ModelFitFunctorBase, itk::Object);
39 
41  typedef std::vector<ParameterImagePixelType> InputPixelArrayType;
42  typedef std::vector<ParameterImagePixelType> OutputPixelArrayType;
43 
56  OutputPixelArrayType Compute(const InputPixelArrayType& value, const ModelBase* model,
57  const ModelBase::ParametersType& initialParameters) const;
58 
62  unsigned int GetNumberOfOutputs(const ModelBase* model) const;
63 
65 
67  ParameterNamesType GetEvaluationParameterNames() const;
68  void ResetEvaluationParameters();
69  void RegisterEvaluationParameter(const std::string& parameterName,
70  SVModelFitCostFunction* evaluationCostFunction);
71  const SVModelFitCostFunction* GetEvaluationParameterCostFunction(const std::string& parameterName)
72  const;
73 
75  virtual ParameterNamesType GetCriterionNames() const = 0 ;
76 
79  ParameterNamesType GetDebugParameterNames() const;
80 
81  itkBooleanMacro(DebugParameterMaps);
82  itkSetMacro(DebugParameterMaps, bool);
83  itkGetConstMacro(DebugParameterMaps, bool);
84 
85  protected:
86 
89 
91 
92  ~ModelFitFunctorBase() override;
93 
96  virtual OutputPixelArrayType GetCriteria(const ModelBase* model, const ParametersType& parameters,
97  const SignalType& sample) const = 0;
98 
101  OutputPixelArrayType GetDerivedParameters(const ModelBase* model,
102  const ParametersType& parameters) const;
103 
107  OutputPixelArrayType GetEvaluationParameters(const ModelBase* model,
108  const ParametersType& parameters, const SignalType& sample) const;
109 
110  typedef std::map<std::string, ParameterImagePixelType> DebugParameterMapType;
111 
120  virtual ParametersType DoModelFit(const SignalType& value, const ModelBase* model,
121  const ModelBase::ParametersType& initialParameters,
122  DebugParameterMapType& debugParameters) const = 0;
123 
126  virtual ParameterNamesType DefineDebugParameterNames()const = 0;
127 
128  private:
129 
130  typedef std::map<std::string, SVModelFitCostFunction::Pointer> CostFunctionMapType;
131  CostFunctionMapType m_CostFunctionMap;
132  bool m_DebugParameterMaps;
133  mutable std::mutex m_Mutex;
134  };
135 
136 }
137 
138 
139 #endif
mitk::ModelFitCostFunctionInterface::SignalType
itk::Array< double > SignalType
Definition: mitkModelFitCostFunctionInterface.h:30
mitk::ModelFitFunctorBase::ParameterNamesType
ModelBase::ParameterNamesType ParameterNamesType
Definition: mitkModelFitFunctorBase.h:64
mitk::ModelFitFunctorBase::ParameterImagePixelType
ScalarType ParameterImagePixelType
Definition: mitkModelFitFunctorBase.h:38
mitk::ModelBase::ParameterNamesType
ModelTraitsInterface::ParameterNamesType ParameterNamesType
Definition: mitkModelBase.h:64
mitk::ModelFitFunctorBase::OutputPixelArrayType
std::vector< ParameterImagePixelType > OutputPixelArrayType
Definition: mitkModelFitFunctorBase.h:42
MitkModelFitExports.h
mitk::ModelFitFunctorBase::Superclass
itk::Object Superclass
Definition: mitkModelFitFunctorBase.h:34
mitk::ModelBase::ParametersType
ModelTraitsInterface::ParametersType ParametersType
Definition: mitkModelBase.h:59
itk::SmartPointer< Self >
mitkSVModelFitCostFunction.h
MITKMODELFIT_EXPORT
#define MITKMODELFIT_EXPORT
Definition: MitkModelFitExports.h:15
mitkModelBase.h
mitk
Find image slices visible on a given plane.
Definition: RenderingTests.dox:1
mitk::ModelFitFunctorBase::SignalType
ModelFitCostFunctionInterface::SignalType SignalType
Definition: mitkModelFitFunctorBase.h:88
mitk::ModelFitFunctorBase::DebugParameterMapType
std::map< std::string, ParameterImagePixelType > DebugParameterMapType
Definition: mitkModelFitFunctorBase.h:110
mitk::ModelFitFunctorBase
Definition: mitkModelFitFunctorBase.h:30
mitk::ModelFitFunctorBase::Pointer
itk::SmartPointer< Self > Pointer
Definition: mitkModelFitFunctorBase.h:35
mitk::ModelFitFunctorBase::ConstPointer
itk::SmartPointer< const Self > ConstPointer
Definition: mitkModelFitFunctorBase.h:36
mitk::ModelFitFunctorBase::ParametersType
ModelBase::ParametersType ParametersType
Definition: mitkModelFitFunctorBase.h:83
mitk::SVModelFitCostFunction
Definition: mitkSVModelFitCostFunction.h:27
mitk::ModelFitFunctorBase::Self
ModelFitFunctorBase Self
Definition: mitkModelFitFunctorBase.h:33
mitkVector.h
mitk::ModelBase
Base class for (dynamic) models. A model can be used to calculate its signal given the discrete time ...
Definition: mitkModelBase.h:47
mitk::ModelFitFunctorBase::InputPixelArrayType
std::vector< ParameterImagePixelType > InputPixelArrayType
Definition: mitkModelFitFunctorBase.h:41
mitk::ScalarType
double ScalarType
Definition: mitkNumericConstants.h:20