Medical Imaging Interaction Toolkit  2018.4.99-12ad79a3
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 MODELBASE_H
14 #define MODELBASE_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 
203  TimeGridType m_TimeGrid;
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 // MODELBASE_H
itk::Array< double > ModelResultType
itk::SmartPointer< Self > Pointer
Definition: mitkModelBase.h:52
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
TimeGridType m_TimeGrid
std::map< ParameterNameType, double > DerivedParamterScaleMapType
double DerivedParameterValueType
Definition: mitkModelBase.h:74
std::map< ParameterNameType, StaticParameterValuesType > StaticParameterMapType
Definition: mitkModelBase.h:72
ParametersType::SizeValueType ParametersSizeType
std::map< ParameterNameType, double > ParamterScaleMapType
DataCollection - Class to facilitate loading/accessing structured data.
itk::Array< double > TimeGridType
Definition: mitkModelBase.h:62
#define MITKMODELFIT_EXPORT
itk::Array< ParameterValueType > ParametersType
std::vector< ParameterNameType > ParameterNamesType
ParameterNamesType DerivedParameterNamesType
itk::Object Superclass
Definition: mitkModelBase.h:51
ModelTraitsInterface::ParametersSizeType ParametersSizeType
Definition: mitkModelBase.h:65
std::vector< StaticParameterValueType > StaticParameterValuesType
Definition: mitkModelBase.h:71
std::map< ParameterNameType, DerivedParameterValueType > DerivedParameterMapType
Definition: mitkModelBase.h:75
ModelTraitsInterface::ModelResultType ModelResultType
Definition: mitkModelBase.h:55
ModelTraitsInterface::ParameterValueType ParameterValueType
Definition: mitkModelBase.h:58
ModelTraitsInterface::DerivedParametersSizeType DerivedParametersSizeType
Definition: mitkModelBase.h:68
ModelTraitsInterface::ParameterNameType ParameterNameType
Definition: mitkModelBase.h:63
double StaticParameterValueType
Definition: mitkModelBase.h:70
ModelTraitsInterface::ParameterNamesType ParameterNamesType
Definition: mitkModelBase.h:64
ParametersSizeType DerivedParametersSizeType
ModelBase Self
Definition: mitkModelBase.h:50
itk::SmartPointer< const Self > ConstPointer
Definition: mitkModelBase.h:53
std::map< ParameterNameType, std::string > ParamterUnitMapType
ModelTraitsInterface::DerivedParameterNamesType DerivedParameterNamesType
Definition: mitkModelBase.h:67
std::map< ParameterNameType, std::string > DerivedParamterUnitMapType