Medical Imaging Interaction Toolkit  2018.4.99-87d68d9f
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

Definition at line 120 of file mitkModelBase.cpp.

◆ ~ModelBase()

mitk::ModelBase::~ModelBase ( )
overrideprotected

Definition at line 124 of file mitkModelBase.cpp.

Member Function Documentation

◆ ComputeDerivedParameters()

mitk::ModelBase::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::ExtendedToftsModel, mitk::StandardToftsModel, mitk::TestModel, and mitk::LinearModel.

Definition at line 261 of file mitkModelBase.cpp.

Referenced by GetDerivedParameters().

◆ ComputeModelfunction()

◆ GetClassID()

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

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

Implements mitk::ModelTraitsInterface.

Definition at line 90 of file mitkModelBase.cpp.

Referenced by GetModelDisplayName().

◆ GetClassName()

◆ GetDerivedParameterNames()

mitk::ModelBase::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::TestModel, mitk::ExtendedToftsModel, and mitk::StandardToftsModel.

Definition at line 224 of file mitkModelBase.cpp.

Referenced by GetDerivedParameterScales(), and GetDerivedParameterUnits().

◆ GetDerivedParameters()

mitk::ModelBase::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

Definition at line 249 of file mitkModelBase.cpp.

References ComputeDerivedParameters(), and mitk::ModelTraitsInterface::GetNumberOfParameters().

Referenced by mitk::ModelFitFunctorBase::GetDerivedParameters().

◆ GetDerivedParameterScales()

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

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

Implements mitk::ModelTraitsInterface.

Definition at line 47 of file mitkModelBase.cpp.

References GetDerivedParameterNames().

◆ GetDerivedParameterUnits()

mitk::ModelBase::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::StandardToftsModel, and mitk::ExtendedToftsModel.

Definition at line 61 of file mitkModelBase.cpp.

References GetDerivedParameterNames().

◆ GetFunctionString()

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

Default implementation returns an empty functions string.

Implements mitk::ModelTraitsInterface.

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

Definition at line 85 of file mitkModelBase.cpp.

◆ GetModelDisplayName()

◆ GetModelType()

◆ GetNumberOfDerivedParameters()

mitk::ModelBase::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::TestModel, mitk::ExtendedToftsModel, and mitk::StandardToftsModel.

Definition at line 244 of file mitkModelBase.cpp.

Referenced by mitk::ModelFitFunctorBase::GetNumberOfOutputs().

◆ GetNumberOfStaticParameters()

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

Returns the number of static parameters that will be used when using the model to compute the signal (but are not defined via GetSignal()).

Implemented in mitk::NumericTwoCompartmentExchangeModel, mitk::DescriptivePharmacokineticBrixModel, mitk::ThreeStepLinearModel, mitk::AIFBasedModelBase, mitk::GenericParamModel, mitk::TestModel, mitk::T2DecayModel, and mitk::LinearModel.

◆ GetParameterScales()

mitk::ModelBase::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.

Definition at line 19 of file mitkModelBase.cpp.

References mitk::ModelTraitsInterface::GetParameterNames().

◆ GetParameterUnits()

◆ GetSignal()

◆ GetStaticParameterNames()

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

Returns the names of static parameters that will be used when using the model to compute the signal (but are not defined via GetSignal()).

Implemented in mitk::NumericTwoCompartmentExchangeModel, mitk::DescriptivePharmacokineticBrixModel, mitk::ThreeStepLinearModel, mitk::AIFBasedModelBase, mitk::GenericParamModel, mitk::TestModel, mitk::T2DecayModel, and mitk::LinearModel.

Referenced by GetStaticParameters(), GetStaticParameterUnits(), and SetStaticParameters().

◆ GetStaticParameters()

mitk::ModelBase::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().

Definition at line 210 of file mitkModelBase.cpp.

References GetStaticParameterNames(), and GetStaticParameterValue().

◆ GetStaticParameterUnits()

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

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

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

Definition at line 231 of file mitkModelBase.cpp.

References GetStaticParameterNames().

◆ GetStaticParameterValue()

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

Helper function called by GetStaticParameters(). Implement in derived classes to realize the concrete retrieval of static parameters.

