Medical Imaging Interaction Toolkit  2026.06.00
Medical Imaging Interaction Toolkit
mitk::GenericParamModel Class Reference

Model that uses a user-specified formula string as its model function. More...

#include <mitkGenericParamModel.h>

Inheritance diagram for mitk::GenericParamModel:
Collaboration diagram for mitk::GenericParamModel:

Public Types

typedef GenericParamModel Self
 
typedef mitk::ModelBase Superclass
 
typedef itk::SmartPointer< Self > Pointer
 
typedef itk::SmartPointer< const Self > ConstPointer
 
typedef Superclass::ParameterNameType ParameterNameType
 
typedef Superclass::ParametersSizeType ParametersSizeType
 
- Public Types inherited from mitk::ModelBase
typedef ModelBase Self
 
typedef itk::Object Superclass
 
typedef itk::SmartPointer< Self > Pointer
 
typedef itk::SmartPointer< const Self > ConstPointer
 
typedef ModelTraitsInterface::ModelResultType ModelResultType
 
typedef ModelTraitsInterface::ParameterValueType ParameterValueType
 
typedef ModelTraitsInterface::ParametersType ParametersType
 
typedef itk::Array< double > TimeGridType
 Type defining the time grid used by models. More...
 
typedef ModelTraitsInterface::ParameterNameType ParameterNameType
 
typedef ModelTraitsInterface::ParameterNamesType ParameterNamesType
 
typedef ModelTraitsInterface::ParametersSizeType ParametersSizeType
 
typedef ModelTraitsInterface::DerivedParameterNamesType DerivedParameterNamesType
 
typedef ModelTraitsInterface::DerivedParametersSizeType DerivedParametersSizeType
 
typedef double StaticParameterValueType
 
typedef std::vector< StaticParameterValueType > StaticParameterValuesType
 
typedef std::map< ParameterNameType, StaticParameterValuesType > StaticParameterMapType
 
typedef double DerivedParameterValueType
 
typedef std::map< ParameterNameType, DerivedParameterValueType > DerivedParameterMapType
 
- Public Types inherited from mitk::ModelTraitsInterface
typedef itk::Array< double > ModelResultType
 Type representing the model output signal as an array of doubles. More...
 
using ParameterValueType = double
 Type of a single parameter value. More...
 
typedef itk::Array< ParameterValueType > ParametersType
 Type representing a vector of parameter values. More...
 
typedef std::string ParameterNameType
 Type used for parameter names. More...
 
typedef std::vector< ParameterNameType > ParameterNamesType
 Type for a list of parameter names. More...
 
typedef ParametersType::SizeValueType ParametersSizeType
 Type for the count of parameters. More...
 
typedef ParameterNamesType DerivedParameterNamesType
 Type for a list of derived parameter names. More...
 
typedef ParametersSizeType DerivedParametersSizeType
 Type for the count of derived parameters. More...
 
typedef std::map< ParameterNameType, double > ParamterScaleMapType
 Map type associating parameter names to their scaling factors. More...
 
typedef std::map< ParameterNameType, std::string > ParamterUnitMapType
 Map type associating parameter names to their unit strings. More...
 
typedef std::map< ParameterNameType, double > DerivedParamterScaleMapType
 Map type associating derived parameter names to their scaling factors. More...
 
typedef std::map< ParameterNameType, std::string > DerivedParamterUnitMapType
 Map type associating derived parameter names to their unit strings. More...
 
typedef std::string FunctionStringType
 Type for the function string representation of the model. More...
 
typedef std::string ModellClassIDType
 Type for the unique class identifier of the model. More...
 

Public Member Functions

Pointer Clone () const
 
virtual const char * GetClassName () const
 
std::string GetModelDisplayName () const override
 Returns the human-readable display name of the model. More...
 
std::string GetModelType () const override
 Returns the type/category string of the model (e.g. "Linear", "Pharmacokinetic"). More...
 
FunctionStringType GetFunctionString () const override
 Returns a parsable function string representing the model equation. More...
 
virtual void SetFunctionString (const char *_arg)
 
virtual void SetNumberOfParameters (ParametersSizeType _arg)
 
std::string GetXName () const override
 Returns the name of the independent variable used by the model (e.g. "x"). More...
 
ParameterNamesType GetParameterNames () const override
 Returns the names of parameters that must be defined when using the model to compute the signal (GetSignal()). More...
 
ParametersSizeType GetNumberOfParameters () const override
 Returns the number of parameters that must be defined when using the model to compute the signal (GetSignal()). More...
 
ParamterUnitMapType GetParameterUnits () const override
 Returns the unit strings for all model parameters. More...
 
ParameterNamesType GetStaticParameterNames () const override
 Returns the names of static parameters used when computing the signal. More...
 
ParametersSizeType GetNumberOfStaticParameters () const override
 Returns the number of static parameters. More...
 
- Public Member Functions inherited from mitk::ModelBase
ParamterScaleMapType GetParameterScales () const override
 Default implementation returns a scale of 1.0 for every defined parameter. More...
 
