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

Model representing a simple linear function: y(x) = b * x + y0. More...

#include <mitkLinearModel.h>

Inheritance diagram for mitk::LinearModel:
Collaboration diagram for mitk::LinearModel:

Public Types

typedef LinearModel 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
 
ParameterNamesType GetParameterNames () const override
 Returns the names of all model parameters. More...
 
ParametersSizeType GetNumberOfParameters () const override
 Returns the number of model parameters (2). More...
 
ParamterUnitMapType GetParameterUnits () const override
 Returns the unit map for model parameters. More...
 
ParameterNamesType GetDerivedParameterNames () const override
 Returns the names of derived parameters. More...
 
ParametersSizeType GetNumberOfDerivedParameters () const override
 Returns the number of derived parameters (1). More...
 
ParamterUnitMapType GetDerivedParameterUnits () const override
 Returns the unit map for derived parameters. More...
 
ParameterNamesType GetStaticParameterNames () const override
 Returns the names of static parameters (empty for this model). More...
 
ParametersSizeType GetNumberOfStaticParameters () const override
 Returns the number of static parameters (0). More...
 
std::string GetModelDisplayName () const override
 Returns the display name "Linear Model". More...
 
std::string GetModelType () const override
 Returns the model type string. More...
 
FunctionStringType GetFunctionString () const override
 Returns the function string representing the model equation. More...
 
std::string GetXName () const override
 Returns the name of the independent variable. More...
 
std::string GetXAxisName () const override
 Returns the x-axis display name. More...
 
std::string GetXAxisUnit () const override
 Returns the x-axis unit. More...
 
std::string GetYAxisName () const override
 Returns the y-axis display name. More...
 
std::string GetYAxisUnit () const override
 Returns the y-axis unit. 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_PARAMETER_y0
 Name string for the y-intercept parameter ("y-intercept"). More...
 
static const std::string NAME_PARAMETER_b
 Name string for the slope parameter ("slope"). More...
 
static const unsigned int NUMBER_OF_PARAMETERS
 Total number of model parameters (2). More...
 
static const std::string UNIT_PARAMETER_y0
 Unit of the y-intercept parameter. More...
 
static const std::string UNIT_PARAMETER_b
 Unit of the slope parameter. More...
 
static const unsigned int POSITION_PARAMETER_y0
 Index position of y-intercept in the parameter vector. More...
 
static const unsigned int POSITION_PARAMETER_b
 Index position of slope in the parameter vector. More...
 
static const std::string NAME_DERIVED_PARAMETER_x_intercept
 Name string for the derived x-intercept parameter. More...
 
static const unsigned int NUMBER_OF_DERIVED_PARAMETERS
 Total number of derived parameters (1). More...
 
static const std::string UNIT_DERIVED_PARAMETER_x_intercept
 Unit of the derived x-intercept parameter. More...
 
static const unsigned int NUMBER_OF_STATIC_PARAMETERS
 Total number of static parameters (0). More...
 
static const std::string MODEL_DISPLAY_NAME
 Display name of this model ("Linear Model"). More...
 
static const std::string MODEL_TYPE
 Type category of this model. More...
 
static const std::string FUNCTION_STRING
 Function string representation of the model equation. More...
 
static const std::string X_NAME
 Name of the independent variable. More...
 
static const std::string X_AXIS_NAME
 Display name for the x-axis. More...
 
static const std::string X_AXIS_UNIT
 Unit for the x-axis. More...
 
static const std::string Y_AXIS_NAME
 Display name for the y-axis. More...
 
static const std::string Y_AXIS_UNIT
 Unit for the y-axis. More...
 

Protected Member Functions

 LinearModel ()
 
 ~LinearModel () override
 
 LinearModel (const LinearModel &source)
 
 mitkCloneMacro (LinearModel)
 
ModelResultType ComputeModelfunction (const ParametersType &parameters) const override
 Computes the model function for the given parameters. More...
 
DerivedParameterMapType ComputeDerivedParameters (const mitk::ModelBase::ParametersType &parameters) const override
 Computes derived parameters from the given model 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...
 
 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 representing a simple linear function: y(x) = b * x + y0.

This model implements a linear relationship between the independent variable x and the dependent variable y. It has two parameters (slope b and intercept y0) and one derived parameter (x-intercept = -y0/b).

See also
LinearModelFactory, LinearModelParameterizer, ModelBase

Definition at line 33 of file mitkLinearModel.h.

Member Typedef Documentation

◆ ConstPointer

