template<typename TParametersValueType = double, unsigned int VDimension = 3>
class itk::CompositeTransform< TParametersValueType, VDimension >
This class contains a list of transforms and concatenates them by composition.
This class concatenates transforms in reverse queue order by means of composition: \( T_0 o T_1 = T_0(T_1(x)) \) Transforms are stored in a container (queue), in the following order: \( T_0, T_1, ... , T_N-1 \) Transforms are added via a single method, AddTransform(). This adds the transforms to the back of the queue. A single method for adding transforms is meant to simplify the interface and prevent errors. One use of the class is to optimize only a subset of included transforms.
The sub transforms are the same dimensionality as this class.
Example: A user wants to optimize two Affine transforms together, then add a Deformation Field (DF) transform, and optimize it separately. They first add the two Affines, then run the optimization and both Affines transform parameters are optimized. Next, they add the DF transform and call SetOnlyMostRecentTransformToOptimizeOn, which clears the optimization flags for both of the affine transforms, and leaves the flag set only for the DF transform, since it was the last transform added. Now they run the optimization and only the DF transform is optimized, but the affines are included in the transformation during the optimization.
Optimization Flags: The m_TransformsToOptimize flags hold one flag for each transform in the queue, designating if each transform is to be used for optimization. Note that all transforms in the queue are applied in TransformPoint, regardless of these flags states'. The methods GetParameters, SetParameters, ComputeJacobianWithRespectToParameters, GetTransformCategory, GetFixedParameters, and SetFixedParameters all query these flags and include only those transforms whose corresponding flag is set. Their input or output is a concatenated array of all transforms set for use in optimization. The goal is to be able to optimize multiple transforms at once, while leaving other transforms fixed. See the above example.
Setting Optimization Flags: A transform's optimization flag is set when it is added to the queue, and remains set as other transforms are added. The methods SetNthTransformToOptimize* and SetAllTransformToOptimize* are used to set and clear flags arbitrarily. SetOnlyMostRecentTransformToOptimizeOn is a convenience method for setting only the most recently added transform for optimization, with the idea that this will be a common practice.
Indexing: The index values used in GetNthTransform and SetNthTransformToOptimize* and SetAllTransformToOptimize* follow the order in which transforms were added. Thus, the first transform added is at index 0, the next at index 1, etc.
Inverse: The inverse transform is created by retrieving the inverse from each sub transform and adding them to a composite transform in reverse order. The m_TransformsToOptimizeFlags is copied in reverse for the inverse.
- Examples
- Examples/IO/TransformReadWrite.cxx, Examples/RegistrationITKv4/DeformableRegistration15.cxx, Examples/RegistrationITKv4/ImageRegistration1.cxx, Examples/RegistrationITKv4/MultiStageImageRegistration1.cxx, Examples/RegistrationITKv4/MultiStageImageRegistration2.cxx, SphinxExamples/src/Core/Transform/CopyACompositeTransform/Code.cxx, SphinxExamples/src/Registration/Common/Perform2DTranslationRegistrationWithMeanSquares/Code.cxx, and SphinxExamples/src/Registration/Metricsv4/PerformRegistrationOnVectorImages/Code.cxx.
Definition at line 87 of file itkCompositeTransform.h.
|
using | ConstPointer = SmartPointer< const Self > |
|
using | Pointer = SmartPointer< Self > |
|
using | Self = CompositeTransform |
|
using | Superclass = MultiTransform< TParametersValueType, VDimension, VDimension > |
|
using | TransformsToOptimizeFlagsType = std::deque< bool > |
|
using | TransformType = typename Superclass::TransformType |
|
using | ConstPointer = SmartPointer< const Self > |
|
using | Pointer = SmartPointer< Self > |
|
using | ScalarType = ParametersValueType |
|
using | Self = MultiTransform |
|
using | SubTransformInverseTransformBasePointer = typename TransformType::InverseTransformBasePointer |
|
using | Superclass = Transform< TParametersValueType, VDimension, VSubDimensions > |
|
using | TransformQueueType = std::deque< TransformTypePointer > |
|
using | TransformType = Transform< TParametersValueType, VSubDimensions, VSubDimensions > |
|
using | TransformTypePointer = typename TransformType::Pointer |
|
using | ConstPointer = SmartPointer< const Self > |
|
using | DerivativeType = Array< ParametersValueType > |
|
using | DirectionChangeMatrix = Matrix< double, Self::OutputSpaceDimension, Self::InputSpaceDimension > |
|
using | InputCovariantVectorType = CovariantVector< TParametersValueType, VInputDimension > |
|
using | InputDiffusionTensor3DType = DiffusionTensor3D< TParametersValueType > |
|
using | InputDirectionMatrix = Matrix< double, Self::InputSpaceDimension, Self::InputSpaceDimension > |
|
using | InputPointType = Point< TParametersValueType, VInputDimension > |
|
using | InputSymmetricSecondRankTensorType = SymmetricSecondRankTensor< TParametersValueType, VInputDimension > |
|
using | InputVectorPixelType = VariableLengthVector< TParametersValueType > |
|
using | InputVectorType = Vector< TParametersValueType, VInputDimension > |
|
using | InputVnlVectorType = vnl_vector_fixed< TParametersValueType, VInputDimension > |
|
using | InverseJacobianPositionType = vnl_matrix_fixed< ParametersValueType, VInputDimension, VOutputDimension > |
|
using | InverseTransformBasePointer = typename InverseTransformBaseType::Pointer |
|
using | InverseTransformBaseType = Transform< TParametersValueType, VOutputDimension, VInputDimension > |
|
using | JacobianPositionType = vnl_matrix_fixed< ParametersValueType, VOutputDimension, VInputDimension > |
|
using | JacobianType = Array2D< ParametersValueType > |
|
using | MatrixType = Matrix< TParametersValueType, Self::OutputSpaceDimension, Self::InputSpaceDimension > |
|
using | OutputCovariantVectorType = CovariantVector< TParametersValueType, VOutputDimension > |
|
using | OutputDiffusionTensor3DType = DiffusionTensor3D< TParametersValueType > |
|
using | OutputDirectionMatrix = Matrix< double, Self::OutputSpaceDimension, Self::OutputSpaceDimension > |
|
using | OutputPointType = Point< TParametersValueType, VOutputDimension > |
|
using | OutputSymmetricSecondRankTensorType = SymmetricSecondRankTensor< TParametersValueType, VOutputDimension > |
|
using | OutputVectorPixelType = VariableLengthVector< TParametersValueType > |
|
using | OutputVectorType = Vector< TParametersValueType, VOutputDimension > |
|
using | OutputVnlVectorType = vnl_vector_fixed< TParametersValueType, VOutputDimension > |
|
using | Pointer = SmartPointer< Self > |
|
using | ScalarType = ParametersValueType |
|
using | Self = Transform |
|
using | Superclass = TransformBaseTemplate< TParametersValueType > |
|
|
void | ClearTransformQueue () override |
|
void | ComputeJacobianWithRespectToParameters (const InputPointType &p, JacobianType &outJacobian) const override |
|
virtual void | FlattenTransformQueue () |
|
const FixedParametersType & | GetFixedParameters () const override |
|
bool | GetInverse (Self *inverse) const |
|
InverseTransformBasePointer | GetInverseTransform () const override |
|
const char * | GetNameOfClass () const override |
|
virtual bool | GetNthTransformToOptimize (SizeValueType i) const |
|
NumberOfParametersType | GetNumberOfFixedParameters () const override |
|
NumberOfParametersType | GetNumberOfLocalParameters () const override |
|
NumberOfParametersType | GetNumberOfParameters () const override |
|
const ParametersType & | GetParameters () const override |
|
TransformCategoryEnum | GetTransformCategory () const override |
|
virtual const TransformsToOptimizeFlagsType & | GetTransformsToOptimizeFlags () const |
|
virtual void | SetAllTransformsToOptimize (bool state) |
|
virtual void | SetAllTransformsToOptimizeOff () |
|
virtual void | SetAllTransformsToOptimizeOn () |
|
void | SetFixedParameters (const FixedParametersType &inputParameters) override |
|
virtual void | SetNthTransformToOptimize (SizeValueType i, bool state) |
|
virtual void | SetNthTransformToOptimizeOff (SizeValueType i) |
|
virtual void | SetNthTransformToOptimizeOn (SizeValueType i) |
|
virtual void | SetOnlyMostRecentTransformToOptimizeOn () |
|
void | SetParameters (const ParametersType &inputParameters) override |
|
OutputCovariantVectorType | TransformCovariantVector (const InputCovariantVectorType &) const override |
|
OutputCovariantVectorType | TransformCovariantVector (const InputCovariantVectorType &inputVector, const InputPointType &inputPoint) const override |
|
OutputVectorPixelType | TransformCovariantVector (const InputVectorPixelType &) const override |
|
OutputVectorPixelType | TransformCovariantVector (const InputVectorPixelType &inputVector, const InputPointType &inputPoint) const override |
|
OutputDiffusionTensor3DType | TransformDiffusionTensor3D (const InputDiffusionTensor3DType &inputTensor) const override |
|
OutputDiffusionTensor3DType | TransformDiffusionTensor3D (const InputDiffusionTensor3DType &inputTensor, const InputPointType &inputPoint) const override |
|
OutputVectorPixelType | TransformDiffusionTensor3D (const InputVectorPixelType &inputTensor) const override |
|
OutputVectorPixelType | TransformDiffusionTensor3D (const InputVectorPixelType &inputTensor, const InputPointType &inputPoint) const override |
|
OutputPointType | TransformPoint (const InputPointType &inputPoint) const override |
|
OutputSymmetricSecondRankTensorType | TransformSymmetricSecondRankTensor (const InputSymmetricSecondRankTensorType &inputTensor) const override |
|
OutputSymmetricSecondRankTensorType | TransformSymmetricSecondRankTensor (const InputSymmetricSecondRankTensorType &inputTensor, const InputPointType &inputPoint) const override |
|
OutputVectorPixelType | TransformSymmetricSecondRankTensor (const InputVectorPixelType &inputTensor) const override |
|
OutputVectorPixelType | TransformSymmetricSecondRankTensor (const InputVectorPixelType &inputTensor, const InputPointType &inputPoint) const override |
|
OutputVectorPixelType | TransformVector (const InputVectorPixelType &inputVector) const override |
|
OutputVectorPixelType | TransformVector (const InputVectorPixelType &inputVector, const InputPointType &inputPoint) const override |
|
OutputVectorType | TransformVector (const InputVectorType &) const override |
|
OutputVectorType | TransformVector (const InputVectorType &inputVector, const InputPointType &inputPoint) const override |
|
OutputVnlVectorType | TransformVector (const InputVnlVectorType &inputVector) const override |
|
OutputVnlVectorType | TransformVector (const InputVnlVectorType &inputVector, const InputPointType &inputPoint) const override |
|
void | UpdateTransformParameters (const DerivativeType &update, ScalarType factor=1.0) override |
|
|
void | ComputeJacobianWithRespectToParametersCachedTemporaries (const InputPointType &p, JacobianType &outJacobian, JacobianType &cacheJacobian) const override |
|
virtual void | AddTransform (TransformType *t) |
|
virtual void | AppendTransform (TransformType *t) |
|
virtual const TransformType * | GetBackTransform () const |
|
const FixedParametersType & | GetFixedParameters () const override |
|
virtual const TransformType * | GetFrontTransform () const |
|
bool | GetInverse (Self *inverse) const |
|
const char * | GetNameOfClass () const override |
|
virtual const TransformTypePointer | GetNthTransform (SizeValueType n) const |
|
virtual const TransformType * | GetNthTransformConstPointer (const SizeValueType n) const |
|
virtual TransformType * | GetNthTransformModifiablePointer (const SizeValueType n) const |
|
NumberOfParametersType | GetNumberOfFixedParameters () const override |
|
NumberOfParametersType | GetNumberOfLocalParameters () const override |
|
NumberOfParametersType | GetNumberOfParameters () const override |
|
virtual SizeValueType | GetNumberOfTransforms () const |
|
const ParametersType & | GetParameters () const override |
|
TransformCategoryEnum | GetTransformCategory () const override |
|
virtual const TransformQueueType & | GetTransformQueue () const |
|
bool | IsLinear () const override |
|
virtual bool | IsTransformQueueEmpty () const |
|
virtual void | PrependTransform (TransformType *t) |
|
virtual void | RemoveTransform () |
|
void | SetFixedParameters (const FixedParametersType &inputParameters) override |
|
void | SetParameters (const ParametersType &inputParameters) override |
|
void | UpdateTransformParameters (const DerivativeType &update, ScalarType factor=1.0) override |
|
void | CopyInFixedParameters (const FixedParametersValueType *const begin, const FixedParametersValueType *const end) override |
|
void | CopyInParameters (const ParametersValueType *const begin, const ParametersValueType *const end) override |
|
const FixedParametersType & | GetFixedParameters () const override |
|
unsigned int | GetInputSpaceDimension () const override |
|
bool | GetInverse (Self *) const |
|
const char * | GetNameOfClass () const override |
|
NumberOfParametersType | GetNumberOfParameters () const override |
|
unsigned int | GetOutputSpaceDimension () const override |
|
const ParametersType & | GetParameters () const override |
|
TransformCategoryEnum | GetTransformCategory () const override |
|
std::string | GetTransformTypeAsString () const override |
|
| itkCloneMacro (Self) |
|
void | SetParametersByValue (const ParametersType &p) override |
|
virtual void | ComputeJacobianWithRespectToPosition (const InputPointType &, JacobianPositionType &) const |
|
template< typename TImage > std std::enable_if_t< TImage::ImageDimension==VInputDimension &&TImage::ImageDimension==VOutputDimension, void > | ApplyToImageMetadata (SmartPointer< TImage > image) const |
|
template<typename TParametersValueType = double, unsigned int VDimension = 3>
Compute the position of point in the new space.
Transforms are applied starting from the back of the queue. That is, in reverse order of which they were added, in order to work properly with ResampleFilter.
Imagine a user wants to apply an Affine transform followed by a Deformation Field (DF) transform. He adds the Affine, then the DF. Because the user typically conceptualizes a transformation as being applied from the Moving image to the Fixed image, this makes intuitive sense. But since the ResampleFilter expects to transform from the Fixed image to the Moving image, the transforms are applied in reverse order of addition, i.e. from the back of the queue, and thus, DF then Affine.
Implements itk::Transform< TParametersValueType, VDimension, VSubDimensions >.