Skip to content

shapeworks::SamplingFunction

This function returns an estimate of the gradient of the entropy of a particle distribution with respect to change in position of a specific particle in that distribution. More...

#include <SamplingFunction.h>

Inherits from shapeworks::VectorFunction, itk::LightObject

Inherited by shapeworks::CurvatureSamplingFunction

Public Types

Name
typedef float TGradientNumericType
typedef SamplingFunction Self
typedef itk::SmartPointer< Self > Pointer
typedef itk::SmartPointer< const Self > ConstPointer
typedef VectorFunction Superclass
typedef TGradientNumericType GradientNumericType
typedef GenericContainerArray< double > SigmaCacheType
typedef Superclass::VectorType VectorType
typedef ParticleSystem::PointType PointType
typedef vnl_vector_fixed< TGradientNumericType, VDimension > GradientVectorType

Public Functions

Name
itkTypeMacro(SamplingFunction , VectorFunction )
itkNewMacro(Self )
itkStaticConstMacro(Dimension , unsigned int , VDimension )
virtual VectorType Evaluate(unsigned int , unsigned int , const ParticleSystem * , double & maxtimestep) const
virtual VectorType Evaluate(unsigned int idx, unsigned int d, const ParticleSystem * system, double & maxdt, double & energy) const
virtual double Energy(unsigned int , unsigned int , const ParticleSystem * ) const
virtual void ResetBuffers()
virtual double EstimateSigma(unsigned int idx, const typename ParticleSystem::PointVectorType & neighborhood, const shapeworks::ParticleDomain * domain, const std::vector< double > & weights, const PointType & pos, double initial_sigma, double precision, int & err) const
TGradientNumericType AngleCoefficient(const GradientVectorType & , const GradientVectorType & ) const
void SetMinimumNeighborhoodRadius(double s)
double GetMinimumNeighborhoodRadius() const
void SetMaximumNeighborhoodRadius(double s)
double GetMaximumNeighborhoodRadius() const
void SetFlatCutoff(double s)
double GetFlatCutoff() const
void SetNeighborhoodToSigmaRatio(double s)
double GetNeighborhoodToSigmaRatio() const
void SetSpatialSigmaCache(SigmaCacheType * s)
SigmaCacheType * GetSpatialSigmaCache()
const SigmaCacheType * GetSpatialSigmaCache() const
void ComputeAngularWeights(const PointType & , int , const typename ParticleSystem::PointVectorType & , const shapeworks::ParticleDomain * , std::vector< double > & ) const
virtual VectorFunction::Pointer Clone()

Protected Functions

Name
SamplingFunction()
virtual ~SamplingFunction()
void operator=(const SamplingFunction & )
SamplingFunction(const SamplingFunction & )

Public Attributes

Name
constexpr static int VDimension

Protected Attributes

Name
double m_MinimumNeighborhoodRadius
double m_MaximumNeighborhoodRadius
double m_FlatCutoff
double m_NeighborhoodToSigmaRatio
SigmaCacheType::Pointer m_SpatialSigmaCache

Additional inherited members

Public Functions inherited from shapeworks::VectorFunction

Name
virtual void AfterIteration()
virtual void BeforeIteration()
virtual void BeforeEvaluate(unsigned int , unsigned int , const ParticleSystem * )
virtual void SetParticleSystem(ParticleSystem * p)
virtual ParticleSystem * GetParticleSystem() const
virtual void SetDomainNumber(unsigned int i)
virtual int GetDomainNumber() const
virtual double GetRelativeEnergyScaling() const
virtual void SetRelativeEnergyScaling(double r)

Protected Functions inherited from shapeworks::VectorFunction

Name
VectorFunction()
virtual ~VectorFunction()
VectorFunction(const VectorFunction & )

Protected Attributes inherited from shapeworks::VectorFunction

Name
ParticleSystem * m_ParticleSystem
unsigned int m_DomainNumber

Detailed Description

class shapeworks::SamplingFunction;

This function returns an estimate of the gradient of the entropy of a particle distribution with respect to change in position of a specific particle in that distribution.

Please note that CurvatureSamplingFunction is currently being used in all cases the curvature part is generally disabled though as the Rho value is always set to 0

