aimsdata 6.0.0
Neuroimaging data handling
aims::AffineTransformation3d Class Reference

Affine 3D transformation. More...

#include <aims/transformation/affinetransformation3d.h>

Inheritance diagram for aims::AffineTransformation3d:
Collaboration diagram for aims::AffineTransformation3d:

Public Member Functions

 AffineTransformation3d ()
 Create an identity transformation.
 
 AffineTransformation3d (const AffineTransformation3d &other)
 
 AffineTransformation3d (const AffineTransformation3dBase &other)
 
 AffineTransformation3d (const std::vector< float > &mat)
 Create a AffineTransformation3d from a 4x4 matrix given as a line vector.
 
 AffineTransformation3d (const carto::Object mat)
 Create a AffineTransformation3d from a 4x4 matrix given as a line vector in an Object.
 
 AffineTransformation3d (const aims::Quaternion &quat)
 
virtual ~AffineTransformation3d ()
 
virtual AffineTransformation3doperator= (const AffineTransformation3d &other)
 
virtual AffineTransformation3doperator= (const std::vector< float > &mat)
 
virtual AffineTransformation3doperator= (const carto::Object mat)
 
virtual AffineTransformation3doperator= (const aims::Quaternion &quat)
 
virtual bool operator== (const AffineTransformation3d &) const
 
virtual bool operator!= (const AffineTransformation3d &) const
 
AffineTransformation3doperator*= (const AffineTransformation3dBase &trans)
 
virtual AffineTransformation3d operator- () const
 
std::unique_ptr< AffineTransformation3dinverse () const
 
std::unique_ptr< TransformationgetInverse () const CARTO_OVERRIDE
 
Point3df translation ()
 
Point3df translation () const
 
carto::VolumeRef< float > rotation ()
 
const carto::VolumeRef< float > rotation () const
 
carto::VolumeRef< float > affine ()
 
const carto::VolumeRef< float > affine () const
 
virtual void setMatrix (const carto::VolumeRef< float > &mat)
 
virtual void setRotationAffine (float rx, float ry, float rz, const Point3df &cg=Point3df(0.0))
 
- Public Member Functions inherited from soma::AffineTransformation3dBase
 AffineTransformation3dBase ()
 
 AffineTransformation3dBase (const AffineTransformation3dBase &other)
 
 AffineTransformation3dBase (const std::vector< float > &mat)
 
 AffineTransformation3dBase (const carto::Object mat)
 
virtual ~AffineTransformation3dBase ()
 
virtual AffineTransformation3dBaseoperator= (const AffineTransformation3dBase &other)
 
AffineTransformation3dBaseoperator*= (const AffineTransformation3dBase &trans)
 
AffineTransformation3dBase operator- () const
 
virtual bool operator== (const AffineTransformation3dBase &) const
 
virtual void extendOrder (unsigned n)
 
Point3dd transform (double x, double y, double z) const
 
Point3dd transform (const Point3dd &pos) const
 
Point3df transform (const Point3df &pos) const
 
Point3df transform (float x, float y, float z) const
 
Point3d transform (const Point3d &p) const
 
Point3di transform (const Point3di &p) const
 
Point3di transform (int x, int y, int z) const
 
virtual std::vector< double > transform (const std::vector< double > &pos) const
 
virtual std::vector< float > transform (const std::vector< float > &pos) const
 
virtual std::vector< int > transform (const std::vector< int > &pos) const
 
Point3dd transformVector (const Point3dd &vec) const
 
Point3df transformVector (const Point3df &dir) const
 
Point3df transformVector (const Point3di &dir) const
 
Point3dd transformVector (double x, double y, double z) const
 
Point3df transformVector (float x, float y, float z) const
 
Point3di transformVector (int x, int y, int z) const
 
virtual std::vector< double > transformVector (const std::vector< double > &pos) const
 
virtual std::vector< float > transformVector (const std::vector< float > &pos) const
 
virtual std::vector< int > transformVector (const std::vector< int > &pos) const
 
Point3dd transformNormal (const Point3dd &dir) const
 
Point3df transformNormal (const Point3df &dir) const
 
Point3dd transformNormal (double x, double y, double z) const
 
Point3df transformNormal (float x, float y, float z) const
 
Point3dd transformUnitNormal (const Point3dd &dir) const
 
Point3df transformUnitNormal (const Point3df &dir) const
 
Point3dd transformUnitNormal (double x, double y, double z) const
 
