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

A simplified wrapper around a variety of ITK transforms. More...

#include <sitkTransform.h>

+ Inheritance diagram for itk::simple::Transform:

Classes

struct  DisplacementInitializationMemberFunctionAddressor
 
struct  TransformTryCastVisitor
 

Public Types

using Self = Transform
 

Public Member Functions

unsigned int GetDimension () const
 
Transform GetInverse () const
 Return a new inverse transform of the same type as this. More...
 
virtual std::string GetName () const
 
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

virtual void SetPimpleTransform (PimpleTransformBase *pimpleTransform)
 
 Transform (PimpleTransformBase *pimpleTransform)
 

Private Member Functions

template<unsigned int >
void InternalBSplineInitialization (Image &img)
 
template<typename TDisplacementType >
void InternalDisplacementInitialization (Image &img)
 
void InternalInitialization (itk::TransformBase *base)
 
template<unsigned int VDimension>
void InternalInitialization (TransformEnum type, itk::TransformBase *base=nullptr)
 
template<class TransformType >
void InternalInitialization (TransformType *t)
 

Private Attributes

PimpleTransformBase * m_PimpleTransform
 

Detailed Description

A simplified wrapper around a variety of ITK transforms.

The interface to ITK transform objects to be used with the ImageRegistrationMethod, ResampleImageFilter and other SimpleITK process objects. The transforms are designed to have a serialized array of parameters to facilitate optimization for registration.

Provides a base class interface to any type of ITK transform. Objects of this type may have their interface converted to a derived interface while keeping the same reference to the ITK object.

Additionally, this class provides a basic interface to a composite transforms.

See also
itk::CompositeTransform
Examples
DemonsRegistration2/DemonsRegistration2.cxx, ImageRegistrationMethod1/ImageRegistrationMethod1.cxx, ImageRegistrationMethod2/ImageRegistrationMethod2.cxx, ImageRegistrationMethodBSpline1/ImageRegistrationMethodBSpline1.cxx, ImageRegistrationMethodBSpline3/ImageRegistrationMethodBSpline3.cxx, and ImageRegistrationMethodDisplacement1/ImageRegistrationMethodDisplacement1.cxx.

Definition at line 80 of file sitkTransform.h.

Member Typedef Documentation

◆ Self

Definition at line 83 of file sitkTransform.h.

Constructor & Destructor Documentation

◆ Transform() [1/7]

itk::simple::Transform::Transform ( )

By default a 3-d identity transform is constructed.

◆ Transform() [2/7]

template<unsigned int NDimension>
itk::simple::Transform::Transform ( itk::CompositeTransform< double, NDimension > *  compositeTransform)
inlineexplicit

Construct a SimpleITK Transform from a pointer to an ITK composite transform.

Definition at line 94 of file sitkTransform.h.

References itk::simple::sitkComposite, and sitkExceptionMacro.

◆ Transform() [3/7]

itk::simple::Transform::Transform ( itk::TransformBase transform)
explicit

◆ Transform() [4/7]

itk::simple::Transform::Transform ( unsigned int  dimensions,
TransformEnum  type 
)

Construct a specific transformation.

Deprecated:
This constructor will be removed in future releases.

◆ Transform() [5/7]

itk::simple::Transform::Transform ( Image displacement,
TransformEnum  type = sitkDisplacementField 
)
explicit

Use an image to construct a transform.

The input displacement image is transferred to the constructed transform object. The input image is modified to be a default constructed Image object.

Only the sitkDisplacementField transformation type can currently be constructed this way. Image must be of sitkVectorFloat64 pixel type with the number of components equal to the image dimension.

Deprecated:
This constructor will be removed in future releases.

◆ ~Transform()

virtual itk::simple::Transform::~Transform ( )
virtual

◆ Transform() [6/7]

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

Copy constructor and assignment operator.

Performs a shallow copy of the internal ITK transform. A deep copy will be done if the transform in modified.

◆ Transform() [7/7]

itk::simple::Transform::Transform ( PimpleTransformBase *  pimpleTransform)
explicitprotected

Member Function Documentation

◆ GetDimension()

unsigned int itk::simple::Transform::GetDimension ( ) const

Return the dimension of the Transform ( 2D or 3D )

◆ GetFixedParameters()

std::vector<double> itk::simple::Transform::GetFixedParameters ( ) const

Set/Get Fixed Transform Parameter

◆ GetInverse()

Transform itk::simple::Transform::GetInverse ( ) const

Return a new inverse transform of the same type as this.

Creates a new transform object and tries to set the value to the inverse. As not all transform types have inverse and some transforms are not invertible, an exception will be throw is there is no inverse.

