18#ifndef itkStatisticalShapePointPenalty_h
19#define itkStatisticalShapePointPenalty_h
24#include "itkPointSet.h"
27#include <itkVariableSizeMatrix.h>
29#include <vnl/vnl_matrix.h>
30#include <vnl/vnl_math.h>
31#include <vnl/vnl_vector.h>
32#include <vnl/algo/vnl_real_eigensystem.h>
33#include <vnl/algo/vnl_symmetric_eigensystem.h>
35#include <vnl/algo/vnl_svd_economy.h>
55template <
class TFixedPo
intSet,
class TMovingPo
intSet>
81 using typename Superclass::MeasureType;
82 using typename Superclass::DerivativeType;
119 DerivativeType & Derivative)
const override;
122 itkSetClampMacro(ShrinkageIntensity, MeasureType, 0.0, 1.0);
123 itkGetConstMacro(ShrinkageIntensity, MeasureType);
125 itkSetMacro(ShrinkageIntensityNeedsUpdate,
bool);
126 itkBooleanMacro(ShrinkageIntensityNeedsUpdate);
129 itkSetClampMacro(BaseVariance, MeasureType, -1.0, NumericTraits<MeasureType>::max());
130 itkGetConstMacro(BaseVariance, MeasureType);
132 itkSetMacro(BaseVarianceNeedsUpdate,
bool);
133 itkBooleanMacro(BaseVarianceNeedsUpdate);
135 itkSetClampMacro(CentroidXVariance, MeasureType, -1.0, NumericTraits<MeasureType>::max());
136 itkGetConstMacro(CentroidXVariance, MeasureType);
138 itkSetClampMacro(CentroidYVariance, MeasureType, -1.0, NumericTraits<MeasureType>::max());
139 itkGetConstMacro(CentroidYVariance, MeasureType);
141 itkSetClampMacro(CentroidZVariance, MeasureType, -1.0, NumericTraits<MeasureType>::max());
142 itkGetConstMacro(CentroidZVariance, MeasureType);
144 itkSetClampMacro(SizeVariance, MeasureType, -1.0, NumericTraits<MeasureType>::max());
145 itkGetConstMacro(SizeVariance, MeasureType);
147 itkSetMacro(VariancesNeedsUpdate,
bool);
148 itkBooleanMacro(VariancesNeedsUpdate);
150 itkSetClampMacro(CutOffValue, MeasureType, 0.0, NumericTraits<MeasureType>::max());
151 itkGetConstMacro(CutOffValue, MeasureType);
153 itkSetClampMacro(CutOffSharpness,
155 NumericTraits<MeasureType>::NonpositiveMin(),
156 NumericTraits<MeasureType>::max());
157 itkGetConstMacro(CutOffSharpness, MeasureType);
159 itkSetMacro(ShapeModelCalculation,
int);
160 itkGetConstReferenceMacro(ShapeModelCalculation,
int);
162 itkSetMacro(NormalizedShapeModel,
bool);
163 itkGetConstReferenceMacro(NormalizedShapeModel,
bool);
164 itkBooleanMacro(NormalizedShapeModel);
166 itkSetConstObjectMacro(EigenVectors, vnl_matrix<double>);
167 itkSetConstObjectMacro(EigenValues, vnl_vector<double>);
168 itkSetConstObjectMacro(MeanVector, vnl_vector<double>);
170 itkSetConstObjectMacro(CovarianceMatrix, vnl_matrix<double>);
178 PrintSelf(std::ostream & os, Indent indent)
const override;
210 const MeasureType & value,
214 const unsigned int shapeLength)
const;
260#ifndef ITK_MANUAL_INSTANTIATION
261# include "itkStatisticalShapePointPenalty.hxx"
Computes similarity between two point sets.
typename FixedPointSetType::PointDataContainer::ConstIterator PointDataIterator
typename TransformType::NonZeroJacobianIndicesType NonZeroJacobianIndicesType
typename TransformType::InputPointType InputPointType
typename TransformType::Pointer TransformPointer
typename DerivativeType::ValueType DerivativeValueType
typename MovingPointSetType::ConstPointer MovingPointSetConstPointer
typename FixedPointSetType::ConstPointer FixedPointSetConstPointer
TMovingPointSet MovingPointSetType
typename TransformType::ParametersType TransformParametersType
typename TransformType::JacobianType TransformJacobianType
TFixedPointSet FixedPointSetType
typename TransformType::OutputPointType OutputPointType
typename FixedPointSetType::PointsContainer::ConstIterator PointIterator
Computes the Mahalanobis distance between the transformed shape and a mean shape. A model mean and co...
void UpdateCentroidAndAlignProposalVector(const unsigned int shapeLength) const
vnl_matrix< CoordRepType > VnlMatrixType
unsigned int m_ProposalLength
void NormalizeProposalVector(const unsigned int shapeLength) const
const VnlVectorType * m_MeanVector
void UpdateCentroidAndAlignProposalDerivative(const unsigned int shapeLength) const
StatisticalShapePointPenalty()
VnlVectorType m_ProposalVector
double m_CentroidYVariance
void UpdateL2AndNormalizeProposalDerivative(const unsigned int shapeLength) const
double m_ShrinkageIntensity
int m_ShapeModelCalculation
bool m_NormalizedShapeModel
double m_CentroidXVariance
vnl_svd_economy< CoordRepType > PCACovarianceType
void CalculateCutOffDerivative(typename DerivativeType::element_type &derivativeElement, const MeasureType &value) const
SmartPointer< const Self > ConstPointer
bool m_VariancesNeedsUpdate
void GetValueAndDerivative(const TransformParametersType ¶meters, MeasureType &Value, DerivativeType &Derivative) const override
bool m_BaseVarianceNeedsUpdate
const VnlMatrixType * m_EigenVectors
double m_CentroidZVariance
VnlMatrixType * m_InverseCovarianceMatrix
VnlVectorType * m_EigenValuesRegularized
const VnlVectorType * m_EigenValues
bool m_ShrinkageIntensityNeedsUpdate
void CalculateDerivative(DerivativeType &derivative, const MeasureType &value, const VnlVectorType &differenceVector, const VnlVectorType ¢errotated, const VnlVectorType &eigrot, const unsigned int shapeLength) const
void FillProposalVector(const OutputPointType &fixedPoint, const unsigned int vertexindex) const
void CalculateValue(MeasureType &value, VnlVectorType &differenceVector, VnlVectorType ¢errotated, VnlVectorType &eigrot) const
void PrintSelf(std::ostream &os, Indent indent) const override
ProposalDerivativeType * m_ProposalDerivative
~StatisticalShapePointPenalty() override
const VnlMatrixType * m_CovarianceMatrix
MeasureType GetValue(const TransformParametersType ¶meters) const override
typename TransformType::ParametersType TransformParametersType
void CalculateCutOffValue(MeasureType &value) const
void Initialize() override
typename OutputPointType::CoordRepType CoordRepType
typename TransformType::OutputPointType OutputPointType
ITK_DISALLOW_COPY_AND_MOVE(StatisticalShapePointPenalty)
void GetDerivative(const TransformParametersType ¶meters, DerivativeType &Derivative) const override
void FillProposalDerivative(const OutputPointType &fixedPoint, const unsigned int vertexindex) const
vnl_vector< CoordRepType > VnlVectorType
void UpdateL2(const unsigned int shapeLength) const
VnlVectorType m_MeanValues
typename std::vector< VnlVectorType * > ProposalDerivativeType