Medical Imaging Interaction Toolkit  2018.4.99-1640525a
Medical Imaging Interaction Toolkit
mitkAIFBasedModelBase.cpp
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 #include "mitkAIFBasedModelBase.h"
14 #include "mitkTimeGridHelper.h"
16 
17 #include "itkArray2D.h"
18 
19 
20 const std::string mitk::AIFBasedModelBase::NAME_STATIC_PARAMETER_AIF = "Aterial Input Function";
22  "Aterial Input Function Timegrid";
23 
24 //Assumed AIF is always extracted from concentration image
27  "s";
28 
30 {
31  return "Time";
32 };
33 
35 {
36  return "s";
37 }
38 
40 {
41  return "";
42 };
43 
45 {
46  return "";
47 }
48 
50 {
51 }
52 
54 {
55 }
56 
59 {
60  if (!m_AterialInputFunctionTimeGrid.empty())
61  {
63  }
64  else
65  {
66  return m_TimeGrid;
67  }
68 };
69 
72 {
73  if (CurrentTimeGrid.GetSize() == 0)
74  {
75  return this->m_AterialInputFunctionValues;
76  }
77  else
78  {
80  GetCurrentAterialInputFunctionTimeGrid(), CurrentTimeGrid);
81  }
82 }
83 
85 {
86  ParameterNamesType result;
87 
88  result.push_back(NAME_STATIC_PARAMETER_AIF);
89  result.push_back(NAME_STATIC_PARAMETER_AIFTimeGrid);
90 
91  return result;
92 }
93 
95 const
96 {
97  return 2;
98 }
99 
102 {
103  ParamterUnitMapType result;
104 
105  result.insert(std::make_pair(NAME_STATIC_PARAMETER_AIF, UNIT_STATIC_PARAMETER_AIF));
107 
108  return result;
109 };
110 
111 
113  const StaticParameterValuesType& values)
114 {
115  if (name == NAME_STATIC_PARAMETER_AIF)
116  {
118 
120  }
121 
123  {
124  TimeGridType timegrid = mitk::convertParameterToArray(values);
125 
127  }
128 };
129 
131  const ParameterNameType& name) const
132 {
134 
135  if (name == NAME_STATIC_PARAMETER_AIF)
136  {
138  }
139 
141  {
143  }
144 
145  return result;
146 };
147 
148 bool mitk::AIFBasedModelBase::ValidateModel(std::string& error) const
149 {
150  bool result = Superclass::ValidateModel(error);
151 
152  if (result)
153  {
154  if (m_AterialInputFunctionTimeGrid.empty())
155  {
156  if (this->m_TimeGrid.GetSize() != m_AterialInputFunctionValues.GetSize())
157  {
158  result = false;
159  error = "Number of elements of Model Time Grid does not match number of elements in Aterial Input Function! Set valid aif or aif time grid.";
160  }
161  }
162  else
163  {
165  {
166  result = false;
167  error = "Number of elements of Aterial Input Function Time Grid does not match number of elements of Aterial Input Function Values! Set valid curve";
168  }
169  }
170  }
171 
172  return result;
173 };
174 
175 void mitk::AIFBasedModelBase::PrintSelf(std::ostream& os, ::itk::Indent indent) const
176 {
177  Superclass::PrintSelf(os, indent);
178 
179  os << indent << "Aterial Input Function: " << m_AterialInputFunctionValues;
180  os << indent << "Aterial Input Function Time Grid: " << m_AterialInputFunctionTimeGrid;
181 };
182 
183 
StaticParameterValuesType GetStaticParameterValue(const ParameterNameType &name) const override
virtual bool ValidateModel(std::string &error) const
TimeGridType m_TimeGrid
static const std::string NAME_STATIC_PARAMETER_AIFTimeGrid
void SetStaticParameter(const ParameterNameType &name, const StaticParameterValuesType &values) override
ParameterNamesType GetStaticParameterNames() const override
void PrintSelf(std::ostream &os, ::itk::Indent indent) const override
itk::Array< double > TimeGridType
Definition: mitkModelBase.h:62
ParametersSizeType GetNumberOfStaticParameters() const override
const AterialInputFunctionType GetAterialInputFunction(TimeGridType currentTimeGrid) const
std::string GetYAxisUnit() const override
MITKPHARMACOKINETICS_EXPORT ModelBase::StaticParameterValuesType convertArrayToParameter(itk::Array< double > array)
void PrintSelf(std::ostream &os, ::itk::Indent indent) const override
ModelTraitsInterface::ParametersSizeType ParametersSizeType
Definition: mitkModelBase.h:65
AterialInputFunctionType m_AterialInputFunctionValues
std::vector< StaticParameterValueType > StaticParameterValuesType
Definition: mitkModelBase.h:71
MITKMODELFIT_EXPORT ModelBase::ModelResultType InterpolateSignalToNewTimeGrid(const ModelBase::ModelResultType &inputSignal, const ModelBase::TimeGridType &inputGrid, const ModelBase::TimeGridType &outputGrid)
std::string GetXAxisUnit() const override
ParamterUnitMapType GetStaticParameterUnits() const override
MITKPHARMACOKINETICS_EXPORT itk::Array< double > convertParameterToArray(ModelBase::StaticParameterValuesType)
itk::Array< double > AterialInputFunctionType
ModelTraitsInterface::ParameterNameType ParameterNameType
Definition: mitkModelBase.h:63
bool ValidateModel(std::string &error) const override
virtual void SetAterialInputFunctionTimeGrid(TimeGridType _arg)
static const std::string NAME_STATIC_PARAMETER_AIF
static const std::string UNIT_STATIC_PARAMETER_AIFTimeGrid
virtual void SetAterialInputFunctionValues(AterialInputFunctionType _arg)
std::string GetXAxisName() const override
ModelTraitsInterface::ParameterNamesType ParameterNamesType
Definition: mitkModelBase.h:64
const TimeGridType & GetCurrentAterialInputFunctionTimeGrid() const
TimeGridType m_AterialInputFunctionTimeGrid
std::string GetYAxisName() const override
std::map< ParameterNameType, std::string > ParamterUnitMapType
static const std::string UNIT_STATIC_PARAMETER_AIF