Point3df transformUnitNormal (float x, float y, float z) const
 
bool isIdentity () const CARTO_OVERRIDE
 
virtual void setToIdentity ()
 
std::unique_ptr< AffineTransformation3dBaseinverse () const
 
bool invertible () const CARTO_OVERRIDE
 
std::unique_ptr< TransformationgetInverse () const CARTO_OVERRIDE
 
virtual void scale (const Point3df &sizeFrom, const Point3df &sizeTo)
 
void setTranslation (Point3df trans)
 
void fromColumnVector (const float *vec)
 
- Public Member Functions inherited from soma::Transformation3d
virtual ~Transformation3d ()
 
Point3dd transform (double x, double y, double z) const
 
Point3dd transform (const Point3dd &pos) const
 
Point3df transform (const Point3df &dir) const
 
Point3df transform (float x, float y, float z) const
 
Point3d transform (const Point3d &p) const
 
Point3di transform (const Point3di &p) const
 
Point3di transform (int x, int y, int z) const
 
- Public Member Functions inherited from soma::Transformation
virtual ~Transformation ()
 
virtual Transformationoperator= (const Transformation &other)
 
carto::Object header ()
 
const carto::Object header () const
 
void setHeader (carto::Object ph)
 
- Public Member Functions inherited from carto::RCObject
 RCObject ()
 
 RCObject (const RCObject &)
 
RCObjectoperator= (const RCObject &)
 
virtual ~RCObject ()
 
- Public Member Functions inherited from soma::AffineTransformationBase
 AffineTransformationBase (int order=3)
 
 AffineTransformationBase (const AffineTransformationBase &other)
 
 AffineTransformationBase (const std::vector< float > &mat)
 
 AffineTransformationBase (const carto::Object mat)
 
virtual ~AffineTransformationBase ()
 
virtual AffineTransformationBaseoperator= (const AffineTransformationBase &other)
 
virtual bool operator== (const AffineTransformationBase &) const
 
AffineTransformationBaseoperator*= (const AffineTransformationBase &trans)
 
AffineTransformationBase operator- () const
 
void negate ()
 
bool isIdentity () const CARTO_OVERRIDE
 
bool isDirect () const override
 
bool invertible () const CARTO_OVERRIDE
 
std::unique_ptr< AffineTransformationBaseinverse () const
 
std::unique_ptr< TransformationgetInverse () const CARTO_OVERRIDE
 
int order () const
 
virtual void squeezeOrder (unsigned n, bool check=true, bool notify_fail=true)
 
Table< float > & matrix ()
 
const Table< float > & matrix () const
 
std::vector< float > toVector () const
 
std::vector< float > toColumnVector () const
 
void fromColumnVector (const std::vector< float > &vec)
 
void fromColumnVector (const float *vec, unsigned size)
 

Static Public Member Functions

static carto::VolumeRef< float > rotationaroundx (float rx)
 
static carto::VolumeRef< float > rotationaroundy (float ry)
 
static carto::VolumeRef< float > rotationaroundz (float rz)
 
static AffineTransformation3d translationTransform (float tx, float ty, float tz)
 convenient function which returns a translation transformation
 
static AffineTransformation3d translationTransform (const Point3df &t)
 
static AffineTransformation3d translationTransform (const std::vector< float > &t)
 
- Static Public Member Functions inherited from soma::Transformation
static std::vector< T > vadd (const std::vector< T > &v1, const std::vector< T > &v2)
 
static std::vector< T > vsub (const std::vector< T > &v1, const std::vector< T > &v2)
 
static std::vector< T > vadd (const std::vector< T > &v1, const T &v2)
 
static std::vector< T > vsub (const std::vector< T > &v1, const T &v2)
 
static std::vector< T > vadd (const T &v1, const std::vector< T > &v2)
 
static std::vector< T > vsub (const T &v1, const std::vector< T > &v2)
 

Additional Inherited Members

- Public Types inherited from carto::RCObject
typedef int RefCounterType
 
- Static Public Attributes inherited from soma::AffineTransformationBase
static float epsilon
 
- Protected Member Functions inherited from soma::AffineTransformation3dBase
Point3dd transformDouble (double x, double y, double z) const CARTO_OVERRIDE
 
Point3df transformFloat (float x, float y, float z) const CARTO_OVERRIDE
 
Point3di transformInt (int x, int y, int z) const CARTO_OVERRIDE
 
virtual Point3dd transformVectorPoint3dd (const Point3dd &vec) const
 
