Medical Imaging Interaction Toolkit  2018.4.99-07c45cb1
Medical Imaging Interaction Toolkit
mitkDescriptivePharmacokineticBrixModel.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 
14 
16  "Descriptive Pharmacokinetic Brix Model";
17 
21 //tlag in minutes
23 
27 //tlag in minutes
29 
32 
35 
40 
42 
44 {
45  return MODEL_DISPLAY_NAME;
46 };
47 
49 {
50  return "Perfusion.MR";
51 };
52 
54 {
55  return "Time";
56 };
57 
59 {
60  return "s";
61 }
62 
64 {
65  return "";
66 };
67 
69 {
70  return "";
71 }
72 
74 {
75 
76 }
77 
79 {
80 
81 }
82 
85 {
86  ParameterNamesType result;
87 
88  result.push_back(NAME_PARAMETER_A);
89  result.push_back(NAME_PARAMETER_kep);
90  result.push_back(NAME_PARAMETER_kel);
91  result.push_back(NAME_PARAMETER_tlag);
92 
93  return result;
94 }
95 
98 {
99  return NUMBER_OF_PARAMETERS;
100 }
101 
104 {
105  ParamterUnitMapType result;
106 
107  result.insert(std::make_pair(NAME_PARAMETER_A, UNIT_PARAMETER_A));
108  result.insert(std::make_pair(NAME_PARAMETER_kep, UNIT_PARAMETER_kep));
109  result.insert(std::make_pair(NAME_PARAMETER_kel, UNIT_PARAMETER_kel));
110  result.insert(std::make_pair(NAME_PARAMETER_tlag, UNIT_PARAMETER_tlag));
111 
112  return result;
113 };
114 
117 {
118  ParameterNamesType result;
119 
120  result.push_back(NAME_STATIC_PARAMETER_Tau);
121  result.push_back(NAME_STATIC_PARAMETER_S0);
122 
123  return result;
124 }
125 
128 {
129  ParamterUnitMapType result;
130 
131  result.insert(std::make_pair(NAME_STATIC_PARAMETER_Tau, UNIT_STATIC_PARAMETER_Tau));
132  result.insert(std::make_pair(NAME_STATIC_PARAMETER_S0, UNIT_STATIC_PARAMETER_S0));
133 
134  return result;
135 };
136 
139 {
140  return 1;
141 }
142 
143 
146 const
147 {
148  if (m_TimeGrid.GetSize() == 0)
149  {
150  itkExceptionMacro("No Time Grid Set! Cannot Calculate Signal");
151  }
152 
153  if (m_Tau == 0)
154  {
155  itkExceptionMacro("Injection time is 0! Cannot Calculate Signal");
156  }
157 
158  ModelResultType signal(m_TimeGrid.GetSize());
159 
160  double tx = 0;
161  double amplitude = parameters[POSITION_PARAMETER_A];
162  double kel = parameters[POSITION_PARAMETER_kel];
163  double kep = parameters[POSITION_PARAMETER_kep];
164  double tlag = parameters[POSITION_PARAMETER_tlag];
165 
166  TimeGridType::const_iterator timeGridEnd = m_TimeGrid.end();
167  ModelResultType::iterator signalPos = signal.begin();
168 
169  for (TimeGridType::const_iterator gridPos = m_TimeGrid.begin(); gridPos != timeGridEnd;
170  ++gridPos, ++signalPos)
171  {
172  double t = (*gridPos) / 60.0; //convert from [sec] to [min]
173 
174 
175  if (t <= tlag)
176  {
177  tx = 0;
178  }
179  else if ((t > tlag) && (t < (m_Tau + tlag)))
180  {
181  tx = t - tlag;
182  }
183  else if (t >= (m_Tau + tlag))
184  {
185  tx = m_Tau;
186  }
187 
188  double kDiff = kep - kel;
189  double tDiff = t - tlag;
190 
191  double expkel = (kep * exp(-kel * tDiff));
192  double expkeltx = exp(kel * tx);
193  double expkep = exp(-kep * tDiff);
194  double expkeptx = exp(kep * tx);
195 
196  double value = 1 + (amplitude / m_Tau) * (((expkel / (kel * kDiff)) * (expkeltx - 1)) - ((
197  expkep / kDiff) * (expkeptx - 1)));
198 
199  *signalPos = value * m_S0;
200  }
201 
202  return signal;
203 
204 }
205 
207  const StaticParameterValuesType& values)
208 {
209  if (name == NAME_STATIC_PARAMETER_Tau)
210  {
211  SetTau(values[0]);
212  }
213 
214  if (name == NAME_STATIC_PARAMETER_S0)
215  {
216  SetS0(values[0]);
217  }
218 };
219 
222 const
223 {
225 
226  if (name == NAME_STATIC_PARAMETER_Tau)
227  {
228  result.push_back(GetTau());
229  }
230 
231  if (name == NAME_STATIC_PARAMETER_S0)
232  {
233  result.push_back(GetS0());
234  }
235 
236  return result;
237 };
238 
240 {
242 
243  newClone->SetTimeGrid(this->m_TimeGrid);
244  newClone->SetTau(this->m_Tau);
245  newClone->SetS0(this->m_S0);
246 
247  return newClone.GetPointer();
248 };
249 
251  ::itk::Indent indent) const
252 {
253  Superclass::PrintSelf(os, indent);
254 
255  os << indent << "Tau (injection time): " << m_Tau;
256  os << indent << "S0 (base value): " << m_S0;
257 };
ModelResultType ComputeModelfunction(const ParametersType &parameters) const override
ModelTraitsInterface::ParametersType ParametersType
Definition: mitkModelBase.h:59
TimeGridType m_TimeGrid
StaticParameterValuesType GetStaticParameterValue(const ParameterNameType &name) const override
void PrintSelf(std::ostream &os, ::itk::Indent indent) const override
void SetStaticParameter(const ParameterNameType &name, const StaticParameterValuesType &values) override
ModelTraitsInterface::ParametersSizeType ParametersSizeType
Definition: mitkModelBase.h:65
std::vector< StaticParameterValueType > StaticParameterValuesType
Definition: mitkModelBase.h:71
ModelTraitsInterface::ModelResultType ModelResultType
Definition: mitkModelBase.h:55
void PrintSelf(std::ostream &os, ::itk::Indent indent) const override
ModelTraitsInterface::ParameterNameType ParameterNameType
Definition: mitkModelBase.h:63
ModelTraitsInterface::ParameterNamesType ParameterNamesType
Definition: mitkModelBase.h:64
std::map< ParameterNameType, std::string > ParamterUnitMapType