diff --git a/Modules/ModelFit/include/mitkExponentialSaturationModel.h b/Modules/ModelFit/include/mitkExponentialSaturationModel.h index b448a79bff..daba982745 100644 --- a/Modules/ModelFit/include/mitkExponentialSaturationModel.h +++ b/Modules/ModelFit/include/mitkExponentialSaturationModel.h @@ -1,136 +1,132 @@ /*============================================================================ 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. ============================================================================*/ #ifndef __MITK_EXPONENTIAL_SATURATION_MODEL_H_ #define __MITK_EXPONENTIAL_SATURATION_MODEL_H_ #include "mitkModelBase.h" #include "MitkModelFitExports.h" namespace mitk { /** @class ExponentialSaturationModel * @brief This genric model has the form: if x<onset: y(x) = baseline , else: y(x) = baseline + (y_final-baseline) * (1 - exp(-rate*(x-onset))) */ class MITKMODELFIT_EXPORT ExponentialSaturationModel : public mitk::ModelBase { public: typedef ExponentialSaturationModel Self; typedef mitk::ModelBase Superclass; typedef itk::SmartPointer< Self > Pointer; typedef itk::SmartPointer< const Self > ConstPointer; typedef Superclass::ParameterNameType ParameterNameType; typedef Superclass::ParametersSizeType ParametersSizeType; /** Method for creation through the object factory. */ itkFactorylessNewMacro(Self); itkCloneMacro(Self); /** Run-time type information (and related methods). */ itkTypeMacro(ExponentialSaturationModel, ModelBase); static const std::string NAME_PARAMETER_BAT; static const std::string NAME_PARAMETER_y_bl; static const std::string NAME_PARAMETER_y_fin; static const std::string NAME_PARAMETER_k; static const unsigned int NUMBER_OF_PARAMETERS; static const std::string UNIT_PARAMETER_BAT; static const std::string UNIT_PARAMETER_y_bl; static const std::string UNIT_PARAMETER_y_fin; static const std::string UNIT_PARAMETER_k; static const unsigned int POSITION_PARAMETER_BAT; static const unsigned int POSITION_PARAMETER_y_bl; static const unsigned int POSITION_PARAMETER_y_fin; static const unsigned int POSITION_PARAMETER_k; - static const unsigned int NUMBER_OF_DERIVED_PARAMETERS; - static const unsigned int NUMBER_OF_STATIC_PARAMETERS; static const std::string MODEL_DISPLAY_NAME; static const std::string MODEL_TYPE; static const std::string FUNCTION_STRING; static const std::string X_NAME; static const std::string X_AXIS_NAME; static const std::string X_AXIS_UNIT; static const std::string Y_AXIS_NAME; static const std::string Y_AXIS_UNIT; ParameterNamesType GetParameterNames() const override; ParametersSizeType GetNumberOfParameters() const override; ParamterUnitMapType GetParameterUnits() const override; - ParametersSizeType GetNumberOfDerivedParameters() const override; - ParameterNamesType GetStaticParameterNames() const override; ParametersSizeType GetNumberOfStaticParameters() const override; std::string GetModelDisplayName() const override; std::string GetModelType() const override; FunctionStringType GetFunctionString() const override; std::string GetXName() const override; std::string GetXAxisName() const override; std::string GetXAxisUnit() const override; std::string GetYAxisName() const override; std::string GetYAxisUnit() const override; protected: ExponentialSaturationModel() {}; ~ExponentialSaturationModel() override {}; /** * Actual implementation of the clone method. This method should be reimplemeted * in subclasses to clone the extra required parameters. */ itk::LightObject::Pointer InternalClone() const override; ModelResultType ComputeModelfunction(const ParametersType& parameters) const override; void SetStaticParameter(const ParameterNameType& name, const StaticParameterValuesType& values) override; StaticParameterValuesType GetStaticParameterValue(const ParameterNameType& name) const override; private: //No copy constructor allowed ExponentialSaturationModel(const Self& source); void operator=(const Self&); //purposely not implemented }; } #endif diff --git a/Modules/ModelFit/src/Models/mitkExponentialSaturationModel.cpp b/Modules/ModelFit/src/Models/mitkExponentialSaturationModel.cpp index 6374a7a543..eb6608c68a 100644 --- a/Modules/ModelFit/src/Models/mitkExponentialSaturationModel.cpp +++ b/Modules/ModelFit/src/Models/mitkExponentialSaturationModel.cpp @@ -1,188 +1,179 @@ /*============================================================================ 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 "mitkExponentialSaturationModel.h" #include "mitkNumericConstants.h" const std::string mitk::ExponentialSaturationModel::NAME_PARAMETER_BAT = "onset"; const std::string mitk::ExponentialSaturationModel::NAME_PARAMETER_y_bl = "baseline"; const std::string mitk::ExponentialSaturationModel::NAME_PARAMETER_y_fin = "y_final"; const std::string mitk::ExponentialSaturationModel::NAME_PARAMETER_k = "rate"; const unsigned int mitk::ExponentialSaturationModel::NUMBER_OF_PARAMETERS = 4; const std::string mitk::ExponentialSaturationModel::UNIT_PARAMETER_BAT = "[unit of x]"; const std::string mitk::ExponentialSaturationModel::UNIT_PARAMETER_y_bl = "[unit of y]"; const std::string mitk::ExponentialSaturationModel::UNIT_PARAMETER_y_fin = "[unit of y]"; const std::string mitk::ExponentialSaturationModel::UNIT_PARAMETER_k = "1/[unit of x]"; - const unsigned int mitk::ExponentialSaturationModel::POSITION_PARAMETER_BAT = 0; const unsigned int mitk::ExponentialSaturationModel::POSITION_PARAMETER_y_bl = 1; const unsigned int mitk::ExponentialSaturationModel::POSITION_PARAMETER_y_fin = 2; const unsigned int mitk::ExponentialSaturationModel::POSITION_PARAMETER_k = 3; -const unsigned int mitk::ExponentialSaturationModel::NUMBER_OF_DERIVED_PARAMETERS = 0; - const unsigned int mitk::ExponentialSaturationModel::NUMBER_OF_STATIC_PARAMETERS = 0; const std::string mitk::ExponentialSaturationModel::MODEL_DISPLAY_NAME = "Exponential Saturation Model"; const std::string mitk::ExponentialSaturationModel::MODEL_TYPE = "Generic"; const std::string mitk::ExponentialSaturationModel::FUNCTION_STRING = "if x<onset: y(x) = baseline , else: y(x) = baseline + (y_final-baseline) * (1 - exp(-rate*(x-onset)))"; const std::string mitk::ExponentialSaturationModel::X_NAME = "x"; const std::string mitk::ExponentialSaturationModel::X_AXIS_NAME = "X"; const std::string mitk::ExponentialSaturationModel::X_AXIS_UNIT = "unit of x"; const std::string mitk::ExponentialSaturationModel::Y_AXIS_NAME = "Y"; const std::string mitk::ExponentialSaturationModel::Y_AXIS_UNIT = "unit of y"; std::string mitk::ExponentialSaturationModel::GetModelDisplayName() const { return MODEL_DISPLAY_NAME; }; std::string mitk::ExponentialSaturationModel::GetModelType() const { return MODEL_TYPE; }; mitk::ExponentialSaturationModel::FunctionStringType mitk::ExponentialSaturationModel::GetFunctionString() const { return FUNCTION_STRING; }; std::string mitk::ExponentialSaturationModel::GetXName() const { return X_NAME; }; std::string mitk::ExponentialSaturationModel::GetXAxisName() const { return X_AXIS_NAME; }; std::string mitk::ExponentialSaturationModel::GetXAxisUnit() const { return X_AXIS_UNIT; } std::string mitk::ExponentialSaturationModel::GetYAxisName() const { return Y_AXIS_NAME; }; std::string mitk::ExponentialSaturationModel::GetYAxisUnit() const { return Y_AXIS_UNIT; } mitk::ExponentialSaturationModel::ParameterNamesType mitk::ExponentialSaturationModel::GetParameterNames() const { ParameterNamesType result; result.push_back(NAME_PARAMETER_BAT); result.push_back(NAME_PARAMETER_y_bl); result.push_back(NAME_PARAMETER_y_fin); result.push_back(NAME_PARAMETER_k); return result; }; mitk::ExponentialSaturationModel::ParamterUnitMapType mitk::ExponentialSaturationModel::GetParameterUnits() const { ParamterUnitMapType result; result.insert(std::make_pair(NAME_PARAMETER_BAT, UNIT_PARAMETER_BAT)); result.insert(std::make_pair(NAME_PARAMETER_y_bl, UNIT_PARAMETER_y_bl)); result.insert(std::make_pair(NAME_PARAMETER_y_fin, UNIT_PARAMETER_y_fin)); result.insert(std::make_pair(NAME_PARAMETER_k, UNIT_PARAMETER_k)); return result; } mitk::ExponentialSaturationModel::ParametersSizeType mitk::ExponentialSaturationModel::GetNumberOfParameters() const { return NUMBER_OF_PARAMETERS; }; -mitk::ExponentialSaturationModel::ParametersSizeType -mitk::ExponentialSaturationModel::GetNumberOfDerivedParameters() const -{ - return NUMBER_OF_DERIVED_PARAMETERS; -}; - mitk::ExponentialSaturationModel::ModelResultType mitk::ExponentialSaturationModel::ComputeModelfunction(const ParametersType& parameters) const { ModelResultType signal(m_TimeGrid.GetSize()); ModelResultType::iterator signalPos = signal.begin(); for (const auto& gridPos : m_TimeGrid) { if ((gridPos) < parameters[0]) { *signalPos = parameters[1]; } else { *signalPos = parameters[1] + (parameters[2]- parameters[1]) * (1.0 - exp((-1.0) * parameters[3] * (gridPos - parameters[0]))); } ++signalPos; } return signal; }; mitk::ExponentialSaturationModel::ParameterNamesType mitk::ExponentialSaturationModel::GetStaticParameterNames() const { ParameterNamesType result; return result; } mitk::ExponentialSaturationModel::ParametersSizeType mitk::ExponentialSaturationModel::GetNumberOfStaticParameters() const { return NUMBER_OF_STATIC_PARAMETERS; } void mitk::ExponentialSaturationModel::SetStaticParameter(const ParameterNameType& /*name*/, const StaticParameterValuesType& /*values*/) { //do nothing }; mitk::ExponentialSaturationModel::StaticParameterValuesType mitk::ExponentialSaturationModel::GetStaticParameterValue( const ParameterNameType& /*name*/) const { StaticParameterValuesType result; //do nothing return result; }; itk::LightObject::Pointer mitk::ExponentialSaturationModel::InternalClone() const { ExponentialSaturationModel::Pointer newClone = ExponentialSaturationModel::New(); newClone->SetTimeGrid(this->m_TimeGrid); return newClone.GetPointer(); };