Medical Imaging Interaction Toolkit  2024.06.00
Medical Imaging Interaction Toolkit
mitk::ModelBase Class Referenceabstract

Base class for (dynamic) models. A model can be used to calculate its signal given the discrete time grid of the signal and the parameters of the model.
A model has 3 types of parameters:
. More...

#include <mitkModelBase.h>

Inheritance diagram for mitk::ModelBase:
Collaboration diagram for mitk::ModelBase:

Public Types

typedef ModelBase Self
 
typedef itk::Object Superclass
 
typedef itk::SmartPointer< SelfPointer
 
typedef itk::SmartPointer< const SelfConstPointer
 
typedef ModelTraitsInterface::ModelResultType ModelResultType
 
typedef ModelTraitsInterface::ParameterValueType ParameterValueType
 
typedef ModelTraitsInterface::ParametersType ParametersType
 
typedef itk::Array< double > TimeGridType
 
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< StaticParameterValueTypeStaticParameterValuesType
 
typedef std::map< ParameterNameType, StaticParameterValuesTypeStaticParameterMapType
 
typedef double DerivedParameterValueType
 
typedef std::map< ParameterNameType, DerivedParameterValueTypeDerivedParameterMapType
 
- Public Types inherited from mitk::ModelTraitsInterface
typedef itk::Array< double > ModelResultType
 
using ParameterValueType = double
 
typedef itk::Array< ParameterValueTypeParametersType
 
typedef std::string ParameterNameType
 
typedef std::vector< ParameterNameTypeParameterNamesType
 
typedef ParametersType::SizeValueType ParametersSizeType
 
typedef ParameterNamesType DerivedParameterNamesType
 
typedef ParametersSizeType DerivedParametersSizeType
 
typedef std::map< ParameterNameType, double > ParamterScaleMapType
 
typedef std::map< ParameterNameType, std::string > ParamterUnitMapType
 
typedef std::map< ParameterNameType, double > DerivedParamterScaleMapType
 
typedef std::map< ParameterNameType, std::string > DerivedParamterUnitMapType
 
typedef std::string FunctionStringType
 
typedef std::string ModellClassIDType
 

Public Member Functions

virtual const char * GetClassName () const
 
ParamterScaleMapType GetParameterScales () const override
 
ParamterUnitMapType GetParameterUnits () const override
 
DerivedParamterScaleMapType GetDerivedParameterScales () const override
 
DerivedParamterUnitMapType GetDerivedParameterUnits () const override
 
std::string GetModelDisplayName () const override
 
std::string GetModelType () const override
 
FunctionStringType GetFunctionString () const override
 
ModellClassIDType GetClassID () 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
 
virtual ParameterNamesType GetStaticParameterNames () const =0
 
virtual ParametersSizeType GetNumberOfStaticParameters () const =0
 
virtual ParamterUnitMapType GetStaticParameterUnits () const
 
DerivedParameterNamesType GetDerivedParameterNames () const override
 
DerivedParametersSizeType GetNumberOfDerivedParameters () const override
 
void SetStaticParameters (const StaticParameterMapType &parameters, bool allParameters=true)
 
StaticParameterMapType GetStaticParameters () const
 
DerivedParameterMapType GetDerivedParameters (const ParametersType &parameters) const
 
virtual void SetTimeGrid (const TimeGridType &grid)
 
virtual const TimeGridTypeGetTimeGrid ()
 
ModelResultType GetSignal (const ParametersType &parameters) const
 
- Public Member Functions inherited from mitk::ModelTraitsInterface
virtual ParameterNamesType GetParameterNames () const =0
 
virtual ParametersSizeType GetNumberOfParameters () const =0
 

Protected Member Functions

virtual ModelResultType ComputeModelfunction (const ParametersType &parameters) const =0
 
virtual bool ValidateModel (std::string &error) const
 
virtual DerivedParameterMapType ComputeDerivedParameters (const ParametersType &parameters) const
 
virtual void SetStaticParameter (const ParameterNameType &name, const StaticParameterValuesType &values)=0
 
virtual StaticParameterValuesType GetStaticParameterValue (const ParameterNameType &name) const =0
 
 ModelBase ()
 
 ~ModelBase () override
 
void PrintSelf (std::ostream &os, ::itk::Indent indent) const override
 
- Protected Member Functions inherited from mitk::ModelTraitsInterface
 ModelTraitsInterface ()
 
virtual ~ModelTraitsInterface ()
 

Protected Attributes

TimeGridType m_TimeGrid
 

Detailed Description

Base class for (dynamic) models. A model can be used to calculate its signal given the discrete time grid of the signal and the parameters of the model.
A model has 3 types of parameters:
.

  • parameters
  • static parameters
  • derived parameters

