Medical Imaging Interaction Toolkit  2023.04.00
Medical Imaging Interaction Toolkit
mitkConvertToConcentrationViaT1Functor.h
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 #ifndef mitkConvertToConcentrationViaT1Functor_h
14 #define mitkConvertToConcentrationViaT1Functor_h
15 
16 #include "itkMath.h"
17 
19 
20 namespace mitk {
21 
22  template <class TInputPixel1, class TInputPixel2, class TInputPixel3, class TOutputpixel>
24  {
25 
26  public:
27  ConvertToConcentrationViaT1CalcFunctor(): m_relaxivity(0.0), m_TR(0.0), m_flipangle(0.0) {};
29 
30  void initialize(double relaxivity, double TR, double flipangle)
31  {
32 
33  m_relaxivity = relaxivity;
34  m_TR = TR;
35  m_flipangle = flipangle;
36  }
37 
39  {
40  return !(*this == other);
41 
42  }
44  {
45  return (this->m_relaxivity == other.m_relaxivity) && (this->m_TR == other.m_TR) && (this->m_flipangle == other.m_flipangle);
46  }
47 
48 
49  inline TOutputpixel operator()( const TInputPixel1 & value, const TInputPixel2 & baseline, const TInputPixel3 & nativeT1)
50  {
51  TOutputpixel concentration(0);
52  double R10, R1;
53  if (baseline !=0 && nativeT1 != 0 && value != 0)
54  {
55  double s = (double) value/baseline;
56  R10 = (double) 1/nativeT1;
57  double tmp1 = log(1-s + s*exp(-R10*m_TR) - exp(-R10*m_TR)* cos(m_flipangle));
58  double tmp2 = (1-s*cos(m_flipangle) + s*exp(-R10*m_TR)*cos(m_flipangle) - exp(-R10*m_TR)* cos(m_flipangle));
59 
60  R1 = (double) -1/m_TR * tmp1/tmp2 ;
61 
62  concentration = (double) (R1 - R10)/ m_relaxivity;
63  }
64  else
65  {
66  concentration = 0;
67  }
68 
69  return concentration;
70  }
71  private:
72  double m_relaxivity;
73  double m_TR;
74  double m_flipangle;
75 
76  };
77 
78 }
79 #endif
mitk::ConvertToConcentrationViaT1CalcFunctor::operator==
bool operator==(const ConvertToConcentrationViaT1CalcFunctor &other) const
Definition: mitkConvertToConcentrationViaT1Functor.h:43
MITKPHARMACOKINETICS_EXPORT
#define MITKPHARMACOKINETICS_EXPORT
Definition: MitkPharmacokineticsExports.h:15
mitk::ConvertToConcentrationViaT1CalcFunctor::operator()
TOutputpixel operator()(const TInputPixel1 &value, const TInputPixel2 &baseline, const TInputPixel3 &nativeT1)
Definition: mitkConvertToConcentrationViaT1Functor.h:49
MitkPharmacokineticsExports.h
mitk::ConvertToConcentrationViaT1CalcFunctor::initialize
void initialize(double relaxivity, double TR, double flipangle)
Definition: mitkConvertToConcentrationViaT1Functor.h:30
mitk
DataCollection - Class to facilitate loading/accessing structured data.
Definition: RenderingTests.dox:1
mitk::ConvertToConcentrationViaT1CalcFunctor::~ConvertToConcentrationViaT1CalcFunctor
~ConvertToConcentrationViaT1CalcFunctor()
Definition: mitkConvertToConcentrationViaT1Functor.h:28
mitk::ConvertToConcentrationViaT1CalcFunctor::ConvertToConcentrationViaT1CalcFunctor
ConvertToConcentrationViaT1CalcFunctor()
Definition: mitkConvertToConcentrationViaT1Functor.h:27
mitk::ConvertToConcentrationViaT1CalcFunctor
Definition: mitkConvertToConcentrationViaT1Functor.h:23
mitk::ConvertToConcentrationViaT1CalcFunctor::operator!=
bool operator!=(const ConvertToConcentrationViaT1CalcFunctor &other) const
Definition: mitkConvertToConcentrationViaT1Functor.h:38