13 #ifndef mitkTwoTissueCompartmentModelDifferentialEquations_h
14 #define mitkTwoTissueCompartmentModelDifferentialEquations_h
43 double Ca_t = InterpolateAIFToCurrentTimeStep(t);
45 dxdt[0] = this->K1*Ca_t-(this->k2+this->k3)*x[0] + this->k4*x[1];
46 dxdt[1] = this->k3*x[0] - this->k4*x[1];
54 void initialize(
double k_1,
double k_2,
double k_3,
double k_4)
71 this->m_AIFTimeGrid = grid;
89 double InterpolateAIFToCurrentTimeStep(
double t)
91 double lastValue = m_AIF[0];
92 double lastTime = std::numeric_limits<double>::min();
94 AIFType::const_iterator posITime = m_AIFTimeGrid.begin();
95 AIFType::const_iterator posValue = m_AIF.begin();
99 lastValue = *posValue;
100 lastTime = *posITime;
104 double weightLast = 1 - (t - lastTime)/(*posITime - lastTime);
105 double weightNext = 1- (*posITime - t)/(*posITime - lastTime);
106 double result = weightLast * lastValue + weightNext * (*posValue);