"Parameters" and "static parameters" are used to compute the signal of the model. "Parameters" are the ones that will be changed for/by model fitting. "Static parameters" are used to configure the model for fitting but are itself not part of the fitting scope (compare itk::Transform parameters and static parameters). "Derived parameters" are model specific parameters computed from "Parameters" e.g. (DerivedParam1 = Param1/Param2). It may be implemented if e.g. for practical usage not the fitted parameters are needed but derivation of them.

Remarks
: If you implement your own model calls regard const correctness and do not change or undermine the constness of this base class. It is important because in case of fitting models are used in a multi threaded environment and must be thread safe. Thus the getter and computation functions are implemented as const and thread safe methods.

Definition at line 47 of file mitkModelBase.h.

Member Typedef Documentation

◆ ConstPointer

Definition at line 53 of file mitkModelBase.h.

◆ DerivedParameterMapType

◆ DerivedParameterNamesType

◆ DerivedParametersSizeType

◆ DerivedParameterValueType

Definition at line 74 of file mitkModelBase.h.

◆ ModelResultType

◆ ParameterNamesType

◆ ParameterNameType

◆ ParametersSizeType

◆ ParametersType

◆ ParameterValueType

◆ Pointer

Definition at line 52 of file mitkModelBase.h.

◆ Self

Definition at line 50 of file mitkModelBase.h.

◆ StaticParameterMapType

◆ StaticParameterValuesType

◆ StaticParameterValueType

Definition at line 70 of file mitkModelBase.h.

◆ Superclass

typedef itk::Object mitk::ModelBase::Superclass

Definition at line 51 of file mitkModelBase.h.

◆ TimeGridType

typedef itk::Array<double> mitk::ModelBase::TimeGridType

Type defining the time grid used be models.

Remarks
the model time grid has a resolution in sec and not like the time geometry which uses ms.

Definition at line 62 of file mitkModelBase.h.

Constructor & Destructor Documentation

◆ ModelBase()

mitk::ModelBase::ModelBase ( )
protected

◆ ~ModelBase()

mitk::ModelBase::~ModelBase ( )
overrideprotected

Member Function Documentation

◆ ComputeDerivedParameters()

virtual DerivedParameterMapType mitk::ModelBase::ComputeDerivedParameters ( const ParametersType parameters) const
protectedvirtual

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 in mitk::ThreeStepLinearModel, mitk::LinearModel, mitk::ExtendedToftsModel, mitk::StandardToftsModel, mitk::TestModel, mitk::TwoStepLinearModel, and mitk::ExponentialDecayModel.

◆ ComputeModelfunction()

◆ GetClassID()

ModellClassIDType mitk::ModelBase::GetClassID ( ) const
overridevirtual

Default implementation the class name of the concrete instance as ID.

Implements mitk::ModelTraitsInterface.

◆ GetClassName()

◆ GetDerivedParameterNames()

DerivedParameterNamesType mitk::ModelBase::GetDerivedParameterNames ( ) const
overridevirtual

Returns the names of derived parameters that can/will be computed by the model given specific model parameters.

Remarks
Default implementation has no derived parameters

Implements mitk::ModelTraitsInterface.

Reimplemented in mitk::ThreeStepLinearModel, mitk::TwoStepLinearModel, mitk::ExtendedToftsModel, mitk::StandardToftsModel, and mitk::TestModel.

◆ GetDerivedParameters()

DerivedParameterMapType mitk::ModelBase::GetDerivedParameters ( const ParametersType parameters) const

Generic interface method that computes all derived parameters implemented for the given models. To changed the derived parameter computation. ComputeDerivedParameters must be (re)implemented.

Precondition
parameters must have the right size.
Parameters
parametersThe parameters of the model for which the derived parameters should be computed. It calls GetStaticParameter for every name defined in GetStaticParameterNames().
Remarks
Default implementation has no derived parameters

◆ GetDerivedParameterScales()

DerivedParamterScaleMapType mitk::ModelBase::GetDerivedParameterScales ( ) const
overridevirtual

Default implementation returns a scale of 1.0 for every defined derived parameter.

Implements mitk::ModelTraitsInterface.

◆ GetDerivedParameterUnits()

DerivedParamterUnitMapType mitk::ModelBase::GetDerivedParameterUnits ( ) const
overridevirtual

Default implementation returns no unit string ("") for every defined derived parameter.

Implements mitk::ModelTraitsInterface.

Reimplemented in mitk::ThreeStepLinearModel, mitk::TwoStepLinearModel, mitk::ExtendedToftsModel, and mitk::StandardToftsModel.

◆ GetFunctionString()

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

Default implementation returns an empty functions string.

Implements mitk::ModelTraitsInterface.

Reimplemented in mitk::ThreeStepLinearModel, mitk::TwoStepLinearModel, and mitk::TestModel.

◆ GetModelDisplayName()

◆ GetModelType()