Definition at line 40 of file mitkLinearModel.h.

◆ ParameterNameType

◆ ParametersSizeType

◆ Pointer

Definition at line 39 of file mitkLinearModel.h.

◆ Self

Definition at line 37 of file mitkLinearModel.h.

◆ Superclass

Constructor & Destructor Documentation

◆ LinearModel() [1/2]

mitk::LinearModel::LinearModel ( )
inlineprotected

Definition at line 172 of file mitkLinearModel.h.

◆ ~LinearModel()

mitk::LinearModel::~LinearModel ( )
inlineoverrideprotected

Definition at line 173 of file mitkLinearModel.h.

◆ LinearModel() [2/2]

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

Member Function Documentation

◆ Clone()

Pointer mitk::LinearModel::Clone ( ) const

◆ ComputeDerivedParameters()

DerivedParameterMapType mitk::LinearModel::ComputeDerivedParameters ( const mitk::ModelBase::ParametersType &  parameters) const
overrideprotectedvirtual

Computes derived parameters from the given model parameters.

Helper function called by GetDerivedParameters(). Implement in derived classes to realize the concrete computation of derived parameters.

Remarks
Default implementation has no derived parameters.

Reimplemented from mitk::ModelBase.

◆ ComputeModelfunction()

ModelResultType mitk::LinearModel::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::LinearModel::GetClassName ( ) const
virtual

Run-time type information (and related methods).

Reimplemented from mitk::ModelBase.

◆ GetDerivedParameterNames()

ParameterNamesType mitk::LinearModel::GetDerivedParameterNames ( ) const
overridevirtual

Returns the names of derived parameters.

Returns
Vector containing "x-intercept".

Implements mitk::ModelTraitsInterface.

◆ GetDerivedParameterUnits()

ParamterUnitMapType mitk::LinearModel::GetDerivedParameterUnits ( ) const
overridevirtual

Returns the unit map for derived parameters.

Returns
Map of derived parameter names to their unit strings.

Implements mitk::ModelTraitsInterface.

◆ GetFunctionString()

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

Returns the function string representing the model equation.

Returns
The function string.

Implements mitk::ModelTraitsInterface.

◆ GetModelDisplayName()

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

Returns the display name "Linear Model".

Returns
The model display name.

Implements mitk::ModelTraitsInterface.

◆ GetModelType()

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

Returns the model type string.

Returns
The model type.

Implements mitk::ModelTraitsInterface.

◆ GetNumberOfDerivedParameters()

ParametersSizeType mitk::LinearModel::GetNumberOfDerivedParameters ( ) const
overridevirtual

Returns the number of derived parameters (1).

Returns
1

Implements mitk::ModelTraitsInterface.

◆ GetNumberOfParameters()

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

Returns the number of model parameters (2).

Returns
2

Implements mitk::ModelTraitsInterface.

◆ GetNumberOfStaticParameters()

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

Returns the number of static parameters (0).

Returns
0

Implements mitk::ModelBase.

◆ GetParameterNames()

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

Returns the names of all model parameters.

Returns
Vector containing "y-intercept" and "slope".

Implements mitk::ModelTraitsInterface.

◆ GetParameterUnits()

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

Returns the unit map for model parameters.

Returns
Map of parameter names to their unit strings.

Implements mitk::ModelTraitsInterface.

◆ GetStaticParameterNames()

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

Returns the names of static parameters (empty for this model).

Returns
Empty vector.

Implements mitk::ModelBase.

◆ GetStaticParameterValue()

StaticParameterValuesType mitk::LinearModel::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.

◆ GetXAxisName()

std::string mitk::LinearModel::GetXAxisName ( ) const
overridevirtual

Returns the x-axis display name.

Returns
The x-axis name.

Implements mitk::ModelTraitsInterface.

◆ GetXAxisUnit()

std::string mitk::LinearModel::GetXAxisUnit ( ) const
overridevirtual

Returns the x-axis unit.

Returns
The x-axis unit string.

Implements mitk::ModelTraitsInterface.

◆ GetXName()

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

Returns the name of the independent variable.

Returns
The x variable name.

Implements mitk::ModelTraitsInterface.

◆ GetYAxisName()

std::string mitk::LinearModel::GetYAxisName ( ) const
overridevirtual

Returns the y-axis display name.

Returns
The y-axis name.

Implements mitk::ModelTraitsInterface.

◆ GetYAxisUnit()

std::string mitk::LinearModel::GetYAxisUnit ( ) const
overridevirtual

