#pragma once#include"itkObject.h"#include"itkObjectFactory.h"#include"itkObject.h"#include"itkWeakPointer.h"#include"itkParticleSystem.h"#include<vector>#include"vnl/vnl_vector_fixed.h"#include"itkParticleVectorFunction.h"#include"ParticleImageDomainWithGradients.h"#include<algorithm>#include<limits>namespaceitk{template<classTGradientNumericType,unsignedintVDimension>classParticleGradientDescentPositionOptimizer:publicObject{public:typedefParticleGradientDescentPositionOptimizerSelf;typedefObjectSuperclass;typedefSmartPointer<Self>Pointer;typedefSmartPointer<constSelf>ConstPointer;typedefWeakPointer<constSelf>ConstWeakPointer;itkNewMacro(Self);typedefshapeworks::ParticleImageDomainWithGradients<TGradientNumericType>DomainType;itkTypeMacro(ParticleGradientDescentPositionOptimizer,Object);itkStaticConstMacro(Dimension,unsignedint,VDimension);typedefParticleSystemParticleSystemType;typedefParticleVectorFunction<VDimension>GradientFunctionType;typedeftypenameGradientFunctionType::VectorTypeVectorType;typedeftypenameParticleSystemType::PointTypePointType;voidStartOptimization(){this->StartAdaptiveGaussSeidelOptimization();}voidStartAdaptiveGaussSeidelOptimization();voidAugmentedLagrangianConstraints(VectorType&gradient,constPointType&pt,constsize_t&dom,constdouble&maximumUpdateAllowed);inlinevoidStopOptimization(){this->m_StopOptimization=true;}inlinevoidAbortProcessing(){this->m_StopOptimization=true;this->m_AbortProcessing=true;}itkGetMacro(NumberOfIterations,unsignedint);itkSetMacro(NumberOfIterations,unsignedint);voidSetVerbosity(unsignedintval){m_verbosity=val;}unsignedintGetVerbosity(){returnm_verbosity;}itkGetMacro(TimeStep,double);itkSetMacro(TimeStep,double);itkGetMacro(MaximumNumberOfIterations,unsignedint);itkSetMacro(MaximumNumberOfIterations,unsignedint);itkGetMacro(Tolerance,double);itkSetMacro(Tolerance,double);itkGetObjectMacro(ParticleSystem,ParticleSystemType);itkSetObjectMacro(ParticleSystem,ParticleSystemType);itkGetObjectMacro(GradientFunction,GradientFunctionType);itkSetObjectMacro(GradientFunction,GradientFunctionType);protected:ParticleGradientDescentPositionOptimizer();ParticleGradientDescentPositionOptimizer(constParticleGradientDescentPositionOptimizer&);constParticleGradientDescentPositionOptimizer&operator=(constParticleGradientDescentPositionOptimizer&);voidPrintSelf(std::ostream&os,Indentindent)const{Superclass::PrintSelf(os,indent);}virtual~ParticleGradientDescentPositionOptimizer(){};private:typenameParticleSystemType::Pointerm_ParticleSystem;typenameGradientFunctionType::Pointerm_GradientFunction;boolm_StopOptimization;boolm_AbortProcessing=false;unsignedintm_NumberOfIterations;unsignedintm_MaximumNumberOfIterations;doublem_Tolerance;doublem_TimeStep;std::vector<std::vector<double>>m_TimeSteps;unsignedintm_verbosity;voidResetTimeStepVectors();};}// end namespace#include"itkParticleGradientDescentPositionOptimizer.txx"