ITK  6.0.0
Insight Toolkit
itkDisplacementFieldTransform.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 itkDisplacementFieldTransform_h
19#define itkDisplacementFieldTransform_h
20
21#include "itkTransform.h"
22
23#include "itkImage.h"
24#include "itkVectorImage.h"
28
29namespace itk
30{
31
86template <typename TParametersValueType, unsigned int VDimension>
87class ITK_TEMPLATE_EXPORT DisplacementFieldTransform : public Transform<TParametersValueType, VDimension, VDimension>
88{
89public:
90 ITK_DISALLOW_COPY_AND_MOVE(DisplacementFieldTransform);
91
97
99 itkOverrideGetNameOfClassMacro(DisplacementFieldTransform);
100
102 itkNewMacro(Self);
103
105 using typename Superclass::InverseTransformBasePointer;
106
108 using typename Superclass::ScalarType;
109
111 using typename Superclass::FixedParametersType;
112 using typename Superclass::FixedParametersValueType;
113 using typename Superclass::ParametersType;
114 using typename Superclass::ParametersValueType;
115
117 using typename Superclass::JacobianType;
118 using typename Superclass::JacobianPositionType;
119 using typename Superclass::InverseJacobianPositionType;
120
122 using typename Superclass::TransformCategoryEnum;
123
125 using typename Superclass::NumberOfParametersType;
126
128 using typename Superclass::InputPointType;
129 using typename Superclass::OutputPointType;
130
132 using typename Superclass::InputVectorType;
133 using typename Superclass::OutputVectorType;
134
135 using typename Superclass::InputVectorPixelType;
136 using typename Superclass::OutputVectorPixelType;
137
139 using typename Superclass::InputCovariantVectorType;
140 using typename Superclass::OutputCovariantVectorType;
141
143 using typename Superclass::InputVnlVectorType;
144 using typename Superclass::OutputVnlVectorType;
145
147 using typename Superclass::InputDiffusionTensor3DType;
148 using typename Superclass::OutputDiffusionTensor3DType;
149
153
155 using typename Superclass::DerivativeType;
156
158 static constexpr unsigned int Dimension = VDimension;
159
165
167
176
180
185 virtual void
187 virtual void
189 void SetDisplacementField(std::nullptr_t) = delete;
190 itkGetModifiableObjectMacro(DisplacementField, DisplacementFieldType);
195 virtual void
197 itkGetModifiableObjectMacro(InverseDisplacementField, DisplacementFieldType);
202 virtual void
204 itkGetModifiableObjectMacro(Interpolator, InterpolatorType);
209 virtual void
211 itkGetModifiableObjectMacro(InverseInterpolator, InterpolatorType);
215 itkGetConstReferenceMacro(DisplacementFieldSetTime, ModifiedTimeType);
216
220 TransformPoint(const InputPointType & inputPoint) const override;
221
223 using Superclass::TransformVector;
225 TransformVector(const InputVectorType &) const override
226 {
227 itkExceptionMacro("TransformVector(Vector) unimplemented, use "
228 "TransformVector(Vector,Point)");
229 }
232 OutputVectorPixelType
233 TransformVector(const InputVectorPixelType &) const override
234 {
235 itkExceptionMacro("TransformVector(Vector) unimplemented, use "
236 "TransformVector(Vector,Point)");
237 }
238
239 OutputVnlVectorType
240 TransformVector(const InputVnlVectorType &) const override
241 {
242 itkExceptionMacro("TransformVector(Vector) unimplemented, use "
243 "TransformVector(Vector,Point)");
244 }
245
247 using Superclass::TransformDiffusionTensor3D;
248 OutputDiffusionTensor3DType
250 {
251 itkExceptionMacro("TransformDiffusionTensor(Tensor) unimplemented, use "
252 "TransformDiffusionTensor(Tensor,Point)");
253 }
256 OutputVectorPixelType
258 {
259 itkExceptionMacro("TransformDiffusionTensor(Tensor) unimplemented, use "
260 "TransformDiffusionTensor(Tensor,Point)");
261 }
262
264 using Superclass::TransformCovariantVector;
265 OutputCovariantVectorType
267 {
268 itkExceptionMacro("TransformCovariantVector(CovariantVector) "
269 "unimplemented, use TransformCovariantVector(CovariantVector,Point)");
270 }
273 OutputVectorPixelType
275 {
276 itkExceptionMacro("TransformCovariantVector(CovariantVector) "
277 "unimplemented, use TransformCovariantVector(CovariantVector,Point)");
278 }
279
282 void
283 SetParameters(const ParametersType & params) override
284 {
285 if (&(this->m_Parameters) != &params)
286 {
287 if (params.Size() != this->m_Parameters.Size())
288 {
289 itkExceptionMacro("Input parameters size (" << params.Size() << ") does not match internal size ("
290 << this->m_Parameters.Size() << ").");
291 }
292 // Copy into existing object
293 this->m_Parameters = params;
294 this->Modified();
295 }
296 }
308 void
310
332 void
334 {
335 j = this->m_IdentityJacobian;
336 }
345 virtual void
347 {
348 j = this->m_IdentityJacobian;
349 }
350
355 void
357 using Superclass::ComputeJacobianWithRespectToPosition;
358
363 void
365 InverseJacobianPositionType & jacobian) const override;
366 using Superclass::ComputeInverseJacobianWithRespectToPosition;
367
372 virtual void
374
386 virtual void
388 JacobianPositionType & jacobian,
389 bool useSVD = false) const;
390
402 virtual void
404 JacobianPositionType & jacobian,
405 bool useSVD = false) const;
406
407 void
408 UpdateTransformParameters(const DerivativeType & update, ScalarType factor = 1.0) override;
409
412 bool
413 GetInverse(Self * inverse) const;
414
418 GetInverseTransform() const override;
419
420 virtual void
422
425 GetTransformCategory() const override
426 {
427 return Self::TransformCategoryEnum::DisplacementField;
428 }
429
430 NumberOfParametersType
432 {
433 return Dimension;
434 }
435
443 itkSetMacro(CoordinateTolerance, double);
444 itkGetConstMacro(CoordinateTolerance, double);
454 itkSetMacro(DirectionTolerance, double);
455 itkGetConstMacro(DirectionTolerance, double);
458protected:
460 ~DisplacementFieldTransform() override = default;
461 void
462 PrintSelf(std::ostream & os, Indent indent) const override;
463
465 typename DisplacementFieldType::Pointer m_DisplacementField{};
466 typename DisplacementFieldType::Pointer m_InverseDisplacementField{};
467
469 typename InterpolatorType::Pointer m_Interpolator{};
470 typename InterpolatorType::Pointer m_InverseInterpolator{};
471
474 ModifiedTimeType m_DisplacementFieldSetTime{ 0 };
475
478 JacobianType m_IdentityJacobian{};
479
480private:
489 virtual void
491 JacobianPositionType & jacobian,
492 bool doInverseJacobian) const;
493
498 virtual void
500
505 virtual void
507
508 double m_CoordinateTolerance{};
509 double m_DirectionTolerance{};
510};
511
512} // end namespace itk
513
514#ifndef ITK_MANUAL_INSTANTIATION
515# include "itkDisplacementFieldTransform.hxx"
516#endif
517
518#endif // itkDisplacementFieldTransform_h
OptimizerParameters< FixedParametersValueType > FixedParametersType
TransformBaseTemplateEnums::TransformCategory TransformCategoryEnum
SmartPointer< const Self > ConstPointer
OptimizerParameters< ParametersValueType > ParametersType
SmartPointer< Self > Pointer
Array2D class representing a 2D array.
Definition: itkArray2D.h:43
Array class with size defined at construction time.
Definition: itkArray.h:48
A templated class holding a n-Dimensional covariant vector.
Represent a diffusion tensor as used in DTI images.
Provides local/dense/high-dimensionality transformation via a a displacement field.
NumberOfParametersType GetNumberOfLocalParameters() const override
void ComputeInverseJacobianWithRespectToPosition(const InputPointType &point, InverseJacobianPositionType &jacobian) const override
virtual void ComputeJacobianWithRespectToParameters(const IndexType &, JacobianType &j) const
typename DisplacementFieldType::SpacingType SpacingType
typename DisplacementFieldType::PixelType PixelType
virtual void GetInverseJacobianOfForwardFieldWithRespectToPosition(const InputPointType &point, JacobianPositionType &jacobian, bool useSVD=false) const
virtual void SetInverseInterpolator(InterpolatorType *interpolator)
OutputVectorPixelType TransformDiffusionTensor(const InputVectorPixelType &) const
typename DisplacementFieldType::IndexType IndexType
void ComputeJacobianWithRespectToParameters(const InputPointType &, JacobianType &j) const override
void SetParameters(const ParametersType &params) override
virtual void ComputeJacobianWithRespectToPosition(const IndexType &index, JacobianPositionType &jacobian) const
OutputPointType TransformPoint(const InputPointType &inputPoint) const override
typename DisplacementFieldType::Pointer DisplacementFieldPointer
OutputCovariantVectorType TransformCovariantVector(const InputCovariantVectorType &) const override
typename DisplacementFieldType::RegionType RegionType
OutputVnlVectorType TransformVector(const InputVnlVectorType &) const override
OutputDiffusionTensor3DType TransformDiffusionTensor(const InputDiffusionTensor3DType &) const
virtual void SetFixedParametersFromDisplacementField() const
typename DisplacementFieldType::DirectionType DirectionType
virtual void SetInterpolator(InterpolatorType *interpolator)
void ComputeJacobianWithRespectToPosition(const InputPointType &point, JacobianPositionType &jacobian) const override
~DisplacementFieldTransform() override=default
OutputVectorPixelType TransformCovariantVector(const InputVectorPixelType &) const override
virtual void SetDisplacementField(DisplacementFieldType *field)
void SetFixedParameters(const FixedParametersType &) override
virtual void GetInverseJacobianOfForwardFieldWithRespectToPosition(const IndexType &index, JacobianPositionType &jacobian, bool useSVD=false) const
virtual void SetInverseDisplacementField(DisplacementFieldType *inverseField)
void SetDisplacementField(std::nullptr_t)=delete
typename DisplacementFieldType::PointType PointType
virtual void ComputeJacobianWithRespectToPositionInternal(const IndexType &index, JacobianPositionType &jacobian, bool doInverseJacobian) const
typename DisplacementFieldType::ConstPointer DisplacementFieldConstPointer
OutputVectorType TransformVector(const InputVectorType &) const override
void UpdateTransformParameters(const DerivativeType &update, ScalarType factor=1.0) override
virtual void SetDisplacementField(VectorImageDisplacementFieldType *field)
void PrintSelf(std::ostream &os, Indent indent) const override
typename DisplacementFieldType::SizeType SizeType
OutputVectorPixelType TransformVector(const InputVectorPixelType &) const override
TransformCategoryEnum GetTransformCategory() const override
bool GetInverse(Self *inverse) const
virtual void VerifyFixedParametersInformation()
InverseTransformBasePointer GetInverseTransform() const override
Class to hold and manage parameters of type Image<Vector<...>,...>, used in Transforms,...
Templated n-dimensional image class.
Definition: itkImage.h:89
TPixel PixelType
Definition: itkImage.h:108
Control indentation during Print() invocation.
Definition: itkIndent.h:50
A templated class holding a geometric point in n-Dimensional space.
Definition: itkPoint.h:54
Transform points and vectors from an input space to an output space.
Definition: itkTransform.h:84
vnl_vector_fixed< TParametersValueType, VInputDimension > InputVnlVectorType
Definition: itkTransform.h:156
vnl_matrix_fixed< ParametersValueType, VOutputDimension, VInputDimension > JacobianPositionType
Definition: itkTransform.h:131
vnl_matrix_fixed< ParametersValueType, VInputDimension, VOutputDimension > InverseJacobianPositionType
Definition: itkTransform.h:132
typename InverseTransformBaseType::Pointer InverseTransformBasePointer
Definition: itkTransform.h:167
Templated n-dimensional vector image class.
Base class for all vector image interpolators.
SmartPointer< const Self > ConstPointer
SmartPointer< Self > Pointer
The "itk" namespace contains all Insight Segmentation and Registration Toolkit (ITK) classes....
*par Constraints *The filter image with at least two dimensions and a vector *length of at least The theory supports extension to scalar but *the implementation of the itk vector classes do not **The template parameter TRealType must be floating point(float or double) or *a user-defined "real" numerical type with arithmetic operations defined *sufficient to compute derivatives. **\par Performance *This filter will automatically multithread if run with *SetUsePrincipleComponents
SizeValueType ModifiedTimeType
Definition: itkIntTypes.h:105