The following description is an excerpt from

J Cates, P T Fletcher, M Styner, M Shenton, R Whitaker. Shape Modeling and Analysis with Entropy-Based Particle Systems. Information Processing in Medical Imaging IPMI 2007, LNCS 4584, pp. 333�345, 2007.

We treat a surface as a subset of \(\Re^d\), where \(d=2\) or \(d=3\) depending whether we are processing curves in the plane or surfaces in a volume, refspectively. The method we describe here deals with smooth, closed manifolds of codimension one, and we will refer to such manifolds as {surfaces}. We sample a surface \({\cal S} \subset \Re^d\) using a discrete set of \(N\) points that are considered random variables \(Z = (X_1, X_2, \ldots, X_N)\) drawn from a probability density function (PDF), \(p(X)\). We denote a realization of this PDF with lower case, and thus we have \(z = (x_1, x_2,\ldots, x_N)\), where \(z \in {\cal S}^N\). The probability of a realization \(x\) is \(p(X = x)\), which we denote simply as \(p(x)\).

The amount of information contained in such a random sampling is, in the limit, the differential entropy of the PDF, which is \(H[X] = -\int_S p(x) \log p(x) dx = -E\{\log p(X)\}\), where \(E\{ \cdot \}\) is the expectation. When we have a sufficient number of points sampled from \(p\), we can approximate the expectation by the sample mean, which gives \(H[X] \approx - (1/N)\sum_{i} \log p(x_i)\). We must also estimate \(p(x_i)\). Density functions on surfaces can be quite complex, and so we use a nonparametric, Parzen windowing estimation of this density using the particles themselves. Thus we have where \(G(x_i - x_j, \sigma_i)\) is a \(d\)-dimensional, isotropic Gaussian with standard deviation \(\sigma_i\). The cost function \(C\), is therefore an approximation of (negative) entropy:

Public Types Documentation

typedef TGradientNumericType

typedef float shapeworks::SamplingFunction::TGradientNumericType;

typedef Self

typedef SamplingFunction shapeworks::SamplingFunction::Self;

Standard class typedefs.

typedef Pointer

typedef itk::SmartPointer<Self> shapeworks::SamplingFunction::Pointer;

typedef ConstPointer

typedef itk::SmartPointer<const Self> shapeworks::SamplingFunction::ConstPointer;

typedef Superclass

typedef VectorFunction shapeworks::SamplingFunction::Superclass;

typedef GradientNumericType

typedef TGradientNumericType shapeworks::SamplingFunction::GradientNumericType;

Data type representing individual gradient components.

typedef SigmaCacheType

typedef GenericContainerArray<double> shapeworks::SamplingFunction::SigmaCacheType;

Cache type for the sigma values.

typedef VectorType

typedef Superclass::VectorType shapeworks::SamplingFunction::VectorType;

Vector & Point types.

typedef PointType

typedef ParticleSystem::PointType shapeworks::SamplingFunction::PointType;

typedef GradientVectorType

typedef vnl_vector_fixed<TGradientNumericType, VDimension> shapeworks::SamplingFunction::GradientVectorType;

Public Functions Documentation

function itkTypeMacro

itkTypeMacro(
    SamplingFunction ,
    VectorFunction 
)

function itkNewMacro

itkNewMacro(
    Self 
)

Method for creation through the object factory.

function itkStaticConstMacro

itkStaticConstMacro(
    Dimension ,
    unsigned int ,
    VDimension 
)

Dimensionality of the domain of the particle system.

function Evaluate

virtual VectorType Evaluate(
    unsigned int ,
    unsigned int ,
    const ParticleSystem * ,
    double & maxtimestep
) const

Reimplements: shapeworks::VectorFunction::Evaluate

Reimplemented by: shapeworks::CurvatureSamplingFunction::Evaluate

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.

function Evaluate

inline virtual VectorType Evaluate(
    unsigned int idx,
    unsigned int d,
    const ParticleSystem * system,
    double & maxdt,
    double & energy
) const

Reimplements: shapeworks::VectorFunction::Evaluate

Reimplemented by: shapeworks::CurvatureSamplingFunction::Evaluate

function Energy