ParamterUnitMapType GetParameterUnits () const override
 Default implementation returns no unit string ("") for every defined parameter. More...
 
DerivedParamterScaleMapType GetDerivedParameterScales () const override
 Default implementation returns a scale of 1.0 for every defined derived parameter. More...
 
DerivedParamterUnitMapType GetDerivedParameterUnits () const override
 Default implementation returns no unit string ("") for every defined derived parameter. More...
 
std::string GetModelDisplayName () const override
 Default implementation returns GetClassID as display name. More...
 
std::string GetModelType () const override
 Default implementation returns "Unknown" as model type. More...
 
FunctionStringType GetFunctionString () const override
 Default implementation returns an empty function string. More...
 
ModellClassIDType GetClassID () const override
 Default implementation returns the class name of the concrete instance as ID. More...
 
std::string GetXName () const override
 Default implementation returns an empty string. More...
 
std::string GetXAxisName () const override
 Default implementation returns an empty string. More...
 
std::string GetXAxisUnit () const override
 Default implementation returns an empty string. More...
 
std::string GetYAxisName () const override
 Default implementation returns an empty string. More...
 
std::string GetYAxisUnit () const override
 Default implementation returns an empty string. More...
 
virtual ParamterUnitMapType GetStaticParameterUnits () const
 Default implementation returns no unit string ("") for every defined static parameter. More...
 
DerivedParameterNamesType GetDerivedParameterNames () const override
 Returns the names of derived parameters that can be computed by the model. More...
 
DerivedParametersSizeType GetNumberOfDerivedParameters () const override
 Returns the number of derived parameters that can be computed by the model. More...
 
void SetStaticParameters (const StaticParameterMapType &parameters, bool allParameters=true)
 Sets the static parameters of the model before it is used. More...
 
StaticParameterMapType GetStaticParameters () const
 Retrieves the static parameters of the model (e.g. for serialization). More...
 
DerivedParameterMapType GetDerivedParameters (const ParametersType &parameters) const
 Computes all derived parameters for the given model parameters. More...
 
virtual void SetTimeGrid (const TimeGridType &grid)
 Sets the time grid of the model. More...
 
virtual const TimeGridType & GetTimeGrid ()
 Gets the time grid of the model. More...
 
ModelResultType GetSignal (const ParametersType &parameters) const
 Computes and returns the model signal for the given parameters. More...
 

Static Public Member Functions

static Pointer New ()
 

Static Public Attributes

static const std::string NAME_STATIC_PARAMETER_number
 

Protected Member Functions

 GenericParamModel ()
 
 ~GenericParamModel () override
 
 GenericParamModel (const GenericParamModel &source)
 
 mitkCloneMacro (GenericParamModel)
 
ModelResultType ComputeModelfunction (const ParametersType &parameters) const override
 Computes the model function for the given parameters. More...
 
void SetStaticParameter (const ParameterNameType &name, const StaticParameterValuesType &values) override
 Sets a single static parameter by name. More...
 
StaticParameterValuesType GetStaticParameterValue (const ParameterNameType &name) const override
 Retrieves a single static parameter value by name. More...
 
- Protected Member Functions inherited from mitk::ModelBase
virtual bool ValidateModel (std::string &error) const
 Validates whether the model is in a valid state to compute the signal. More...
 
virtual DerivedParameterMapType ComputeDerivedParameters (const ParametersType &parameters) const
 Computes derived parameters from the given model parameters. More...
 
 ModelBase ()
 
 ~ModelBase () override
 
 ModelBase (const ModelBase &source)
 
void PrintSelf (std::ostream &os, ::itk::Indent indent) const override
 
- Protected Member Functions inherited from mitk::ModelTraitsInterface
 ModelTraitsInterface ()
 
virtual ~ModelTraitsInterface ()
 

Additional Inherited Members

- Protected Attributes inherited from mitk::ModelBase
TimeGridType m_TimeGrid
 

Detailed Description

Model that uses a user-specified formula string as its model function.

The parser used to interpret the string can handle simple mathematical formulas (e.g. "3.5 + a * x * sin(x) - 1 / 2"). It recognizes:

  • sums, differences, products and divisions (a + b, 4 - 3, 2 * x, 9 / 3)
  • algebraic signs (+5, -5)
  • exponentiation (2 ^ 4)
  • parentheses (3 * (4 + 2))
  • unary functions: abs, exp, sin, cos, tan, sind, cosd, tand
  • variables (x, a, b, ... j)
Note
The variable "x" is reserved for the signal position / time point.
The current version supports up to 10 model parameters (a through j). Do not use "x" as a model parameter; it is the independent variable.
See also
GenericParamModelFactory, GenericParamModelParameterizer, FormulaParser

Definition at line 42 of file mitkGenericParamModel.h.

Member Typedef Documentation

◆ ConstPointer

◆ ParameterNameType

◆ ParametersSizeType

◆ Pointer

◆ Self

◆ Superclass

Constructor & Destructor Documentation

◆ GenericParamModel() [1/2]

