diff --git a/Modules/Pharmacokinetics/src/Models/mitkTwoStepLinearModel.cpp b/Modules/Pharmacokinetics/src/Models/mitkTwoStepLinearModel.cpp index 8ab06bfed8..177b9264ec 100644 --- a/Modules/Pharmacokinetics/src/Models/mitkTwoStepLinearModel.cpp +++ b/Modules/Pharmacokinetics/src/Models/mitkTwoStepLinearModel.cpp @@ -1,218 +1,211 @@ /*============================================================================ The Medical Imaging Interaction Toolkit (MITK) Copyright (c) German Cancer Research Center (DKFZ) All rights reserved. Use of this source code is governed by a 3-clause BSD license that can be found in the LICENSE file. ============================================================================*/ #include "mitkTwoStepLinearModel.h" #include const std::string mitk::TwoStepLinearModel::MODELL_NAME = "Two Step Linear Model"; const std::string mitk::TwoStepLinearModel::NAME_PARAMETER_y1 = "BaseValue"; const std::string mitk::TwoStepLinearModel::NAME_PARAMETER_a1 = "Slope_1"; const std::string mitk::TwoStepLinearModel::NAME_PARAMETER_t = "Change_Point"; const std::string mitk::TwoStepLinearModel::NAME_PARAMETER_a2 = "Slope_2"; const unsigned int mitk::TwoStepLinearModel::POSITION_PARAMETER_y1 = 0; const unsigned int mitk::TwoStepLinearModel::POSITION_PARAMETER_t = 1; const unsigned int mitk::TwoStepLinearModel::POSITION_PARAMETER_a1 = 2; const unsigned int mitk::TwoStepLinearModel::POSITION_PARAMETER_a2 = 3; const unsigned int mitk::TwoStepLinearModel::NUMBER_OF_PARAMETERS = 4; std::string mitk::TwoStepLinearModel::GetModelDisplayName() const { return MODELL_NAME; }; std::string mitk::TwoStepLinearModel::GetModelType() const { return "Generic"; }; mitk::TwoStepLinearModel::FunctionStringType mitk::TwoStepLinearModel::GetFunctionString() const { return "Slope_1*t+Y_intercept_1 if t= 0) && (a2 >= 0)) smax = sfin; else if ((a1 < 0) && (a2 < 0)) smax = b1; else if ((a1 > 0) && (a2 < 0)) smax = (a1 * t + b1); else { if (abs(a1 * t) >= abs(a2 * (taq - t))) smax = b1; else smax = sfin; } double auc = 0.0; TimeGridType::const_iterator timeGridEnd = m_TimeGrid.end(); for (TimeGridType::const_iterator gridPos = m_TimeGrid.begin(); gridPos != timeGridEnd -1; ++gridPos) { double currentGridPos = *gridPos; double nextGridPos = *(++gridPos); double deltaX = nextGridPos - currentGridPos; double deltaY = ComputeSignalFromParameters(nextGridPos, t, a1, a2, b1, b2) - ComputeSignalFromParameters(currentGridPos, t, a1, a2, b1, b2); double Yi = ComputeSignalFromParameters(currentGridPos, t, a1, a2, b1, b2); double intI = 0.5 * deltaX * deltaY + Yi * deltaX; auc += std::abs(intI); --gridPos; } DerivedParameterMapType result; result.insert(std::make_pair("AUC", auc)); result.insert(std::make_pair("FinalUptake", sfin)); result.insert(std::make_pair("Smax", smax)); result.insert(std::make_pair("y-intercept2", b2)); return result; }; itk::LightObject::Pointer mitk::TwoStepLinearModel::InternalClone() const { TwoStepLinearModel::Pointer newClone = TwoStepLinearModel::New(); newClone->SetTimeGrid(this->m_TimeGrid); return newClone.GetPointer(); };