ITK  4.9.0
Insight Segmentation and Registration Toolkit
Public Types | Public Member Functions | Private Attributes | List of all members

#include <itkVersor.h>

+ Inheritance diagram for itk::Versor< T >:
+ Collaboration diagram for itk::Versor< T >:

Detailed Description

template<typename T>
class itk::Versor< T >

A templated class holding a unit quaternion.

Versor is a templated class that holds a unit quaternion. The difference between versors and quaternions is that quaternions can represent rotations and scale changes while versors are limited to rotations.

This class only implements the operations that maintain versors as a group, that is, any operations between versors result in another versor. For this reason, addition is not defined in this class, even though it is a valid operation between quaternions.

See Also
Vector
Point
CovariantVector
Matrix
Examples:
Examples/RegistrationITKv3/ChangeInformationImageFilter.cxx, Examples/RegistrationITKv4/ChangeInformationImageFilter.cxx, and SphinxExamples/src/Filtering/ImageGrid/ChangeImageOriginSpacingOrDirection/Code.cxx.

Definition at line 50 of file itkVersor.h.

Public Types

typedef CovariantVector< T, 3 > CovariantVectorType
 
typedef Matrix< T, 3, 3 > MatrixType
 
typedef Point< T, 3 > PointType
 
typedef NumericTraits
< ValueType >::RealType 
RealType
 
typedef Versor Self
 
typedef T ValueType
 
typedef Vector< T, 3 > VectorType
 
typedef vnl_quaternion< T > VnlQuaternionType
 
typedef vnl_vector_fixed< T, 3 > VnlVectorType
 

Public Member Functions

Self Exponential (ValueType exponent) const
 
ValueType GetAngle () const
 
VectorType GetAxis () const
 
Self GetConjugate () const
 
MatrixType GetMatrix () const
 
Self GetReciprocal () const
 
VectorType GetRight () const
 
ValueType GetScalar () const
 
ValueType GetTensor () const
 
vnl_quaternion< T > GetVnlQuaternion () const
 
ValueType GetW (void) const
 
ValueType GetX (void) const
 
ValueType GetY (void) const
 
ValueType GetZ (void) const
 
void Normalize ()
 
bool operator!= (const Self &vec) const
 
Self operator* (const Self &vec) const
 
const Selfoperator*= (const Self &v)
 
Self operator/ (const Self &vec) const
 
const Selfoperator/= (const Self &v)
 
const Selfoperator= (const Self &v)
 
bool operator== (const Self &vec) const
 
void Set (const VnlQuaternionType &)
 
void Set (const VectorType &axis, ValueType angle)
 
void Set (const MatrixType &m)
 
void Set (const VectorType &axis)
 
void SetIdentity ()
 
void SetRotationAroundX (ValueType angle)
 
void SetRotationAroundY (ValueType angle)
 
void SetRotationAroundZ (ValueType angle)
 
Self SquareRoot () const
 
VectorType Transform (const VectorType &v) const
 
CovariantVectorType Transform (const CovariantVectorType &v) const
 
PointType Transform (const PointType &v) const
 
VnlVectorType Transform (const VnlVectorType &v) const
 
 Versor ()
 
 Versor (const Self &v)
 
void Set (T x, T y, T z, T w)
 

Static Private Member Functions

static ValueType Epsilon (double *)
 
static ValueType Epsilon (float *)
 
static ValueType Epsilon ()
 

Private Attributes

ValueType m_W
 
ValueType m_X
 
ValueType m_Y
 
ValueType m_Z
 

Member Typedef Documentation

template<typename T>
typedef CovariantVector< T, 3 > itk::Versor< T >::CovariantVectorType

CovariantVector type.

Definition at line 70 of file itkVersor.h.

template<typename T>
typedef Matrix< T, 3, 3 > itk::Versor< T >::MatrixType

Type of the rotation matrix equivalent to the Versor

Definition at line 79 of file itkVersor.h.

template<typename T>
typedef Point< T, 3 > itk::Versor< T >::PointType

Point type.

Definition at line 67 of file itkVersor.h.

template<typename T>
typedef NumericTraits< ValueType >::RealType itk::Versor< T >::RealType

Type used for computations on the versor components

Definition at line 61 of file itkVersor.h.

template<typename T>
typedef Versor itk::Versor< T >::Self

Standard class typedefs.

Definition at line 54 of file itkVersor.h.

template<typename T>
typedef T itk::Versor< T >::ValueType

ValueType can be used to declare a variable that is the same type as a data element held in a Versor.

Definition at line 58 of file itkVersor.h.

template<typename T>
typedef Vector< T, 3 > itk::Versor< T >::VectorType

Vector type used to represent the axis.

Definition at line 64 of file itkVersor.h.

template<typename T>
typedef vnl_quaternion< T > itk::Versor< T >::VnlQuaternionType

