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:
61
67
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
128 itkGetModifiableObjectMacro(SourceLandmarks, PointSetType); // NOTE: This is used to circumvent the SetTargetLandmarks
129 virtual void
132
134 itkGetModifiableObjectMacro(TargetLandmarks, PointSetType); // NOTE: This is used to circumvent the SetTargetLandmarks
135 virtual void
138
141 itkGetModifiableObjectMacro(Displacements, VectorSetType);
142
144 void
146
149 TransformPoint(const InputPointType & thisPoint) const override;
150
154 TransformVector(const InputVectorType &) const override
155 {
156 itkExceptionMacro("TransformVector(const InputVectorType &) is not implemented for KernelTransform");
157 }
158
159
160 OutputVnlVectorType
161 TransformVector(const InputVnlVectorType &) const override
162 {
163 itkExceptionMacro("TransformVector(const InputVnlVectorType &) is not implemented for KernelTransform");
164 }
165
167 using Superclass::TransformCovariantVector;
168 OutputCovariantVectorType
170 {
171 itkExceptionMacro(
172 << "TransformCovariantVector(const InputCovariantVectorType &) is not implemented for KernelTransform");
173 }
174
175
177 using IMatrixType = vnl_matrix_fixed<TParametersValueType, VDimension, VDimension>;
178
180 void
182
183 void
185 {
186 itkExceptionMacro("ComputeJacobianWithRespectToPosition not yet implemented "
187 "for "
188 << 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 {
226 }
227
235 itkSetClampMacro(Stiffness, double, 0.0, NumericTraits<double>::max());
236 itkGetConstMacro(Stiffness, double);
238
239protected:
241 ~KernelTransform() override = default;
242 void
243 PrintSelf(std::ostream & os, Indent indent) const override;
244
245public:
247 using GMatrixType = vnl_matrix_fixed<TParametersValueType, VDimension, VDimension>;
248
250 using LMatrixType = vnl_matrix<TParametersValueType>;
251
253 using KMatrixType = vnl_matrix<TParametersValueType>;
254
256 using PMatrixType = vnl_matrix<TParametersValueType>;
257
259 using YMatrixType = vnl_matrix<TParametersValueType>;
260
262 using WMatrixType = vnl_matrix<TParametersValueType>;
263
265 using DMatrixType = vnl_matrix<TParametersValueType>;
266
268 using AMatrixType = vnl_matrix_fixed<TParametersValueType, VDimension, VDimension>;
269
271 using BMatrixType = vnl_vector_fixed<TParametersValueType, VDimension>;
272
274 using RowMatrixType = vnl_matrix_fixed<TParametersValueType, 1, VDimension>;
275
277 using ColumnMatrixType = vnl_matrix_fixed<TParametersValueType, VDimension, 1>;
278
279protected:
286 virtual void
287 ComputeG(const InputVectorType & landmarkVector, GMatrixType & gmatrix) const;
288
299
302 virtual void
304
306 void
308
310 void
312
314 void
316
318 void
320
322 void
324
329 void
331
333 double m_Stiffness{};
334
338
341
344
347
350
353
360
363
366
371
374
377
380
383
384private:
385};
386} // end namespace itk
387
388#ifndef ITK_MANUAL_INSTANTIATION
389# include "itkKernelTransform.hxx"
390#endif
391
392#endif // itkKernelTransform_h
itkOverrideGetNameOfClassMacro(TransformBaseTemplate)
static constexpr TransformCategoryEnum Spline
ITK_DISALLOW_COPY_AND_MOVE(TransformBaseTemplate)
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< FixedParametersValueType > FixedParametersType
TransformBaseTemplateEnums::TransformCategory TransformCategoryEnum
Point< double, VOutputDimension > OutputPointType
OptimizerParameters< ParametersValueType > ParametersType
CovariantVector< double, VOutputDimension > OutputCovariantVectorType
virtual OutputVectorType TransformVector(const InputVectorType &) const
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
const char * GetNameOfClass() const override
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