◆ GetITKBase() [1/2]

itk::TransformBase* itk::simple::Transform::GetITKBase ( )

Get access to internal ITK data object.

The return value should immediately be assigned to as itk::SmartPointer.

In many cases the value may need to be dynamically cast to the actual transform type.

◆ GetITKBase() [2/2]

const itk::TransformBase* itk::simple::Transform::GetITKBase ( ) const

Get access to internal ITK data object.

The return value should immediately be assigned to as itk::SmartPointer.

In many cases the value may need to be dynamically cast to the actual transform type.

◆ GetName()

virtual std::string itk::simple::Transform::GetName ( ) const
virtual

◆ GetNumberOfFixedParameters()

unsigned int itk::simple::Transform::GetNumberOfFixedParameters ( ) const

Get the number of fixed parameters

◆ GetNumberOfParameters()

unsigned int itk::simple::Transform::GetNumberOfParameters ( ) const

Return the number of optimizable parameters

Examples
ImageRegistrationMethodBSpline3/ImageRegistrationMethodBSpline3.cxx.

◆ GetParameters()

std::vector<double> itk::simple::Transform::GetParameters ( ) const

◆ GetTransformEnum()

TransformEnum itk::simple::Transform::GetTransformEnum ( ) const

Get the TransformEnum of the underlying Transform.

A SimpleITK Transform object can internally hold any ITK transform. This method returns the TransformEnum representing the internal ITK transform. This value may be used to identify which SimpleITK class the transform can be converted to.

◆ InternalBSplineInitialization()

template<unsigned int >
void itk::simple::Transform::InternalBSplineInitialization ( Image img)
private

◆ InternalDisplacementInitialization()

template<typename TDisplacementType >
void itk::simple::Transform::InternalDisplacementInitialization ( Image img)
private

◆ InternalInitialization() [1/3]

void itk::simple::Transform::InternalInitialization ( itk::TransformBase base)
private

◆ InternalInitialization() [2/3]

template<unsigned int VDimension>
void itk::simple::Transform::InternalInitialization ( TransformEnum  type,
itk::TransformBase base = nullptr 
)
private

◆ InternalInitialization() [3/3]

template<class TransformType >
void itk::simple::Transform::InternalInitialization ( TransformType *  t)
private

◆ IsLinear()

virtual bool itk::simple::Transform::IsLinear ( ) const
virtual

◆ MakeUnique()

void itk::simple::Transform::MakeUnique ( )

Performs actually coping if needed to make object unique.

The Transform class by default performs lazy coping and assignment. This method make sure that coping actually happens to the itk::Transform pointed to is only pointed to by this object.

◆ operator=()

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

Copy constructor and assignment operator.

Performs a shallow copy of the internal ITK transform. A deep copy will be done if the transform in modified.

◆ SetFixedParameters()

void itk::simple::Transform::SetFixedParameters ( const std::vector< double > &  parameters)

Set/Get Fixed Transform Parameter

◆ SetIdentity()

virtual void itk::simple::Transform::SetIdentity ( )
virtual

◆ SetInverse()

virtual bool itk::simple::Transform::SetInverse ( )
virtual

Try to change the current transform to it's inverse.

If the transform has an inverse, i.e. non-singular linear transforms, then a new ITK transform is created of the same type and this object is set to it.

However not all transform have a direct inverse, if the inverse does not exist or fails false will be returned and this transform will not be modified.

◆ SetParameters()

void itk::simple::Transform::SetParameters ( const std::vector< double > &  parameters)

Set/Get Transform Parameter

◆ SetPimpleTransform()

virtual void itk::simple::Transform::SetPimpleTransform ( PimpleTransformBase *  pimpleTransform)
protectedvirtual

◆ ToString()

std::string itk::simple::Transform::ToString ( ) const

◆ TransformPoint()

std::vector< double > itk::simple::Transform::TransformPoint ( const std::vector< double > &  point) const

Apply transform to a point.

The dimension of the point must match the transform.

◆ TransformVector()

std::vector< double > itk::simple::Transform::TransformVector ( const std::vector< double > &  vector,
const std::vector< double > &  point 
) const

Apply transform to a vector at a point.

The ITK concept of a vector is a direction at a specific point, for example the difference between two points is a vector.

For linear transforms the point does not matter, in general the vector is transformed by the Jacobian with respect to point position.

The dimension of the vector and point must match the transform.

◆ WriteTransform()

void itk::simple::Transform::WriteTransform ( const std::string &  filename) const

Member Data Documentation

◆ m_PimpleTransform

PimpleTransformBase* itk::simple::Transform::m_PimpleTransform
private

Definition at line 308 of file sitkTransform.h.


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