ANIMA  4.0
animaVoxelExhaustiveOptimizer.h
Go to the documentation of this file.
1 #pragma once
2 
3 #include <itkSingleValuedNonLinearOptimizer.h>
4 #include <vnl/vnl_matrix.h>
5 #include "AnimaOptimizersExport.h"
6 
7 namespace anima
8 {
9 
10 class ANIMAOPTIMIZERS_EXPORT VoxelExhaustiveOptimizer :
11 public itk::SingleValuedNonLinearOptimizer
12 {
13 public:
16  typedef itk::SingleValuedNonLinearOptimizer Superclass;
17  typedef itk::SmartPointer<Self> Pointer;
18  typedef itk::SmartPointer<const Self> ConstPointer;
19  typedef vnl_matrix <double> GeometryType;
20 
21  typedef itk::Array< unsigned long > StepsType;
23  itkNewMacro(Self)
24 
25 
26  itkTypeMacro(VoxelExhaustiveOptimizer, SingleValuedNonLinearOptimizer)
27 
28  virtual void StartOptimization() ITK_OVERRIDE;
29 
30  void StartWalking( void );
31  void ResumeWalking( void );
32  void StopWalking(void);
33 
34  itkSetMacro(NumberOfSteps, StepsType)
35 
36  // Geometry information
37  itkSetMacro(Geometry, GeometryType)
38 
39  itkGetConstReferenceMacro(NumberOfSteps, StepsType)
40  itkGetConstReferenceMacro(CurrentValue, MeasureType)
41  itkGetConstReferenceMacro(MaximumMetricValue, MeasureType)
42  itkGetConstReferenceMacro(MinimumMetricValue, MeasureType)
43  itkGetConstReferenceMacro(MinimumMetricValuePosition, ParametersType)
44  itkGetConstReferenceMacro(MaximumMetricValuePosition, ParametersType)
45  itkGetConstReferenceMacro(CurrentIndex, ParametersType)
46  itkGetConstReferenceMacro(MaximumNumberOfIterations, unsigned long)
47 
49  const std::string GetStopConditionDescription() const ITK_OVERRIDE;
50 
52  itkSetMacro(Maximize, bool)
53  itkBooleanMacro(Maximize)
54  itkGetConstReferenceMacro(Maximize, bool)
55 
58  const MeasureType& GetCurrentCost() const;
59 
60 protected:
62  virtual ~VoxelExhaustiveOptimizer() {}
63  void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE;
64 
66  void IncrementIndex(ParametersType &newPosition);
67 
68 
69 protected:
70  MeasureType m_CurrentValue;
71  StepsType m_NumberOfSteps;
72  unsigned long m_CurrentIteration;
73  bool m_Stop;
74  unsigned int m_CurrentParameter;
75  ParametersType m_CurrentIndex;
77  MeasureType m_MaximumMetricValue;
78  MeasureType m_MinimumMetricValue;
81 
82  GeometryType m_Geometry;
83 
84 private:
85  VoxelExhaustiveOptimizer(const Self&); //purposely not implemented
86  void operator=(const Self&);//purposely not implemented
87 
88  std::ostringstream m_StopConditionDescription;
89 
90  bool m_Maximize;
91 };
92 
93 } // end of namespace anima
STL namespace.
itk::SingleValuedNonLinearOptimizer Superclass
itk::SmartPointer< const Self > ConstPointer