Shapeworks Studio  2.1
Shape analysis software suite
List of all members | Public Types | Public Member Functions | Protected Member Functions | Protected Attributes
itk::PSMShapeEntropyFunction< VDimension > Class Template Reference

#include <itkPSMShapeEntropyFunction.h>

+ Inheritance diagram for itk::PSMShapeEntropyFunction< VDimension >:
+ Collaboration diagram for itk::PSMShapeEntropyFunction< VDimension >:

Public Types

typedef PSMShapeEntropyFunction Self
 
typedef SmartPointer< SelfPointer
 
typedef SmartPointer< const SelfConstPointer
 
typedef PSMCostFunction< VDimension > Superclass
 
typedef Superclass::ParticleSystemType ParticleSystemType
 
typedef PSMShapeMatrixAttribute< double, VDimension > ShapeMatrixType
 
typedef ShapeMatrixType::DataType DataType
 
typedef Superclass::VectorType VectorType
 
typedef ParticleSystemType::PointType PointType
 
typedef vnl_vector< DataType > vnl_vector_type
 
typedef vnl_matrix< DataType > vnl_matrix_type
 
- Public Types inherited from itk::PSMCostFunction< VDimension >
typedef PSMCostFunction Self
 
typedef SmartPointer< SelfPointer
 
typedef SmartPointer< const SelfConstPointer
 
typedef LightObject Superclass
 
typedef PSMParticleSystem< VDimension > ParticleSystemType
 
typedef vnl_vector_fixed< double, VDimension > VectorType
 

Public Member Functions

 itkTypeMacro (PSMShapeEntropyFunction, PSMCostFunction)
 
 itkNewMacro (Self)
 
 itkStaticConstMacro (Dimension, unsigned int, VDimension)
 
virtual VectorType Evaluate (unsigned int, unsigned int, const ParticleSystemType *, double &, double &) const
 
virtual VectorType Evaluate (unsigned int a, unsigned int b, const ParticleSystemType *c, double &d) const
 
virtual double Energy (unsigned int a, unsigned int b, const ParticleSystemType *c) const
 
void SetShapeMatrix (ShapeMatrixType *s)
 
ShapeMatrixTypeGetShapeMatrix ()
 
const ShapeMatrixTypeGetShapeMatrix () const
 
virtual void BeforeIteration ()
 
virtual void AfterIteration ()
 
void SetMinimumVariance (double d)
 
double GetMinimumVariance () const
 
void SetMinimumVarianceDecay (double initial_value, double final_value, double time_period)
 
bool GetMinimumVarianceDecayConstant () const
 
bool GetHoldMinimumVariance () const
 
void SetHoldMinimumVariance (bool b)
 
void SetRecomputeCovarianceInterval (int i)
 
int GetRecomputeCovarianceInterval () const
 
const std::vector< double > & GetShapePCAVariances () const
 
- Public Member Functions inherited from itk::PSMCostFunction< VDimension >
 itkTypeMacro (PSMCostFunction, LightObject)
 
 itkStaticConstMacro (Dimension, unsigned int, VDimension)
 
virtual void ResetBuffers ()
 
virtual void BeforeEvaluate (unsigned int, unsigned int, const ParticleSystemType *)
 
virtual void SetParticleSystem (ParticleSystemType *p)
 
virtual ParticleSystemTypeGetParticleSystem () const
 
virtual void SetDomainNumber (unsigned int i)
 
virtual int GetDomainNumber () const
 

Protected Member Functions

void operator= (const PSMShapeEntropyFunction &)
 
 PSMShapeEntropyFunction (const PSMShapeEntropyFunction &)
 
virtual void ComputeCovarianceMatrix ()
 
- Protected Member Functions inherited from itk::PSMCostFunction< VDimension >
void operator= (const PSMCostFunction &)
 
 PSMCostFunction (const PSMCostFunction &)
 

Protected Attributes

ShapeMatrixType::Pointer m_ShapeMatrix
 
std::vector< double > m_ShapePCAVariances
 
vnl_matrix_type m_PointsUpdate
 
double m_MinimumVariance
 
double m_MinimumEigenValue
 
double m_CurrentEnergy
 
bool m_HoldMinimumVariance
 
double m_MinimumVarianceDecayConstant
 
int m_RecomputeCovarianceInterval
 
int m_Counter
 
- Protected Attributes inherited from itk::PSMCostFunction< VDimension >
ParticleSystemTypem_ParticleSystem
 
