Medical Imaging Interaction Toolkit  2018.4.99-a3d2e8fb
Medical Imaging Interaction Toolkit
mitkTwoTissueCompartmentFDGModel.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 #include "mitkConvolutionHelper.h"
15 #include <fstream>
16 const std::string mitk::TwoTissueCompartmentFDGModel::MODEL_DISPLAY_NAME = "Two Tissue Compartment Model for FDG (Sokoloff Model)";
17 
22 
27 
32 
34 
36 {
37  return MODEL_DISPLAY_NAME;
38 };
39 
41 {
42  return "Dynamic.PET";
43 };
44 
46 {
47 
48 }
49 
51 {
52 
53 }
54 
57 {
58  ParameterNamesType result;
59 
60  result.push_back(NAME_PARAMETER_K1);
61  result.push_back(NAME_PARAMETER_k2);
62  result.push_back(NAME_PARAMETER_k3);
63  result.push_back(NAME_PARAMETER_VB);
64 
65  return result;
66 }
67 
70 {
71  return NUMBER_OF_PARAMETERS;
72 }
73 
76 {
77  ParamterUnitMapType result;
78 
79  result.insert(std::make_pair(NAME_PARAMETER_K1, UNIT_PARAMETER_K1));
80  result.insert(std::make_pair(NAME_PARAMETER_k2, UNIT_PARAMETER_k2));
81  result.insert(std::make_pair(NAME_PARAMETER_k3, UNIT_PARAMETER_k3));
82  result.insert(std::make_pair(NAME_PARAMETER_VB, UNIT_PARAMETER_VB));
83 
84  return result;
85 };
86 
89 {
90  if (this->m_TimeGrid.GetSize() == 0)
91  {
92  itkExceptionMacro("No Time Grid Set! Cannot Calculate Signal");
93  }
94 
95  AterialInputFunctionType aterialInputFunction;
96  aterialInputFunction = GetAterialInputFunction(this->m_TimeGrid);
97 
98 
99  unsigned int timeSteps = this->m_TimeGrid.GetSize();
100 
101  //Model Parameters
102  double k1 = (double)parameters[POSITION_PARAMETER_K1] / 60.0;
103  double k2 = (double)parameters[POSITION_PARAMETER_k2] / 60.0;
104  double k3 = (double)parameters[POSITION_PARAMETER_k3] / 60.0;
105  double VB = parameters[POSITION_PARAMETER_VB];
106 
107 
108 
109 
110  double lambda = k2+k3;
111  //double lambda2 = -alpha2;
113  aterialInputFunction, lambda);
114  mitk::ModelBase::ModelResultType CA = mitk::convoluteAIFWithConstant(this->m_TimeGrid, aterialInputFunction, k3);
115 
116 
117  //Signal that will be returned by ComputeModelFunction
118  mitk::ModelBase::ModelResultType signal(timeSteps);
119  signal.fill(0.0);
120 
121  mitk::ModelBase::ModelResultType::const_iterator expPos = exp.begin();
122  mitk::ModelBase::ModelResultType::const_iterator CAPos = CA.begin();
123  AterialInputFunctionType::const_iterator aifPos = aterialInputFunction.begin();
124 
125  for (mitk::ModelBase::ModelResultType::iterator signalPos = signal.begin();
126  signalPos != signal.end(); ++expPos, ++signalPos, ++aifPos)
127  {
128  double Ci = k1 * k2 /lambda *(*expPos) + k1*k3/lambda*(*CAPos);
129  *signalPos = VB * (*aifPos) + (1 - VB) * Ci;
130  }
131 
132  return signal;
133 
134 }
135 
136 
137 
138 
139 itk::LightObject::Pointer mitk::TwoTissueCompartmentFDGModel::InternalClone() const
140 {
142 
143  newClone->SetTimeGrid(this->m_TimeGrid);
144 
145  return newClone.GetPointer();
146 }
147 
148 void mitk::TwoTissueCompartmentFDGModel::PrintSelf(std::ostream& os, ::itk::Indent indent) const
149 {
150  Superclass::PrintSelf(os, indent);
151 
152 
153 }
154 
155 
156 
ParametersSizeType GetNumberOfParameters() const override
ModelTraitsInterface::ParametersType ParametersType
Definition: mitkModelBase.h:59
TimeGridType m_TimeGrid
void PrintSelf(std::ostream &os, ::itk::Indent indent) const override
itk::Array< double > convoluteAIFWithConstant(mitk::ModelBase::TimeGridType timeGrid, mitk::AIFBasedModelBase::AterialInputFunctionType aif, double constant)
const AterialInputFunctionType GetAterialInputFunction(TimeGridType currentTimeGrid) const
itk::LightObject::Pointer InternalClone() const override
ModelTraitsInterface::ParametersSizeType ParametersSizeType
Definition: mitkModelBase.h:65
ModelTraitsInterface::ModelResultType ModelResultType
Definition: mitkModelBase.h:55
ParameterNamesType GetParameterNames() const override
itk::Array< double > AterialInputFunctionType
ModelTraitsInterface::ParameterNamesType ParameterNamesType
Definition: mitkModelBase.h:64
itk::Array< double > convoluteAIFWithExponential(mitk::ModelBase::TimeGridType timeGrid, mitk::AIFBasedModelBase::AterialInputFunctionType aif, double lambda)
void PrintSelf(std::ostream &os, ::itk::Indent indent) const override
std::map< ParameterNameType, std::string > ParamterUnitMapType
ModelResultType ComputeModelfunction(const ParametersType &parameters) const override
ParamterUnitMapType GetParameterUnits() const override