Vnl Quaternion type.

Definition at line 76 of file itkVersor.h.

template<typename T>
typedef vnl_vector_fixed< T, 3 > itk::Versor< T >::VnlVectorType

Vnl Vector type.

Definition at line 73 of file itkVersor.h.

Constructor & Destructor Documentation

template<typename T>
itk::Versor< T >::Versor ( )

Default constructor creates a null versor (representing 0 degrees rotation).

template<typename T>
itk::Versor< T >::Versor ( const Self v)

Copy constructor.

Member Function Documentation

template<typename T>
static ValueType itk::Versor< T >::Epsilon ( double *  )
inlinestaticprivate

use different epsilon for float and double

Definition at line 265 of file itkVersor.h.

template<typename T>
static ValueType itk::Versor< T >::Epsilon ( float *  )
inlinestaticprivate

use different epsilon for float and double

Definition at line 269 of file itkVersor.h.

template<typename T>
static ValueType itk::Versor< T >::Epsilon ( )
inlinestaticprivate

use different epsilon for float and double

Definition at line 273 of file itkVersor.h.

Referenced by itk::Versor< TParametersValueType >::Epsilon().

template<typename T>
Self itk::Versor< T >::Exponential ( ValueType  exponent) const

Compute the Exponential of the unit quaternion Exponentiation by a factor is equivalent to multiplication of the rotaion angle of the quaternion.

template<typename T>
ValueType itk::Versor< T >::GetAngle ( ) const

Returns the rotation angle in radians.

template<typename T>
VectorType itk::Versor< T >::GetAxis ( ) const

Returns the axis of the rotation. It is a unit vector parallel to the axis.

template<typename T>
Self itk::Versor< T >::GetConjugate ( ) const

Get Conjugate versor. Returns the versor that produce a rotation by the same angle but in opposite direction.

template<typename T>
MatrixType itk::Versor< T >::GetMatrix ( ) const

Get the matrix representation.

template<typename T>
Self itk::Versor< T >::GetReciprocal ( ) const

Get Reciprocal versor. Returns the versor that composed with this one will result in a scalar operator equals to 1. It is also equivalent to 1/this.

template<typename T>
VectorType itk::Versor< T >::GetRight ( ) const

Returns the Right part It is a vector part of the Versor. It is called Right because it is equivalent to a right angle rotation.

template<typename T>
ValueType itk::Versor< T >::GetScalar ( ) const

Returns the Scalar part.

template<typename T>
ValueType itk::Versor< T >::GetTensor ( ) const

Get Tensor part of the Versor. Given that Versors are normalized quaternions this value is expected to be 1.0 always

template<typename T>
vnl_quaternion< T > itk::Versor< T >::GetVnlQuaternion ( ) const

Get a vnl_quaternion with a copy of the internal memory block.

template<typename T>
ValueType itk::Versor< T >::GetW ( void  ) const
inline

Returns the W component.

Definition at line 178 of file itkVersor.h.

Referenced by itk::operator<<().

template<typename T>
ValueType itk::Versor< T >::GetX ( void  ) const
inline

Returns the X component.

Definition at line 169 of file itkVersor.h.

Referenced by itk::operator<<().

template<typename T>
ValueType itk::Versor< T >::GetY ( void  ) const
inline

Returns the Y component.

Definition at line 172 of file itkVersor.h.

Referenced by itk::operator<<().

template<typename T>
ValueType itk::Versor< T >::GetZ ( void  ) const
inline

Returns the Z component.

Definition at line 175 of file itkVersor.h.

Referenced by itk::operator<<().

template<typename T>
void itk::Versor< T >::Normalize ( )

Normalize the Versor. Given that Versors are normalized quaternions this method is provided only for convinience when it is suspected that a versor could be out of the unit sphere.

template<typename T>
bool itk::Versor< T >::operator!= ( const Self vec) const

Versor operator!= Performs the comparison between two versors. this operation uses an arbitrary threshold for the comparison.

template<typename T>
Self itk::Versor< T >::operator* ( const Self vec) const

Versor operator*. Performs the composition of two versors. this operation is NOT commutative.

template<typename T>
const Self& itk::Versor< T >::operator*= ( const Self v)

Composition operator *=. Compose the current versor with the operand and store the result in the current versor.

template<typename T>
Self itk::Versor< T >::operator/ ( const Self vec) const

Versor operator/. Performs the division of two versors.

template<typename T>
const Self& itk::Versor< T >::operator/= ( const Self v)

Division operator /=. Divide the current versor with the operand and store the result in the current versor. This is equivalent to compose the Versor with the reciprocal of the operand

See Also
GetReciprocal
template<typename T>
const Self& itk::Versor< T >::operator= ( const Self v)

Assignment operator =. Copy the versor argument.

template<typename T>
bool itk::Versor< T >::operator== ( const Self vec) const

