Medical Imaging Interaction Toolkit  2018.4.99-389bf124
Medical Imaging Interaction Toolkit
mitkOneTissueCompartmentModel.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::OneTissueCompartmentModel::MODEL_DISPLAY_NAME = "One Tissue Compartment Model";
19 
22 
23 const std::string mitk::OneTissueCompartmentModel::UNIT_PARAMETER_k1 = "1/min";
24 const std::string mitk::OneTissueCompartmentModel::UNIT_PARAMETER_k2 = "1/min";
25 
28 
30 
32 {
33  return MODEL_DISPLAY_NAME;
34 };
35 
37 {
38  return "Dynamic.PET";
39 };
40 
42 {
43 
44 }
45 
47 {
48 
49 }
50 
52 {
53  ParameterNamesType result;
54 
55  result.push_back(NAME_PARAMETER_k1);
56  result.push_back(NAME_PARAMETER_k2);
57 
58  return result;
59 }
60 
62 const
63 {
64  return NUMBER_OF_PARAMETERS;
65 }
66 
67 
70 {
71  ParamterUnitMapType result;
72 
73  result.insert(std::make_pair(NAME_PARAMETER_k1, UNIT_PARAMETER_k1));
74  result.insert(std::make_pair(NAME_PARAMETER_k2, UNIT_PARAMETER_k2));
75 
76  return result;
77 };
78 
80  const ParametersType& parameters) const
81 {
82  if (this->m_TimeGrid.GetSize() == 0)
83  {
84  itkExceptionMacro("No Time Grid Set! Cannot Calculate Signal");
85  }
86 
87  AterialInputFunctionType aterialInputFunction;
88  aterialInputFunction = GetAterialInputFunction(this->m_TimeGrid);
89 
90 
91 
92  unsigned int timeSteps = this->m_TimeGrid.GetSize();
93 
94  //Model Parameters
95  double K1 = (double) parameters[POSITION_PARAMETER_k1] / 60.0;
96  double k2 = (double) parameters[POSITION_PARAMETER_k2] / 60.0;
97 
98 
99 
101  aterialInputFunction, k2);
102 
103  //Signal that will be returned by ComputeModelFunction
104  mitk::ModelBase::ModelResultType signal(timeSteps);
105  signal.fill(0.0);
106 
107  mitk::ModelBase::ModelResultType::iterator signalPos = signal.begin();
108 
109 
110 
111  for (mitk::ModelBase::ModelResultType::const_iterator res = convolution.begin(); res != convolution.end(); ++res, ++signalPos)
112  {
113  *signalPos = K1 * (*res);
114  }
115 
116  return signal;
117 
118 }
119 
120 
121 
122 
123 itk::LightObject::Pointer mitk::OneTissueCompartmentModel::InternalClone() const
124 {
126 
127  newClone->SetTimeGrid(this->m_TimeGrid);
128 
129  return newClone.GetPointer();
130 };
131 
132 void mitk::OneTissueCompartmentModel::PrintSelf(std::ostream& os, ::itk::Indent indent) const
133 {
134  Superclass::PrintSelf(os, indent);
135 
136 
137 };
138 
ModelTraitsInterface::ParametersType ParametersType
Definition: mitkModelBase.h:59
TimeGridType m_TimeGrid
void PrintSelf(std::ostream &os, ::itk::Indent indent) const override
Helper for itk implementation of vnl fourier transformation This namespace provides functions for the...
static const unsigned int NUMBER_OF_PARAMETERS
itk::LightObject::Pointer InternalClone() const override
void PrintSelf(std::ostream &os, ::itk::Indent indent) const override
const AterialInputFunctionType GetAterialInputFunction(TimeGridType currentTimeGrid) const
ParametersSizeType GetNumberOfParameters() const override
ModelResultType ComputeModelfunction(const ParametersType &parameters) const override
ModelTraitsInterface::ParametersSizeType ParametersSizeType
Definition: mitkModelBase.h:65
static const unsigned int POSITION_PARAMETER_k1
ModelTraitsInterface::ModelResultType ModelResultType
Definition: mitkModelBase.h:55
std::string GetModelDisplayName() const override
itk::Array< double > AterialInputFunctionType
static const unsigned int POSITION_PARAMETER_k2
ParameterNamesType GetParameterNames() const override
ModelTraitsInterface::ParameterNamesType ParameterNamesType
Definition: mitkModelBase.h:64
ParamterUnitMapType GetParameterUnits() const override
itk::Array< double > convoluteAIFWithExponential(mitk::ModelBase::TimeGridType timeGrid, mitk::AIFBasedModelBase::AterialInputFunctionType aif, double lambda)
std::map< ParameterNameType, std::string > ParamterUnitMapType