ANIMA  4.0
animaGaussianMCMVariableProjectionSingleValuedCostFunction.cxx
Go to the documentation of this file.
2 
3 namespace anima
4 {
5 
6 unsigned int
9 {
10  if (!m_InternalCost)
11  itkExceptionMacro("Internal variable projection cost required to get number of parameters");
12 
13  return m_InternalCost->GetNumberOfParameters();
14 }
15 
18 ::GetValue(const ParametersType &parameters) const
19 {
20  if (!m_InternalCost)
21  itkExceptionMacro("Internal variable projection cost required to compute cost value");
22 
23  // Called to compute the actual weights, and other projected stuff
24  m_InternalCost->GetValues(parameters);
25 
26  return m_InternalCost->GetCurrentCostValue();
27 }
28 
29 void
31 ::GetDerivative(const ParametersType & parameters, DerivativeType & derivative) const
32 {
33  if (!m_InternalCost)
34  itkExceptionMacro("Internal variable projection cost required to compute cost derivatives");
35 
37  m_InternalCost->GetDerivativeMatrix(parameters,derivativeMatrix);
38 
39  m_InternalCost->GetCurrentDerivative(derivativeMatrix,derivative);
40 }
41 
42 double
45 {
46  return m_InternalCost->GetSigmaSquare();
47 }
48 
49 std::vector <double> &
52 {
53  return m_InternalCost->GetOptimalWeights();
54 }
55 
56 } // end namespace anima
virtual MeasureType GetValue(const ParametersType &parameters) const ITK_OVERRIDE
virtual void GetDerivative(const ParametersType &parameters, DerivativeType &derivative) const ITK_OVERRIDE
itk::Array2D< double > DerivativeMatrixType