Versor operator== Performs the comparison between two versors. this operation uses an arbitrary threshold for the comparison.

template<typename T>
void itk::Versor< T >::Set ( const VnlQuaternionType )

Set the Versor from a Quaternion

Warning
After assignment, the corresponding quaternion will be normalized in order to get a consistent Versor.
template<typename T>
void itk::Versor< T >::Set ( x,
y,
z,
w 
)

Set the Versor from Quaternion components.

Warning
After assignment, the corresponding quaternion will be normalized in order to get a consistent Versor. Also, if the "w" component is negative, the four components will be negated in order to produce a quaternion where "w" is positive, since this is implicitly assumed in other sections of the code, in particular when "w" is computed from (x,y,z) via normalization. The reason why it is valid to negate all the components is that the rotation by angle $\theta$, is represented by $\sin(\frac{\theta}{2})$ in the (x,y,z) components and by $\cos(\frac{\theta}{2})$ in the "w" component. The rotation by any $\theta$ should be equivalent to a rotation by $\theta + n \times \pi$, therefore we should be able to replace $\sin(\frac{\theta}{2})$ with $\sin(\frac{\theta}{2} + n \times \pi )$ and $\cos(\frac{\theta}{2})$ with $\cos(\frac{\theta}{2} + n \times \pi )$. Considering that $\cos( n \times \pi ) = (-1)^{n}$ we can conclude that if we simultaneously change the signs of all the Versor components, the rotation that it represents remains unchanged.
template<typename T>
void itk::Versor< T >::Set ( const VectorType axis,
ValueType  angle 
)

Set the versor using a vector and angle the unit vector parallel to the given vector will be used. The angle is expected in radians.

template<typename T>
void itk::Versor< T >::Set ( const MatrixType m)

Set the versor using an orthogonal matrix. Based on code from: http://www.euclideanspace.com/maths/geometry/rotations/ conversions/matrixToQuaternion/index.htm

template<typename T>
void itk::Versor< T >::Set ( const VectorType axis)

Set the versor using the right part. the magnitude of the vector given is assumed to be equal to std::sin(angle/2). This method will compute internally the scalar part that preserve the Versor as a unit quaternion.

template<typename T>
void itk::Versor< T >::SetIdentity ( )

Reset the values so the versor is equivalent to an identity transformation. This is equivalent to set a zero angle

template<typename T>
void itk::Versor< T >::SetRotationAroundX ( ValueType  angle)

Sets a rotation around the X axis using the parameter as angle in radians. This is a method provided for convinience to initialize a rotation. The effect of this methods is not cumulative with any value previously stored in the Versor.

See Also
Set
SetRotationAroundY
SetRotationAroundZ
template<typename T>
void itk::Versor< T >::SetRotationAroundY ( ValueType  angle)

Sets a rotation around the Y axis using the parameter as angle in radians. This is a method provided for convinience to initialize a rotation. The effect of this methods is not cumulative with any value previously stored in the Versor.

See Also
Set
SetRotationAroundX
SetRotationAroundZ
template<typename T>
void itk::Versor< T >::SetRotationAroundZ ( ValueType  angle)

Sets a rotation around the Y axis using the parameter as angle in radians. This is a method provided for convinience to initialize a rotation. The effect of this methods is not cumulative with any value previously stored in the Versor.

See Also
Set
SetRotationAroundX
SetRotationAroundY
template<typename T>
Self itk::Versor< T >::SquareRoot ( ) const

Get the Square root of the unit quaternion.

template<typename T>
VectorType itk::Versor< T >::Transform ( const VectorType v) const

Transform a vector.

template<typename T>
CovariantVectorType itk::Versor< T >::Transform ( const CovariantVectorType v) const

Transform a covariant vector.

template<typename T>
PointType itk::Versor< T >::Transform ( const PointType v) const

Transform a point.

template<typename T>
VnlVectorType itk::Versor< T >::Transform ( const VnlVectorType v) const

Transform a vnl_vector.

Member Data Documentation

template<typename T>
ValueType itk::Versor< T >::m_W
private

Escalar component of the Versor.

Definition at line 289 of file itkVersor.h.

Referenced by itk::Versor< TParametersValueType >::GetW().

template<typename T>
ValueType itk::Versor< T >::m_X
private

Component parallel to x axis.

Definition at line 280 of file itkVersor.h.

Referenced by itk::Versor< TParametersValueType >::GetX().

template<typename T>
ValueType itk::Versor< T >::m_Y
private

Component parallel to y axis.

Definition at line 283 of file itkVersor.h.

Referenced by itk::Versor< TParametersValueType >::GetY().

template<typename T>
ValueType itk::Versor< T >::m_Z
private

Component parallel to z axis.

Definition at line 286 of file itkVersor.h.

Referenced by itk::Versor< TParametersValueType >::GetZ().


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