ITK 6.0.0
Insight Toolkit
 
Loading...
Searching...
No Matches
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:
91
97
100
102 itkNewMacro(Self);
103
106
108 using typename Superclass::ScalarType;
109
111 using typename Superclass::FixedParametersType;
113 using typename Superclass::ParametersType;
114 using typename Superclass::ParametersValueType;
115
117 using typename Superclass::JacobianType;
120
123
126
128 using typename Superclass::InputPointType;
129 using typename Superclass::OutputPointType;
130
132 using typename Superclass::InputVectorType;
133 using typename Superclass::OutputVectorType;
134
137
141
143 using typename Superclass::InputVnlVectorType;
144 using typename Superclass::OutputVnlVectorType;
145
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);
192
195 virtual void
197 itkGetModifiableObjectMacro(InverseDisplacementField, DisplacementFieldType);
199
202 virtual void
204 itkGetModifiableObjectMacro(Interpolator, InterpolatorType);
206
209 virtual void
211 itkGetModifiableObjectMacro(InverseInterpolator, InterpolatorType);
213
215 itkGetConstReferenceMacro(DisplacementFieldSetTime, ModifiedTimeType);
216
220 TransformPoint(const InputPointType & inputPoint) const override;
221
225 TransformVector(const InputVectorType &) const override
226 {
227 itkExceptionMacro("TransformVector(Vector) unimplemented, use "
228 "TransformVector(Vector,Point)");
229 }
230
231
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 }
254
255
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 }
271
272
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 }
297
298
308 void
310
332 void
334 {
335 j = this->m_IdentityJacobian;
336 }
337
338
345 virtual void
350
355 void
358
363 void
365 InverseJacobianPositionType & jacobian) const override;
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
429
430 NumberOfParametersType
432 {
433 return Dimension;
434 }
435
443 itkSetMacro(CoordinateTolerance, double);
444 itkGetConstMacro(CoordinateTolerance, double);
446
454 itkSetMacro(DirectionTolerance, double);
455 itkGetConstMacro(DirectionTolerance, double);
457
458protected:
460 ~DisplacementFieldTransform() override = default;
461 void
462 PrintSelf(std::ostream & os, Indent indent) const override;
463
467
471
475
479
480private:
489 virtual void
491 JacobianPositionType & jacobian,
492 bool doInverseJacobian) const;
493
498 virtual void
500
505 virtual void
507
510};
511
512} // end namespace itk
513
514#ifndef ITK_MANUAL_INSTANTIATION
515# include "itkDisplacementFieldTransform.hxx"
516#endif
517
518#endif // itkDisplacementFieldTransform_h
itkSetMacro(InputSpaceName, std::string)
itkGetConstReferenceMacro(InputSpaceName, std::string)
itkOverrideGetNameOfClassMacro(TransformBaseTemplate)
ITK_DISALLOW_COPY_AND_MOVE(TransformBaseTemplate)
static constexpr TransformCategoryEnum DisplacementField
SizeValueType Size() const
Definition itkArray.h:131
A templated class holding a n-Dimensional covariant vector.
Provides local/dense/high-dimensionality transformation via a a displacement field.
CovariantVector< ScalarType, InputDiffusionTensor3DType::Dimension > InputTensorEigenVectorType
NumberOfParametersType GetNumberOfLocalParameters() const override
void ComputeInverseJacobianWithRespectToPosition(const InputPointType &point, InverseJacobianPositionType &jacobian) const override
virtual void ComputeJacobianWithRespectToParameters(const IndexType &, JacobianType &j) const
VariableLengthVector< CoordinateRepresentationType > InputVectorPixelType
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
vnl_matrix_fixed< ParametersValueType, VOutputDimension, VInputDimension > JacobianPositionType
Point< CoordinateRepresentationType, VInputDimension > InputPointType
typename DisplacementFieldType::Pointer DisplacementFieldPointer
OutputCovariantVectorType TransformCovariantVector(const InputCovariantVectorType &) const override
vnl_vector_fixed< CoordinateRepresentationType, VInputDimension > InputVnlVectorType
CovariantVector< ScalarType, OutputDiffusionTensor3DType::Dimension > OutputTensorEigenVectorType
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
VectorInterpolateImageFunction< DisplacementFieldType, ScalarType > InterpolatorType
~DisplacementFieldTransform() override=default
OutputVectorPixelType TransformCovariantVector(const InputVectorPixelType &) const override
virtual void SetDisplacementField(DisplacementFieldType *field)
void SetFixedParameters(const FixedParametersType &) override
DiffusionTensor3D< CoordinateRepresentationType > InputDiffusionTensor3DType
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
ImageVectorOptimizerParametersHelper< ScalarType, OutputVectorType::Dimension, Dimension > OptimizerParametersHelperType
Transform< TParametersValueType, VDimension, VDimension > Superclass
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
Image< OutputVectorType, Dimension > DisplacementFieldType
typename DisplacementFieldType::SizeType SizeType
OutputVectorPixelType TransformVector(const InputVectorPixelType &) const override
TransformCategoryEnum GetTransformCategory() const override
Point< CoordinateRepresentationType, VOutputDimension > OutputPointType
bool GetInverse(Self *inverse) const
Vector< CoordinateRepresentationType, VInputDimension > InputVectorType
VectorImage< TParametersValueType, Dimension > VectorImageDisplacementFieldType
CovariantVector< CoordinateRepresentationType, VInputDimension > InputCovariantVectorType
Vector< CoordinateRepresentationType, VOutputDimension > OutputVectorType
virtual void VerifyFixedParametersInformation()
vnl_matrix_fixed< ParametersValueType, VInputDimension, VOutputDimension > InverseJacobianPositionType
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
SmartPointer< const Self > ConstPointer
Definition itkImage.h:97
Point< PointValueType, VImageDimension > PointType
ImageRegion< VImageDimension > RegionType
Vector< SpacingValueType, VImageDimension > SpacingType
Matrix< SpacePrecisionType, VImageDimension, VImageDimension > DirectionType
Control indentation during Print() invocation.
Definition itkIndent.h:50
Implements transparent reference counting.
VariableLengthVector< TParametersValueType > OutputVectorPixelType
DiffusionTensor3D< TParametersValueType > InputDiffusionTensor3DType
ParametersType m_Parameters
virtual void ComputeInverseJacobianWithRespectToPosition(const InputPointType &pnt, InverseJacobianPositionType &jacobian) const
OptimizerParameters< FixedParametersValueType > FixedParametersType
TransformBaseTemplateEnums::TransformCategory TransformCategoryEnum
double FixedParametersValueType
virtual void ComputeJacobianWithRespectToPosition(const InputPointType &x, JacobianPositionType &jacobian) const
IdentifierType NumberOfParametersType
Point< TParametersValueType, VOutputDimension > OutputPointType
TParametersValueType ParametersValueType
VariableLengthVector< TParametersValueType > InputVectorPixelType
OptimizerParameters< ParametersValueType > ParametersType
CovariantVector< TParametersValueType, VOutputDimension > OutputCovariantVectorType
virtual OutputVectorType TransformVector(const InputVectorType &) const
vnl_vector_fixed< TParametersValueType, VInputDimension > InputVnlVectorType
vnl_matrix_fixed< ParametersValueType, VOutputDimension, VInputDimension > JacobianPositionType
vnl_matrix_fixed< ParametersValueType, VInputDimension, VOutputDimension > InverseJacobianPositionType
DiffusionTensor3D< TParametersValueType > OutputDiffusionTensor3DType
Array2D< ParametersValueType > JacobianType
Point< TParametersValueType, VInputDimension > InputPointType
typename InverseTransformBaseType::Pointer InverseTransformBasePointer
CovariantVector< TParametersValueType, VInputDimension > InputCovariantVectorType
Vector< TParametersValueType, VInputDimension > InputVectorType
ParametersValueType ScalarType
Vector< TParametersValueType, VOutputDimension > OutputVectorType
vnl_vector_fixed< TParametersValueType, VOutputDimension > OutputVnlVectorType
Templated n-dimensional vector image class.
Base class for all vector image interpolators.
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