Medical Imaging Interaction Toolkit  2026.06.00
Medical Imaging Interaction Toolkit
mitkMVModelFitCostFunction.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 mitkMVModelFitCostFunction_h
14 #define mitkMVModelFitCostFunction_h
15 
16 #include <itkMultipleValuedCostFunction.h>
17 #include <itkMacro.h>
18 
20 
21 #include <MitkModelFitExports.h>
22 
23 namespace mitk
24 {
25 
36 class MITKMODELFIT_EXPORT MVModelFitCostFunction : public itk::MultipleValuedCostFunction, public ModelFitCostFunctionInterface
37 {
38 public:
39 
41  typedef itk::MultipleValuedCostFunction Superclass;
44 
46  typedef Superclass::MeasureType MeasureType;
47  typedef Superclass::DerivativeType DerivativeType;
48 
53  void SetSample(const SignalType &sampleSet) override;
54 
60  MeasureType GetValue(const ParametersType& parameter) const override;
61 
67  void GetDerivative (const ParametersType &parameters, DerivativeType &derivative) const override;
68 
73  unsigned int GetNumberOfValues (void) const override;
74 
79  unsigned int GetNumberOfParameters (void) const override;
80 
83 
84  itkSetMacro(DerivativeStepLength, double);
85  itkGetConstMacro(DerivativeStepLength, double);
86 
87 protected:
88 
89  virtual MeasureType CalcMeasure(const ParametersType &parameters, const SignalType& signal) const = 0;
90 
91  MVModelFitCostFunction() : m_DerivativeStepLength(1e-5)
92  {
93  }
94 
96 
98 
99 private:
100  ModelBase::ConstPointer m_Model;
101 
103  double m_DerivativeStepLength;
104 };
105 
106 }
107 
108 #endif
#define MITKMODELFIT_EXPORT
Base class for all model fit cost functions that return a vector of cost values.
itk::SmartPointer< const Self > ConstPointer
itk::MultipleValuedCostFunction Superclass
void GetDerivative(const ParametersType &parameters, DerivativeType &derivative) const override
Computes the Jacobian matrix numerically via finite differences.
ModelFitCostFunctionInterface::SignalType SignalType
unsigned int GetNumberOfValues(void) const override
Returns the number of values (residuals) returned by GetValue().
MeasureType GetValue(const ParametersType &parameter) const override
Computes the cost value vector for the given parameters.
mitkOverrideGetConstObjectMacro(Model, ModelBase)
unsigned int GetNumberOfParameters(void) const override
Returns the number of model parameters.
Superclass::DerivativeType DerivativeType
void SetSample(const SignalType &sampleSet) override
Sets the observed sample signal.
mitkOverrideSetConstObjectMacro(Model, ModelBase)
virtual MeasureType CalcMeasure(const ParametersType &parameters, const SignalType &signal) const =0
Base class for (dynamic) models.
Definition: mitkModelBase.h:56
Interface class that is implemented by all cost functions used in model fitting.
itk::Array< double > SignalType
Type representing the observed signal values.
Find image slices visible on a given plane.