Medical Imaging Interaction Toolkit  2018.4.99-12ad79a3
Medical Imaging Interaction Toolkit
mitkMVConstrainedCostFunctionDecorator.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 MV_CONSTRAINED_COST_FUNCTION_DECORATOR_H
14 #define MV_CONSTRAINED_COST_FUNCTION_DECORATOR_H
15 
18 
19 #include "MitkModelFitExports.h"
20 
21 namespace mitk
22 {
23 
38 {
39 public:
40 
45 
46  itkNewMacro(Self);
47 
50 
51  itkSetConstObjectMacro(WrappedCostFunction, MVModelFitCostFunction);
52  itkGetConstObjectMacro(WrappedCostFunction, MVModelFitCostFunction);
53 
54  itkSetConstObjectMacro(ConstraintChecker, ConstraintCheckerBase);
55  itkGetConstObjectMacro(ConstraintChecker, ConstraintCheckerBase);
56 
57  itkSetMacro(FailureThreshold, PenaltyValueType);
58  itkGetConstMacro(FailureThreshold, PenaltyValueType);
59  itkSetMacro(ActivateFailureThreshold, bool);
60  itkGetConstMacro(ActivateFailureThreshold, bool);
61 
64  itkGetConstMacro(EvaluationCount, unsigned int);
65 
69  double GetPenaltyRatio() const;
73  double GetFailureRatio() const;
74 
76  ParametersType::size_type GetFailedParameter() const;
77 protected:
78 
79  MeasureType CalcMeasure(const ParametersType &parameters, const SignalType& signal) const override;
80 
81  MVConstrainedCostFunctionDecorator() : m_FailureThreshold(1e15), m_ActivateFailureThreshold(true),
82  m_EvaluationCount(0), m_PenaltyCount(0), m_FailureCount(0), m_LastFailedParameter(-1)
83  {
84  }
85 
87 
90  PenaltyValueType m_FailureThreshold;
92  mutable unsigned int m_EvaluationCount;
93  mutable unsigned int m_PenaltyCount;
94  mutable unsigned int m_FailureCount;
95  mutable ParametersType::size_type m_LastFailedParameter;
96 };
97 
98 }
99 
100 #endif
ModelFitCostFunctionInterface::SignalType SignalType
Superclass::PenaltyValueType PenaltyValueType
DataCollection - Class to facilitate loading/accessing structured data.
#define MITKMODELFIT_EXPORT
This class is used to add constraints to any multi valued model fit cost function.
ConstraintCheckerBase::PenaltyValueType PenaltyValueType
This class is the base class for constraint checker.