ITK 6.0.0
Insight Toolkit
 
Loading...
Searching...
No Matches
itkKernelTransform.h
Go to the documentation of this file.
1/*=========================================================================
2 *
3 * Copyright NumFOCUS
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 * https://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 itkKernelTransform_h
19#define itkKernelTransform_h
20
21#include "itkTransform.h"
22#if !defined(ITK_LEGACY_REMOVE) && !defined(ITK_FUTURE_LEGACY_REMOVE)
23# include "vnl/algo/vnl_svd.h" // transitional transitive include; dropped on ITK legacy removal
24#endif
25#include "itkMatrix.h"
26#include "itkPointSet.h"
27#include <deque>
28#include <cmath>
29#include "vnl/vnl_matrix_fixed.h"
30#include "vnl/vnl_matrix.h"
31#include "vnl/vnl_vector.h"
32#include "vnl/vnl_vector_fixed.h"
33
34namespace itk
35{
58template <typename TParametersValueType, unsigned int VDimension>
59class ITK_TEMPLATE_EXPORT KernelTransform : public Transform<TParametersValueType, VDimension, VDimension>
60{
61public:
62 ITK_DISALLOW_COPY_AND_MOVE(KernelTransform);
63
69
71 itkOverrideGetNameOfClassMacro(KernelTransform);
72
74 itkNewMacro(Self);
75
77 static constexpr unsigned int SpaceDimension = VDimension;
78
80 using typename Superclass::ScalarType;
81
84 using typename Superclass::ParametersType;
85
87 using typename Superclass::JacobianType;
90
93
95 using typename Superclass::InputPointType;
96 using typename Superclass::OutputPointType;
97
99 using typename Superclass::InputVectorType;
100 using typename Superclass::OutputVectorType;
101
105
107 using typename Superclass::InputVnlVectorType;
108 using typename Superclass::OutputVnlVectorType;
109
112
118
124
128
131 itkGetModifiableObjectMacro(SourceLandmarks, PointSetType); // NOTE: This is used to circumvent the SetTargetLandmarks
132 virtual void
137 itkGetModifiableObjectMacro(TargetLandmarks, PointSetType); // NOTE: This is used to circumvent the SetTargetLandmarks
138 virtual void
143 itkGetModifiableObjectMacro(Displacements, VectorSetType);
144
146 void
148
151 TransformPoint(const InputPointType & thisPoint) const override;
152
157 TransformVector(const InputVectorType &) const override
158 {
159 itkExceptionStringMacro("TransformVector(const InputVectorType &) is not implemented for KernelTransform");
160 }
161
162 OutputVnlVectorType
163 TransformVector(const InputVnlVectorType &) const override
164 {
165 itkExceptionStringMacro("TransformVector(const InputVnlVectorType &) is not implemented for KernelTransform");
166 }
167
170 using Superclass::TransformCovariantVector;
171 OutputCovariantVectorType
173 {
174 itkExceptionMacro(
175 << "TransformCovariantVector(const InputCovariantVectorType &) is not implemented for KernelTransform");
176 }
177
179 using IMatrixType = vnl_matrix_fixed<TParametersValueType, VDimension, VDimension>;
180
182 void
184
185 void
187 {
188 itkExceptionMacro("ComputeJacobianWithRespectToPosition not yet implemented for " << this->GetNameOfClass());
189 }
190 using Superclass::ComputeJacobianWithRespectToPosition;
191
196 void
197 SetParameters(const ParametersType &) override;
198
204 void
206
208 virtual void
210
212 const ParametersType &
213 GetParameters() const override;
214
216 const FixedParametersType &
217 GetFixedParameters() const override;
218
223 GetTransformCategory() const override
224 {
225 return Self::TransformCategoryEnum::Spline;
226 }
227
233 template <typename TTransform>
234 bool
235 GetInverse(TTransform * inverseTransform) const;
236 template <typename TTransform>
237 bool
238 GetInverse(SmartPointer<TTransform> inverseTransform) const
239 {
240 return this->GetInverse(inverseTransform.GetPointer());
241 }
242
244
247 GetInverseTransform() const override
248 {
249 return Superclass::InvertTransform(*this);
250 }
251
260 itkSetClampMacro(Stiffness, double, 0.0, NumericTraits<double>::max());
261 itkGetConstMacro(Stiffness, double);
263protected:
265 ~KernelTransform() override = default;
266 void
267 PrintSelf(std::ostream & os, Indent indent) const override;
268
269public:
271 using GMatrixType = vnl_matrix_fixed<TParametersValueType, VDimension, VDimension>;
272
274 using LMatrixType = vnl_matrix<TParametersValueType>;
275
277 using KMatrixType = vnl_matrix<TParametersValueType>;
278
280 using PMatrixType = vnl_matrix<TParametersValueType>;
281
283 using YMatrixType = vnl_matrix<TParametersValueType>;
284
286 using WMatrixType = vnl_matrix<TParametersValueType>;
287
289 using DMatrixType = vnl_matrix<TParametersValueType>;
290
292 using AMatrixType = vnl_matrix_fixed<TParametersValueType, VDimension, VDimension>;
293
295 using BMatrixType = vnl_vector_fixed<TParametersValueType, VDimension>;
296
298 using RowMatrixType = vnl_matrix_fixed<TParametersValueType, 1, VDimension>;
299
301 using ColumnMatrixType = vnl_matrix_fixed<TParametersValueType, VDimension, 1>;
302
303protected:
310 virtual void
311 ComputeG(const InputVectorType & landmarkVector, GMatrixType & gmatrix) const;
312
323
326 virtual void
328
330 void
332
334 void
336
338 void
340
342 void
344
346 void
348
353 void
355
357 double m_Stiffness{};
358
362
365
368
371
374
377
384
387
390
395
398
401
404
407};
408} // end namespace itk
409
410#ifndef ITK_MANUAL_INSTANTIATION
411# include "itkKernelTransform.hxx"
412#endif
413
414#endif // itkKernelTransform_h
Control indentation during Print() invocation.
Definition itkIndent.h:51
typename VectorSetType::Pointer VectorSetPointer
virtual void SetSourceLandmarks(PointSetType *)
void SetFixedParameters(const FixedParametersType &) override
vnl_matrix_fixed< TParametersValueType, VDimension, VDimension > GMatrixType
PointSet< InputPointType, VDimension, PointSetTraitsType > PointSetType
const FixedParametersType & GetFixedParameters() const override
typename PointSetType::PointsContainerIterator PointsIterator
vnl_matrix< TParametersValueType > YMatrixType
vnl_matrix_fixed< ParametersValueType, VOutputDimension, VInputDimension > JacobianPositionType
Point< double, VInputDimension > InputPointType
OutputVnlVectorType TransformVector(const InputVnlVectorType &) const override
Transform< TParametersValueType, VDimension, VDimension > Superclass
vnl_vector_fixed< double, VInputDimension > InputVnlVectorType
TransformCategoryEnum GetTransformCategory() const override
vnl_vector_fixed< TParametersValueType, VDimension > BMatrixType
vnl_matrix< TParametersValueType > PMatrixType
typename Superclass::InverseTransformBasePointer InverseTransformBasePointer
vnl_matrix_fixed< TParametersValueType, 1, VDimension > RowMatrixType
typename PointSetType::PointsContainer PointsContainer
virtual const GMatrixType & ComputeReflexiveG(PointsIterator) const
SmartPointer< Self > Pointer
vnl_matrix< TParametersValueType > DMatrixType
const ParametersType & GetParameters() const override
typename PointSetType::Pointer PointSetPointer
typename PointSetType::PointsContainerConstIterator PointsConstIterator
virtual void ComputeG(const InputVectorType &landmarkVector, GMatrixType &gmatrix) const
virtual void ComputeDeformationContribution(const InputPointType &thisPoint, OutputPointType &result) const
vnl_matrix< TParametersValueType > WMatrixType
void SetParameters(const ParametersType &) override
vnl_matrix< TParametersValueType > LMatrixType
OutputCovariantVectorType TransformCovariantVector(const InputCovariantVectorType &) const override
~KernelTransform() override=default
bool GetInverse(TTransform *inverseTransform) const
vnl_matrix_fixed< TParametersValueType, VDimension, VDimension > IMatrixType
itk::VectorContainer< InputVectorType > VectorSetType
vnl_matrix< TParametersValueType > KMatrixType
typename PointSetType::PointIdentifier PointIdentifier
void ComputeJacobianWithRespectToParameters(const InputPointType &p, JacobianType &jacobian) const override
virtual void UpdateParameters() const
void PrintSelf(std::ostream &os, Indent indent) const override
bool GetInverse(SmartPointer< TTransform > inverseTransform) const
InverseTransformBasePointer GetInverseTransform() const override
OutputPointType TransformPoint(const InputPointType &thisPoint) const override
DefaultStaticMeshTraits< TParametersValueType, VDimension, VDimension, TParametersValueType, TParametersValueType > PointSetTraitsType
void ComputeJacobianWithRespectToPosition(const InputPointType &, JacobianPositionType &) const override
virtual void SetTargetLandmarks(PointSetType *)
Point< double, VOutputDimension > OutputPointType
Vector< double, VInputDimension > InputVectorType
vnl_matrix_fixed< TParametersValueType, VDimension, VDimension > AMatrixType
CovariantVector< double, VInputDimension > InputCovariantVectorType
vnl_matrix_fixed< TParametersValueType, VDimension, 1 > ColumnMatrixType
Vector< double, VOutputDimension > OutputVectorType
OutputVectorType TransformVector(const InputVectorType &) const override
SmartPointer< const Self > ConstPointer
static constexpr T max(const T &)
typename PointsContainer::Iterator PointsContainerIterator
typename PointsContainer::ConstIterator PointsContainerConstIterator
TPointsContainer PointsContainer
A superclass of the N-dimensional mesh structure; supports point (geometric coordinate and attribute)...
Definition itkPointSet.h:82
Implements transparent reference counting.
ObjectType * GetPointer() const noexcept
OptimizerParameters< ParametersValueType > ParametersType
Point< double, VOutputDimension > OutputPointType
OptimizerParameters< FixedParametersValueType > FixedParametersType
CovariantVector< double, VOutputDimension > OutputCovariantVectorType
virtual OutputVectorType TransformVector(const InputVectorType &) const
TransformBaseTemplateEnums::TransformCategory TransformCategoryEnum
vnl_vector_fixed< double, VInputDimension > InputVnlVectorType
vnl_matrix_fixed< ParametersValueType, VOutputDimension, VInputDimension > JacobianPositionType
vnl_matrix_fixed< ParametersValueType, VInputDimension, VOutputDimension > InverseJacobianPositionType
static InverseTransformBasePointer InvertTransform(const TTransform &transform)
Array2D< ParametersValueType > JacobianType
Point< double, VInputDimension > InputPointType
typename InverseTransformBaseType::Pointer InverseTransformBasePointer
CovariantVector< double, VInputDimension > InputCovariantVectorType
Vector< double, VInputDimension > InputVectorType
Vector< double, VOutputDimension > OutputVectorType
vnl_vector_fixed< double, VOutputDimension > OutputVnlVectorType
The "itk" namespace contains all Insight Segmentation and Registration Toolkit (ITK) classes....
detail::VectorContainer< std::conditional_t< std::is_void_v< T2 >, SizeValueType, T1 >, std::conditional_t< std::is_void_v< T2 >, T1, T2 > > VectorContainer