Medical Imaging Interaction Toolkit  2026.06.00
Medical Imaging Interaction Toolkit
mitkLevenbergMarquardtModelFitFunctor.h
Go to the documentation of this file.
1 /*============================================================================
2 
3 The Medical Imaging Interaction Toolkit (MITK)
4 
5 Copyright (c) German Cancer Research Center (DKFZ)
6 All rights reserved.
7 
8 Use of this source code is governed by a 3-clause BSD license that can be
9 found in the LICENSE file.
10 
11 ============================================================================*/
12 
13 #ifndef mitkLevenbergMarquardtModelFitFunctor_h
14 #define mitkLevenbergMarquardtModelFitFunctor_h
15 
16 #include <itkObject.h>
17 #include <itkLevenbergMarquardtOptimizer.h>
18 
19 #include <mitkModelBase.h>
22 
23 #include <MitkModelFitExports.h>
24 
25 namespace mitk
26 {
27 
40  {
41  public:
46 
47  itkNewMacro(Self);
49 
52 
53  itkSetMacro(Epsilon, double);
54  itkSetMacro(GradientTolerance, double);
55  itkSetMacro(ValueTolerance, double);
56  itkSetMacro(DerivativeStepLength, double);
57  itkSetMacro(Iterations, unsigned int);
58  itkSetMacro(Scales, ::itk::LevenbergMarquardtOptimizer::ScalesType);
59 
60  itkGetMacro(Epsilon, double);
61  itkGetMacro(GradientTolerance, double);
62  itkGetMacro(ValueTolerance, double);
63  itkGetMacro(DerivativeStepLength, double);
64  itkGetMacro(Iterations, unsigned int);
65  itkGetMacro(Scales, ::itk::LevenbergMarquardtOptimizer::ScalesType);
66 
67  itkSetConstObjectMacro(ConstraintChecker, ConstraintCheckerBase);
68  itkGetConstObjectMacro(ConstraintChecker, ConstraintCheckerBase);
69  itkSetMacro(ActivateFailureThreshold, bool);
70  itkGetConstMacro(ActivateFailureThreshold, bool);
71 
73 
74  protected:
75 
78 
80 
82 
83  ParametersType DoModelFit(const SignalType& value, const ModelBase* model,
84  const ModelBase::ParametersType& initialParameters,
85  DebugParameterMapType& debugParameters) const override;
86 
87  OutputPixelArrayType GetCriteria(const ModelBase* model, const ParametersType& parameters,
88  const SignalType& sample) const override;
89 
92  const ModelBase* model) const;
93 
95 
96  private:
97  double m_Epsilon;
98  double m_GradientTolerance;
99  double m_ValueTolerance;
100  unsigned int m_Iterations;
101  double m_DerivativeStepLength;
102  ::itk::LevenbergMarquardtOptimizer::ScalesType m_Scales;
103 
106  ConstraintCheckerBase::ConstPointer m_ConstraintChecker;
109  bool m_ActivateFailureThreshold;
110  };
111 
112 }
113 
114 
115 #endif
#define MITKMODELFIT_EXPORT
Base class for constraint checkers used in model fitting.
Model fit functor that uses the Levenberg-Marquardt optimization algorithm.
ParametersType DoModelFit(const SignalType &value, const ModelBase *model, const ModelBase::ParametersType &initialParameters, DebugParameterMapType &debugParameters) const override
Internal method that performs the actual model fitting.
virtual MVModelFitCostFunction::Pointer GenerateCostFunction(const SignalType &value, const ModelBase *model) const
ParameterNamesType DefineDebugParameterNames() const override
Returns names of the debug parameters generated by the functor.
OutputPixelArrayType GetCriteria(const ModelBase *model, const ParametersType &parameters, const SignalType &sample) const override
Internal method called by Compute() to get the final criterion values that drove the fit.
ParameterNamesType GetCriterionNames() const override
Returns names of the criteria used to fit the model.
Base class for (dynamic) models.
Definition: mitkModelBase.h:56
ModelTraitsInterface::ParametersType ParametersType
Definition: mitkModelBase.h:67
Abstract base class for functors that perform model fitting.
ModelFitCostFunctionInterface::SignalType SignalType
std::map< std::string, ParameterImagePixelType > DebugParameterMapType
std::vector< ParameterImagePixelType > InputPixelArrayType
ModelBase::ParametersType ParametersType
ModelBase::ParameterNamesType ParameterNamesType
std::vector< ParameterImagePixelType > OutputPixelArrayType
Find image slices visible on a given plane.