SimpleITK  
Classes | Public Types | Public Member Functions | Protected Member Functions | Private Member Functions | Private Attributes | List of all members
itk::simple::CompositeTransform Class Reference

This class contains a stack of transforms and concatenates them by composition. More...

#include <sitkCompositeTransform.h>

+ Inheritance diagram for itk::simple::CompositeTransform:
+ Collaboration diagram for itk::simple::CompositeTransform:

Classes

struct  MyVisitor
 

Public Types

using Self = CompositeTransform
 
using Superclass = Transform
 
- Public Types inherited from itk::simple::Transform
using Self = Transform
 

Public Member Functions

SelfAddTransform (Transform t)
 Add a transform to the back of the stack. More...
 
void ClearTransforms ()
 Remove all transforms from the stack. More...
 
 CompositeTransform (const CompositeTransform &)
 A lazy copy constructor. More...
 
 CompositeTransform (const std::vector< itk::simple::Transform > &)
 Create a composite from a vector of Transform. More...
 
 CompositeTransform (const Transform &)
 Create CompositeTransform converted or holding the transform argument. More...
 
 CompositeTransform (unsigned int dimensions)
 Construct an empty CompositeTransform. More...
 
SelfFlattenTransform ()
 Removes nested composite transforms. More...
 
Transform GetBackTransform ()
 Get a copy of the back transform. More...
 
std::string GetName () const override
 
Transform GetNthTransform (unsigned int n)
 Get a copy of a transform in the stack. More...
 
unsigned int GetNumberOfTransforms () const
 The number of transforms in the stack. More...
 
CompositeTransformoperator= (const CompositeTransform &)
 
void RemoveTransform ()
 Remove the active transform at the back. More...
 
 ~CompositeTransform () override
 
- Public Member Functions inherited from itk::simple::Transform
unsigned int GetDimension () const
 
Transform GetInverse () const
 Return a new inverse transform of the same type as this. More...
 
unsigned int GetNumberOfFixedParameters () const
 
unsigned int GetNumberOfParameters () const
 
TransformEnum GetTransformEnum () const
 Get the TransformEnum of the underlying Transform. More...
 
virtual bool IsLinear () const
 
void MakeUnique ()
 Performs actually coping if needed to make object unique. More...
 
virtual void SetIdentity ()
 
virtual bool SetInverse ()
 Try to change the current transform to it's inverse. More...
 
std::string ToString () const
 
 Transform ()
 By default a 3-d identity transform is constructed. More...
 
 Transform (Image &displacement, TransformEnum type=sitkDisplacementField)
 Use an image to construct a transform. More...
 
template<unsigned int NDimension>
 Transform (itk::CompositeTransform< double, NDimension > *compositeTransform)
 Construct a SimpleITK Transform from a pointer to an ITK composite transform. More...
 
 Transform (itk::TransformBase *transform)
 
 Transform (unsigned int dimensions, TransformEnum type)
 Construct a specific transformation. More...
 
std::vector< double > TransformPoint (const std::vector< double > &point) const
 
std::vector< double > TransformVector (const std::vector< double > &vector, const std::vector< double > &point) const
 
void WriteTransform (const std::string &filename) const
 
virtual ~Transform ()
 
Transformoperator= (const Transform &)
 Copy constructor and assignment operator. More...
 
 Transform (const Transform &)
 Copy constructor and assignment operator. More...
 
itk::TransformBaseGetITKBase ()
 
const itk::TransformBaseGetITKBase () const
 
void SetParameters (const std::vector< double > &parameters)
 
std::vector< double > GetParameters () const
 
void SetFixedParameters (const std::vector< double > &parameters)
 
std::vector< double > GetFixedParameters () const
 

Protected Member Functions

void SetPimpleTransform (std::unique_ptr< PimpleTransformBase > &&) override
 
- Protected Member Functions inherited from itk::simple::Transform
 Transform (PimpleTransformBase *pimpleTransform)
 

Private Member Functions

template<unsigned int NDimension>
void InternalInitialization (itk::CompositeTransform< double, NDimension > *)
 
template<unsigned int NDimensions>
void InternalInitialization (itk::Transform< double, NDimensions, NDimensions > *)
 
void InternalInitialization (itk::TransformBase *transform)
 

Private Attributes

std::function< void(Transform &)> m_pfAddTransform
 
std::function< Transform()> m_pfBackTransform
 
std::function< void()> m_pfClearTransformQueue
 
std::function< void()> m_pfFlattenTransform
 
std::function< Transform(unsigned int)> m_pfGetNthTransform
 
std::function< unsigned int()> m_pfGetNumberOfTransforms
 
std::function< void()> m_pfRemoveTransform
 

Detailed Description

This class contains a stack of transforms and concatenates them by composition.

The transforms are composed in reverse order with the back being applied first: \( T_0 o T_1 = T_0(T_1(x)) \) Transforms are stored in a queue, in the following order: \( T_0, T_1, ... , T_N-1 \)

Transforms are added via AddTransform(). This adds the transforms to the back of the queue.

The only parameters of the transform at the back of the queue are exposed and optimizable for registration.

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.

See also
itk::CompositeTransform
Examples
ImageRegistrationMethodDisplacement1/ImageRegistrationMethodDisplacement1.cxx.

Definition at line 58 of file sitkCompositeTransform.h.

Member Typedef Documentation

◆ Self

Definition at line 61 of file sitkCompositeTransform.h.

◆ Superclass

