Medical Imaging Interaction Toolkit  2018.4.99-663e373e
Medical Imaging Interaction Toolkit
mitkConcreteModelParameterizerBase.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 __CONCRETE_MODEL_PARAMETERIZER_BASE_H
14 #define __CONCRETE_MODEL_PARAMETERIZER_BASE_H
15 
17 
18 namespace mitk
19 {
20  template <class TModel>
22  {
23  public:
28 
30  itkFactorylessNewMacro(Self);
31 
34 
35  typedef TModel ModelType;
36  typedef typename ModelType::Pointer ModelPointer;
37 
41 
43 
44  /* Returns the global static parameters for the model.
45  * @remark this default implementation assumes no global static parameters exist.
46  * Thus an empty map is returned.*/
47  StaticParameterMapType GetGlobalStaticParameters() const override
48  {
49  StaticParameterMapType result;
50  return result;
51  };
52 
53  /* Returns the local static parameters for the model at the given index.
54  * @remark this default implementation assumes no local static parameters exist.
55  * Thus an empty map is returned.*/
56  StaticParameterMapType GetLocalStaticParameters(const IndexType& /*currentPosition*/) const override
57  {
58  StaticParameterMapType result;
59  return result;
60  };
61 
62  /* Returns an newly generated instance of the concrete model.
63  * It is parameterized by the static parameters (returns of GetGlobalParameter() and
64  * GetLocalParameter()).
65  */
66  ModelBasePointer GenerateParameterizedModel(const IndexType& currentPosition) const override
67  {
68  ModelPointer newModel = ModelType::New();
69  StaticParameterMapType params = this->GetGlobalStaticParameters();
70  StaticParameterMapType locals = this->GetLocalStaticParameters(currentPosition);
71 
72  params.insert(locals.begin(), locals.end());
73  newModel->SetTimeGrid(m_DefaultTimeGrid);
74  newModel->SetStaticParameters(params);
75 
76  return newModel.GetPointer();
77  };
78 
79  ModelBasePointer GenerateParameterizedModel() const override
80  {
81  ModelPointer newModel = ModelType::New();
82  StaticParameterMapType params = this->GetGlobalStaticParameters();
83 
84  newModel->SetTimeGrid(m_DefaultTimeGrid);
85  newModel->SetStaticParameters(params, false);
86 
87  return newModel.GetPointer();
88  };
89 
90  /* Returns a parameterization filled with zeros.
91  * @remark this default implementation assumes no special initial parameterization is suggested.
92  * Thus an zero filled vector is returned.*/
94  {
95  ModelPointer newModel = ModelType::New();
96  ParametersType params;
97  params.SetSize(newModel->GetNumberOfParameters());
98  params.Fill(0.0);
99 
100  return params;
101  };
102 
104  {
105  return GenerateParameterizedModel()->GetParameterNames();
106  };
107 
109  {
110  return GenerateParameterizedModel()->GetNumberOfParameters();
111  };
112 
114  {
115  return GenerateParameterizedModel()->GetParameterScales();
116  };
117 
119  {
120  return GenerateParameterizedModel()->GetParameterUnits();
121  };
122 
124  {
125  return GenerateParameterizedModel()->GetDerivedParameterNames();
126  };
127 
129  {
130  return GenerateParameterizedModel()->GetNumberOfDerivedParameters();
131  };
132 
134  {
135  return GenerateParameterizedModel()->GetDerivedParameterScales();
136  };
137 
139  {
140  return GenerateParameterizedModel()->GetDerivedParameterUnits();
141  };
142 
143  std::string GetModelDisplayName() const override
144  {
145  return GenerateParameterizedModel()->GetModelDisplayName();
146  };
147 
148  std::string GetModelType() const override
149  {
150  return GenerateParameterizedModel()->GetModelType();
151  };
152 
154  {
155  return GenerateParameterizedModel()->GetFunctionString();
156  };
157 
158  ModellClassIDType GetClassID() const override
159  {
160  return GenerateParameterizedModel()->GetClassID();
161  };
162 
163  std::string GetXName() const override
164  {
165  return GenerateParameterizedModel()->GetXName();
166  };
167 
168  std::string GetXAxisName() const override
169  {
170  return GenerateParameterizedModel()->GetXAxisName();
171  };
172 
173  std::string GetXAxisUnit() const override
174  {
175  return GenerateParameterizedModel()->GetXAxisUnit();
176  };
177 
178  std::string GetYAxisName() const override
179  {
180  return GenerateParameterizedModel()->GetYAxisName();
181  };
182 
183  std::string GetYAxisUnit() const override
184  {
185  return GenerateParameterizedModel()->GetYAxisUnit();
186  }
187 
188  protected:
190  {
191  };
192 
194  {
195  };
196 
197  private:
198 
199  //No copy constructor allowed
200  ConcreteModelParameterizerBase(const Self& source);
201  void operator=(const Self&); //purposely not implemented
202  };
203 }
204 
205 #endif // __CONCRETE_MODEL_PARAMETERIZER_BASE_H
ParametersSizeType GetNumberOfParameters() const override
ParametersSizeType GetNumberOfDerivedParameters() const override
Superclass::StaticParameterValuesType StaticParameterValuesType
StaticParameterMapType GetLocalStaticParameters(const IndexType &) const override
ParameterNamesType GetParameterNames() const override
std::map< ParameterNameType, double > DerivedParamterScaleMapType
ParametersType::SizeValueType ParametersSizeType
std::map< ParameterNameType, double > ParamterScaleMapType
ConcreteModelParameterizerBase< TModel > Self
FunctionStringType GetFunctionString() const override
DataCollection - Class to facilitate loading/accessing structured data.
ParamterUnitMapType GetParameterUnits() const override
DerivedParamterScaleMapType GetDerivedParameterScales() const override
ParametersType GetDefaultInitialParameterization() const override
ParameterNamesType GetDerivedParameterNames() const override
std::vector< ParameterNameType > ParameterNamesType
ModelBasePointer GenerateParameterizedModel(const IndexType &currentPosition) const override
ParamterScaleMapType GetParameterScales() const override
ModelBaseType::StaticParameterValueType StaticParameterValueType
Superclass::StaticParameterMapType StaticParameterMapType
ModelBaseType::StaticParameterValuesType StaticParameterValuesType
DerivedParamterUnitMapType GetDerivedParameterUnits() const override
ModelBaseType::ParametersType ParametersType
StaticParameterMapType GetGlobalStaticParameters() const override
Superclass::StaticParameterValueType StaticParameterValueType
ModelBasePointer GenerateParameterizedModel() const override
ModelBaseType::StaticParameterMapType StaticParameterMapType
std::map< ParameterNameType, std::string > ParamterUnitMapType
std::map< ParameterNameType, std::string > DerivedParamterUnitMapType