ANIMA  4.0
animaNLOPTParametersConstraintFunction.h
Go to the documentation of this file.
1 #pragma once
2 
3 #include <itkObject.h>
4 #include <itkSmartPointer.h>
5 
6 #include <AnimaOptimizersExport.h>
7 
8 namespace anima
9 {
10 
11 class ANIMAOPTIMIZERS_EXPORT NLOPTParametersConstraintFunction : public itk::Object
12 {
13 public:
16  typedef itk::Object Superclass;
17  typedef itk::SmartPointer<Self> Pointer;
18  typedef itk::SmartPointer<const Self> ConstPointer;
19 
20  itkTypeMacro(NLOPTParametersConstraintFunction, itk::Object)
21 
22  typedef struct
23  {
26 
27  static double GetConstraintValue(unsigned int n, const double *x, double *grad, void *data);
28 
29  itkSetMacro(Tolerance, double)
30  itkGetMacro(Tolerance, double)
31 
32  itkGetMacro(AdditionalData, ConstraintDataType *)
33 
34 protected:
36  {
37  m_Tolerance = 1.0e-8;
38  m_AdditionalData = new ConstraintDataType;
39  m_AdditionalData->constraintPointer = this;
40  }
41 
43  {
44  delete m_AdditionalData;
45  }
46 
47  virtual double InternalComputeConstraint(unsigned int numParameters, const double *dataValue, double *gradValue) = 0;
48 
49 private:
50  NLOPTParametersConstraintFunction(const Self&); //purposely not implemented
51  void operator=(const Self&); //purposely not implemented
52 
53  double m_Tolerance;
54  ConstraintDataType *m_AdditionalData;
55 };
56 
57 } // end namespace anima