13 #ifndef mitkConvertToConcentrationViaT1Functor_h
14 #define mitkConvertToConcentrationViaT1Functor_h
22 template <
class TInputPixel1,
class TInputPixel2,
class TInputPixel3,
class TOutputpixel>
30 void initialize(
double relaxivity,
double TR,
double flipangle,
double flipanglePDW)
32 m_relaxivity = relaxivity;
34 m_flipangle = flipangle;
35 m_flipanglePDW = flipanglePDW;
40 return !(*
this == other);
45 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);
49 inline TOutputpixel
operator()(
const TInputPixel1 & value,
const TInputPixel2 & baseline,
const TInputPixel3 & pdw)
51 TOutputpixel concentration(0.0);
52 if (baseline != 0 && pdw != 0 && value != 0)
55 const double a = pdw * sin(m_flipangle) / (baseline * sin(m_flipanglePDW));
56 const double b = (a - 1.0) / (a * cos(m_flipanglePDW) - cos(m_flipangle));
57 const double T10 =
static_cast<double>((-1.0) * m_TR / log(b));
58 const double lambda = exp((-1.0) * m_TR / T10);
59 const double S0 = pdw * (1.0-lambda * cos(m_flipanglePDW)) / ((1.0 - lambda) * sin(m_flipanglePDW));
62 const double c = (value - S0 * sin(m_flipangle)) / (value * cos(m_flipangle) - S0 * sin(m_flipangle));
63 const double T1 =
static_cast<double>((-1.0) * m_TR / log(c));
66 concentration =
static_cast<double>((1.0 / T1 - 1.0 / T10) / (m_relaxivity/1000.0));
79 double m_flipanglePDW;