unsigned int m_DomainNumber
 

Detailed Description

template<unsigned int VDimension>
class itk::PSMShapeEntropyFunction< VDimension >

This function estimates the entropy of a distribution of particle-system-based shapes (itkPSMParticleSystem) in shape space. It also computes the gradient of the entropy function. This class is used to optimize the correspondence of particle positions across shapes samples through minimization of the entropy of their distribution in shape space.

Author
Josh Cates

Definition at line 44 of file itkPSMShapeEntropyFunction.h.

Member Typedef Documentation

template<unsigned int VDimension>
typedef Superclass::ParticleSystemType itk::PSMShapeEntropyFunction< VDimension >::ParticleSystemType

Type of particle system.

Definition at line 55 of file itkPSMShapeEntropyFunction.h.

template<unsigned int VDimension>
typedef PSMShapeEntropyFunction itk::PSMShapeEntropyFunction< VDimension >::Self

Standard class typedefs.

Definition at line 48 of file itkPSMShapeEntropyFunction.h.

template<unsigned int VDimension>
typedef Superclass::VectorType itk::PSMShapeEntropyFunction< VDimension >::VectorType

Vector & Point types.

Definition at line 62 of file itkPSMShapeEntropyFunction.h.

Member Function Documentation

template<unsigned int VDimension>
virtual void itk::PSMShapeEntropyFunction< VDimension >::AfterIteration ( )
inlinevirtual

Called after each iteration of the solver.

Reimplemented from itk::PSMCostFunction< VDimension >.

Definition at line 119 of file itkPSMShapeEntropyFunction.h.

120  {
121  m_ShapeMatrix->AfterIteration();
122  // Update the annealing parameter.
123  if (m_HoldMinimumVariance != true)
124  {
125  m_Counter ++;
126  if (m_Counter >= m_RecomputeCovarianceInterval)
127  {
128  m_Counter = 0;
129  m_MinimumVariance *= m_MinimumVarianceDecayConstant;
130  }
131  }
132  }
template<unsigned int VDimension>
virtual void itk::PSMShapeEntropyFunction< VDimension >::BeforeIteration ( )
inlinevirtual

Called before each iteration of a solver.

Reimplemented from itk::PSMCostFunction< VDimension >.

Definition at line 108 of file itkPSMShapeEntropyFunction.h.

109  {
110  m_ShapeMatrix->BeforeIteration();
111 
112  if (m_Counter == 0)
113  {
114  this->ComputeCovarianceMatrix();
115  }
116  }
template<unsigned int VDimension>
PSMShapeEntropyFunction< VDimension >::VectorType itk::PSMShapeEntropyFunction< VDimension >::Evaluate ( unsigned int  idx,
unsigned int  d,
const ParticleSystemType system,
double &  maxdt,
double &  energy 
) const
virtual

The first argument is a pointer to the particle system. The second argument is the index of the domain within that particle system. The third argument is the index of the particle location within the given domain.

Implements itk::PSMCostFunction< VDimension >.

Definition at line 125 of file itkPSMShapeEntropyFunction.hxx.

127 {
128  // NOTE: This code requires that indices be contiguous, i.e. it
129  // won't work if you start deleting particles.
130  energy = m_CurrentEnergy;
131  maxdt = m_MinimumEigenValue;
132  const unsigned int DomainsPerShape = m_ShapeMatrix->GetDomainsPerShape();
133  const unsigned int PointsPerDomain = system->GetNumberOfParticles(d);
134 
135  VectorType gradE;
136  unsigned int k = ((d % DomainsPerShape) * PointsPerDomain * VDimension)
137  + (idx * VDimension);
138  for (unsigned int i = 0; i< VDimension; i++)
139  {
140  gradE[i] = m_PointsUpdate(k + i, d / DomainsPerShape);
141  }
142 
143 
144  return system->TransformVector(gradE,
145  system->GetInversePrefixTransform(d) *
146  system->GetInverseTransform(d));
147 }
template<unsigned int VDimension>
virtual VectorType itk::PSMShapeEntropyFunction< VDimension >::Evaluate ( unsigned int  int,
unsigned int  int,
const ParticleSystemType ,
double &  maxtimestep 
) const
inlinevirtual

Evaluate returns the vector-valued result of the function. The first argument is a pointer to the particle system. The second argument is the index of the domain within that particle system. The third argument is the index of the particle location within the given domain.

