13 #ifndef mitkTwoCompartmentExchangeModelDifferentialEquations_h
14 #define mitkTwoCompartmentExchangeModelDifferentialEquations_h
41 double Ca_t = InterpolateAIFToCurrentTimeStep(t);
44 dxdt[0] = (1/this->vp) * ( this->F*(Ca_t - x[0]) - this->PS*(x[0] - x[1]) );
45 dxdt[1] = (1/this->ve) * this->PS * (x[0] - x[1]);
54 void initialize(
double Fp,
double ps,
double fi,
double fp)
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);