◆ GetNumberOfDerivedParameters()

DerivedParametersSizeType mitk::ModelBase::GetNumberOfDerivedParameters ( ) const
overridevirtual

Returns the number of derived parameters that can/will be computed by the model given specific model parameters.

Remarks
Default implementation has no derived parameters

Implements mitk::ModelTraitsInterface.

Reimplemented in mitk::ThreeStepLinearModel, mitk::TwoStepLinearModel, mitk::ExtendedToftsModel, mitk::StandardToftsModel, and mitk::TestModel.

◆ GetNumberOfStaticParameters()

virtual ParametersSizeType mitk::ModelBase::GetNumberOfStaticParameters ( ) const
pure virtual

◆ GetParameterScales()

ParamterScaleMapType mitk::ModelBase::GetParameterScales ( ) const
overridevirtual

Default implementation returns a scale of 1.0 for every defined parameter.

Implements mitk::ModelTraitsInterface.

Reimplemented in mitk::TestModel.

◆ GetParameterUnits()

◆ GetSignal()

ModelResultType mitk::ModelBase::GetSignal ( const ParametersType parameters) const

◆ GetStaticParameterNames()

virtual ParameterNamesType mitk::ModelBase::GetStaticParameterNames ( ) const
pure virtual

◆ GetStaticParameters()

StaticParameterMapType mitk::ModelBase::GetStaticParameters ( ) const

Generic interface method that can be used to retrieve the static parameters of the model; e.g. in order to serialize the model settings. It calls GetStaticParameter for every name defined in GetStaticParameterNames().

◆ GetStaticParameterUnits()

virtual ParamterUnitMapType mitk::ModelBase::GetStaticParameterUnits ( ) const
virtual

Default implementation returns no unit string ("") for every defined parameter.

Reimplemented in mitk::DescriptivePharmacokineticBrixModel, and mitk::AIFBasedModelBase.

◆ GetStaticParameterValue()

virtual StaticParameterValuesType mitk::ModelBase::GetStaticParameterValue ( const ParameterNameType name) const
protectedpure virtual

◆ GetTimeGrid()

virtual const TimeGridType& mitk::ModelBase::GetTimeGrid ( )
virtual

Gets the time grid of the model. It indicates the time points correlated with the signal the model should produce.

Remarks
The resolution of the time grid is in seconds. (Not in ms like the mitk::TimeGeometry)

◆ GetXAxisName()

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

◆ GetXAxisUnit()

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

◆ GetXName()

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

Default implementation returns an empty string.

Implements mitk::ModelTraitsInterface.

Reimplemented in mitk::ThreeStepLinearModel, mitk::TwoStepLinearModel, and mitk::TestModel.

◆ GetYAxisName()

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

◆ GetYAxisUnit()

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

◆ PrintSelf()

void mitk::ModelBase::PrintSelf ( std::ostream &  os,
::itk::Indent  indent 
) const
overrideprotected

◆ SetStaticParameter()

virtual void mitk::ModelBase::SetStaticParameter ( const ParameterNameType name,
const StaticParameterValuesType values 
)
protectedpure virtual

◆ SetStaticParameters()

void mitk::ModelBase::SetStaticParameters ( const StaticParameterMapType parameters,
bool  allParameters = true 
)

Generic interface method that can be used to set the static parameters of the model before it is used. It checks the validity of the passed map and uses SetStaticParameter to set the values.

Parameters
parametersThe map with the static parameters and their values.
allParametersIf true an exception will be thrown if the keys of passed parameters do not equal the return of GetStaticParameterNames. Thus if true, one must set all static parameters of the model.
Precondition
Parameters must only contain keys that exist in GetStaticParameterNames()
If allParameters == true, parameters must define all keys of GetStaticParameterNames()

◆ SetTimeGrid()

virtual void mitk::ModelBase::SetTimeGrid ( const TimeGridType grid)
virtual

Sets the time grid of the model. It indicates the time points correlated with the signal the model should produce.

Remarks
The resolution of the time grid is in seconds. (Not in ms like the mitk::TimeGeometry)

◆ ValidateModel()

virtual bool mitk::ModelBase::ValidateModel ( std::string &  error) const
protectedvirtual

Member is called by GetSignal() before ComputeModelfunction(). It indicates if model is in a valid state and ready to compute the signal. The default implementation checks nothing and always returns true. Reimplement to realize special behavior for derived classes.

Parameters
[out]errorSet internally to indicate the error reason if method returns false. Is used by GetSignal() for the exception comment.
Returns
Returns true if the model is valid and can compute a signal. Otherwise it returns false.

Reimplemented in mitk::AIFBasedModelBase.

Member Data Documentation

◆ m_TimeGrid

TimeGridType mitk::ModelBase::m_TimeGrid
protected

Definition at line 203 of file mitkModelBase.h.


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