Implemented in mitk::ThreeStepLinearModel, mitk::NumericTwoCompartmentExchangeModel, mitk::DescriptivePharmacokineticBrixModel, mitk::AIFBasedModelBase, mitk::GenericParamModel, mitk::TestModel, mitk::LinearModel, and mitk::T2DecayModel.

Referenced by GetStaticParameters().

◆ 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 modell should produce.

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

Referenced by mitk::ReducedChiSquareFitCostFunction::CalcMeasure(), mitk::ChiSquareFitCostFunction::CalcMeasure(), and mitk::DummyModelFitFunctor::DoModelFit().

◆ GetXAxisName()

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

Default implementation returns an empty string.

Implements mitk::ModelTraitsInterface.

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

Definition at line 100 of file mitkModelBase.cpp.

◆ GetXAxisUnit()

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

Default implementation returns an empty string.

Implements mitk::ModelTraitsInterface.

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

Definition at line 105 of file mitkModelBase.cpp.

◆ GetXName()

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

Default implementation returns an empty string.

Implements mitk::ModelTraitsInterface.

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

Definition at line 95 of file mitkModelBase.cpp.

◆ GetYAxisName()

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

Default implementation returns an empty string.

Implements mitk::ModelTraitsInterface.

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

Definition at line 110 of file mitkModelBase.cpp.

◆ GetYAxisUnit()

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

Default implementation returns an empty string.

Implements mitk::ModelTraitsInterface.

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

Definition at line 115 of file mitkModelBase.cpp.

◆ 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()

Definition at line 178 of file mitkModelBase.cpp.

References GetStaticParameterNames(), and SetStaticParameter().

◆ SetTimeGrid()

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 modell should produce.

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

Definition at line 155 of file mitkModelBase.cpp.

References m_TimeGrid.

◆ ValidateModel()

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.

Definition at line 149 of file mitkModelBase.cpp.

Referenced by GetSignal(), and mitk::AIFBasedModelBase::ValidateModel().

Member Data Documentation

◆ m_TimeGrid

TimeGridType mitk::ModelBase::m_TimeGrid
protected

Definition at line 203 of file mitkModelBase.h.

Referenced by mitk::ThreeStepLinearModel::ComputeDerivedParameters(), mitk::T2DecayModel::ComputeModelfunction(), mitk::LinearModel::ComputeModelfunction(), mitk::OneTissueCompartmentModel::ComputeModelfunction(), mitk::TwoTissueCompartmentFDGModel::ComputeModelfunction(), mitk::ExtendedOneTissueCompartmentModel::ComputeModelfunction(), mitk::TwoTissueCompartmentModel::ComputeModelfunction(), mitk::NumericTwoTissueCompartmentModel::ComputeModelfunction(), mitk::StandardToftsModel::ComputeModelfunction(), mitk::TestModel::ComputeModelfunction(), mitk::ExtendedToftsModel::ComputeModelfunction(), mitk::GenericParamModel::ComputeModelfunction(), mitk::TwoCompartmentExchangeModel::ComputeModelfunction(), mitk::DescriptivePharmacokineticBrixModel::ComputeModelfunction(), mitk::ThreeStepLinearModel::ComputeModelfunction(), mitk::NumericTwoCompartmentExchangeModel::ComputeModelfunction(), mitk::AIFBasedModelBase::GetCurrentAterialInputFunctionTimeGrid(), mitk::T2DecayModel::InternalClone(), mitk::LinearModel::InternalClone(), mitk::OneTissueCompartmentModel::InternalClone(), mitk::TwoTissueCompartmentFDGModel::InternalClone(), mitk::ExtendedOneTissueCompartmentModel::InternalClone(), mitk::TwoTissueCompartmentModel::InternalClone(), mitk::NumericTwoTissueCompartmentModel::InternalClone(), mitk::ExtendedToftsModel::InternalClone(), mitk::StandardToftsModel::InternalClone(), mitk::TestModel::InternalClone(), mitk::GenericParamModel::InternalClone(), mitk::TwoCompartmentExchangeModel::InternalClone(), mitk::DescriptivePharmacokineticBrixModel::InternalClone(), mitk::ThreeStepLinearModel::InternalClone(), mitk::NumericTwoCompartmentExchangeModel::InternalClone(), PrintSelf(), SetTimeGrid(), and mitk::AIFBasedModelBase::ValidateModel().


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