18 #ifndef __itkPSMShapeEntropyFunction_h 19 #define __itkPSMShapeEntropyFunction_h 21 #include "itkPSMShapeMatrixAttribute.h" 22 #include "itkPSMCostFunction.h" 43 template <
unsigned int VDimension>
49 typedef SmartPointer<Self> Pointer;
50 typedef SmartPointer<const Self> ConstPointer;
64 typedef vnl_vector<DataType> vnl_vector_type;
65 typedef vnl_matrix<DataType> vnl_matrix_type;
77 virtual VectorType
Evaluate(
unsigned int,
unsigned int,
78 const ParticleSystemType *,
double &,
double&)
const;
79 virtual VectorType
Evaluate(
unsigned int a,
unsigned int b,
80 const ParticleSystemType *c,
double &d)
const 86 virtual double Energy(
unsigned int a,
unsigned int b,
87 const ParticleSystemType *c)
const 101 { m_ShapeMatrix = s; }
102 ShapeMatrixType *GetShapeMatrix()
103 {
return m_ShapeMatrix.GetPointer(); }
104 const ShapeMatrixType *GetShapeMatrix()
const 105 {
return m_ShapeMatrix.GetPointer(); }
110 m_ShapeMatrix->BeforeIteration();
114 this->ComputeCovarianceMatrix();
121 m_ShapeMatrix->AfterIteration();
123 if (m_HoldMinimumVariance !=
true)
126 if (m_Counter >= m_RecomputeCovarianceInterval)
129 m_MinimumVariance *= m_MinimumVarianceDecayConstant;
146 { m_MinimumVariance = d;}
147 double GetMinimumVariance()
const 148 {
return m_MinimumVariance; }
157 m_MinimumVarianceDecayConstant = exp(log(final_value / initial_value) / time_period);
158 m_MinimumVariance = initial_value;
159 m_HoldMinimumVariance =
false;
165 return m_MinimumVarianceDecayConstant;
173 {
return m_HoldMinimumVariance; }
174 void SetHoldMinimumVariance(
bool b)
175 { m_HoldMinimumVariance = b; }
185 { m_RecomputeCovarianceInterval = i; }
186 int GetRecomputeCovarianceInterval()
const 187 {
return m_RecomputeCovarianceInterval; }
194 return m_ShapePCAVariances;
201 m_HoldMinimumVariance =
true;
202 m_MinimumVariance = 1.0e-5;
203 m_MinimumEigenValue = 0.0;
204 m_MinimumVarianceDecayConstant = 1.0;
205 m_RecomputeCovarianceInterval = 1;
211 typename ShapeMatrixType::Pointer m_ShapeMatrix;
213 std::vector<double> m_ShapePCAVariances;
215 virtual void ComputeCovarianceMatrix();
216 vnl_matrix_type m_PointsUpdate;
217 double m_MinimumVariance;
218 double m_MinimumEigenValue;
219 double m_CurrentEnergy;
220 bool m_HoldMinimumVariance;
221 double m_MinimumVarianceDecayConstant;
222 int m_RecomputeCovarianceInterval;
230 #ifndef ITK_MANUAL_INSTANTIATION 231 #include "itkPSMShapeEntropyFunction.hxx" bool GetMinimumVarianceDecayConstant() const
Each column describes a shape. A shape may be composed of m_DomainsPerShape domains (default 1)...
itkStaticConstMacro(Dimension, unsigned int, VDimension)
Superclass::VectorType VectorType
void SetRecomputeCovarianceInterval(int i)
Superclass::ParticleSystemType ParticleSystemType
void SetMinimumVariance(double d)
void SetMinimumVarianceDecay(double initial_value, double final_value, double time_period)
void SetShapeMatrix(ShapeMatrixType *s)
PSMShapeEntropyFunction Self
virtual void AfterIteration()
virtual VectorType Evaluate(unsigned int, unsigned int, const ParticleSystemType *, double &, double &) const
const std::vector< double > & GetShapePCAVariances() const
virtual void BeforeIteration()
vnl_vector_fixed< double, VDimension > VectorType
bool GetHoldMinimumVariance() const
PSMParticleSystem< VDimension > ParticleSystemType
virtual VectorType Evaluate(unsigned int a, unsigned int b, const ParticleSystemType *c, double &d) const