Medical Imaging Interaction Toolkit  2026.06.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 
38  template <class TInputPixel1, class TInputPixel2, class TInputPixel3, class TOutputpixel>
40  {
41 
42  public:
43  ConvertToConcentrationViaT1CalcFunctor(): m_relaxivity(0.0), m_TR(0.0), m_flipangle(0.0), m_flipanglePDW(0.0) {};
45 
51  void initialize(double relaxivity, double TR, double flipangle, double flipanglePDW)
52  {
53  m_relaxivity = relaxivity;
54  m_TR = TR;
55  m_flipangle = flipangle;
56  m_flipanglePDW = flipanglePDW;
57  }
58 
61  {
62  return !(*this == other);
63 
64  }
67  {
68  return (this->m_relaxivity == other.m_relaxivity) && (this->m_TR == other.m_TR) && (this->m_flipangle == other.m_flipangle) && (this->m_flipanglePDW == other.m_flipanglePDW);
69  }
70 
71 
79  inline TOutputpixel operator()( const TInputPixel1 & value, const TInputPixel2 & baseline, const TInputPixel3 & pdw)
80  {
81  TOutputpixel concentration(0.0);
82  if (baseline != 0 && pdw != 0 && value != 0)
83  {
84  // calculate signal scaling factor S0 and pre-contrast T1 relaxation time T10
85  const double a = pdw * sin(m_flipangle) / (baseline * sin(m_flipanglePDW));
86  const double b = (a - 1.0) / (a * cos(m_flipanglePDW) - cos(m_flipangle));
87  const double T10 = static_cast<double>((-1.0) * m_TR / log(b));
88  const double lambda = exp((-1.0) * m_TR / T10);
89  const double S0 = pdw * (1.0-lambda * cos(m_flipanglePDW)) / ((1.0 - lambda) * sin(m_flipanglePDW));
90 
91  // calculate T1
92  const double c = (value - S0 * sin(m_flipangle)) / (value * cos(m_flipangle) - S0 * sin(m_flipangle));
93  const double T1 = static_cast<double>((-1.0) * m_TR / log(c));
94 
95  //calculate concentration
96  concentration = static_cast<double>((1.0 / T1 - 1.0 / T10) / (m_relaxivity/1000.0));
97  }
98  else
99  {
100  concentration = 0.0;
101  }
102 
103  return concentration;
104  }
105  private:
106  double m_relaxivity;
107  double m_TR;
108  double m_flipangle;
109  double m_flipanglePDW;
110  };
111 
112 }
113 #endif
#define MITKPHARMACOKINETICS_EXPORT
Ternary functor that converts MR signal to concentration via T1 mapping using the variable flip angle...
bool operator!=(const ConvertToConcentrationViaT1CalcFunctor &other) const
Inequality comparison operator.
TOutputpixel operator()(const TInputPixel1 &value, const TInputPixel2 &baseline, const TInputPixel3 &pdw)
Computes concentration from signal, baseline, and PDW pixel values.
void initialize(double relaxivity, double TR, double flipangle, double flipanglePDW)
Initializes the functor with the MR sequence parameters.
bool operator==(const ConvertToConcentrationViaT1CalcFunctor &other) const
Equality comparison operator.
Find image slices visible on a given plane.