Implements itk::PSMCostFunction< VDimension >.

Definition at line 79 of file itkPSMShapeEntropyFunction.h.

81  {
82  double e;
83  return this->Evaluate(a,b,c,d,e);
84  }
virtual VectorType Evaluate(unsigned int, unsigned int, const ParticleSystemType *, double &, double &) const
template<unsigned int VDimension>
bool itk::PSMShapeEntropyFunction< VDimension >::GetHoldMinimumVariance ( ) const
inline

This method gets/sets the HoldMinimumVariance parameter, which turns on (true) or off (false) the gradual decrease in the m_MinumumVariance regularization parameter with successive invocations of the

Definition at line 172 of file itkPSMShapeEntropyFunction.h.

173  { return m_HoldMinimumVariance; }
template<unsigned int VDimension>
bool itk::PSMShapeEntropyFunction< VDimension >::GetMinimumVarianceDecayConstant ( ) const
inline

Returns the decay constant value computed from SetMinimumVarianceDecay.

Definition at line 163 of file itkPSMShapeEntropyFunction.h.

164  {
165  return m_MinimumVarianceDecayConstant;
166  }
template<unsigned int VDimension>
const std::vector<double>& itk::PSMShapeEntropyFunction< VDimension >::GetShapePCAVariances ( ) const
inline

Returns a vector of the variances associated with the PCA decomposition of the shape space. There will be only number_of_samples - 1 total valid PCA modes.

Definition at line 192 of file itkPSMShapeEntropyFunction.h.

193  {
194  return m_ShapePCAVariances;
195  }
template<unsigned int VDimension>
itk::PSMShapeEntropyFunction< VDimension >::itkNewMacro ( Self  )

Method for creation through the object factory.

template<unsigned int VDimension>
itk::PSMShapeEntropyFunction< VDimension >::itkStaticConstMacro ( Dimension  ,
unsigned  int,
VDimension   
)

Dimensionality of the domain of the particle system.

template<unsigned int VDimension>
void itk::PSMShapeEntropyFunction< VDimension >::SetMinimumVariance ( double  d)
inline

MinimumVariance is a regularization parameter that is added to the diagonal elements of the covariance matrix of the particle positions on shape. Higher MinimumVariance produces larger gradients, thus allowing shapes to move larger distances in shape space during optimization of positions with this function. Higher MinimumVariance values minimize the effects of smaller modes of variation in the covariance matrix. Conversely, smaller MinimumVariance values increase the significance of the smaller modes of variation on the gradient calculation. This class allows for an "annealing" type optimization using the SetMinumumVarianceDecay function.

Definition at line 145 of file itkPSMShapeEntropyFunction.h.

146  { m_MinimumVariance = d;}
template<unsigned int VDimension>
void itk::PSMShapeEntropyFunction< VDimension >::SetMinimumVarianceDecay ( double  initial_value,
double  final_value,
double  time_period 
)
inline

Sets up an "annealing" type of optimization strategy when this method is used within a PSMOptimizer class. This method specifies and initial value, a final value, and a time period (number of iterations) over which MinimumValue regularization parameter will decay.

Definition at line 155 of file itkPSMShapeEntropyFunction.h.

156  {
157  m_MinimumVarianceDecayConstant = exp(log(final_value / initial_value) / time_period);
158  m_MinimumVariance = initial_value;
159  m_HoldMinimumVariance = false;
160  }
template<unsigned int VDimension>
void itk::PSMShapeEntropyFunction< VDimension >::SetRecomputeCovarianceInterval ( int  i)
inline

Set/Get the number of times this function can be called before the covariance matrix is recomputed. In general, it may not be necessary to recompute the covariance matrix every time that particle positions are updated. However, the default value of 1 is the most accurate. For small numbers of samples and reasonably small numbers of particles (e.g. < 2000 per shape), a default value of 1 should not incur much of a time penalty.

Definition at line 184 of file itkPSMShapeEntropyFunction.h.

185  { m_RecomputeCovarianceInterval = i; }
template<unsigned int VDimension>
void itk::PSMShapeEntropyFunction< VDimension >::SetShapeMatrix ( ShapeMatrixType s)
inline

Write the first n modes to +- 3 std dev and the mean of the model described by the covariance matrix. The string argument is a prefix to the file names. Access the shape matrix.

Definition at line 100 of file itkPSMShapeEntropyFunction.h.

101  { m_ShapeMatrix = s; }

The documentation for this class was generated from the following files: