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>
75 using typename Superclass::TransformType;
76 using typename Superclass::TransformPointer;
77 using typename Superclass::TransformParametersType;
78 using typename Superclass::TransformJacobianType;
79 using typename Superclass::NonZeroJacobianIndicesType;
81 using typename Superclass::MeasureType;
82 using typename Superclass::DerivativeType;
83 using typename Superclass::DerivativeValueType;
84 using typename Superclass::FixedPointSetType;
85 using typename Superclass::MovingPointSetType;
86 using typename Superclass::FixedPointSetConstPointer;
87 using typename Superclass::MovingPointSetConstPointer;
89 using typename Superclass::PointIterator;
90 using typename Superclass::PointDataIterator;
92 using typename Superclass::InputPointType;
93 using typename Superclass::OutputPointType;
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);
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.
SmartPointer< const Self > ConstPointer
typename TransformType::ParametersType TransformParametersType
typename TransformType::OutputPointType OutputPointType
SingleValuedCostFunction Superclass
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
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
void CalculateCutOffValue(MeasureType &value) const
void Initialize() override
typename OutputPointType::CoordRepType CoordRepType
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