#include <itkDisplacementFieldTransform.h>
Provides local/dense/high-dimensionality transformation via a a displacement field.
The displacement field stores vectors of displacements, with dimension VDimension
. Transformation is performed at a given point by adding the displacement at that point to the input point.
T(x, p), x is the position, p is the local parameter at position x. For a 2D example:
x = (x0, x1), p = (p0, p1)
then T(x, p) is defined as:
T(x, p) = (T0, T1) = (x0+p0, x1+p1)
During transformation, out-of-bounds input points are returned with zero displacement.
The displacement field is defined using an itkImage, and must be set before use by the user, using SetDisplacementField
. The image has the same dimensionality as the input and output spaces, defined by template parameter VDimension
, and is an image of vectors of type OutputVectorType
, with dimensionality VDimension as well.
An interpolator of type VectorInterpolateImageFunction
is used with the displacement field image. By default, VectorLinearInterpolateImageFunction is used, and the user can override using SetInterpolator.
The displacement field data is stored using the common OptimizerParameters
type in conjunction with the ImageVectorOptimizerParametersHelper
class. This allows access of the displacement field image as if it were an itkArray, allowing transparent use with other classes.
SetParameters
method will copy the passed parameters, which can be costly since displacement fields are dense and thus potentially very large.The UpdateTransformParameters
method simply adds the provided update array, applying the usual optional scaling factor. Derived classes may provide different behavior.
Because this is a local transform, methods that have a version that takes a point must be used, such as TransformVector
, TransformCovariantVector
, and TransformDiffusionTensor
. Also, ComputeJacobianWithRespectToParameters
simply returns an identity matrix (see method documentation), and ComputeJacobianWithRespectToPosition
should be used.
Definition at line 87 of file itkDisplacementFieldTransform.h.
Static Public Member Functions | |
static Pointer | New () |
Static Public Attributes | |
static constexpr unsigned int | Dimension = VDimension |
![]() | |
static constexpr unsigned int | InputSpaceDimension |
static constexpr unsigned int | InputSpaceDimension |
static constexpr unsigned int | OutputSpaceDimension |
static constexpr unsigned int | OutputSpaceDimension |
![]() | |
static constexpr TransformCategoryEnum | BSpline = TransformCategoryEnum::BSpline |
static constexpr TransformCategoryEnum | DisplacementField = TransformCategoryEnum::DisplacementField |
static constexpr TransformCategoryEnum | Linear = TransformCategoryEnum::Linear |
static constexpr TransformCategoryEnum | Spline = TransformCategoryEnum::Spline |
static constexpr TransformCategoryEnum | UnknownTransformCategory = TransformCategoryEnum::UnknownTransformCategory |
static constexpr TransformCategoryEnum | VelocityField = TransformCategoryEnum::VelocityField |
Private Member Functions | |
virtual void | ComputeJacobianWithRespectToPositionInternal (const IndexType &index, JacobianPositionType &jacobian, bool doInverseJacobian) const |
virtual void | SetFixedParametersFromDisplacementField () const |
virtual void | VerifyFixedParametersInformation () |
Private Attributes | |
double | m_CoordinateTolerance {} |
double | m_DirectionTolerance {} |
Additional Inherited Members | |
![]() | |
static InverseTransformBasePointer | InvertTransform (const TTransform &transform) |
static InverseTransformBasePointer | InvertTransform (const TTransform &transform) |
using itk::DisplacementFieldTransform< TParametersValueType, VDimension >::ConstPointer = SmartPointer<const Self> |
Definition at line 96 of file itkDisplacementFieldTransform.h.
using itk::Transform< TParametersValueType, VInputDimension, VOutputDimension >::DerivativeType |
Definition at line 124 of file itkTransform.h.
using itk::DisplacementFieldTransform< TParametersValueType, VDimension >::DirectionType = typename DisplacementFieldType::DirectionType |
Definition at line 173 of file itkDisplacementFieldTransform.h.
using itk::DisplacementFieldTransform< TParametersValueType, VDimension >::DisplacementFieldConstPointer = typename DisplacementFieldType::ConstPointer |
Definition at line 164 of file itkDisplacementFieldTransform.h.
using itk::DisplacementFieldTransform< TParametersValueType, VDimension >::DisplacementFieldPointer = typename DisplacementFieldType::Pointer |
Definition at line 163 of file itkDisplacementFieldTransform.h.
using itk::DisplacementFieldTransform< TParametersValueType, VDimension >::DisplacementFieldType = Image<OutputVectorType, Dimension> |
Define the displacement field type and corresponding interpolator type.
Definition at line 161 of file itkDisplacementFieldTransform.h.
using itk::DisplacementFieldTransform< TParametersValueType, VDimension >::IndexType = typename DisplacementFieldType::IndexType |
Standard types for the displacement Field
Definition at line 169 of file itkDisplacementFieldTransform.h.
using itk::Transform< TParametersValueType, VInputDimension, VOutputDimension >::InputCovariantVectorType |
Standard covariant vector type for this class
Definition at line 152 of file itkTransform.h.
using itk::Transform< TParametersValueType, VInputDimension, VOutputDimension >::InputDiffusionTensor3DType |
Definition at line 148 of file itkTransform.h.
using itk::Transform< TParametersValueType, VInputDimension, VOutputDimension >::InputPointType |
Standard coordinate point type for this class
Definition at line 160 of file itkTransform.h.
using itk::DisplacementFieldTransform< TParametersValueType, VDimension >::InputTensorEigenVectorType = CovariantVector<ScalarType, InputDiffusionTensor3DType::Dimension> |
Standard tensor type for this class
Definition at line 151 of file itkDisplacementFieldTransform.h.
using itk::Transform< TParametersValueType, VInputDimension, VOutputDimension >::InputVectorPixelType |
Standard variable length vector type for this class this provides an interface for the VectorImage class
Definition at line 140 of file itkTransform.h.
using itk::Transform< TParametersValueType, VInputDimension, VOutputDimension >::InputVectorType |
Standard vector type for this class.
Definition at line 135 of file itkTransform.h.
using itk::Transform< TParametersValueType, VInputDimension, VOutputDimension >::InputVnlVectorType |
Standard vnl_vector type for this class.
Definition at line 156 of file itkTransform.h.
using itk::DisplacementFieldTransform< TParametersValueType, VDimension >::InterpolatorType = VectorInterpolateImageFunction<DisplacementFieldType, ScalarType> |
Definition at line 166 of file itkDisplacementFieldTransform.h.
using itk::Transform< TParametersValueType, VInputDimension, VOutputDimension >::InverseJacobianPositionType |
Definition at line 132 of file itkTransform.h.
using itk::Transform< TParametersValueType, VInputDimension, VOutputDimension >::InverseTransformBasePointer |
Definition at line 167 of file itkTransform.h.
using itk::Transform< TParametersValueType, VInputDimension, VOutputDimension >::JacobianPositionType |
Definition at line 131 of file itkTransform.h.
using itk::Transform< TParametersValueType, VInputDimension, VOutputDimension >::JacobianType |
Type of the Jacobian matrix.
Definition at line 130 of file itkTransform.h.
The number of parameters can potentially be very large, therefore we use here a large capacity integer.
using itk::DisplacementFieldTransform< TParametersValueType, VDimension >::OptimizerParametersHelperType |
Define the internal parameter helper used to access the field
Definition at line 178 of file itkDisplacementFieldTransform.h.
using itk::Transform< TParametersValueType, VInputDimension, VOutputDimension >::OutputCovariantVectorType |
Definition at line 153 of file itkTransform.h.
using itk::Transform< TParametersValueType, VInputDimension, VOutputDimension >::OutputDiffusionTensor3DType |
Definition at line 149 of file itkTransform.h.
using itk::Transform< TParametersValueType, VInputDimension, VOutputDimension >::OutputPointType |
Definition at line 161 of file itkTransform.h.
using itk::DisplacementFieldTransform< TParametersValueType, VDimension >::OutputTensorEigenVectorType = CovariantVector<ScalarType, OutputDiffusionTensor3DType::Dimension> |
Definition at line 152 of file itkDisplacementFieldTransform.h.
using itk::Transform< TParametersValueType, VInputDimension, VOutputDimension >::OutputVectorPixelType |
Definition at line 141 of file itkTransform.h.
using itk::Transform< TParametersValueType, VInputDimension, VOutputDimension >::OutputVectorType |
Definition at line 136 of file itkTransform.h.
using itk::Transform< TParametersValueType, VInputDimension, VOutputDimension >::OutputVnlVectorType |
Definition at line 157 of file itkTransform.h.
Type of the input parameters.
using itk::DisplacementFieldTransform< TParametersValueType, VDimension >::PixelType = typename DisplacementFieldType::PixelType |
Definition at line 175 of file itkDisplacementFieldTransform.h.
using itk::DisplacementFieldTransform< TParametersValueType, VDimension >::Pointer = SmartPointer<Self> |
Definition at line 95 of file itkDisplacementFieldTransform.h.
using itk::DisplacementFieldTransform< TParametersValueType, VDimension >::PointType = typename DisplacementFieldType::PointType |
Definition at line 174 of file itkDisplacementFieldTransform.h.
using itk::DisplacementFieldTransform< TParametersValueType, VDimension >::RegionType = typename DisplacementFieldType::RegionType |
Definition at line 170 of file itkDisplacementFieldTransform.h.
using itk::Transform< TParametersValueType, VInputDimension, VOutputDimension >::ScalarType |
Type of the scalar representing coordinate and vector elements.
Definition at line 127 of file itkTransform.h.
using itk::DisplacementFieldTransform< TParametersValueType, VDimension >::Self = DisplacementFieldTransform |
Standard class type aliases.
Definition at line 93 of file itkDisplacementFieldTransform.h.
using itk::DisplacementFieldTransform< TParametersValueType, VDimension >::SizeType = typename DisplacementFieldType::SizeType |
Definition at line 171 of file itkDisplacementFieldTransform.h.
using itk::DisplacementFieldTransform< TParametersValueType, VDimension >::SpacingType = typename DisplacementFieldType::SpacingType |
Definition at line 172 of file itkDisplacementFieldTransform.h.
using itk::DisplacementFieldTransform< TParametersValueType, VDimension >::Superclass = Transform<TParametersValueType, VDimension, VDimension> |
Definition at line 94 of file itkDisplacementFieldTransform.h.
using itk::DisplacementFieldTransform< TParametersValueType, VDimension >::VectorImageDisplacementFieldType = VectorImage<TParametersValueType, Dimension> |
Definition at line 162 of file itkDisplacementFieldTransform.h.
|
protected |
|
overrideprotecteddefault |
|
overridevirtual |
Compute the jacobian with respect to the position, by point. j
will be resized as needed.
Reimplemented from itk::Transform< TParametersValueType, VDimension, VDimension >.
|
inlinevirtual |
Compute the jacobian with respect to the parameters at an index. Simply returns identity matrix, sized [VDimension, VDimension]. See ComputeJacobianWithRespectToParameters( InputPointType, ... )
for rationale.
Definition at line 346 of file itkDisplacementFieldTransform.h.
|
inlineoverridevirtual |
Compute the jacobian with respect to the parameters at a point. Simply returns identity matrix, sized [VDimension, VDimension].
T(x, p), x is the position, p is the local parameter at position x. Take a 2D example, x = (x0, x1), p = (p0, p1) and T(x, p) is defined as:
T(x, p) = (T0, T1) = (x0+p0, x1+p1)
Each local deformation is defined as a translation transform. So the Jacobian w.r.t parameters are
dT/dp = [ dT0/dp0, dT0/dp1; dT1/dp0, dT1/dp1 ];
= [1, 0; 0, 1];
TODO: format the above for doxygen formula.
Implements itk::Transform< TParametersValueType, VDimension, VDimension >.
Definition at line 333 of file itkDisplacementFieldTransform.h.
|
virtual |
Compute the jacobian with respect to the position, by index. j
will be resized as needed.
|
overridevirtual |
Compute the jacobian with respect to the position, by point. j
will be resized as needed.
Reimplemented from itk::Transform< TParametersValueType, VDimension, VDimension >.
|
privatevirtual |
Internal method for calculating either forward or inverse jacobian, depending on state of doInverseJacobian
. Used by public methods ComputeJacobianWithRespectToPosition
and GetInverseJacobianOfForwardFieldWithRespectToPosition
to perform actual work. doInverseJacobian
indicates that the inverse jacobian should be returned
virtual::itk::LightObject::Pointer itk::DisplacementFieldTransform< TParametersValueType, VDimension >::CreateAnother | ( | ) | const |
|
virtual |
Set/Get the coordinate tolerance. This tolerance is used when comparing the space defined by deformation fields and its inverse to ensure they occupy the same physical space.
|
virtual |
Set/Get the direction tolerance. This tolerance is used to when comparing the orientation of the deformation fields and its inverse to ensure they occupy the same physical space.
|
virtual |
Get/Set the displacement field. Set the displacement field. Create special set accessor to update interpolator and assign displacement field to transform parameters container.
|
virtual |
Get the modification time of displacement field.
|
virtual |
Get/Set the interpolator. Create out own set accessor that assigns the displacement field.
bool itk::DisplacementFieldTransform< TParametersValueType, VDimension >::GetInverse | ( | Self * | inverse | ) | const |
Return an inverse of this transform. Note that the inverse displacement field must be set by the user.
|
virtual |
Get/Set the inverse displacement field. This must be supplied by the user for GetInverse() to work.
|
virtual |
Get/Set the interpolator for the inverse field. Create out own set accessor that assigns the displacement field.
|
virtual |
Compute the inverse jacobian of the forward displacement field with respect to the position, by index.Note that this is different than the jacobian of the inverse displacement field. This takes advantage of the ability to compute the inverse jacobian of a displacement field by simply reversing the sign of the forward jacobian. However, a more accurate method for computing the inverse jacobian is to take the inverse of the jacobian matrix. This method is more computationally expensive and may be used by setting useSVD
to true
|
virtual |
Compute the inverse jacobian of the forward displacement field with respect to the position, by point. Note that this is different than the jacobian of the inverse displacement field. This takes advantage of the ability to compute the inverse jacobian of a displacement field by simply reversing the sign of the forward jacobian. However, a more accurate method for computing the inverse jacobian is to take the inverse of the jacobian matrix. This method is more computationally expensive and may be used by setting useSVD
to true
|
overridevirtual |
Return an inverse of this transform. Note that the inverse displacement field must be set by the user.
Reimplemented from itk::Transform< TParametersValueType, VDimension, VDimension >.
Reimplemented in itk::VelocityFieldTransform< TParametersValueType, VDimension >.
|
virtual |
Get/Set the displacement field. Set the displacement field. Create special set accessor to update interpolator and assign displacement field to transform parameters container.
|
virtual |
Get/Set the interpolator. Create out own set accessor that assigns the displacement field.
|
virtual |
Get/Set the inverse displacement field. This must be supplied by the user for GetInverse() to work.
|
virtual |
Get/Set the interpolator for the inverse field. Create out own set accessor that assigns the displacement field.
|
override |
|
inlineoverridevirtual |
Return the number of local parameters that completely defines the Transform at an individual voxel. For transforms with local support, this will enable downstream computation of the jacobian wrt only the local support region. For instance, in the case of a deformation field, this will be equal to the number of image dimensions. If it is an affine transform, this will be the same as the GetNumberOfParameters().
Reimplemented from itk::Transform< TParametersValueType, VDimension, VDimension >.
Definition at line 431 of file itkDisplacementFieldTransform.h.
|
inlineoverridevirtual |
This transform is not linear.
Implements TransformBaseTemplate< TParametersValueType >.
Definition at line 425 of file itkDisplacementFieldTransform.h.
|
static |
New macro for creation of through a Smart Pointer
|
overrideprotected |
|
virtual |
Set/Get the coordinate tolerance. This tolerance is used when comparing the space defined by deformation fields and its inverse to ensure they occupy the same physical space.
|
virtual |
Set/Get the direction tolerance. This tolerance is used to when comparing the orientation of the deformation fields and its inverse to ensure they occupy the same physical space.
|
virtual |
Get/Set the displacement field. Set the displacement field. Create special set accessor to update interpolator and assign displacement field to transform parameters container.
Reimplemented in itk::VelocityFieldTransform< TParametersValueType, VDimension >.
|
delete |
Get/Set the displacement field. Set the displacement field. Create special set accessor to update interpolator and assign displacement field to transform parameters container.
|
virtual |
Get/Set the displacement field. Set the displacement field. Create special set accessor to update interpolator and assign displacement field to transform parameters container.
Reimplemented in itk::VelocityFieldTransform< TParametersValueType, VDimension >.
|
overridevirtual |
This method sets the fixed parameters of the transform. For a displacement field transform, the fixed parameters are the following: field size, field origin, field spacing, and field direction.
Note: If a displacement field already exists, this function creates a new one with zero displacement (identity transform). If an inverse displacement field exists, a new one is also created.
Implements itk::Transform< TParametersValueType, VDimension, VDimension >.
Reimplemented in itk::VelocityFieldTransform< TParametersValueType, VDimension >.
|
privatevirtual |
Convenience method which reads the information from the current displacement field into m_FixedParameters.
|
virtual |
|
virtual |
Get/Set the interpolator. Create out own set accessor that assigns the displacement field.
|
virtual |
Get/Set the inverse displacement field. This must be supplied by the user for GetInverse() to work.
|
virtual |
Get/Set the interpolator for the inverse field. Create out own set accessor that assigns the displacement field.
|
inlineoverridevirtual |
Set the transformation parameters. This sets the displacement field image directly.
Implements itk::Transform< TParametersValueType, VDimension, VDimension >.
Definition at line 283 of file itkDisplacementFieldTransform.h.
|
inlineoverridevirtual |
Method to transform a CovariantVector.
Reimplemented from itk::Transform< TParametersValueType, VDimension, VDimension >.
Definition at line 266 of file itkDisplacementFieldTransform.h.
|
virtual |
Method to transform a CovariantVector.
Reimplemented from itk::Transform< TParametersValueType, VDimension, VDimension >.
|
inlineoverridevirtual |
Method to transform a CovariantVector stored in a VectorImage.
Reimplemented from itk::Transform< TParametersValueType, VDimension, VDimension >.
Definition at line 274 of file itkDisplacementFieldTransform.h.
|
virtual |
Method to transform a CovariantVector.
Reimplemented from itk::Transform< TParametersValueType, VDimension, VDimension >.
|
inline |
Method to transform a tensor.
Definition at line 249 of file itkDisplacementFieldTransform.h.
|
inline |
Definition at line 257 of file itkDisplacementFieldTransform.h.
|
virtual |
Method to transform a tensor.
Reimplemented from itk::Transform< TParametersValueType, VDimension, VDimension >.
|
inlinevirtual |
Method to transform a tensor.
Reimplemented from itk::Transform< TParametersValueType, VDimension, VDimension >.
Definition at line 269 of file itkTransform.h.
|
virtual |
Method to transform a tensor.
Reimplemented from itk::Transform< TParametersValueType, VDimension, VDimension >.
|
inlinevirtual |
Method to transform a tensor.
Reimplemented from itk::Transform< TParametersValueType, VDimension, VDimension >.
Definition at line 286 of file itkTransform.h.
|
overridevirtual |
Method to transform a point. Out-of-bounds points will be returned with zero displacement.
Implements itk::Transform< TParametersValueType, VDimension, VDimension >.
|
inlineoverridevirtual |
Method to transform a vector stored in a VectorImage.
Reimplemented from itk::Transform< TParametersValueType, VDimension, VDimension >.
Definition at line 233 of file itkDisplacementFieldTransform.h.
|
virtual |
Method to transform a vector.
Reimplemented from itk::Transform< TParametersValueType, VDimension, VDimension >.
|
inlineoverridevirtual |
Method to transform a vector.
Reimplemented from itk::Transform< TParametersValueType, VDimension, VDimension >.
Definition at line 225 of file itkDisplacementFieldTransform.h.
|
virtual |
Method to transform a vector.
Reimplemented from itk::Transform< TParametersValueType, VDimension, VDimension >.
|
inlineoverridevirtual |
Method to transform a vnl_vector.
Reimplemented from itk::Transform< TParametersValueType, VDimension, VDimension >.
Definition at line 240 of file itkDisplacementFieldTransform.h.
|
virtual |
Method to transform a vector.
Reimplemented from itk::Transform< TParametersValueType, VDimension, VDimension >.
|
overridevirtual |
Update the transform's parameters by the values in update
.
update | must be of the same length as returned by GetNumberOfParameters(). Throw an exception otherwise. |
factor | is a scalar multiplier for each value in update . SetParameters is called at the end of this method, to allow the transform to perform any required operations on the updated parameters - typically a conversion to member variables for use in TransformPoint. |
Reimplemented from itk::Transform< TParametersValueType, VDimension, VDimension >.
Reimplemented in itk::GaussianExponentialDiffeomorphicTransform< TParametersValueType, VDimension >, itk::GaussianSmoothingOnUpdateDisplacementFieldTransform< TParametersValueType, VDimension >, itk::GaussianSmoothingOnUpdateTimeVaryingVelocityFieldTransform< TParametersValueType, VDimension >, itk::TimeVaryingBSplineVelocityFieldTransform< TParametersValueType, VDimension >, and itk::VelocityFieldTransform< TParametersValueType, VDimension >.
|
privatevirtual |
Internal method to check that the inverse and forward displacement fields have the same fixed parameters.
|
staticconstexpr |
Dimension of the domain spaces.
Definition at line 158 of file itkDisplacementFieldTransform.h.
|
private |
Definition at line 508 of file itkDisplacementFieldTransform.h.
|
private |
Definition at line 509 of file itkDisplacementFieldTransform.h.
|
protected |
The displacement field and its inverse (if it exists).
Definition at line 465 of file itkDisplacementFieldTransform.h.
Referenced by itk::VelocityFieldTransform< TParametersValueType, VDimension >::SetDisplacementField().
|
protected |
Track when the displacement field was last set/assigned, as distinct from when it may have had its contents modified.
Definition at line 474 of file itkDisplacementFieldTransform.h.
|
protected |
Create an identity jacobian for use in ComputeJacobianWithRespectToParameters.
Definition at line 478 of file itkDisplacementFieldTransform.h.
|
protected |
The interpolator.
Definition at line 469 of file itkDisplacementFieldTransform.h.
|
protected |
Definition at line 466 of file itkDisplacementFieldTransform.h.
|
protected |
Definition at line 470 of file itkDisplacementFieldTransform.h.