aimsdata  5.0.5
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. More...
 
 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. More...
 
 AffineTransformation3d (const carto::Object mat)
 Create a AffineTransformation3d from a 4x4 matrix given as a line vector in an Object. More...
 
 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
 
AffineTransformation3d inverse () const
 
std::unique_ptr< Transformation3dgetInverse () const CARTO_OVERRIDE
 
aims::PythonHeaderheader ()
 
const aims::PythonHeaderheader () const
 
void setHeader (aims::PythonHeader *ph)
 
Point3df translation ()
 
Point3df translation () const
 
AimsData< float > rotation ()
 
const AimsData< float > rotation () const
 
carto::VolumeRef< float > affine ()
 
const carto::VolumeRef< float > affine () const
 
virtual void setMatrix (const carto::VolumeRef< float > &mat)
 
virtual void setMatrix (const AimsData< 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)
 
virtual bool operator== (const AffineTransformation3dBase &) const
 
AffineTransformation3dBaseoperator*= (const AffineTransformation3dBase &trans)
 
AffineTransformation3dBase operator- () const
 
Point3dd transformVector (const Point3dd &vec) const
 
Point3df transformVector (const Point3df &dir) const
 
Point3dd transformVector (double x, double y, double z) const
 
Point3df transformVector (float x, float y, float z) 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 ()
 
AffineTransformation3dBase inverse () const
 
bool invertible () const CARTO_OVERRIDE
 
virtual void scale (const Point3df &sizeFrom, const Point3df &sizeTo)
 
bool isDirect () const
 
void setTranslation (Point3df trans)
 
std::vector< float > toVector () const
 
std::vector< float > toColumnVector () const
 
void fromColumnVector (const std::vector< float > &vec)
 
void fromColumnVector (const float *vec)
 
Table< float > & matrix ()
 
const Table< float > & matrix () const
 
- 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
 
- Public Member Functions inherited from soma::Transformation
virtual ~Transformation ()
 
- Public Member Functions inherited from carto::RCObject
 RCObject ()
 
 RCObject (const RCObject &)
 
RCObjectoperator= (const RCObject &)
 
virtual ~RCObject ()
 

Static Public Member Functions

static AimsData< float > rotationaroundx (float rx)
 
static AimsData< float > rotationaroundy (float ry)
 
static AimsData< float > rotationaroundz (float rz)
 

Protected Attributes

aims::PythonHeader_header
 
- Protected Attributes inherited from soma::AffineTransformation3dBase
Table< float > _matrix
 

Additional Inherited Members

- Public Types inherited from carto::RCObject
typedef int RefCounterType
 
- 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
 
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 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
 
- Protected Member Functions inherited from soma::Transformation
 Transformation ()
 

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 AimsData for rotation() and Point3df for translation(), and the header.

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:

  • forward declarations for the Motion class will not work any longer, since Motion is not a class anymore but a typedef. It is still possible to replace:
    class Motion;
    by: but of course it is better to use directly the AffineTransformation3d class under its real name.
  • there are several overloaded transform() methods taking double, or float numbers, or Point3df or Point3dd arguments. As there were formerly only float and Point3df arguments, ambiguities may raise from calling them with mixed double/float arguments
  • the base soma::Transformation class and its typedef in aims namespace introduces a name ambiguity with anatomist anatomist::Transformation class, so it now requires to handle namespaces carefully.

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 allready 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 (AimsData, Volume, Quaternion).
  • AffineTransformation3d::rotation does not return a reference any longer. Code using it as a reference should be modified. As the returned AimsData object is itself a reference to the transformation array, changging 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 modity 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]

aims::AffineTransformation3d::AffineTransformation3d ( )

Create an identity transformation.

◆ 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<Transformation3d> aims::AffineTransformation3d::getInverse ( ) const
virtual

Reimplemented from soma::AffineTransformation3dBase.

◆ header() [1/2]

aims::PythonHeader* aims::AffineTransformation3d::header ( )
inline

Definition at line 181 of file affinetransformation3d.h.

References _header.

◆ header() [2/2]

const aims::PythonHeader* aims::AffineTransformation3d::header ( ) const
inline

◆ inverse()

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 std::vector< float > &  mat)
virtual

Reimplemented from soma::AffineTransformation3dBase.

◆ operator=() [3/4]

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

Reimplemented from soma::AffineTransformation3dBase.

◆ operator=() [4/4]

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

◆ operator==()

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

◆ rotation() [1/2]

AimsData< float > aims::AffineTransformation3d::rotation ( )
inline

◆ rotation() [2/2]

const AimsData< float > aims::AffineTransformation3d::rotation ( ) const
inline

◆ rotationaroundx()

static AimsData<float> aims::AffineTransformation3d::rotationaroundx ( float  rx)
static

Referenced by header().

◆ rotationaroundy()

static AimsData<float> aims::AffineTransformation3d::rotationaroundy ( float  ry)
static

Referenced by header().

◆ rotationaroundz()

static AimsData<float> aims::AffineTransformation3d::rotationaroundz ( float  rz)
static

Referenced by header().

◆ setHeader()

void aims::AffineTransformation3d::setHeader ( aims::PythonHeader ph)

Referenced by header().

◆ setMatrix() [1/2]

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

Referenced by header().

◆ setMatrix() [2/2]

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

◆ setRotationAffine()

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

Reimplemented in aims::DecomposedAffineTransformation3d.

Referenced by header().

◆ translation() [1/2]

Point3df aims::AffineTransformation3d::translation ( )
inline

◆ translation() [2/2]

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

Member Data Documentation

◆ _header

aims::PythonHeader* aims::AffineTransformation3d::_header
protected

Definition at line 207 of file affinetransformation3d.h.

Referenced by header().


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