Medical Imaging Interaction Toolkit  2026.06.00
Medical Imaging Interaction Toolkit
mitk::ModelFitFunctorBase Class Referenceabstract

Abstract base class for functors that perform model fitting. More...

#include <mitkModelFitFunctorBase.h>

Inheritance diagram for mitk::ModelFitFunctorBase:
Collaboration diagram for mitk::ModelFitFunctorBase:

Public Types

typedef ModelFitFunctorBase Self
 
typedef itk::Object Superclass
 
typedef itk::SmartPointer< Self > Pointer
 
typedef itk::SmartPointer< const Self > ConstPointer
 
typedef ScalarType ParameterImagePixelType
 
typedef std::vector< ParameterImagePixelType > InputPixelArrayType
 
typedef std::vector< ParameterImagePixelType > OutputPixelArrayType
 
typedef ModelBase::ParameterNamesType ParameterNamesType
 

Public Member Functions

virtual const char * GetClassName () const
 
OutputPixelArrayType Compute (const InputPixelArrayType &value, const ModelBase *model, const ModelBase::ParametersType &initialParameters) const
 Performs model fitting and returns the results. More...
 
unsigned int GetNumberOfOutputs (const ModelBase *model) const
 Returns the number of outputs the fit functor will produce. More...
 
ParameterNamesType GetEvaluationParameterNames () const
 Returns names of all evaluation parameters defined by the user. More...
 
void ResetEvaluationParameters ()
 Removes all registered evaluation parameters. More...
 
void RegisterEvaluationParameter (const std::string &parameterName, SVModelFitCostFunction *evaluationCostFunction)
 Registers an evaluation parameter with its cost function. More...
 
const SVModelFitCostFunction * GetEvaluationParameterCostFunction (const std::string &parameterName) const
 Returns the cost function associated with the given evaluation parameter. More...
 
virtual ParameterNamesType GetCriterionNames () const =0
 Returns names of the criteria used to fit the model. More...
 
ParameterNamesType GetDebugParameterNames () const
 Returns names of the debug parameters generated by the functor. More...
 
virtual void DebugParameterMapsOn ()
 
virtual void DebugParameterMapsOff ()
 
virtual void SetDebugParameterMaps (bool _arg)
 
virtual bool GetDebugParameterMaps () const
 

Protected Types

typedef ModelBase::ParametersType ParametersType
 
typedef ModelFitCostFunctionInterface::SignalType SignalType
 
typedef std::map< std::string, ParameterImagePixelType > DebugParameterMapType
 

Protected Member Functions

 ModelFitFunctorBase ()
 
 ~ModelFitFunctorBase () override
 
virtual OutputPixelArrayType GetCriteria (const ModelBase *model, const ParametersType &parameters, const SignalType &sample) const =0
 Internal method called by Compute() to get the final criterion values that drove the fit. More...
 
OutputPixelArrayType GetDerivedParameters (const ModelBase *model, const ParametersType &parameters) const
 Internal method called by Compute() to get derived parameters with the final fit parameters. More...
 
OutputPixelArrayType GetEvaluationParameters (const ModelBase *model, const ParametersType &parameters, const SignalType &sample) const
 Internal method called by Compute() to get evaluation parameters from user-defined cost functions. More...
 
virtual ParametersType DoModelFit (const SignalType &value, const ModelBase *model, const ModelBase::ParametersType &initialParameters, DebugParameterMapType &debugParameters) const =0
 Internal method that performs the actual model fitting. More...
 
virtual ParameterNamesType DefineDebugParameterNames () const =0
 Returns names of the debug parameters generated by the functor. More...
 

Detailed Description

Abstract base class for functors that perform model fitting.

A model fit functor takes an observed signal, a model instance, and initial parameters, then performs the fitting optimization. Subclasses implement specific fitting algorithms (e.g. Levenberg-Marquardt). The functor also supports user-defined evaluation cost functions and optional debug parameter maps.

See also
LevenbergMarquardtModelFitFunctor, DummyModelFitFunctor

Definition at line 41 of file mitkModelFitFunctorBase.h.

Member Typedef Documentation

◆ ConstPointer

◆ DebugParameterMapType

Definition at line 147 of file mitkModelFitFunctorBase.h.

◆ InputPixelArrayType

◆ OutputPixelArrayType

◆ ParameterImagePixelType

◆ ParameterNamesType

◆ ParametersType

◆ Pointer

◆ Self

◆ SignalType

◆ Superclass

Definition at line 45 of file mitkModelFitFunctorBase.h.

Constructor & Destructor Documentation

◆ ModelFitFunctorBase()

mitk::ModelFitFunctorBase::ModelFitFunctorBase ( )
protected

◆ ~ModelFitFunctorBase()

mitk::ModelFitFunctorBase::~ModelFitFunctorBase ( )
overrideprotected

Member Function Documentation

◆ Compute()

OutputPixelArrayType mitk::ModelFitFunctorBase::Compute ( const InputPixelArrayType &  value,
const ModelBase *  model,
const ModelBase::ParametersType &  initialParameters 
) const

Performs model fitting and returns the results.

The values in the returned vector are ordered in the following sequence:

Parameters
valueSignal the model should be fitted onto.
modelPointer to the preconfigured model instance.
initialParametersStarting point parameters for the fitting process.
Returns
Vector of fitted parameter values, derived parameters, criteria, and evaluation parameters.
Precondition
model must point to a valid instance.
Size of initialParameters must be equal to model->GetNumberOfParameters().

◆ DebugParameterMapsOff()

virtual void mitk::ModelFitFunctorBase::DebugParameterMapsOff ( )
virtual

◆ DebugParameterMapsOn()

virtual void mitk::ModelFitFunctorBase::DebugParameterMapsOn ( )
virtual

◆ DefineDebugParameterNames()

virtual ParameterNamesType mitk::ModelFitFunctorBase::DefineDebugParameterNames ( ) const
protectedpure virtual

Returns names of the debug parameters generated by the functor.

Will be called by GetDebugParameterNames() if debug is activated.

Implemented in mitk::LevenbergMarquardtModelFitFunctor, and mitk::DummyModelFitFunctor.

◆ DoModelFit()

virtual ParametersType mitk::ModelFitFunctorBase::DoModelFit ( const SignalType &  value,
const ModelBase *  model,
const ModelBase::ParametersType &  initialParameters,
DebugParameterMapType &  debugParameters 
) const
protectedpure virtual

Internal method that performs the actual model fitting.

Must be implemented by derived classes. Returns the found parameters and optionally populates the debug parameter map.

Parameters
valueSignal the model should be fitted against.
modelPointer to the model that should be fitted.
initialParametersInitial model parameters for the fit.
[out]debugParametersMap containing all debug parameters (only valid if m_DebugParameterMaps is true).
Returns
The optimized parameter values.
Postcondition
If m_DebugParameterMaps is true, all debug parameters defined by DefineDebugParameterNames() must be returned via debugParameters.

Implemented in mitk::LevenbergMarquardtModelFitFunctor, and mitk::DummyModelFitFunctor.

◆ GetClassName()

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

◆ GetCriteria()

virtual OutputPixelArrayType mitk::ModelFitFunctorBase::GetCriteria ( const ModelBase *  model,
const ParametersType &  parameters,
const SignalType &  sample 
) const
protectedpure virtual

Internal method called by Compute() to get the final criterion values that drove the fit.

Must be implemented by concrete functor classes.

Implemented in mitk::LevenbergMarquardtModelFitFunctor, and mitk::DummyModelFitFunctor.

◆ GetCriterionNames()

virtual ParameterNamesType mitk::ModelFitFunctorBase::GetCriterionNames ( ) const
pure virtual

Returns names of the criteria used to fit the model.

Implemented in mitk::LevenbergMarquardtModelFitFunctor, and mitk::DummyModelFitFunctor.

◆ GetDebugParameterMaps()

virtual bool mitk::ModelFitFunctorBase::GetDebugParameterMaps ( ) const
virtual

◆ GetDebugParameterNames()

ParameterNamesType mitk::ModelFitFunctorBase::GetDebugParameterNames ( ) const

Returns names of the debug parameters generated by the functor.

Returns an empty list if debug is deactivated.

◆ GetDerivedParameters()

OutputPixelArrayType mitk::ModelFitFunctorBase::GetDerivedParameters ( const ModelBase *  model,
const ParametersType &  parameters 
) const
protected

Internal method called by Compute() to get derived parameters with the final fit parameters.

◆ GetEvaluationParameterCostFunction()

const SVModelFitCostFunction* mitk::ModelFitFunctorBase::GetEvaluationParameterCostFunction ( const std::string &  parameterName) const

Returns the cost function associated with the given evaluation parameter.

Parameters
parameterNameThe name of the evaluation parameter.
Returns
Pointer to the associated cost function.

◆ GetEvaluationParameterNames()

ParameterNamesType mitk::ModelFitFunctorBase::GetEvaluationParameterNames ( ) const

Returns names of all evaluation parameters defined by the user.

◆ GetEvaluationParameters()

OutputPixelArrayType mitk::ModelFitFunctorBase::GetEvaluationParameters ( const ModelBase *  model,
const ParametersType &  parameters,
const SignalType &  sample 
) const
protected

Internal method called by Compute() to get evaluation parameters from user-defined cost functions.

◆ GetNumberOfOutputs()

unsigned int mitk::ModelFitFunctorBase::GetNumberOfOutputs ( const ModelBase *  model) const

Returns the number of outputs the fit functor will produce.

The number depends in part on the passed model.

Parameters
modelThe model for which the output count is determined.
Returns
The total number of output values.
Exceptions
Exceptionif no valid model is passed.

◆ RegisterEvaluationParameter()

void mitk::ModelFitFunctorBase::RegisterEvaluationParameter ( const std::string &  parameterName,
SVModelFitCostFunction *  evaluationCostFunction 
)

Registers an evaluation parameter with its cost function.

Parameters
parameterNameThe name of the evaluation parameter.
evaluationCostFunctionThe cost function used to compute this evaluation parameter.

◆ ResetEvaluationParameters()

void mitk::ModelFitFunctorBase::ResetEvaluationParameters ( )

Removes all registered evaluation parameters.

◆ SetDebugParameterMaps()

virtual void mitk::ModelFitFunctorBase::SetDebugParameterMaps ( bool  _arg)
virtual

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