ANIMA  4.0
animaMCMSingleValuedCostFunction.h
Go to the documentation of this file.
1 #pragma once
2 
3 #include <itkSingleValuedCostFunction.h>
4 #include <animaBaseMCMCost.h>
5 #include <AnimaMCMBaseExport.h>
6 
7 namespace anima
8 {
9 
10 class ANIMAMCMBASE_EXPORT MCMSingleValuedCostFunction : public itk::SingleValuedCostFunction
11 {
12 public:
15  typedef itk::SingleValuedCostFunction Superclass;
16  typedef itk::SmartPointer<Self> Pointer;
17  typedef itk::SmartPointer<const Self> ConstPointer;
18 
19  itkNewMacro(Self)
20 
21 
22  itkTypeMacro(MCMSingleValuedCostFunction, itk::SingleValuedCostFunction)
23 
24  typedef Superclass::MeasureType MeasureType;
25  typedef Superclass::DerivativeType DerivativeType;
26  typedef Superclass::ParametersType ParametersType;
27 
29  typedef InternalCostType::Pointer InternalCostPointer;
30 
31  itkSetMacro(InternalCost, InternalCostPointer)
32 
33  virtual MeasureType GetValue(const ParametersType &parameters) const ITK_OVERRIDE;
34  virtual void GetDerivative(const ParametersType & parameters, DerivativeType & derivative) const ITK_OVERRIDE;
35 
36  double GetSigmaSquare();
37 
38  InternalCostType::MCMPointer &GetMCMStructure() {return m_InternalCost->GetMCMStructure();}
39 
40  unsigned int GetNumberOfParameters() const ITK_OVERRIDE;
41 
42 protected:
44  {
45  m_InternalCost = ITK_NULLPTR;
46  }
47 
48  virtual ~MCMSingleValuedCostFunction() ITK_OVERRIDE {}
49 
50 private:
51  MCMSingleValuedCostFunction(const Self&); //purposely not implemented
52  void operator=(const Self&); //purposely not implemented
53 
54  mutable InternalCostPointer m_InternalCost;
55 };
56 
57 } // end namespace anima
MCMPointer & GetMCMStructure()
Base cost function class to handle maximum likelihood estimation.