virtual Point3df transformVectorPoint3df (const Point3df &dir) const
 
virtual Point3dd transformVectorDouble (double x, double y, double z) const
 
virtual Point3df transformVectorFloat (float x, float y, float z) const
 
virtual Point3di transformVectorInt (int x, int y, int z) const
 
virtual Point3dd transformNormalPoint3dd (const Point3dd &dir) const
 
virtual Point3df transformNormalPoint3df (const Point3df &dir) const
 
virtual Point3dd transformNormalDouble (double x, double y, double z) const
 
virtual Point3df transformNormalFloat (float x, float y, float z) const
 
- Protected Member Functions inherited from soma::Transformation3d
 Transformation3d ()
 
virtual Point3dd transformPoint3dd (const Point3dd &pos) const
 
virtual Point3df transformPoint3df (const Point3df &dir) const
 
virtual Point3d transformPoint3d (const Point3d &p) const
 
virtual Point3di transformPoint3di (const Point3di &p) const
 
- Protected Member Functions inherited from soma::Transformation
 Transformation ()
 
- Protected Attributes inherited from soma::Transformation
carto::Object _header
 
- Protected Attributes inherited from soma::AffineTransformationBase
Table< float > _matrix
 

Detailed Description

Affine 3D transformation.

WARNING: this is the old Motion class of Aims 3.x, which has been renamed and changed in Aims 4.0. Since Aims 4.7, most of the code is in soma-io where it is used to transform voxels coordinates in IO code. This additional layer mainly adds compatibility with older code which uses VolumeRef for rotation() and Point3df for translation().

A new transformation classes tree has been setup to allow non-linear transformations: see Transformation and Transformation3d. AffineTransformation3d now inherits Transformation3d.

A typedef is still provided for backward compatibility, in aims/resampling/motion.h (the former location of the Motion class) and should minimize inconvenience when compiling old code which used Motion. However a few API differences may cause compilation problems:

Changes in AIMS 4.7

In Aims and Soma-IO 4.7, it was needed to move transformations to Soma-IO, because they are used in IO code that is moving to soma-io. To do to, we also had to move AimsVector and typedefs Point3df etc. Then several changes had to be done:

  • Transformation and Transformation3d are now in the namespace soma. They are still typedef'd in aims for compatibility, but programmers should use them in soma now.
  • The AffineTransformation3d has been split in two parts, soma::AffineTransformation3dBase which already does pretty much everything, which is in soma-io and used this way there, and AffineTransformation3d which is still here in aims, and merely adds compatibility methods converting with aims types (Volume, Quaternion).
  • AffineTransformation3d::rotation does not return a reference any longer. Code using it as a reference should be modified. As the returned VolumeRef object is itself a reference to the transformation array, changing this is normally merely a matter of removing the "&", the object will still be usable to modify the transformation.
  • AffineTransformation3d::translation does not return a reference any longer. Code using it as a reference should be modified. This modification however requires a bit more changes than for rotation() because the returned Point3df cannot be used to modify the transformation itself. Instead you can use AffineTransformation3d::setTranslation(), or AffineTransformation3dBase::matrix()(i, 3) to modify the translation in place.
  • AffineTransformation3d::rotation() and AffineTransformation3d::translation are left for partial compatibility with older code, but should be considered deprecated. They are less efficient as they used to be, because the returned objects are built on-the-fly and are not the native storage for the transform anymore. Instead, AffineTransformation3dBase::matrix() should be used, it has the same functionalities and allows to address the full 4x4 matrix, with same convention as rotation(): accessors are (line, column), thus the translation is (line, 3).
  • AffineTransformation3d::setTranslation() has changed behavior: it used to add the coordinates to the current translation in the matrix, which was wrong or at least unclear. It was almost never used anyway. The behavior is now what is expected: it sets the translation part of the matrix, and may be used to replace the former expressions trans.translation() = Point3df(..) which do not work any longer.

Definition at line 147 of file affinetransformation3d.h.

Constructor & Destructor Documentation

◆ AffineTransformation3d() [1/6]

◆ AffineTransformation3d() [2/6]

aims::AffineTransformation3d::AffineTransformation3d ( const AffineTransformation3d & other)

◆ AffineTransformation3d() [3/6]

aims::AffineTransformation3d::AffineTransformation3d ( const AffineTransformation3dBase & other)

◆ AffineTransformation3d() [4/6]

