go home Home | Main Page | Modules | Namespace List | Class Hierarchy | Alphabetical List | Data Structures | File List | Namespace Members | Data Fields | Globals | Related Pages
itkAdvancedMatrixOffsetTransformBase.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
19/*
20
21 Program: Insight Segmentation & Registration Toolkit
22 Module: $RCSfile: itkAdvancedMatrixOffsetTransformBase.h,v $
23 Date: $Date: 2008-06-29 12:58:58 $
24 Version: $Revision: 1.20 $
25
26 Copyright (c) Insight Software Consortium. All rights reserved.
27 See ITKCopyright.txt or http://www.itk.org/HTML/Copyright.htm for details.
28
29 This software is distributed WITHOUT ANY WARRANTY; without even
30 the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
31 PURPOSE. See the above copyright notices for more information.
32
33=========================================================================*/
34#ifndef itkAdvancedMatrixOffsetTransformBase_h
35#define itkAdvancedMatrixOffsetTransformBase_h
36
37#include <iostream>
38
39#include "itkMatrix.h"
41#include "itkMacro.h"
42#include "itkMacro.h"
43
44namespace itk
45{
46
91template <class TScalarType = double, // Data type for scalars
92 unsigned int NInputDimensions = 3, // Number of dimensions in the input space
93 unsigned int NOutputDimensions = 3>
94// Number of dimensions in the output space
95class ITK_TEMPLATE_EXPORT AdvancedMatrixOffsetTransformBase
96 : public AdvancedTransform<TScalarType, NInputDimensions, NOutputDimensions>
97{
98public:
102 using Pointer = SmartPointer<Self>;
103 using ConstPointer = SmartPointer<const Self>;
107
109 itkNewMacro(Self);
110
112 itkStaticConstMacro(InputSpaceDimension, unsigned int, NInputDimensions);
113 itkStaticConstMacro(OutputSpaceDimension, unsigned int, NOutputDimensions);
114 itkStaticConstMacro(ParametersDimension, unsigned int, NOutputDimensions *(NInputDimensions + 1));
115
117 using typename Superclass::ScalarType;
118 using typename Superclass::ParametersType;
119 using typename Superclass::FixedParametersType;
120
121 using typename Superclass::NumberOfParametersType;
122 using typename Superclass::JacobianType;
123 using typename Superclass::InputVectorType;
124 using typename Superclass::OutputVectorType;
125 using typename Superclass::InputCovariantVectorType;
126 using typename Superclass::OutputCovariantVectorType;
127 using typename Superclass::InputVnlVectorType;
128 using typename Superclass::OutputVnlVectorType;
129 using typename Superclass::InputPointType;
130 using typename Superclass::OutputPointType;
131 using typename Superclass::TransformCategoryEnum;
132
134 using typename Superclass::SpatialJacobianType;
136 using typename Superclass::SpatialHessianType;
138 using typename Superclass::InternalMatrixType;
139
141 using MatrixType = Matrix<TScalarType, Self::OutputSpaceDimension, Self::InputSpaceDimension>;
142
144 using InverseMatrixType = Matrix<TScalarType, Self::InputSpaceDimension, Self::OutputSpaceDimension>;
145
147 using CenterType = InputPointType;
148 using OffsetType = OutputVectorType;
149 using TranslationType = OutputVectorType;
150
154 virtual void
156
169 virtual void
170 SetMatrix(const MatrixType & matrix)
171 {
172 this->m_Matrix = matrix;
173 this->ComputeOffset();
174 this->ComputeMatrixParameters();
175 this->m_MatrixMTime.Modified();
176 this->Modified();
177 }
178
179
187 const MatrixType &
188 GetMatrix() const
189 {
190 return this->m_Matrix;
191 }
192
193
217 void
218 SetCenter(const InputPointType & center)
219 {
220 this->m_Center = center;
221 this->ComputeOffset();
222 this->Modified();
223 }
224
225
233 const InputPointType &
234 GetCenter() const
235 {
236 return this->m_Center;
237 }
238
239
247 void
248 SetTranslation(const OutputVectorType & translation)
249 {
250 this->m_Translation = translation;
251 this->ComputeOffset();
252 this->Modified();
253 }
254
255
263 const OutputVectorType &
265 {
266 return this->m_Translation;
267 }
268
269
275 void
276 SetParameters(const ParametersType & parameters) override;
277
279 const ParametersType &
280 GetParameters() const override;
281
283 void
284 SetFixedParameters(const FixedParametersType &) override;
285
287 const FixedParametersType &
288 GetFixedParameters() const override;
289
298 OutputPointType
299 TransformPoint(const InputPointType & point) const override;
300
301 OutputVectorType
302 TransformVector(const InputVectorType & vector) const override;
303
304 OutputVnlVectorType
305 TransformVector(const InputVnlVectorType & vector) const override;
306
307 OutputCovariantVectorType
308 TransformCovariantVector(const InputCovariantVectorType & vector) const override;
309
315 bool
316 IsLinear() const override
317 {
318 return true;
319 }
320
321
325 TransformCategoryEnum
326 GetTransformCategory() const override
327 {
328 return TransformCategoryEnum::Linear;
329 }
330
331
333 void
334 GetJacobian(const InputPointType &, JacobianType &, NonZeroJacobianIndicesType &) const override;
335
337 void
338 GetSpatialJacobian(const InputPointType &, SpatialJacobianType &) const override;
339
341 void
342 GetSpatialHessian(const InputPointType &, SpatialHessianType &) const override;
343
345 void
346 GetJacobianOfSpatialJacobian(const InputPointType &,
348 NonZeroJacobianIndicesType &) const override;
349
351 void
352 GetJacobianOfSpatialJacobian(const InputPointType &,
355 NonZeroJacobianIndicesType &) const override;
356
358 void
359 GetJacobianOfSpatialHessian(const InputPointType &,
361 NonZeroJacobianIndicesType &) const override;
362
365 void
366 GetJacobianOfSpatialHessian(const InputPointType & inputPoint,
369 NonZeroJacobianIndicesType & nonZeroJacobianIndices) const override;
370
371protected:
380 explicit AdvancedMatrixOffsetTransformBase(const unsigned int paramDims = ParametersDimension);
381
384
386 void
387 PrintSelf(std::ostream & s, Indent indent) const override;
388
389 virtual void
391
392 virtual void
394
395 void
396 SetVarMatrix(const MatrixType & matrix)
397 {
398 this->m_Matrix = matrix;
399 this->m_MatrixMTime.Modified();
400 }
401
402 void
404
405 void
406 SetVarTranslation(const OutputVectorType & translation)
407 {
408 this->m_Translation = translation;
409 }
410
411 virtual void
413
420 const OutputVectorType &
421 GetOffset() const
422 {
423 return this->m_Offset;
424 }
425
433
434private:
436 const Self &
437 operator=(const Self &);
438
440 void
441 PrecomputeJacobians(unsigned int paramDims);
442
443 const InverseMatrixType &
445
446
448 MatrixType m_Matrix{ MatrixType::GetIdentity() }; // Matrix of the transformation
449 OutputVectorType m_Offset{}; // Offset of the transformation
450 mutable InverseMatrixType m_InverseMatrix{ InverseMatrixType::GetIdentity() }; // Inverse of the matrix
451 mutable bool m_Singular{ false }; // Is m_Inverse singular?
452
453 InputPointType m_Center{};
454 OutputVectorType m_Translation{};
455
459};
460
461} // namespace itk
462
463#ifndef ITK_MANUAL_INSTANTIATION
464# include "itkAdvancedMatrixOffsetTransformBase.hxx"
465#endif
466
467#endif /* itkAdvancedMatrixOffsetTransformBase_h */
OutputVnlVectorType TransformVector(const InputVnlVectorType &vector) const override
void GetJacobian(const InputPointType &, JacobianType &, NonZeroJacobianIndicesType &) const override
itkStaticConstMacro(InputSpaceDimension, unsigned int, NInputDimensions)
void GetJacobianOfSpatialHessian(const InputPointType &inputPoint, SpatialHessianType &sh, JacobianOfSpatialHessianType &jsh, NonZeroJacobianIndicesType &nonZeroJacobianIndices) const override
void SetFixedParameters(const FixedParametersType &) override
const InverseMatrixType & GetInverseMatrix() const
void GetJacobianOfSpatialHessian(const InputPointType &, JacobianOfSpatialHessianType &, NonZeroJacobianIndicesType &) const override
TransformCategoryEnum GetTransformCategory() const override
OutputPointType TransformPoint(const InputPointType &point) const override
AdvancedMatrixOffsetTransformBase(const Self &other)
void GetSpatialJacobian(const InputPointType &, SpatialJacobianType &) const override
void GetSpatialHessian(const InputPointType &, SpatialHessianType &) const override
OutputVectorType TransformVector(const InputVectorType &vector) const override
OutputCovariantVectorType TransformCovariantVector(const InputCovariantVectorType &vector) const override
void PrintSelf(std::ostream &s, Indent indent) const override
void GetJacobianOfSpatialJacobian(const InputPointType &, SpatialJacobianType &, JacobianOfSpatialJacobianType &, NonZeroJacobianIndicesType &) const override
const ParametersType & GetParameters() const override
void GetJacobianOfSpatialJacobian(const InputPointType &, JacobianOfSpatialJacobianType &, NonZeroJacobianIndicesType &) const override
void PrecomputeJacobians(unsigned int paramDims)
~AdvancedMatrixOffsetTransformBase() override=default
void SetTranslation(const OutputVectorType &translation)
const Self & operator=(const Self &)
const FixedParametersType & GetFixedParameters() const override
Matrix< TScalarType, Self::InputSpaceDimension, Self::OutputSpaceDimension > InverseMatrixType
Matrix< TScalarType, Self::OutputSpaceDimension, Self::InputSpaceDimension > MatrixType
AdvancedMatrixOffsetTransformBase(const unsigned int paramDims=ParametersDimension)
void SetVarTranslation(const OutputVectorType &translation)
void SetParameters(const ParametersType &parameters) override
itkStaticConstMacro(OutputSpaceDimension, unsigned int, NOutputDimensions)
itkStaticConstMacro(ParametersDimension, unsigned int, NOutputDimensions *(NInputDimensions+1))
AdvancedRigid3DTransform of a vector space (e.g. space coordinates)
AdvancedSimilarity2DTransform of a vector space (e.g. space coordinates)
Transform maps points, vectors and covariant vectors from an input space to an output space.
Matrix< ScalarType, OutputSpaceDimension, InputSpaceDimension > SpatialJacobianType
FixedArray< Matrix< ScalarType, InputSpaceDimension, InputSpaceDimension >, OutputSpaceDimension > SpatialHessianType
SmartPointer< const Self > ConstPointer


Generated on 2023-01-13 for elastix by doxygen 1.9.6 elastix logo