13 #ifndef mitkConvertToConcentrationViaT1Functor_h
14 #define mitkConvertToConcentrationViaT1Functor_h
38 template <
class TInputPixel1,
class TInputPixel2,
class TInputPixel3,
class TOutputpixel>
51 void initialize(
double relaxivity,
double TR,
double flipangle,
double flipanglePDW)
53 m_relaxivity = relaxivity;
55 m_flipangle = flipangle;
56 m_flipanglePDW = flipanglePDW;
62 return !(*
this == other);
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);
79 inline TOutputpixel
operator()(
const TInputPixel1 & value,
const TInputPixel2 & baseline,
const TInputPixel3 & pdw)
81 TOutputpixel concentration(0.0);
82 if (baseline != 0 && pdw != 0 && value != 0)
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));
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));
96 concentration =
static_cast<double>((1.0 / T1 - 1.0 / T10) / (m_relaxivity/1000.0));
103 return concentration;
109 double m_flipanglePDW;
#define MITKPHARMACOKINETICS_EXPORT
Ternary functor that converts MR signal to concentration via T1 mapping using the variable flip angle...
ConvertToConcentrationViaT1CalcFunctor()
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.
~ConvertToConcentrationViaT1CalcFunctor()
bool operator==(const ConvertToConcentrationViaT1CalcFunctor &other) const
Equality comparison operator.
Find image slices visible on a given plane.