Medical Imaging Interaction Toolkit  2024.06.00
Medical Imaging Interaction Toolkit
mitkModelBase.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 mitkModelBase_h
14 #define mitkModelBase_h
15 
16 #include <iostream>
17 
18 #include <itkArray.h>
19 #include <itkArray2D.h>
20 #include <itkObject.h>
21 
22 #include "MitkModelFitExports.h"
24 
25 namespace mitk
26 {
47  class MITKMODELFIT_EXPORT ModelBase : public itk::Object, public ModelTraitsInterface
48  {
49  public:
50  typedef ModelBase Self;
51  typedef itk::Object Superclass;
54 
55  itkTypeMacro(ModelBase, itk::Object);
56 
62  typedef itk::Array<double> TimeGridType;
66 
69 
70  typedef double StaticParameterValueType;
71  typedef std::vector<StaticParameterValueType> StaticParameterValuesType;
72  typedef std::map<ParameterNameType, StaticParameterValuesType> StaticParameterMapType;
73 
74  typedef double DerivedParameterValueType;
75  typedef std::map<ParameterNameType, DerivedParameterValueType> DerivedParameterMapType;
76 
78  ParamterScaleMapType GetParameterScales() const override;
79 
81  ParamterUnitMapType GetParameterUnits() const override;
82 
84  DerivedParamterScaleMapType GetDerivedParameterScales() const override;
85 
87  DerivedParamterUnitMapType GetDerivedParameterUnits() const override;
88 
90  std::string GetModelDisplayName() const override;
91 
93  std::string GetModelType() const override;
94 
96  FunctionStringType GetFunctionString() const override;
97 
99  ModellClassIDType GetClassID() const override;
100 
102  std::string GetXName() const override;
103 
105  std::string GetXAxisName() const override;
106 
108  std::string GetXAxisUnit() const override;
109 
111  std::string GetYAxisName() const override;
112 
114  std::string GetYAxisUnit() const override;
115 
118  virtual ParameterNamesType GetStaticParameterNames() const = 0;
121  virtual ParametersSizeType GetNumberOfStaticParameters() const = 0;
122 
124  virtual ParamterUnitMapType GetStaticParameterUnits() const;
125 
126 
130  DerivedParameterNamesType GetDerivedParameterNames() const override;
134  DerivedParametersSizeType GetNumberOfDerivedParameters() const override;
135 
145  void SetStaticParameters(const StaticParameterMapType& parameters, bool allParameters = true);
146 
150  StaticParameterMapType GetStaticParameters() const;
151 
158  DerivedParameterMapType GetDerivedParameters(const ParametersType& parameters) const;
159 
163  virtual void SetTimeGrid(const TimeGridType& grid);
167  itkGetConstReferenceMacro(TimeGrid, TimeGridType);
168 
169  ModelResultType GetSignal(const ParametersType& parameters) const;
170 
171  protected:
172 
173  virtual ModelResultType ComputeModelfunction(const ParametersType& parameters) const = 0;
174 
181  virtual bool ValidateModel(std::string& error) const;
182 
186  virtual DerivedParameterMapType ComputeDerivedParameters(const ParametersType& parameters) const;
187 
190  virtual void SetStaticParameter(const ParameterNameType& name,
191  const StaticParameterValuesType& values) = 0;
194  virtual StaticParameterValuesType GetStaticParameterValue(const ParameterNameType& name) const = 0;
195 
196  ModelBase();
197  ~ModelBase() override;
198 
199  void PrintSelf(std::ostream& os, ::itk::Indent indent) const override;
200 
201  //timeGrid in seconds
202 
204 
205  private:
206 
207  //No copy constructor allowed
208  ModelBase(const Self& source);
209  void operator=(const Self&); //purposely not implemented
210  };
211 }
212 
213 #endif
mitk::ModelTraitsInterface::ParamterUnitMapType
std::map< ParameterNameType, std::string > ParamterUnitMapType
Definition: mitkModelTraitsInterface.h:40
mitk::ModelTraitsInterface::ParamterScaleMapType
std::map< ParameterNameType, double > ParamterScaleMapType
Definition: mitkModelTraitsInterface.h:39
mitk::ModelBase::DerivedParameterNamesType
ModelTraitsInterface::DerivedParameterNamesType DerivedParameterNamesType
Definition: mitkModelBase.h:67
mitkModelTraitsInterface.h
mitk::ModelBase::StaticParameterValueType
double StaticParameterValueType
Definition: mitkModelBase.h:70
mitk::ModelBase::ParameterNamesType
ModelTraitsInterface::ParameterNamesType ParameterNamesType
Definition: mitkModelBase.h:64
mitk::ModelBase::ModelResultType
ModelTraitsInterface::ModelResultType ModelResultType
Definition: mitkModelBase.h:55
mitk::ModelTraitsInterface::ParametersSizeType
ParametersType::SizeValueType ParametersSizeType
Definition: mitkModelTraitsInterface.h:35
MitkModelFitExports.h
mitk::ModelBase::DerivedParametersSizeType
ModelTraitsInterface::DerivedParametersSizeType DerivedParametersSizeType
Definition: mitkModelBase.h:68
mitk::ModelBase::StaticParameterValuesType
std::vector< StaticParameterValueType > StaticParameterValuesType
Definition: mitkModelBase.h:71
mitk::ModelBase::Self
ModelBase Self
Definition: mitkModelBase.h:50
mitk::ModelBase::ConstPointer
itk::SmartPointer< const Self > ConstPointer
Definition: mitkModelBase.h:53
mitk::ModelBase::ParameterNameType
ModelTraitsInterface::ParameterNameType ParameterNameType
Definition: mitkModelBase.h:63
mitk::ModelBase::ParametersType
ModelTraitsInterface::ParametersType ParametersType
Definition: mitkModelBase.h:59
itk::SmartPointer< Self >
mitk::ModelBase::DerivedParameterMapType
std::map< ParameterNameType, DerivedParameterValueType > DerivedParameterMapType
Definition: mitkModelBase.h:75
mitk::ModelTraitsInterface::DerivedParameterNamesType
ParameterNamesType DerivedParameterNamesType
Definition: mitkModelTraitsInterface.h:36
MITKMODELFIT_EXPORT
#define MITKMODELFIT_EXPORT
Definition: MitkModelFitExports.h:15
mitk
Find image slices visible on a given plane.
Definition: RenderingTests.dox:1
mitk::ModelTraitsInterface::DerivedParamterScaleMapType
std::map< ParameterNameType, double > DerivedParamterScaleMapType
Definition: mitkModelTraitsInterface.h:41
mitk::ModelTraitsInterface::ParameterNamesType
std::vector< ParameterNameType > ParameterNamesType
Definition: mitkModelTraitsInterface.h:34
mitk::ModelTraitsInterface::ModellClassIDType
std::string ModellClassIDType
Definition: mitkModelTraitsInterface.h:45
mitk::ModelTraitsInterface
Definition: mitkModelTraitsInterface.h:24
mitk::ModelBase::m_TimeGrid
TimeGridType m_TimeGrid
Definition: mitkModelBase.h:203
mitk::ModelTraitsInterface::ParameterValueType
double ParameterValueType
Definition: mitkModelTraitsInterface.h:30
mitk::ModelTraitsInterface::FunctionStringType
std::string FunctionStringType
Definition: mitkModelTraitsInterface.h:44
mitk::ModelBase::Pointer
itk::SmartPointer< Self > Pointer
Definition: mitkModelBase.h:52
mitk::ModelTraitsInterface::DerivedParamterUnitMapType
std::map< ParameterNameType, std::string > DerivedParamterUnitMapType
Definition: mitkModelTraitsInterface.h:42
mitk::ModelTraitsInterface::ParametersType
itk::Array< ParameterValueType > ParametersType
Definition: mitkModelTraitsInterface.h:31
mitk::ModelBase::ParametersSizeType
ModelTraitsInterface::ParametersSizeType ParametersSizeType
Definition: mitkModelBase.h:65
mitk::ModelTraitsInterface::ParameterNameType
std::string ParameterNameType
Definition: mitkModelTraitsInterface.h:33
mitk::ModelBase::TimeGridType
itk::Array< double > TimeGridType
Definition: mitkModelBase.h:62
mitk::ModelBase::ParameterValueType
ModelTraitsInterface::ParameterValueType ParameterValueType
Definition: mitkModelBase.h:58
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::ModelTraitsInterface::ModelResultType
itk::Array< double > ModelResultType
Definition: mitkModelTraitsInterface.h:29
mitk::ModelBase::Superclass
itk::Object Superclass
Definition: mitkModelBase.h:51
mitk::ModelBase::StaticParameterMapType
std::map< ParameterNameType, StaticParameterValuesType > StaticParameterMapType
Definition: mitkModelBase.h:72
mitk::ModelTraitsInterface::DerivedParametersSizeType
ParametersSizeType DerivedParametersSizeType
Definition: mitkModelTraitsInterface.h:37
mitk::ModelBase::DerivedParameterValueType
double DerivedParameterValueType
Definition: mitkModelBase.h:74