Definition at line 62 of file sitkCompositeTransform.h.

Constructor & Destructor Documentation

◆ CompositeTransform() [1/4]

itk::simple::CompositeTransform::CompositeTransform ( unsigned int  dimensions)
explicit

Construct an empty CompositeTransform.

The created CompositeTransform is initialized with zero transforms. Additional transforms of dimensions can be added.

◆ CompositeTransform() [2/4]

itk::simple::CompositeTransform::CompositeTransform ( const Transform )

Create CompositeTransform converted or holding the transform argument.

If the Transform is internally a CompositeTransform, a shallow copy to the internal transform will be made. Otherwise a new CompositeTransform is constructed which holds the transform argument.

◆ CompositeTransform() [3/4]

itk::simple::CompositeTransform::CompositeTransform ( const CompositeTransform )

A lazy copy constructor.

The new SimpleITK object will reference to the same underlying ITK CompositeTransform. A deep-copy will be made when the object is modified.

◆ CompositeTransform() [4/4]

itk::simple::CompositeTransform::CompositeTransform ( const std::vector< itk::simple::Transform > &  )
explicit

Create a composite from a vector of Transform.

The CompositeTransform is constructed from deep copies of the Transforms. If the vector contains additional composite transforms, deep copies will be made and nested composite transforms will be constructed.

An exception is thrown if the vector is empty.

◆ ~CompositeTransform()

itk::simple::CompositeTransform::~CompositeTransform ( )
override

Member Function Documentation

◆ AddTransform()

Self& itk::simple::CompositeTransform::AddTransform ( Transform  t)

Add a transform to the back of the stack.

A deep-copy of the transform is performed. The added transform will have the optimizable parameters, while the other parameters are part of the fixed parameters.

◆ ClearTransforms()

void itk::simple::CompositeTransform::ClearTransforms ( )

Remove all transforms from the stack.

◆ FlattenTransform()

Self& itk::simple::CompositeTransform::FlattenTransform ( )

Removes nested composite transforms.

If this transform contains additional composite transforms, then these nested composite transformed are removed, while preserving the order of the regular transforms and transferring ownership to the parent CompositeTransform.

Nested composite transform may not be written to a file.

◆ GetBackTransform()

Transform itk::simple::CompositeTransform::GetBackTransform ( )

Get a copy of the back transform.

If the stack is empty an exception will be thrown.

◆ GetName()

std::string itk::simple::CompositeTransform::GetName ( ) const
inlineoverridevirtual

Name of this class

Reimplemented from itk::simple::Transform.

Definition at line 105 of file sitkCompositeTransform.h.

◆ GetNthTransform()

Transform itk::simple::CompositeTransform::GetNthTransform ( unsigned int  n)

Get a copy of a transform in the stack.

If n is equal or greater than the number of transforms, then an exception will be thrown.

◆ GetNumberOfTransforms()

unsigned int itk::simple::CompositeTransform::GetNumberOfTransforms ( ) const

The number of transforms in the stack.

◆ InternalInitialization() [1/3]

template<unsigned int NDimension>
void itk::simple::CompositeTransform::InternalInitialization ( itk::CompositeTransform< double, NDimension > *  )
private

◆ InternalInitialization() [2/3]

template<unsigned int NDimensions>
void itk::simple::CompositeTransform::InternalInitialization ( itk::Transform< double, NDimensions, NDimensions > *  )
private

◆ InternalInitialization() [3/3]

void itk::simple::CompositeTransform::InternalInitialization ( itk::TransformBase transform)
private

◆ operator=()

CompositeTransform& itk::simple::CompositeTransform::operator= ( const CompositeTransform )

◆ RemoveTransform()

void itk::simple::CompositeTransform::RemoveTransform ( )

Remove the active transform at the back.

If the stack is empty an exception will be thrown.

◆ SetPimpleTransform()

void itk::simple::CompositeTransform::SetPimpleTransform ( std::unique_ptr< PimpleTransformBase > &&  )
overrideprotectedvirtual

Reimplemented from itk::simple::Transform.

Member Data Documentation

◆ m_pfAddTransform

std::function<void(Transform &)> itk::simple::CompositeTransform::m_pfAddTransform
private

Definition at line 197 of file sitkCompositeTransform.h.

◆ m_pfBackTransform

std::function<Transform()> itk::simple::CompositeTransform::m_pfBackTransform
private

Definition at line 199 of file sitkCompositeTransform.h.

◆ m_pfClearTransformQueue

std::function<void()> itk::simple::CompositeTransform::m_pfClearTransformQueue
private

Definition at line 202 of file sitkCompositeTransform.h.

◆ m_pfFlattenTransform

std::function<void()> itk::simple::CompositeTransform::m_pfFlattenTransform
private

Definition at line 196 of file sitkCompositeTransform.h.

◆ m_pfGetNthTransform

std::function<Transform(unsigned int)> itk::simple::CompositeTransform::m_pfGetNthTransform
private

Definition at line 200 of file sitkCompositeTransform.h.

◆ m_pfGetNumberOfTransforms

std::function<unsigned int()> itk::simple::CompositeTransform::m_pfGetNumberOfTransforms
private

Definition at line 201 of file sitkCompositeTransform.h.

◆ m_pfRemoveTransform

std::function<void()> itk::simple::CompositeTransform::m_pfRemoveTransform
private

Definition at line 198 of file sitkCompositeTransform.h.


The documentation for this class was generated from the following file: