go home Home | Main Page | Modules | Namespace List | Class Hierarchy | Alphabetical List | Data Structures | File List | Namespace Members | Data Fields | Globals | Related Pages
itkAdvancedIdentityTransform.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 Program: Insight Segmentation & Registration Toolkit
21 Module: $RCSfile: itkIdentityTransform.h,v $
22 Date: $Date: 2009-06-28 14:41:47 $
23 Version: $Revision: 1.19 $
24
25 Copyright (c) Insight Software Consortium. All rights reserved.
26 See ITKCopyright.txt or http://www.itk.org/HTML/Copyright.htm for details.
27
28 This software is distributed WITHOUT ANY WARRANTY; without even
29 the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
30 PURPOSE. See the above copyright notices for more information.
31
32=========================================================================*/
33#ifndef itkAdvancedIdentityTransform_h
34#define itkAdvancedIdentityTransform_h
35
36#include "itkObject.h"
37#include "itkPoint.h"
38#include "itkVector.h"
39#include "itkCovariantVector.h"
40#include <vnl/vnl_vector_fixed.h>
41#include "itkArray.h"
42#include "itkArray2D.h"
44
45#include "itkObjectFactory.h"
46
47#include <numeric> // For iota.
48
49namespace itk
50{
51
71template <class TScalarType, unsigned int NDimensions = 3>
72class ITK_TEMPLATE_EXPORT AdvancedIdentityTransform : public AdvancedTransform<TScalarType, NDimensions, NDimensions>
73{
74public:
76
80 using Pointer = SmartPointer<Self>;
81 using ConstPointer = SmartPointer<const Self>;
82
84 itkNewMacro(Self);
85
88
90 itkStaticConstMacro(InputSpaceDimension, unsigned int, NDimensions);
91 itkStaticConstMacro(OutputSpaceDimension, unsigned int, NDimensions);
92 itkStaticConstMacro(ParametersDimension, unsigned int, 1);
93
96
98 using typename Superclass::ParametersType;
99 using typename Superclass::NumberOfParametersType;
100 using typename Superclass::TransformCategoryEnum;
101
103 using typename Superclass::JacobianType;
104
106 using InputVectorType = Vector<TScalarType, Self::InputSpaceDimension>;
107 using OutputVectorType = Vector<TScalarType, Self::OutputSpaceDimension>;
108
110 using InputCovariantVectorType = CovariantVector<TScalarType, Self::InputSpaceDimension>;
111 using OutputCovariantVectorType = CovariantVector<TScalarType, Self::OutputSpaceDimension>;
112
114 using InputVnlVectorType = vnl_vector_fixed<TScalarType, Self::InputSpaceDimension>;
115 using OutputVnlVectorType = vnl_vector_fixed<TScalarType, Self::OutputSpaceDimension>;
116
118 using InputPointType = Point<TScalarType, Self::InputSpaceDimension>;
119 using OutputPointType = Point<TScalarType, Self::OutputSpaceDimension>;
120
124 using InverseTransformBasePointer = typename InverseTransformBaseType::Pointer;
125
128 using typename Superclass::SpatialJacobianType;
130 using typename Superclass::SpatialHessianType;
132 using typename Superclass::InternalMatrixType;
133
136 TransformPoint(const InputPointType & point) const override
137 {
138 return point;
139 }
140
142 OutputVectorType
143 TransformVector(const InputVectorType & vector) const override
144 {
145 return vector;
146 }
147
149 OutputVnlVectorType
150 TransformVector(const InputVnlVectorType & vector) const override
151 {
152 return vector;
153 }
154
156 OutputCovariantVectorType
158 {
159 return vector;
160 }
161
166 void
168 {}
169
171 InverseTransformBasePointer
172 GetInverseTransform() const override
173 {
174 return this->New().GetPointer();
175 }
176
177
183 bool
184 IsLinear() const override
185 {
186 return true;
187 }
188
192 TransformCategoryEnum
193 GetTransformCategory() const override
194 {
195 return TransformCategoryEnum::Linear;
196 }
197
198
200 const ParametersType &
201 GetFixedParameters() const override
202 {
203 return this->m_FixedParameters;
204 }
205
206
208 void
209 SetFixedParameters(const ParametersType &) override
210 {}
211
213 const ParametersType &
214 GetParameters() const override
215 {
216 return this->m_Parameters;
217 }
218
219
221 void
222 SetParameters(const ParametersType &) override
223 {}
224
226 void
228 JacobianType & j,
229 NonZeroJacobianIndicesType & nonZeroJacobianIndices) const override
230 {
231 j = this->m_LocalJacobian;
232 nonZeroJacobianIndices = this->m_NonZeroJacobianIndices;
233 }
234
235
237 void
239 {
240 sj = this->m_SpatialJacobian;
241 }
242
243
245 void
247 {
248 sh = this->m_SpatialHessian;
249 }
250
251
253 void
256 NonZeroJacobianIndicesType & nonZeroJacobianIndices) const override
257 {
258 jsj = this->m_JacobianOfSpatialJacobian;
259 nonZeroJacobianIndices = this->m_NonZeroJacobianIndices;
260 }
261
262
264 void
268 NonZeroJacobianIndicesType & nonZeroJacobianIndices) const override
269 {
270 sj = this->m_SpatialJacobian;
271 jsj = this->m_JacobianOfSpatialJacobian;
272 nonZeroJacobianIndices = this->m_NonZeroJacobianIndices;
273 }
274
275
277 void
280 NonZeroJacobianIndicesType & nonZeroJacobianIndices) const override
281 {
282 jsh = this->m_JacobianOfSpatialHessian;
283 nonZeroJacobianIndices = this->m_NonZeroJacobianIndices;
284 }
285
286
290 void
294 NonZeroJacobianIndicesType & nonZeroJacobianIndices) const override
295 {
296 sh = this->m_SpatialHessian;
297 jsh = this->m_JacobianOfSpatialHessian;
298 nonZeroJacobianIndices = this->m_NonZeroJacobianIndices;
299 }
300
301
302protected:
304 : AdvancedTransform<TScalarType, NDimensions, NDimensions>(NDimensions)
305 {
306 // The Jacobian is constant, therefore it can be initialized in the constructor.
307 this->m_LocalJacobian = JacobianType(NDimensions, 1, 0.0);
308
310 this->m_SpatialJacobian.SetIdentity();
311
313 this->m_NonZeroJacobianIndices.resize(ParametersDimension);
314 std::iota(m_NonZeroJacobianIndices.begin(), m_NonZeroJacobianIndices.end(), 0u);
315
317 this->m_HasNonZeroSpatialHessian = false;
318 this->m_HasNonZeroJacobianOfSpatialHessian = false;
319 this->m_JacobianOfSpatialJacobian.resize(ParametersDimension);
320 this->m_JacobianOfSpatialHessian.resize(ParametersDimension);
321
323 }
324
325
326 ~AdvancedIdentityTransform() override = default;
327
328private:
329 // Private using-declarations, to avoid `-Woverloaded-virtual` warnings from GCC (GCC 11.4).
330 using Superclass::TransformVector;
331 using Superclass::TransformCovariantVector;
332
333 JacobianType m_LocalJacobian{};
334 SpatialJacobianType m_SpatialJacobian{};
335 SpatialHessianType m_SpatialHessian{};
336 NonZeroJacobianIndicesType m_NonZeroJacobianIndices{};
337 JacobianOfSpatialJacobianType m_JacobianOfSpatialJacobian{};
338 JacobianOfSpatialHessianType m_JacobianOfSpatialHessian{};
339};
340
341} // end namespace itk
342
343#endif
Implementation of an Identity Transform.
OutputCovariantVectorType TransformCovariantVector(const InputCovariantVectorType &vector) const override
typename InverseTransformBaseType::Pointer InverseTransformBasePointer
Vector< TScalarType, Self::OutputSpaceDimension > OutputVectorType
typename Superclass::InverseTransformBaseType InverseTransformBaseType
Vector< TScalarType, Self::InputSpaceDimension > InputVectorType
Point< TScalarType, Self::InputSpaceDimension > InputPointType
void GetSpatialJacobian(const InputPointType &, SpatialJacobianType &sj) const override
InverseTransformBasePointer GetInverseTransform() const override
const ParametersType & GetFixedParameters() const override
OutputVectorType TransformVector(const InputVectorType &vector) const override
itkStaticConstMacro(OutputSpaceDimension, unsigned int, NDimensions)
void GetJacobian(const InputPointType &, JacobianType &j, NonZeroJacobianIndicesType &nonZeroJacobianIndices) const override
itkStaticConstMacro(InputSpaceDimension, unsigned int, NDimensions)
Point< TScalarType, Self::OutputSpaceDimension > OutputPointType
~AdvancedIdentityTransform() override=default
void GetJacobianOfSpatialJacobian(const InputPointType &, SpatialJacobianType &sj, JacobianOfSpatialJacobianType &jsj, NonZeroJacobianIndicesType &nonZeroJacobianIndices) const override
CovariantVector< TScalarType, Self::OutputSpaceDimension > OutputCovariantVectorType
const ParametersType & GetParameters() const override
void SetParameters(const ParametersType &) override
OutputPointType TransformPoint(const InputPointType &point) const override
vnl_vector_fixed< TScalarType, Self::InputSpaceDimension > InputVnlVectorType
ITK_DISALLOW_COPY_AND_MOVE(AdvancedIdentityTransform)
void GetJacobianOfSpatialJacobian(const InputPointType &, JacobianOfSpatialJacobianType &jsj, NonZeroJacobianIndicesType &nonZeroJacobianIndices) const override
void GetSpatialHessian(const InputPointType &, SpatialHessianType &sh) const override
TransformCategoryEnum GetTransformCategory() const override
void GetJacobianOfSpatialHessian(const InputPointType &, JacobianOfSpatialHessianType &jsh, NonZeroJacobianIndicesType &nonZeroJacobianIndices) const override
void SetFixedParameters(const ParametersType &) override
CovariantVector< TScalarType, Self::InputSpaceDimension > InputCovariantVectorType
itkStaticConstMacro(ParametersDimension, unsigned int, 1)
void GetJacobianOfSpatialHessian(const InputPointType &, SpatialHessianType &sh, JacobianOfSpatialHessianType &jsh, NonZeroJacobianIndicesType &nonZeroJacobianIndices) const override
OutputVnlVectorType TransformVector(const InputVnlVectorType &vector) const override
vnl_vector_fixed< TScalarType, Self::OutputSpaceDimension > OutputVnlVectorType
Transform maps points, vectors and covariant vectors from an input space to an output space.
typename SpatialJacobianType::InternalMatrixType InternalMatrixType
typename Superclass::InverseTransformBaseType InverseTransformBaseType
FixedArray< Matrix< ScalarType, InputSpaceDimension, InputSpaceDimension >, OutputSpaceDimension > SpatialHessianType
Matrix< ScalarType, OutputSpaceDimension, InputSpaceDimension > SpatialJacobianType


Generated on 2024-07-17 for elastix by doxygen 1.11.0 (9b424b03c9833626cd435af22a444888fbbb192d) elastix logo