Medical Imaging Interaction Toolkit  2018.4.99-389bf124
Medical Imaging Interaction Toolkit
mitkExtendedOneTissueCompartmentModel.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 <vnl/algo/vnl_fft_1d.h>
16 #include <fstream>
17 
18 const std::string mitk::ExtendedOneTissueCompartmentModel::MODEL_DISPLAY_NAME = "Extended One Tissue Compartment Model (with blood volume)";
19 
23 
27 
31 
33 
35 {
36  return MODEL_DISPLAY_NAME;
37 };
38 
40 {
41  return "Dynamic.PET";
42 };
43 
45 {
46 
47 }
48 
50 {
51 
52 }
53 
55 {
56  ParameterNamesType result;
57 
58  result.push_back(NAME_PARAMETER_k1);
59  result.push_back(NAME_PARAMETER_k2);
60  result.push_back(NAME_PARAMETER_VB);
61 
62  return result;
63 }
64 
66 const
67 {
68  return NUMBER_OF_PARAMETERS;
69 }
70 
73 {
74  ParamterUnitMapType result;
75 
76  result.insert(std::make_pair(NAME_PARAMETER_k1, UNIT_PARAMETER_k1));
77  result.insert(std::make_pair(NAME_PARAMETER_k2, UNIT_PARAMETER_k2));
78  result.insert(std::make_pair(NAME_PARAMETER_VB, UNIT_PARAMETER_VB));
79 
80  return result;
81 };
82 
84  const ParametersType& parameters) const
85 {
86  if (this->m_TimeGrid.GetSize() == 0)
87  {
88  itkExceptionMacro("No Time Grid Set! Cannot Calculate Signal");
89  }
90 
91  AterialInputFunctionType aterialInputFunction;
92  aterialInputFunction = GetAterialInputFunction(this->m_TimeGrid);
93 
94 
95 
96  unsigned int timeSteps = this->m_TimeGrid.GetSize();
97 
98  //Model Parameters
99  double K1 = (double) parameters[POSITION_PARAMETER_k1] / 60.0;
100  double k2 = (double) parameters[POSITION_PARAMETER_k2] / 60.0;
101  double VB = parameters[POSITION_PARAMETER_VB];
102 
103 
104 
106  aterialInputFunction, k2);
107 
108  //Signal that will be returned by ComputeModelFunction
109  mitk::ModelBase::ModelResultType signal(timeSteps);
110  signal.fill(0.0);
111 
112  mitk::ModelBase::ModelResultType::iterator signalPos = signal.begin();
113 
114  AterialInputFunctionType::const_iterator aifPos = aterialInputFunction.begin();
115 
116 
117  for (mitk::ModelBase::ModelResultType::const_iterator res = convolution.begin(); res != convolution.end(); ++res, ++signalPos, ++aifPos)
118  {
119  *signalPos = VB * (*aifPos) + (1 - VB) * K1 * (*res);
120  }
121 
122  return signal;
123 
124 }
125 
126 
127 
128 
130 {
132 
133  newClone->SetTimeGrid(this->m_TimeGrid);
134 
135  return newClone.GetPointer();
136 };
137 
138 void mitk::ExtendedOneTissueCompartmentModel::PrintSelf(std::ostream& os, ::itk::Indent indent) const
139 {
140  Superclass::PrintSelf(os, indent);
141 
142 
143 };
144 
ModelTraitsInterface::ParametersType ParametersType
Definition: mitkModelBase.h:59
TimeGridType m_TimeGrid
Helper for itk implementation of vnl fourier transformation This namespace provides functions for the...
void PrintSelf(std::ostream &os, ::itk::Indent indent) const override
ModelResultType ComputeModelfunction(const ParametersType &parameters) const override
const AterialInputFunctionType GetAterialInputFunction(TimeGridType currentTimeGrid) const
void PrintSelf(std::ostream &os, ::itk::Indent indent) const override
ModelTraitsInterface::ParametersSizeType ParametersSizeType
Definition: mitkModelBase.h:65
ModelTraitsInterface::ModelResultType ModelResultType
Definition: mitkModelBase.h:55
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)
std::map< ParameterNameType, std::string > ParamterUnitMapType
itk::LightObject::Pointer InternalClone() const override