mitk::GenericParamModel::GenericParamModel ( )
protected

◆ ~GenericParamModel()

mitk::GenericParamModel::~GenericParamModel ( )
inlineoverrideprotected

Definition at line 87 of file mitkGenericParamModel.h.

◆ GenericParamModel() [2/2]

mitk::GenericParamModel::GenericParamModel ( const GenericParamModel &  source)
protected

Member Function Documentation

◆ Clone()

Pointer mitk::GenericParamModel::Clone ( ) const

◆ ComputeModelfunction()

ModelResultType mitk::GenericParamModel::ComputeModelfunction ( const ParametersType &  parameters) const
overrideprotectedvirtual

Computes the model function for the given parameters.

Must be implemented by derived classes.

Parameters
parametersThe model parameters.
Returns
The computed model result.

Implements mitk::ModelBase.

◆ GetClassName()

virtual const char* mitk::GenericParamModel::GetClassName ( ) const
virtual

Run-time type information (and related methods).

Reimplemented from mitk::ModelBase.

◆ GetFunctionString()

FunctionStringType mitk::GenericParamModel::GetFunctionString ( ) const
overridevirtual

Returns a parsable function string representing the model equation.

Returns
The function string (e.g. "a*x+b").

Implements mitk::ModelTraitsInterface.

◆ GetModelDisplayName()

std::string mitk::GenericParamModel::GetModelDisplayName ( ) const
overridevirtual

Returns the human-readable display name of the model.

Returns
The model display name.

Implements mitk::ModelTraitsInterface.

◆ GetModelType()

std::string mitk::GenericParamModel::GetModelType ( ) const
overridevirtual

Returns the type/category string of the model (e.g. "Linear", "Pharmacokinetic").

Returns
The model type string.

Implements mitk::ModelTraitsInterface.

◆ GetNumberOfParameters()

ParametersSizeType mitk::GenericParamModel::GetNumberOfParameters ( ) const
overridevirtual

Returns the number of parameters that must be defined when using the model to compute the signal (GetSignal()).

Returns
The number of model parameters.

Implements mitk::ModelTraitsInterface.

◆ GetNumberOfStaticParameters()

ParametersSizeType mitk::GenericParamModel::GetNumberOfStaticParameters ( ) const
overridevirtual

Returns the number of static parameters.

Returns
The count of static parameters.

Implements mitk::ModelBase.

◆ GetParameterNames()

ParameterNamesType mitk::GenericParamModel::GetParameterNames ( ) const
overridevirtual

Returns the names of parameters that must be defined when using the model to compute the signal (GetSignal()).

Returns
A vector of parameter name strings.

Implements mitk::ModelTraitsInterface.

◆ GetParameterUnits()

ParamterUnitMapType mitk::GenericParamModel::GetParameterUnits ( ) const
overridevirtual

Returns the unit strings for all model parameters.

Returns
A map from parameter name to its unit string.

Implements mitk::ModelTraitsInterface.

◆ GetStaticParameterNames()

ParameterNamesType mitk::GenericParamModel::GetStaticParameterNames ( ) const
overridevirtual

Returns the names of static parameters used when computing the signal.

Static parameters are not part of the fitting scope but configure the model.

Returns
A vector of static parameter names.

Implements mitk::ModelBase.

◆ GetStaticParameterValue()

StaticParameterValuesType mitk::GenericParamModel::GetStaticParameterValue ( const ParameterNameType &  name) const
overrideprotectedvirtual

Retrieves a single static parameter value by name.

Helper function called by GetStaticParameters(). Must be implemented in derived classes.

Implements mitk::ModelBase.

◆ GetXName()

std::string mitk::GenericParamModel::GetXName ( ) const
overridevirtual

Returns the name of the independent variable used by the model (e.g. "x").

Returns
The variable name string.

Implements mitk::ModelTraitsInterface.

◆ mitkCloneMacro()

mitk::GenericParamModel::mitkCloneMacro ( GenericParamModel  )
protected

◆ New()

static Pointer mitk::GenericParamModel::New ( )
static

Method for creation through the object factory.

◆ SetFunctionString()

virtual void mitk::GenericParamModel::SetFunctionString ( const char *  _arg)
virtual

◆ SetNumberOfParameters()

virtual void mitk::GenericParamModel::SetNumberOfParameters ( ParametersSizeType  _arg)
virtual
Precondition
The number of parameters must be between 1 and 10.

◆ SetStaticParameter()

void mitk::GenericParamModel::SetStaticParameter ( const ParameterNameType &  name,
const StaticParameterValuesType &  values 
)
overrideprotectedvirtual

Sets a single static parameter by name.

Helper function called by SetStaticParameters(). Must be implemented in derived classes.

Implements mitk::ModelBase.

Member Data Documentation

◆ NAME_STATIC_PARAMETER_number

const std::string mitk::GenericParamModel::NAME_STATIC_PARAMETER_number
static

Definition at line 61 of file mitkGenericParamModel.h.


The documentation for this class was generated from the following file: