ANIMA  4.0
animaBVLSOptimizer.h
Go to the documentation of this file.
1 #pragma once
2 
3 #include <vnl/vnl_matrix.h>
4 #include <vector>
5 
6 #include <itkOptimizer.h>
7 #include "AnimaOptimizersExport.h"
8 
9 namespace anima
10 {
15 class ANIMAOPTIMIZERS_EXPORT BVLSOptimizer : public itk::Optimizer
16 {
17 public:
21  typedef itk::SmartPointer<Self> Pointer;
22  typedef itk::SmartPointer<const Self> ConstPointer;
23 
24  typedef Superclass::ParametersType ParametersType;
25 
27  itkNewMacro(Self)
28 
29 
30  itkTypeMacro(BVLSOptimizer, Optimizer)
31 
32 
33  typedef vnl_matrix <double> MatrixType;
34  typedef vnl_vector <double> VectorType;
35 
37  void StartOptimization() ITK_OVERRIDE;
38 
39  void SetDataMatrix(const MatrixType &data) {m_DataMatrix = data;}
40  void SetPoints(const ParametersType &points) {m_Points = points;}
41  void SetLowerBounds(const ParametersType &lb) {m_LowerBounds = lb;}
42  void SetUpperBounds(const ParametersType &ub) {m_UpperBounds = ub;}
43 
44  double GetCurrentResidual();
45 
46 protected:
48  virtual ~BVLSOptimizer() ITK_OVERRIDE {}
49 
50 private:
51  ITK_DISALLOW_COPY_AND_ASSIGN(BVLSOptimizer);
52 
53  void InitializeSolutionByProjection();
54  void ComputeWVector();
55  bool TestKuhnTuckerConvergence();
56 
57  MatrixType m_DataMatrix;
58  ParametersType m_Points;
59 
60  ParametersType m_LowerBounds, m_UpperBounds;
61 
62  // Working values
64  std::vector <short> m_ParametersAtBoundsVector;
65  std::vector <double> m_TmpVector;
66  std::vector <double> m_WVector;
67  vnl_vector <double> m_bPrimeVector, m_ReducedSolution;
68  MatrixType m_ReducedDataMatrix;
69 };
70 
71 } // end of namespace anima
itk::SmartPointer< const Self > ConstPointer
Bounded variable least squares optimizer. Coming from Stark and Parker paper P.B. Stark and R...
vnl_matrix< double > MatrixType
void SetUpperBounds(const ParametersType &ub)
itk::Optimizer Superclass
itk::SmartPointer< Self > Pointer
Superclass::ParametersType ParametersType
vnl_vector< double > VectorType
virtual ~BVLSOptimizer() ITK_OVERRIDE
void SetLowerBounds(const ParametersType &lb)
void SetPoints(const ParametersType &points)