go home Home | Main Page | Topics | Namespace List | Class Hierarchy | Alphabetical List | Data Structures | File List | Namespace Members | Data Fields | Globals | Related Pages
Loading...
Searching...
No Matches
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 <string>
38
39namespace itk
40{
54
55template <typename TFixedPointSet, typename TMovingPointSet>
56class ITK_TEMPLATE_EXPORT StatisticalShapePointPenalty
57 : public SingleValuedPointSetToPointSetMetric<TFixedPointSet, TMovingPointSet>
58{
59public:
61
65 using Pointer = SmartPointer<Self>;
66 using ConstPointer = SmartPointer<const Self>;
67
69 itkNewMacro(Self);
70
73
75 using typename Superclass::TransformType;
76 using typename Superclass::TransformPointer;
77 using typename Superclass::ParametersType;
80
81 using typename Superclass::MeasureType;
82 using typename Superclass::DerivativeType;
84 using typename Superclass::FixedPointSetType;
85 using typename Superclass::MovingPointSetType;
88
89 using typename Superclass::PointIterator;
90
91 using typename Superclass::InputPointType;
92 using typename Superclass::OutputPointType;
93
94 using CoordinateType = typename OutputPointType::CoordinateType;
95 using VnlVectorType = vnl_vector<CoordinateType>;
96 using VnlMatrixType = vnl_matrix<CoordinateType>;
97 // typedef itk::Array<VnlVectorType *> ProposalDerivativeType;
98 using ProposalDerivativeType = typename std::vector<VnlVectorType *>;
99 // typedef typename vnl_vector<VnlVectorType *> ProposalDerivativeType; //Cannot be linked
100 using PCACovarianceType = vnl_svd_economy<CoordinateType>;
101
103 void
104 Initialize() override;
105
107 MeasureType
108 GetValue(const ParametersType & parameters) const override;
109
111 void
112 GetDerivative(const ParametersType & parameters, DerivativeType & Derivative) const override;
113
115 void
116 GetValueAndDerivative(const ParametersType & parameters,
117 MeasureType & Value,
118 DerivativeType & Derivative) const override;
119
121 itkSetClampMacro(ShrinkageIntensity, MeasureType, 0.0, 1.0);
122 itkGetConstMacro(ShrinkageIntensity, MeasureType);
123
124 itkSetMacro(ShrinkageIntensityNeedsUpdate, bool);
125 itkBooleanMacro(ShrinkageIntensityNeedsUpdate);
126
128 itkSetClampMacro(BaseVariance, MeasureType, -1.0, NumericTraits<MeasureType>::max());
129 itkGetConstMacro(BaseVariance, MeasureType);
130
131 itkSetMacro(BaseVarianceNeedsUpdate, bool);
132 itkBooleanMacro(BaseVarianceNeedsUpdate);
133
134 itkSetClampMacro(CentroidXVariance, MeasureType, -1.0, NumericTraits<MeasureType>::max());
135 itkGetConstMacro(CentroidXVariance, MeasureType);
136
137 itkSetClampMacro(CentroidYVariance, MeasureType, -1.0, NumericTraits<MeasureType>::max());
138 itkGetConstMacro(CentroidYVariance, MeasureType);
139
140 itkSetClampMacro(CentroidZVariance, MeasureType, -1.0, NumericTraits<MeasureType>::max());
141 itkGetConstMacro(CentroidZVariance, MeasureType);
142
143 itkSetClampMacro(SizeVariance, MeasureType, -1.0, NumericTraits<MeasureType>::max());
144 itkGetConstMacro(SizeVariance, MeasureType);
145
146 itkSetMacro(VariancesNeedsUpdate, bool);
147 itkBooleanMacro(VariancesNeedsUpdate);
148
149 itkSetClampMacro(CutOffValue, MeasureType, 0.0, NumericTraits<MeasureType>::max());
150 itkGetConstMacro(CutOffValue, MeasureType);
151
152 itkSetClampMacro(CutOffSharpness,
153 MeasureType,
154 NumericTraits<MeasureType>::NonpositiveMin(),
155 NumericTraits<MeasureType>::max());
156 itkGetConstMacro(CutOffSharpness, MeasureType);
157
158 itkSetMacro(ShapeModelCalculation, int);
159 itkGetConstReferenceMacro(ShapeModelCalculation, int);
160
161 itkSetMacro(NormalizedShapeModel, bool);
162 itkGetConstReferenceMacro(NormalizedShapeModel, bool);
163 itkBooleanMacro(NormalizedShapeModel);
164
165 itkSetConstObjectMacro(EigenVectors, vnl_matrix<double>);
166 itkSetConstObjectMacro(EigenValues, vnl_vector<double>);
167 itkSetConstObjectMacro(MeanVector, vnl_vector<double>);
168
169 itkSetConstObjectMacro(CovarianceMatrix, vnl_matrix<double>);
170
171protected:
174
176 void
177 PrintSelf(std::ostream & os, Indent indent) const override;
178
179private:
180 void
181 FillProposalVector(const OutputPointType & fixedPoint, const unsigned int vertexindex) const;
182
183 void
184 FillProposalDerivative(const OutputPointType & fixedPoint, const unsigned int vertexindex) const;
185
186 void
187 UpdateCentroidAndAlignProposalVector(const unsigned int shapeLength) const;
188
189 void
190 UpdateCentroidAndAlignProposalDerivative(const unsigned int shapeLength) const;
191
192 void
193 UpdateL2(const unsigned int shapeLength) const;
194
195 void
196 NormalizeProposalVector(const unsigned int shapeLength) const;
197
198 void
199 UpdateL2AndNormalizeProposalDerivative(const unsigned int shapeLength) const;
200
201 void
202 CalculateValue(MeasureType & value,
203 VnlVectorType & differenceVector,
204 VnlVectorType & centerrotated,
205 VnlVectorType & eigrot) const;
206
207 void
208 CalculateDerivative(DerivativeType & derivative,
209 const MeasureType & value,
210 const VnlVectorType & differenceVector,
211 const VnlVectorType & eigrot,
212 const unsigned int shapeLength) const;
213
214 void
215 CalculateCutOffValue(MeasureType & value) const;
216
217 void
218 CalculateCutOffDerivative(typename DerivativeType::element_type & derivativeElement, const MeasureType & value) const;
219
224
226
234 double m_SizeStd{};
235
239
241
243 unsigned int m_ProposalLength{};
248 double m_BaseStd{};
251
254};
255
256} // end namespace itk
257
258#ifndef ITK_MANUAL_INSTANTIATION
259# include "itkStatisticalShapePointPenalty.hxx"
260#endif
261
262#endif
typename TransformType::NonZeroJacobianIndicesType NonZeroJacobianIndicesType
typename MovingPointSetType::ConstPointer MovingPointSetConstPointer
typename FixedPointSetType::ConstPointer FixedPointSetConstPointer
AdvancedTransform< CoordinateRepresentationType, Self::FixedPointSetDimension, Self::MovingPointSetDimension > TransformType
typename FixedPointSetType::PointsContainer::ConstIterator PointIterator
void UpdateCentroidAndAlignProposalVector(const unsigned int shapeLength) const
void NormalizeProposalVector(const unsigned int shapeLength) const
MeasureType GetValue(const ParametersType &parameters) const override
void UpdateCentroidAndAlignProposalDerivative(const unsigned int shapeLength) const
void UpdateL2AndNormalizeProposalDerivative(const unsigned int shapeLength) const
void CalculateCutOffDerivative(typename DerivativeType::element_type &derivativeElement, const MeasureType &value) const
void GetDerivative(const ParametersType &parameters, DerivativeType &Derivative) const override
void GetValueAndDerivative(const ParametersType &parameters, MeasureType &Value, DerivativeType &Derivative) const override
void CalculateDerivative(DerivativeType &derivative, const MeasureType &value, const VnlVectorType &differenceVector, const VnlVectorType &eigrot, const unsigned int shapeLength) const
itkOverrideGetNameOfClassMacro(StatisticalShapePointPenalty)
void FillProposalVector(const OutputPointType &fixedPoint, const unsigned int vertexindex) const
void CalculateValue(MeasureType &value, VnlVectorType &differenceVector, VnlVectorType &centerrotated, VnlVectorType &eigrot) const
void PrintSelf(std::ostream &os, Indent indent) const override
void CalculateCutOffValue(MeasureType &value) const
ITK_DISALLOW_COPY_AND_MOVE(StatisticalShapePointPenalty)
void FillProposalDerivative(const OutputPointType &fixedPoint, const unsigned int vertexindex) const
void UpdateL2(const unsigned int shapeLength) const
SingleValuedPointSetToPointSetMetric< typename MetricBase< TElastix >::FixedPointSetType, typename MetricBase< TElastix >::MovingPointSetType > Superclass


Generated on 1774142652 for elastix by doxygen 1.15.0 elastix logo