Returns the y-axis unit.

Returns
The y-axis unit string.

Implements mitk::ModelTraitsInterface.

◆ mitkCloneMacro()

mitk::LinearModel::mitkCloneMacro ( LinearModel  )
protected

◆ New()

static Pointer mitk::LinearModel::New ( )
static

Method for creation through the object factory.

◆ SetStaticParameter()

void mitk::LinearModel::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

◆ FUNCTION_STRING

const std::string mitk::LinearModel::FUNCTION_STRING
static

Function string representation of the model equation.

Definition at line 89 of file mitkLinearModel.h.

◆ MODEL_DISPLAY_NAME

const std::string mitk::LinearModel::MODEL_DISPLAY_NAME
static

Display name of this model ("Linear Model").

Definition at line 83 of file mitkLinearModel.h.

◆ MODEL_TYPE

const std::string mitk::LinearModel::MODEL_TYPE
static

Type category of this model.

Definition at line 86 of file mitkLinearModel.h.

◆ NAME_DERIVED_PARAMETER_x_intercept

const std::string mitk::LinearModel::NAME_DERIVED_PARAMETER_x_intercept
static

Name string for the derived x-intercept parameter.

Definition at line 71 of file mitkLinearModel.h.

◆ NAME_PARAMETER_b

const std::string mitk::LinearModel::NAME_PARAMETER_b
static

Name string for the slope parameter ("slope").

Definition at line 55 of file mitkLinearModel.h.

◆ NAME_PARAMETER_y0

const std::string mitk::LinearModel::NAME_PARAMETER_y0
static

Name string for the y-intercept parameter ("y-intercept").

Definition at line 53 of file mitkLinearModel.h.

◆ NUMBER_OF_DERIVED_PARAMETERS

const unsigned int mitk::LinearModel::NUMBER_OF_DERIVED_PARAMETERS
static

Total number of derived parameters (1).

Definition at line 74 of file mitkLinearModel.h.

◆ NUMBER_OF_PARAMETERS

const unsigned int mitk::LinearModel::NUMBER_OF_PARAMETERS
static

Total number of model parameters (2).

Definition at line 58 of file mitkLinearModel.h.

◆ NUMBER_OF_STATIC_PARAMETERS

const unsigned int mitk::LinearModel::NUMBER_OF_STATIC_PARAMETERS
static

Total number of static parameters (0).

Definition at line 80 of file mitkLinearModel.h.

◆ POSITION_PARAMETER_b

const unsigned int mitk::LinearModel::POSITION_PARAMETER_b
static

Index position of slope in the parameter vector.

Definition at line 68 of file mitkLinearModel.h.

◆ POSITION_PARAMETER_y0

const unsigned int mitk::LinearModel::POSITION_PARAMETER_y0
static

Index position of y-intercept in the parameter vector.

Definition at line 66 of file mitkLinearModel.h.

◆ UNIT_DERIVED_PARAMETER_x_intercept

const std::string mitk::LinearModel::UNIT_DERIVED_PARAMETER_x_intercept
static

Unit of the derived x-intercept parameter.

Definition at line 77 of file mitkLinearModel.h.

◆ UNIT_PARAMETER_b

const std::string mitk::LinearModel::UNIT_PARAMETER_b
static

Unit of the slope parameter.

Definition at line 63 of file mitkLinearModel.h.

◆ UNIT_PARAMETER_y0

const std::string mitk::LinearModel::UNIT_PARAMETER_y0
static

Unit of the y-intercept parameter.

Definition at line 61 of file mitkLinearModel.h.

◆ X_AXIS_NAME

const std::string mitk::LinearModel::X_AXIS_NAME
static

Display name for the x-axis.

Definition at line 95 of file mitkLinearModel.h.

◆ X_AXIS_UNIT

const std::string mitk::LinearModel::X_AXIS_UNIT
static

Unit for the x-axis.

Definition at line 98 of file mitkLinearModel.h.

◆ X_NAME

const std::string mitk::LinearModel::X_NAME
static

Name of the independent variable.

Definition at line 92 of file mitkLinearModel.h.

◆ Y_AXIS_NAME

const std::string mitk::LinearModel::Y_AXIS_NAME
static

Display name for the y-axis.

Definition at line 101 of file mitkLinearModel.h.

◆ Y_AXIS_UNIT

const std::string mitk::LinearModel::Y_AXIS_UNIT
static

Unit for the y-axis.

Definition at line 104 of file mitkLinearModel.h.


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