18 #ifndef itkTransform_h
19 #define itkTransform_h
21 #include <type_traits>
27 #include "vnl/vnl_vector_fixed.h"
28 #include "vnl/vnl_matrix_fixed.h"
82 template <
typename TParametersValueType,
unsigned int VInputDimension = 3,
unsigned int VOutputDimension = 3>
96 itkOverrideGetNameOfClassMacro(
Transform);
99 static constexpr
unsigned int InputSpaceDimension = VInputDimension;
100 static constexpr
unsigned int OutputSpaceDimension = VOutputDimension;
109 return VInputDimension;
116 return VOutputDimension;
120 using typename Superclass::FixedParametersType;
121 using typename Superclass::FixedParametersValueType;
122 using typename Superclass::ParametersType;
123 using typename Superclass::ParametersValueType;
175 using typename Superclass::NumberOfParametersType;
188 itkExceptionMacro(
"TransformVector(const InputVectorType &)"
189 "is unimplemented for "
197 virtual OutputVectorType
198 TransformVector(
const InputVectorType & vector,
const InputPointType &
point)
const;
201 virtual OutputVnlVectorType
204 itkExceptionMacro(
"TransformVector( const InputVnlVectorType & ) is "
213 virtual OutputVnlVectorType
214 TransformVector(
const InputVnlVectorType & vector,
const InputPointType &
point)
const;
217 virtual OutputVectorPixelType
220 itkExceptionMacro(
"TransformVector( const InputVectorPixelType & ) is "
229 virtual OutputVectorPixelType
230 TransformVector(
const InputVectorPixelType & vector,
const InputPointType &
point)
const;
233 virtual OutputCovariantVectorType
236 itkExceptionMacro(
"TransformCovariantVector( const InputCovariantVectorType & ) is "
246 virtual OutputCovariantVectorType
247 TransformCovariantVector(
const InputCovariantVectorType & vector,
const InputPointType &
point)
const;
251 virtual OutputVectorPixelType
254 itkExceptionMacro(
"TransformCovariantVector(const InputVectorPixelType &)"
255 "is unimplemented for "
264 virtual OutputVectorPixelType
265 TransformCovariantVector(
const InputVectorPixelType & vector,
const InputPointType &
point)
const;
268 virtual OutputDiffusionTensor3DType
271 itkExceptionMacro(
"TransformDiffusionTensor3D( const InputDiffusionTensor3DType & ) is "
281 virtual OutputDiffusionTensor3DType
282 TransformDiffusionTensor3D(
const InputDiffusionTensor3DType & inputTensor,
const InputPointType &
point)
const;
285 virtual OutputVectorPixelType
288 itkExceptionMacro(
"TransformDiffusionTensor( const InputVectorPixelType & ) is "
293 virtual OutputVectorPixelType
294 TransformDiffusionTensor3D(
const InputVectorPixelType & inputTensor,
const InputPointType &
point)
const;
301 virtual OutputSymmetricSecondRankTensorType
302 TransformSymmetricSecondRankTensor(
const InputSymmetricSecondRankTensorType & inputTensor,
303 const InputPointType &
point)
const;
306 virtual OutputSymmetricSecondRankTensorType
309 itkExceptionMacro(
"TransformSymmetricSecondRankTensor( const InputSymmetricSecondRankTensorType & ) is "
315 virtual OutputVectorPixelType
318 itkExceptionMacro(
"TransformSymmetricSecondRankTensor( const InputVectorPixelType & ) is "
329 virtual OutputVectorPixelType
330 TransformSymmetricSecondRankTensor(
const InputVectorPixelType & inputTensor,
const InputPointType &
point)
const;
340 SetParameters(
const ParametersType &)
override = 0;
352 this->SetParameters(p);
360 CopyInParameters(
const ParametersValueType *
const begin,
const ParametersValueType *
const end)
override;
367 CopyInFixedParameters(
const FixedParametersValueType *
const begin,
368 const FixedParametersValueType *
const end)
override;
371 const ParametersType &
379 SetFixedParameters(
const FixedParametersType &)
override = 0;
382 const FixedParametersType &
385 return m_FixedParameters;
396 UpdateTransformParameters(
const DerivativeType & update, ParametersValueType factor = 1.0);
406 virtual NumberOfParametersType
409 return this->GetNumberOfParameters();
413 NumberOfParametersType
416 return this->m_Parameters.Size();
420 virtual NumberOfParametersType
423 return this->m_FixedParameters.Size();
446 virtual InverseTransformBasePointer
454 GetTransformTypeAsString()
const override;
456 using typename Superclass::TransformCategoryEnum;
461 TransformCategoryEnum
464 return Superclass::TransformCategoryEnum::UnknownTransformCategory;
470 return (this->GetTransformCategory() == Superclass::TransformCategoryEnum::Linear);
508 ComputeJacobianWithRespectToParameters(
const InputPointType & itkNotUsed(p),
509 JacobianType & itkNotUsed(jacobian))
const = 0;
518 this->ComputeJacobianWithRespectToParameters(p, jacobian);
531 itkExceptionMacro(
"ComputeJacobianWithRespectToPosition( InputPointType, JacobianType )"
532 " is unimplemented for "
535 itkLegacyMacro(
virtual void ComputeJacobianWithRespectToPosition(
const InputPointType & x, JacobianType & jacobian)
547 itkLegacyMacro(
virtual void ComputeInverseJacobianWithRespectToPosition(
const InputPointType & x,
560 template <typename TImage>
561 std::enable_if_t<TImage::ImageDimension == VInputDimension && TImage::ImageDimension == VOutputDimension, void>
562 ApplyToImageMetadata(TImage * image)
const;
563 template <
typename TImage>
564 std::enable_if_t<TImage::ImageDimension == VInputDimension && TImage::ImageDimension == VOutputDimension, void>
567 this->ApplyToImageMetadata(image.
GetPointer());
578 InternalClone()
const override;
583 Transform(NumberOfParametersType numberOfParameters);
586 mutable ParametersType m_Parameters{};
587 mutable FixedParametersType m_FixedParameters{};
589 OutputDiffusionTensor3DType
590 PreservationOfPrincipalDirectionDiffusionTensor3DReorientation(
const InputDiffusionTensor3DType &,
591 const InverseJacobianPositionType &)
const;
595 template <
typename TTransform>
596 static InverseTransformBasePointer
600 return transform.GetInverse(inverse) ? inverse.GetPointer() :
nullptr;
605 template <
typename TType>
609 std::string rval(
"other");
617 std::string rval(
"float");
625 std::string rval(
"double");
632 #ifndef ITK_MANUAL_INSTANTIATION
633 # include "itkTransform.hxx"