Common transforms#
Parametric transforms#
Spatial transforms which are not simply composed of other transformations are called parametric.
These are derived from one of the base classes (SpatialTransform
, LinearTransform
,
NonRigidTransform
) and one of the following mix-ins depending on whether the transformation
can be readily inverted during evaluation of its SpatialTransform.forward()
method or not.
Mix-ins for spatial transformations that have (optimizable) parameters.
These mix-ins add property params
to a
SpatialTransform
, which can be either one of the following. In addition, functional
setter and getter functions are added, which check the type and shape of its arguments.
None
: This spatial transformation has no required parameters set.This value can be specified when initializing a spatial transformation whose parameters will be set at a later time point, e.g., to the output of a neural network. An exception is raised by functions which attempt to access yet uninitialized transformation parameters.
Parameter
: Tensor of optimizable parameters, e.g., for classic registration.To temporarily disable optimization of the parameters, set
params.requires_grad = False
.
Tensor
: Tensor of fixed non-optimizable parameters.These parameters are not returned by
SpatialTransform.parameters()
. This could be a tensor of spatial transformation parameters inferred by a neural network.
Callable
: A callable such as a function ortorch.nn.Module
.Method
SpatialTransform.update()
, which is registered as pre-forward hook for any spatial transformation, invokes this callable to obtain the current transformation parameters with arguments set and obtained bySpatialTransform.condition()
. For example, an input batch of a neural network can be passed to atorch.nn.Module
this way to infer parameters from this input.
Linear transforms#
Linear transformation models.
The most generic linear transform is a HomogeneousTransform
, which is parameterized by
a homogeneous coordinate transformation matrix. This parameterization is less suitable for direct
optimization, however, because there is no control over the individual elementary transformations
making up a linear homogeneous coordinate transformation. But it can be used when the matrix
is derived from the prediction of a neural network or computed by other means.
Elementary linear transforms#
Elementary homogeneous coordinate transformations.
Composite linear transforms#
Spatial transforms composed of two or more elementary linear transforms.
Non-rigid transforms#
Non-rigid transformation models.
Displacement fields#
Spatial transforms which directly represent a displacement vector field.
Diffeomorphic transforms#
Spatial transforms based on the integration of a velocity vector field.