aims::AffineTransformation3d::AffineTransformation3d ( const std::vector< float > & mat)
explicit

Create a AffineTransformation3d from a 4x4 matrix given as a line vector.

◆ AffineTransformation3d() [5/6]

aims::AffineTransformation3d::AffineTransformation3d ( const carto::Object mat)
explicit

Create a AffineTransformation3d from a 4x4 matrix given as a line vector in an Object.

◆ AffineTransformation3d() [6/6]

aims::AffineTransformation3d::AffineTransformation3d ( const aims::Quaternion & quat)

◆ ~AffineTransformation3d()

virtual aims::AffineTransformation3d::~AffineTransformation3d ( )
virtual

Member Function Documentation

◆ affine() [1/2]

carto::VolumeRef< float > aims::AffineTransformation3d::affine ( )
inline

◆ affine() [2/2]

const carto::VolumeRef< float > aims::AffineTransformation3d::affine ( ) const
inline

◆ getInverse()

std::unique_ptr< Transformation > aims::AffineTransformation3d::getInverse ( ) const
virtual

Reimplemented from soma::Transformation.

References affine(), rotation(), and translation().

◆ inverse()

std::unique_ptr< AffineTransformation3d > aims::AffineTransformation3d::inverse ( ) const

◆ operator!=()

virtual bool aims::AffineTransformation3d::operator!= ( const AffineTransformation3d & ) const
virtual

◆ operator*=()

AffineTransformation3d & aims::AffineTransformation3d::operator*= ( const AffineTransformation3dBase & trans)

◆ operator-()

virtual AffineTransformation3d aims::AffineTransformation3d::operator- ( ) const
virtual

◆ operator=() [1/4]

virtual AffineTransformation3d & aims::AffineTransformation3d::operator= ( const AffineTransformation3d & other)
virtual

◆ operator=() [2/4]

virtual AffineTransformation3d & aims::AffineTransformation3d::operator= ( const aims::Quaternion & quat)
virtual

◆ operator=() [3/4]

virtual AffineTransformation3d & aims::AffineTransformation3d::operator= ( const carto::Object mat)
virtual

◆ operator=() [4/4]

virtual AffineTransformation3d & aims::AffineTransformation3d::operator= ( const std::vector< float > & mat)
virtual

◆ operator==()

virtual bool aims::AffineTransformation3d::operator== ( const AffineTransformation3d & ) const
virtual

◆ rotation() [1/2]

carto::VolumeRef< float > aims::AffineTransformation3d::rotation ( )
inline

◆ rotation() [2/2]

const carto::VolumeRef< float > aims::AffineTransformation3d::rotation ( ) const
inline

◆ rotationaroundx()

static carto::VolumeRef< float > aims::AffineTransformation3d::rotationaroundx ( float rx)
static

References rotationaroundx().

Referenced by rotationaroundx().

◆ rotationaroundy()

static carto::VolumeRef< float > aims::AffineTransformation3d::rotationaroundy ( float ry)
static

References rotationaroundy().

Referenced by rotationaroundy().

◆ rotationaroundz()

static carto::VolumeRef< float > aims::AffineTransformation3d::rotationaroundz ( float rz)
static

References rotationaroundz().

Referenced by rotationaroundz().

◆ setMatrix()

virtual void aims::AffineTransformation3d::setMatrix ( const carto::VolumeRef< float > & mat)
virtual

References setMatrix().

Referenced by setMatrix().

◆ setRotationAffine()

virtual void aims::AffineTransformation3d::setRotationAffine ( float rx,
float ry,
float rz,
const Point3df & cg = Point3df(0.0) )
virtual

◆ translation() [1/2]

◆ translation() [2/2]

Point3df aims::AffineTransformation3d::translation ( ) const
inline

Definition at line 219 of file affinetransformation3d.h.

References soma::AffineTransformationBase::_matrix.

◆ translationTransform() [1/3]

static AffineTransformation3d aims::AffineTransformation3d::translationTransform ( const Point3df & t)
static

◆ translationTransform() [2/3]

static AffineTransformation3d aims::AffineTransformation3d::translationTransform ( const std::vector< float > & t)
static

◆ translationTransform() [3/3]

static AffineTransformation3d aims::AffineTransformation3d::translationTransform ( float tx,
float ty,
float tz )
static

convenient function which returns a translation transformation

References AffineTransformation3d(), and translationTransform().

Referenced by translationTransform(), translationTransform(), and translationTransform().


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