go home Home | Main Page | Modules | Namespace List | Class Hierarchy | Alphabetical List | Data Structures | File List | Namespace Members | Data Fields | Globals | Related Pages
itkStatisticalShapePointPenalty.h
Go to the documentation of this file.
1 /*=========================================================================
2  *
3  * Copyright UMC Utrecht and contributors
4  *
5  * Licensed under the Apache License, Version 2.0 (the "License");
6  * you may not use this file except in compliance with the License.
7  * You may obtain a copy of the License at
8  *
9  * http://www.apache.org/licenses/LICENSE-2.0.txt
10  *
11  * Unless required by applicable law or agreed to in writing, software
12  * distributed under the License is distributed on an "AS IS" BASIS,
13  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14  * See the License for the specific language governing permissions and
15  * limitations under the License.
16  *
17  *=========================================================================*/
18 #ifndef __itkStatisticalShapePointPenalty_h
19 #define __itkStatisticalShapePointPenalty_h
20 
22 
23 #include "itkPoint.h"
24 #include "itkPointSet.h"
25 #include "itkImage.h"
26 #include "itkArray.h"
27 #include <itkVariableSizeMatrix.h>
28 
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>
34 //#include <vnl/algo/vnl_svd.h>
35 #include <vnl/algo/vnl_svd_economy.h>
36 
37 #include <vcl_iostream.h>
38 #include <string>
39 
40 namespace itk
41 {
56 template< class TFixedPointSet, class TMovingPointSet >
58  public SingleValuedPointSetToPointSetMetric< TFixedPointSet, TMovingPointSet >
59 {
60 public:
61 
65  TFixedPointSet, TMovingPointSet > Superclass;
67  typedef SmartPointer< const Self > ConstPointer;
68 
70  itkNewMacro( Self );
71 
73  itkTypeMacro( StatisticalShapePointPenalty,
75 
82 
90 
93 
96 
97  typedef typename OutputPointType::CoordRepType CoordRepType;
99  typedef vnl_matrix< CoordRepType > VnlMatrixType;
100  //typedef itk::Array<VnlVectorType *> ProposalDerivativeType;
101  typedef typename std::vector< VnlVectorType * > ProposalDerivativeType;
102  //typedef typename vnl_vector<VnlVectorType *> ProposalDerivativeType; //Cannot be linked
103  typedef vnl_svd_economy< CoordRepType > PCACovarianceType;
104 
106  void Initialize( void ) throw ( ExceptionObject );
107 
109  MeasureType GetValue( const TransformParametersType & parameters ) const;
110 
112  void GetDerivative( const TransformParametersType & parameters,
113  DerivativeType & Derivative ) const;
114 
117  MeasureType & Value, DerivativeType & Derivative ) const;
118 
120  itkSetClampMacro( ShrinkageIntensity, MeasureType, 0.0, 1.0 );
121  itkGetMacro( ShrinkageIntensity, MeasureType );
122 
123  itkSetMacro( ShrinkageIntensityNeedsUpdate, bool );
124  itkBooleanMacro( ShrinkageIntensityNeedsUpdate );
125 
127  itkSetClampMacro( BaseVariance, MeasureType,
128  -1.0, NumericTraits< MeasureType >::max() );
129  itkGetMacro( BaseVariance, MeasureType );
130 
131  itkSetMacro( BaseVarianceNeedsUpdate, bool );
132  itkBooleanMacro( BaseVarianceNeedsUpdate );
133 
134  itkSetClampMacro( CentroidXVariance, MeasureType,
135  -1.0, NumericTraits< MeasureType >::max() );
136  itkGetMacro( CentroidXVariance, MeasureType );
137 
138  itkSetClampMacro( CentroidYVariance, MeasureType,
139  -1.0, NumericTraits< MeasureType >::max() );
140  itkGetMacro( CentroidYVariance, MeasureType );
141 
142  itkSetClampMacro( CentroidZVariance, MeasureType,
143  -1.0, NumericTraits< MeasureType >::max() );
144  itkGetMacro( CentroidZVariance, MeasureType );
145 
146  itkSetClampMacro( SizeVariance, MeasureType,
147  -1.0, NumericTraits< MeasureType >::max() );
148  itkGetMacro( SizeVariance, MeasureType );
149 
150  itkSetMacro( VariancesNeedsUpdate, bool );
151  itkBooleanMacro( VariancesNeedsUpdate );
152 
153  itkSetClampMacro( CutOffValue, MeasureType,
154  0.0, NumericTraits< MeasureType >::max() );
155  itkGetMacro( CutOffValue, MeasureType );
156 
157  itkSetClampMacro( CutOffSharpness, MeasureType,
158  NumericTraits< MeasureType >::NonpositiveMin(), NumericTraits< MeasureType >::max() );
159  itkGetMacro( CutOffSharpness, MeasureType );
160 
161  itkSetMacro( ShapeModelCalculation, int );
162  itkGetConstReferenceMacro( ShapeModelCalculation, int );
163 
164  itkSetMacro( NormalizedShapeModel, bool );
165  itkGetConstReferenceMacro( NormalizedShapeModel, bool );
166  itkBooleanMacro( NormalizedShapeModel );
167 
168  itkSetConstObjectMacro( EigenVectors, vnl_matrix< double > );
169  itkSetConstObjectMacro( EigenValues, vnl_vector< double > );
170  itkSetConstObjectMacro( MeanVector, vnl_vector< double > );
171 
172  itkSetConstObjectMacro( CovarianceMatrix, vnl_matrix< double > );
173 
174 protected:
175 
178 
180  void PrintSelf( std::ostream & os, Indent indent ) const;
181 
182 private:
183 
184  StatisticalShapePointPenalty( const Self & ); // purposely not implemented
185  void operator=( const Self & ); // purposely not implemented
186 
187  void FillProposalVector( const OutputPointType & fixedPoint,
188  const unsigned int vertexindex ) const;
189 
190  void FillProposalDerivative( const OutputPointType & fixedPoint,
191  const unsigned int vertexindex ) const;
192 
194  const unsigned int shapeLength ) const;
195 
197  const unsigned int shapeLength ) const;
198 
199  void UpdateL2( const unsigned int shapeLength ) const;
200 
201  void NormalizeProposalVector( const unsigned int shapeLength ) const;
202 
203  void UpdateL2AndNormalizeProposalDerivative( const unsigned int shapeLength ) const;
204 
205  void CalculateValue( MeasureType & value, VnlVectorType & differenceVector,
206  VnlVectorType & centerrotated, VnlVectorType & eigrot ) const;
207 
208  void CalculateDerivative( DerivativeType & derivative, const MeasureType & value,
209  const VnlVectorType & differenceVector, const VnlVectorType & centerrotated,
210  const VnlVectorType & eigrot, const unsigned int shapeLength ) const;
211 
212  void CalculateCutOffValue( MeasureType & value ) const;
213 
215  typename DerivativeType::element_type & derivativeElement,
216  const MeasureType &value ) const;
217 
222 
224 
232  double m_SizeStd;
233 
237 
239 
241  unsigned int m_ProposalLength;
246  double m_BaseStd;
249 
252 
253 };
254 
255 } // end namespace itk
256 
257 #ifndef ITK_MANUAL_INSTANTIATION
258 #include "itkStatisticalShapePointPenalty.hxx"
259 #endif
260 
261 #endif
itk::StatisticalShapePointPenalty::m_CovarianceMatrix
const VnlMatrixType * m_CovarianceMatrix
Definition: itkStatisticalShapePointPenalty.h:219
itk::StatisticalShapePointPenalty::DerivativeValueType
Superclass::DerivativeValueType DerivativeValueType
Definition: itkStatisticalShapePointPenalty.h:85
itk::StatisticalShapePointPenalty::m_CutOffSharpness
double m_CutOffSharpness
Definition: itkStatisticalShapePointPenalty.h:251
itk::StatisticalShapePointPenalty::CoordRepType
OutputPointType::CoordRepType CoordRepType
Definition: itkStatisticalShapePointPenalty.h:97
itk::StatisticalShapePointPenalty::ConstPointer
SmartPointer< const Self > ConstPointer
Definition: itkStatisticalShapePointPenalty.h:67
itkSingleValuedPointSetToPointSetMetric.h
itk::StatisticalShapePointPenalty::m_MeanValues
VnlVectorType m_MeanValues
Definition: itkStatisticalShapePointPenalty.h:248
itk::StatisticalShapePointPenalty::CalculateDerivative
void CalculateDerivative(DerivativeType &derivative, const MeasureType &value, const VnlVectorType &differenceVector, const VnlVectorType &centerrotated, const VnlVectorType &eigrot, const unsigned int shapeLength) const
itk::StatisticalShapePointPenalty::TransformParametersType
Superclass::TransformParametersType TransformParametersType
Definition: itkStatisticalShapePointPenalty.h:79
itk::StatisticalShapePointPenalty::m_SizeVariance
double m_SizeVariance
Definition: itkStatisticalShapePointPenalty.h:231
itk::StatisticalShapePointPenalty::GetValueAndDerivative
void GetValueAndDerivative(const TransformParametersType &parameters, MeasureType &Value, DerivativeType &Derivative) const
itk::StatisticalShapePointPenalty::Self
StatisticalShapePointPenalty Self
Definition: itkStatisticalShapePointPenalty.h:63
itk::StatisticalShapePointPenalty::CalculateValue
void CalculateValue(MeasureType &value, VnlVectorType &differenceVector, VnlVectorType &centerrotated, VnlVectorType &eigrot) const
itk::StatisticalShapePointPenalty
Computes the Mahalanobis distance between the transformed shape and a mean shape. A model mean and co...
Definition: itkStatisticalShapePointPenalty.h:59
itk::StatisticalShapePointPenalty::m_ProposalLength
unsigned int m_ProposalLength
Definition: itkStatisticalShapePointPenalty.h:241
itk::SingleValuedPointSetToPointSetMetric::TransformParametersType
TransformType::ParametersType TransformParametersType
Definition: itkSingleValuedPointSetToPointSetMetric.h:102
SmartPointer< Self >
itk::StatisticalShapePointPenalty::m_NormalizedShapeModel
bool m_NormalizedShapeModel
Definition: itkStatisticalShapePointPenalty.h:242
itk::StatisticalShapePointPenalty::Pointer
SmartPointer< Self > Pointer
Definition: itkStatisticalShapePointPenalty.h:66
itk::StatisticalShapePointPenalty::NormalizeProposalVector
void NormalizeProposalVector(const unsigned int shapeLength) const
itk::StatisticalShapePointPenalty::TransformJacobianType
Superclass::TransformJacobianType TransformJacobianType
Definition: itkStatisticalShapePointPenalty.h:80
itk::StatisticalShapePointPenalty::Superclass
SingleValuedPointSetToPointSetMetric< TFixedPointSet, TMovingPointSet > Superclass
Definition: itkStatisticalShapePointPenalty.h:65
itk::SingleValuedPointSetToPointSetMetric::TransformPointer
TransformType::Pointer TransformPointer
Definition: itkSingleValuedPointSetToPointSetMetric.h:99
itk::SingleValuedPointSetToPointSetMetric
Computes similarity between two point sets.
Definition: itkSingleValuedPointSetToPointSetMetric.h:64
itk::StatisticalShapePointPenalty::MovingPointSetConstPointer
Superclass::MovingPointSetConstPointer MovingPointSetConstPointer
Definition: itkStatisticalShapePointPenalty.h:89
itk::StatisticalShapePointPenalty::m_VariancesNeedsUpdate
bool m_VariancesNeedsUpdate
Definition: itkStatisticalShapePointPenalty.h:236
itk::StatisticalShapePointPenalty::m_CentroidYStd
double m_CentroidYStd
Definition: itkStatisticalShapePointPenalty.h:228
itk::StatisticalShapePointPenalty::Initialize
void Initialize(void)
itk::StatisticalShapePointPenalty::InputPointType
Superclass::InputPointType InputPointType
Definition: itkStatisticalShapePointPenalty.h:94
itk::StatisticalShapePointPenalty::m_InverseCovarianceMatrix
VnlMatrixType * m_InverseCovarianceMatrix
Definition: itkStatisticalShapePointPenalty.h:223
itk::SingleValuedPointSetToPointSetMetric::OutputPointType
TransformType::OutputPointType OutputPointType
Definition: itkSingleValuedPointSetToPointSetMetric.h:101
itk::StatisticalShapePointPenalty::m_ShrinkageIntensity
double m_ShrinkageIntensity
Definition: itkStatisticalShapePointPenalty.h:244
itk::StatisticalShapePointPenalty::UpdateCentroidAndAlignProposalDerivative
void UpdateCentroidAndAlignProposalDerivative(const unsigned int shapeLength) const
itk::SingleValuedPointSetToPointSetMetric::PointDataIterator
FixedPointSetType::PointDataContainer::ConstIterator PointDataIterator
Definition: itkSingleValuedPointSetToPointSetMetric.h:87
itk::StatisticalShapePointPenalty::MeasureType
Superclass::MeasureType MeasureType
Definition: itkStatisticalShapePointPenalty.h:83
itk::StatisticalShapePointPenalty::GetDerivative
void GetDerivative(const TransformParametersType &parameters, DerivativeType &Derivative) const
itk::StatisticalShapePointPenalty::FixedPointSetType
Superclass::FixedPointSetType FixedPointSetType
Definition: itkStatisticalShapePointPenalty.h:86
vnl_vector< CoordRepType >
itk::StatisticalShapePointPenalty::m_CutOffValue
double m_CutOffValue
Definition: itkStatisticalShapePointPenalty.h:250
itk::StatisticalShapePointPenalty::StatisticalShapePointPenalty
StatisticalShapePointPenalty()
itk::StatisticalShapePointPenalty::m_CentroidXVariance
double m_CentroidXVariance
Definition: itkStatisticalShapePointPenalty.h:225
itk::StatisticalShapePointPenalty::PrintSelf
void PrintSelf(std::ostream &os, Indent indent) const
itk::StatisticalShapePointPenalty::m_BaseStd
double m_BaseStd
Definition: itkStatisticalShapePointPenalty.h:246
itk::StatisticalShapePointPenalty::FillProposalDerivative
void FillProposalDerivative(const OutputPointType &fixedPoint, const unsigned int vertexindex) const
itk::StatisticalShapePointPenalty::m_BaseVariance
double m_BaseVariance
Definition: itkStatisticalShapePointPenalty.h:245
itk::StatisticalShapePointPenalty::VnlMatrixType
vnl_matrix< CoordRepType > VnlMatrixType
Definition: itkStatisticalShapePointPenalty.h:99
itk::StatisticalShapePointPenalty::OutputPointType
Superclass::OutputPointType OutputPointType
Definition: itkStatisticalShapePointPenalty.h:95
itk::StatisticalShapePointPenalty::ProposalDerivativeType
std::vector< VnlVectorType * > ProposalDerivativeType
Definition: itkStatisticalShapePointPenalty.h:101
itk::StatisticalShapePointPenalty::TransformPointer
Superclass::TransformPointer TransformPointer
Definition: itkStatisticalShapePointPenalty.h:78
itk::StatisticalShapePointPenalty::m_SizeStd
double m_SizeStd
Definition: itkStatisticalShapePointPenalty.h:232
itk::StatisticalShapePointPenalty::PCACovarianceType
vnl_svd_economy< CoordRepType > PCACovarianceType
Definition: itkStatisticalShapePointPenalty.h:103
itk::StatisticalShapePointPenalty::FixedPointSetConstPointer
Superclass::FixedPointSetConstPointer FixedPointSetConstPointer
Definition: itkStatisticalShapePointPenalty.h:88
itk::StatisticalShapePointPenalty::m_MeanVector
const VnlVectorType * m_MeanVector
Definition: itkStatisticalShapePointPenalty.h:218
itk::SingleValuedPointSetToPointSetMetric::PointIterator
FixedPointSetType::PointsContainer::ConstIterator PointIterator
Definition: itkSingleValuedPointSetToPointSetMetric.h:86
itk::SingleValuedPointSetToPointSetMetric::MeasureType
Superclass::MeasureType MeasureType
Definition: itkSingleValuedPointSetToPointSetMetric.h:115
itk::SingleValuedPointSetToPointSetMetric::DerivativeValueType
DerivativeType::ValueType DerivativeValueType
Definition: itkSingleValuedPointSetToPointSetMetric.h:117
itk::SingleValuedPointSetToPointSetMetric::MovingPointSetType
TMovingPointSet MovingPointSetType
Definition: itkSingleValuedPointSetToPointSetMetric.h:83
itk::StatisticalShapePointPenalty::m_EigenValues
const VnlVectorType * m_EigenValues
Definition: itkStatisticalShapePointPenalty.h:221
itk::StatisticalShapePointPenalty::FillProposalVector
void FillProposalVector(const OutputPointType &fixedPoint, const unsigned int vertexindex) const
itk::StatisticalShapePointPenalty::PointDataIterator
Superclass::PointDataIterator PointDataIterator
Definition: itkStatisticalShapePointPenalty.h:92
itk::StatisticalShapePointPenalty::m_ShapeModelCalculation
int m_ShapeModelCalculation
Definition: itkStatisticalShapePointPenalty.h:243
itk::SingleValuedPointSetToPointSetMetric::FixedPointSetConstPointer
FixedPointSetType::ConstPointer FixedPointSetConstPointer
Definition: itkSingleValuedPointSetToPointSetMetric.h:82
itk::SingleValuedPointSetToPointSetMetric::MovingPointSetConstPointer
MovingPointSetType::ConstPointer MovingPointSetConstPointer
Definition: itkSingleValuedPointSetToPointSetMetric.h:85
itk::SingleValuedPointSetToPointSetMetric::InputPointType
TransformType::InputPointType InputPointType
Definition: itkSingleValuedPointSetToPointSetMetric.h:100
itk::SingleValuedPointSetToPointSetMetric::NonZeroJacobianIndicesType
TransformType::NonZeroJacobianIndicesType NonZeroJacobianIndicesType
Definition: itkSingleValuedPointSetToPointSetMetric.h:121
itk::StatisticalShapePointPenalty::UpdateCentroidAndAlignProposalVector
void UpdateCentroidAndAlignProposalVector(const unsigned int shapeLength) const
itk::StatisticalShapePointPenalty::UpdateL2AndNormalizeProposalDerivative
void UpdateL2AndNormalizeProposalDerivative(const unsigned int shapeLength) const
itk::StatisticalShapePointPenalty::DerivativeType
Superclass::DerivativeType DerivativeType
Definition: itkStatisticalShapePointPenalty.h:84
itk::StatisticalShapePointPenalty::TransformType
Superclass::TransformType TransformType
Definition: itkStatisticalShapePointPenalty.h:74
itk::StatisticalShapePointPenalty::CalculateCutOffValue
void CalculateCutOffValue(MeasureType &value) const
itk::StatisticalShapePointPenalty::operator=
void operator=(const Self &)
itk::StatisticalShapePointPenalty::StatisticalShapePointPenalty
StatisticalShapePointPenalty(const Self &)
itk::StatisticalShapePointPenalty::m_CentroidYVariance
double m_CentroidYVariance
Definition: itkStatisticalShapePointPenalty.h:227
itk::SingleValuedPointSetToPointSetMetric::DerivativeType
Superclass::DerivativeType DerivativeType
Definition: itkSingleValuedPointSetToPointSetMetric.h:116
vnl_matrix< double >
itk
Definition: itkAdvancedImageToImageMetric.h:40
itk::StatisticalShapePointPenalty::m_ProposalVector
VnlVectorType m_ProposalVector
Definition: itkStatisticalShapePointPenalty.h:247
itk::StatisticalShapePointPenalty::VnlVectorType
vnl_vector< CoordRepType > VnlVectorType
Definition: itkStatisticalShapePointPenalty.h:98
itk::StatisticalShapePointPenalty::m_ShrinkageIntensityNeedsUpdate
bool m_ShrinkageIntensityNeedsUpdate
Definition: itkStatisticalShapePointPenalty.h:234
itk::StatisticalShapePointPenalty::GetValue
MeasureType GetValue(const TransformParametersType &parameters) const
itk::StatisticalShapePointPenalty::m_ProposalDerivative
ProposalDerivativeType * m_ProposalDerivative
Definition: itkStatisticalShapePointPenalty.h:240
itk::StatisticalShapePointPenalty::m_BaseVarianceNeedsUpdate
bool m_BaseVarianceNeedsUpdate
Definition: itkStatisticalShapePointPenalty.h:235
itk::StatisticalShapePointPenalty::m_CentroidZVariance
double m_CentroidZVariance
Definition: itkStatisticalShapePointPenalty.h:229
itk::SingleValuedPointSetToPointSetMetric::FixedPointSetType
TFixedPointSet FixedPointSetType
Definition: itkSingleValuedPointSetToPointSetMetric.h:77
itk::StatisticalShapePointPenalty::NonZeroJacobianIndicesType
Superclass::NonZeroJacobianIndicesType NonZeroJacobianIndicesType
Definition: itkStatisticalShapePointPenalty.h:81
vnl_vector< double >
itk::StatisticalShapePointPenalty::m_CentroidZStd
double m_CentroidZStd
Definition: itkStatisticalShapePointPenalty.h:230
itk::StatisticalShapePointPenalty::m_EigenVectors
const VnlMatrixType * m_EigenVectors
Definition: itkStatisticalShapePointPenalty.h:220
itk::StatisticalShapePointPenalty::m_CentroidXStd
double m_CentroidXStd
Definition: itkStatisticalShapePointPenalty.h:226
itk::StatisticalShapePointPenalty::~StatisticalShapePointPenalty
virtual ~StatisticalShapePointPenalty()
itk::SingleValuedPointSetToPointSetMetric::TransformType
AdvancedTransform< CoordinateRepresentationType, itkGetStaticConstMacro(FixedPointSetDimension), itkGetStaticConstMacro(MovingPointSetDimension) > TransformType
Definition: itkSingleValuedPointSetToPointSetMetric.h:98
itk::StatisticalShapePointPenalty::m_EigenValuesRegularized
VnlVectorType * m_EigenValuesRegularized
Definition: itkStatisticalShapePointPenalty.h:238
itk::StatisticalShapePointPenalty::CalculateCutOffDerivative
void CalculateCutOffDerivative(typename DerivativeType::element_type &derivativeElement, const MeasureType &value) const
itk::SingleValuedPointSetToPointSetMetric::TransformJacobianType
TransformType::JacobianType TransformJacobianType
Definition: itkSingleValuedPointSetToPointSetMetric.h:103
itk::StatisticalShapePointPenalty::PointIterator
Superclass::PointIterator PointIterator
Definition: itkStatisticalShapePointPenalty.h:91
itk::StatisticalShapePointPenalty::MovingPointSetType
Superclass::MovingPointSetType MovingPointSetType
Definition: itkStatisticalShapePointPenalty.h:87
itk::StatisticalShapePointPenalty::UpdateL2
void UpdateL2(const unsigned int shapeLength) const


Generated on OURCE_DATE_EPOCH for elastix by doxygen 1.8.18 elastix logo