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)
33 m_relaxivity = relaxivity;
35 m_flipangle = flipangle;
40 return !(*
this == other);
45 return (this->m_relaxivity == other.m_relaxivity) && (this->m_TR == other.m_TR) && (this->m_flipangle == other.m_flipangle);
49 inline TOutputpixel
operator()(
const TInputPixel1 & value,
const TInputPixel2 & baseline,
const TInputPixel3 & nativeT1)
51 TOutputpixel concentration(0);
53 if (baseline !=0 && nativeT1 != 0 && value != 0)
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));
60 R1 = (double) -1/m_TR * tmp1/tmp2 ;
62 concentration = (double) (R1 - R10)/ m_relaxivity;