inline virtual double Energy(
    unsigned int ,
    unsigned int ,
    const ParticleSystem * 
) const

Reimplements: shapeworks::VectorFunction::Energy

Reimplemented by: shapeworks::CurvatureSamplingFunction::Energy

function ResetBuffers

inline virtual void ResetBuffers()

Reimplements: shapeworks::VectorFunction::ResetBuffers

May be called by the solver class.

function EstimateSigma

virtual double EstimateSigma(
    unsigned int idx,
    const typename ParticleSystem::PointVectorType & neighborhood,
    const shapeworks::ParticleDomain * domain,
    const std::vector< double > & weights,
    const PointType & pos,
    double initial_sigma,
    double precision,
    int & err
) const

Estimate the best sigma for Parzen windowing in a given neighborhood. The best sigma is the sigma that maximizes probability at the given point

function AngleCoefficient

TGradientNumericType AngleCoefficient(
    const GradientVectorType & ,
    const GradientVectorType & 
) const

Returns a weighting coefficient based on the angle between two vectors. Weights smoothly approach zero as the angle between two normals approaches 90 degrees.

function SetMinimumNeighborhoodRadius

inline void SetMinimumNeighborhoodRadius(
    double s
)

Minimum radius of the neighborhood of points that are considered in the calculation. The neighborhood is a spherical radius in 3D space. The actual radius used in a calculation may exceed this value, but will not exceed the MaximumNeighborhoodRadius.

function GetMinimumNeighborhoodRadius

inline double GetMinimumNeighborhoodRadius() const

function SetMaximumNeighborhoodRadius

inline void SetMaximumNeighborhoodRadius(
    double s
)

Maximum radius of the neighborhood of points that are considered in the calculation. The neighborhood is a spherical radius in 3D space.

function GetMaximumNeighborhoodRadius

inline double GetMaximumNeighborhoodRadius() const

function SetFlatCutoff

inline void SetFlatCutoff(
    double s
)

Numerical parameters

function GetFlatCutoff

inline double GetFlatCutoff() const

function SetNeighborhoodToSigmaRatio

inline void SetNeighborhoodToSigmaRatio(
    double s
)

function GetNeighborhoodToSigmaRatio

inline double GetNeighborhoodToSigmaRatio() const

function SetSpatialSigmaCache

inline void SetSpatialSigmaCache(
    SigmaCacheType * s
)

Access the cache of sigma values for each particle position. This cache is populated by registering this object as an observer of the correct particle system (see SetParticleSystem).

function GetSpatialSigmaCache

inline SigmaCacheType * GetSpatialSigmaCache()

function GetSpatialSigmaCache

inline const SigmaCacheType * GetSpatialSigmaCache() const

function ComputeAngularWeights

void ComputeAngularWeights(
    const PointType & ,
    int ,
    const typename ParticleSystem::PointVectorType & ,
    const shapeworks::ParticleDomain * ,
    std::vector< double > & 
) const

Compute a set of weights based on the difference in the normals of a central point and each of its neighbors. Difference of > 90 degrees results in a weight of 0.

function Clone

inline virtual VectorFunction::Pointer Clone()

Reimplements: shapeworks::VectorFunction::Clone

Reimplemented by: shapeworks::CurvatureSamplingFunction::Clone

Protected Functions Documentation

function SamplingFunction

inline SamplingFunction()

function ~SamplingFunction

inline virtual ~SamplingFunction()

function operator=

void operator=(
    const SamplingFunction & 
)

function SamplingFunction

SamplingFunction(
    const SamplingFunction & 
)

Public Attributes Documentation

variable VDimension

static constexpr static int VDimension = 3;

Protected Attributes Documentation

variable m_MinimumNeighborhoodRadius

double m_MinimumNeighborhoodRadius;

variable m_MaximumNeighborhoodRadius

double m_MaximumNeighborhoodRadius;

variable m_FlatCutoff

double m_FlatCutoff;

variable m_NeighborhoodToSigmaRatio

double m_NeighborhoodToSigmaRatio;

variable m_SpatialSigmaCache

SigmaCacheType::Pointer m_SpatialSigmaCache;

Updated on 2024-03-17 at 12:58:44 -0600