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#include "itkMatrix.h"
23#include "itkPointSet.h"
24#include <deque>
25#include <cmath>
26#include "vnl/vnl_matrix_fixed.h"
27#include "vnl/vnl_matrix.h"
28#include "vnl/vnl_vector.h"
29#include "vnl/vnl_vector_fixed.h"
30#include "vnl/algo/vnl_svd.h"
31
32namespace itk
33{
56template <typename TParametersValueType, unsigned int VDimension>
57class ITK_TEMPLATE_EXPORT KernelTransform : public Transform<TParametersValueType, VDimension, VDimension>
58{
59public:
60 ITK_DISALLOW_COPY_AND_MOVE(KernelTransform);
61
67
69 itkOverrideGetNameOfClassMacro(KernelTransform);
70
72 itkNewMacro(Self);
73
75 static constexpr unsigned int SpaceDimension = VDimension;
76
78 using typename Superclass::ScalarType;
79
82 using typename Superclass::ParametersType;
83
85 using typename Superclass::JacobianType;
88
91
93 using typename Superclass::InputPointType;
94 using typename Superclass::OutputPointType;
95
97 using typename Superclass::InputVectorType;
98 using typename Superclass::OutputVectorType;
99
103
105 using typename Superclass::InputVnlVectorType;
106 using typename Superclass::OutputVnlVectorType;
107
110
116
122
126
129 itkGetModifiableObjectMacro(SourceLandmarks, PointSetType); // NOTE: This is used to circumvent the SetTargetLandmarks
130 virtual void
135 itkGetModifiableObjectMacro(TargetLandmarks, PointSetType); // NOTE: This is used to circumvent the SetTargetLandmarks
136 virtual void
141 itkGetModifiableObjectMacro(Displacements, VectorSetType);
142
144 void
146
149 TransformPoint(const InputPointType & thisPoint) const override;
150
155 TransformVector(const InputVectorType &) const override
156 {
157 itkExceptionStringMacro("TransformVector(const InputVectorType &) is not implemented for KernelTransform");
158 }
159
160 OutputVnlVectorType
161 TransformVector(const InputVnlVectorType &) const override
162 {
163 itkExceptionStringMacro("TransformVector(const InputVnlVectorType &) is not implemented for KernelTransform");
164 }
165
168 using Superclass::TransformCovariantVector;
169 OutputCovariantVectorType
171 {
172 itkExceptionMacro(
173 << "TransformCovariantVector(const InputCovariantVectorType &) is not implemented for KernelTransform");
174 }
175
177 using IMatrixType = vnl_matrix_fixed<TParametersValueType, VDimension, VDimension>;
178
180 void
182
183 void
185 {
186 itkExceptionMacro("ComputeJacobianWithRespectToPosition not yet implemented for " << this->GetNameOfClass());
187 }
188 using Superclass::ComputeJacobianWithRespectToPosition;
189
194 void
195 SetParameters(const ParametersType &) override;
196
202 void
204
206 virtual void
208
210 const ParametersType &
211 GetParameters() const override;
212
214 const FixedParametersType &
215 GetFixedParameters() const override;
216
221 GetTransformCategory() const override
222 {
223 return Self::TransformCategoryEnum::Spline;
224 }
225
234 itkSetClampMacro(Stiffness, double, 0.0, NumericTraits<double>::max());
235 itkGetConstMacro(Stiffness, double);
237protected:
239 ~KernelTransform() override = default;
240 void
241 PrintSelf(std::ostream & os, Indent indent) const override;
242
243public:
245 using GMatrixType = vnl_matrix_fixed<TParametersValueType, VDimension, VDimension>;
246
248 using LMatrixType = vnl_matrix<TParametersValueType>;
249
251 using KMatrixType = vnl_matrix<TParametersValueType>;
252
254 using PMatrixType = vnl_matrix<TParametersValueType>;
255
257 using YMatrixType = vnl_matrix<TParametersValueType>;
258
260 using WMatrixType = vnl_matrix<TParametersValueType>;
261
263 using DMatrixType = vnl_matrix<TParametersValueType>;
264
266 using AMatrixType = vnl_matrix_fixed<TParametersValueType, VDimension, VDimension>;
267
269 using BMatrixType = vnl_vector_fixed<TParametersValueType, VDimension>;
270
272 using RowMatrixType = vnl_matrix_fixed<TParametersValueType, 1, VDimension>;
273
275 using ColumnMatrixType = vnl_matrix_fixed<TParametersValueType, VDimension, 1>;
276
277protected:
284 virtual void
285 ComputeG(const InputVectorType & landmarkVector, GMatrixType & gmatrix) const;
286
297
300 virtual void
302
304 void
306
308 void
310
312 void
314
316 void
318
320 void
322
327 void
329
331 double m_Stiffness{};
332
336
339
342
345
348
351
358
361
364
369
372
375
378
381
382private:
383};
384} // end namespace itk
385
386#ifndef ITK_MANUAL_INSTANTIATION
387# include "itkKernelTransform.hxx"
388#endif
389
390#endif // itkKernelTransform_h
Control indentation during Print() invocation.
Definition itkIndent.h:50
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
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
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
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.
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
Array2D< ParametersValueType > JacobianType
Point< double, VInputDimension > InputPointType
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