soma-io  5.0.5
soma::AffineTransformation3dBase Class Reference

Affine 3D transformation. More...

#include <soma-io/transformation/affinetransformation3d_base.h>

Inheritance diagram for soma::AffineTransformation3dBase:
Collaboration diagram for soma::AffineTransformation3dBase:

Classes

class  Table
 

Public Member Functions

 AffineTransformation3dBase ()
 Create an identity transformation. More...
 
 AffineTransformation3dBase (const AffineTransformation3dBase &other)
 
 AffineTransformation3dBase (const std::vector< float > &mat)
 Create a AffineTransformation3d from a 4x4 matrix given as a line vector. More...
 
 AffineTransformation3dBase (const carto::Object mat)
 Create a AffineTransformation3d from a 4x4 matrix given as a line vector in an Object. More...
 
virtual ~AffineTransformation3dBase ()
 
virtual AffineTransformation3dBaseoperator= (const AffineTransformation3dBase &other)
 
virtual AffineTransformation3dBaseoperator= (const std::vector< float > &mat)
 
virtual AffineTransformation3dBaseoperator= (const carto::Object mat)
 
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
 Test if the transformation can safely be omitted. More...
 
virtual void setToIdentity ()
 
AffineTransformation3dBase inverse () const
 
bool invertible () const CARTO_OVERRIDE
 Test if the transformation can be inverted. More...
 
std::unique_ptr< Transformation3dgetInverse () const CARTO_OVERRIDE
 Obtain the inverse transformation. More...
 
virtual void scale (const Point3df &sizeFrom, const Point3df &sizeTo)
 
bool isDirect () const
 true if the transformation is direct, false if it changes orientation More...
 
void setTranslation (Point3df trans)
 
std::vector< float > toVector () const
 conversions and IO) More...
 
std::vector< float > toColumnVector () const
 transform AffineTransformation3d to a column vector (useful for conversions to OpenGL matrices) More...
 
void fromColumnVector (const std::vector< float > &vec)
 transform a column vector to an AffineTransformation3d (useful for conversions from OpenGL matrices) More...
 
void fromColumnVector (const float *vec)
 transform a column vector to an AffineTransformation3d (useful for conversions from OpenGL matrices) More...
 
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 ()
 

Protected Member Functions

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 ()
 

Protected Attributes

Table< float > _matrix
 

Additional Inherited Members

- Public Types inherited from carto::RCObject
typedef int RefCounterType
 

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. It has been partly moved to Soma-IO in soma-io/aims 4.7 since it is needed in IO systems.

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:
    namespace aims { class AffineTransformation3d; }
    typedef aims::AffineTransformation3d Motion;
    but of course it is better to use directly the AffineTransformation3d class under its real name.
  • the Motion::transform_normal() method is now transformUnitNormal()
  • there are now 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 aims::Transformation class introduces a name ambiguity with anatomist anatomist::Transformation class, so it now requires to handle namespaces carefully.
  • the Motion DataTypeCode has also changed to AffineTransformation3d.

Definition at line 92 of file affinetransformation3d_base.h.

Constructor & Destructor Documentation

◆ AffineTransformation3dBase() [1/4]

soma::AffineTransformation3dBase::AffineTransformation3dBase ( )

Create an identity transformation.

◆ AffineTransformation3dBase() [2/4]

soma::AffineTransformation3dBase::AffineTransformation3dBase ( const AffineTransformation3dBase other)

◆ AffineTransformation3dBase() [3/4]

soma::AffineTransformation3dBase::AffineTransformation3dBase ( const std::vector< float > &  mat)

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

◆ AffineTransformation3dBase() [4/4]

soma::AffineTransformation3dBase::AffineTransformation3dBase ( const carto::Object  mat)

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

◆ ~AffineTransformation3dBase()

virtual soma::AffineTransformation3dBase::~AffineTransformation3dBase ( )
virtual

Member Function Documentation

◆ fromColumnVector() [1/2]

void soma::AffineTransformation3dBase::fromColumnVector ( const std::vector< float > &  vec)
inline

transform a column vector to an AffineTransformation3d (useful for conversions from OpenGL matrices)

Definition at line 189 of file affinetransformation3d_base.h.

◆ fromColumnVector() [2/2]

void soma::AffineTransformation3dBase::fromColumnVector ( const float *  vec)

transform a column vector to an AffineTransformation3d (useful for conversions from OpenGL matrices)

◆ getInverse()

std::unique_ptr<Transformation3d> soma::AffineTransformation3dBase::getInverse ( ) const
virtual

Obtain the inverse transformation.

This method should only be called if invertible() returns true. Otherwise, it will throw an exception if the transformation is not actually invertible.

Reimplemented from soma::Transformation3d.

◆ inverse()

AffineTransformation3dBase soma::AffineTransformation3dBase::inverse ( ) const

◆ invertible()

bool soma::AffineTransformation3dBase::invertible ( ) const
virtual

Test if the transformation can be inverted.

getInverse() can be called if this method returns true, in order to obtain the inverse transformation.

Reimplemented from soma::Transformation3d.

◆ isDirect()

bool soma::AffineTransformation3dBase::isDirect ( ) const

true if the transformation is direct, false if it changes orientation

◆ isIdentity()

bool soma::AffineTransformation3dBase::isIdentity ( ) const
virtual

Test if the transformation can safely be omitted.

This method returns true only if the transformation behaves exactly like an identity transformation (notably, the transform methods will always return the input coordinates unchanged).

Note
{Implementors of derived classes may choose to always return false if a test would be difficult to implement or expensive to run. As a result, a false result does not guarantee in general that the transformation is different from identity.}

Reimplemented from soma::Transformation.

◆ matrix() [1/2]

Table<float>& soma::AffineTransformation3dBase::matrix ( )
inline

Definition at line 196 of file affinetransformation3d_base.h.

References _matrix.

◆ matrix() [2/2]

◆ operator*=()

AffineTransformation3dBase& soma::AffineTransformation3dBase::operator*= ( const AffineTransformation3dBase trans)

◆ operator-()

AffineTransformation3dBase soma::AffineTransformation3dBase::operator- ( ) const

◆ operator=() [1/3]

virtual AffineTransformation3dBase& soma::AffineTransformation3dBase::operator= ( const AffineTransformation3dBase other)
virtual

◆ operator=() [2/3]

virtual AffineTransformation3dBase& soma::AffineTransformation3dBase::operator= ( const std::vector< float > &  mat)
virtual

◆ operator=() [3/3]

virtual AffineTransformation3dBase& soma::AffineTransformation3dBase::operator= ( const carto::Object  mat)
virtual

◆ operator==()

virtual bool soma::AffineTransformation3dBase::operator== ( const AffineTransformation3dBase ) const
virtual

◆ scale()

virtual void soma::AffineTransformation3dBase::scale ( const Point3df sizeFrom,
const Point3df sizeTo 
)
virtual

◆ setToIdentity()

virtual void soma::AffineTransformation3dBase::setToIdentity ( )
virtual

◆ setTranslation()

void soma::AffineTransformation3dBase::setTranslation ( Point3df  trans)

◆ toColumnVector()

std::vector<float> soma::AffineTransformation3dBase::toColumnVector ( ) const

transform AffineTransformation3d to a column vector (useful for conversions to OpenGL matrices)

◆ toVector()

std::vector<float> soma::AffineTransformation3dBase::toVector ( ) const

conversions and IO)

◆ transformDouble()

Point3dd soma::AffineTransformation3dBase::transformDouble ( double  x,
double  y,
double  z 
) const
protectedvirtual

Implements soma::Transformation3d.

Referenced by matrix().

◆ transformFloat()

Point3df soma::AffineTransformation3dBase::transformFloat ( float  x,
float  y,
float  z 
) const
protectedvirtual

Reimplemented from soma::Transformation3d.

Referenced by matrix().

◆ transformNormal() [1/4]

Point3dd soma::AffineTransformation3dBase::transformNormal ( const Point3dd dir) const
inline

◆ transformNormal() [2/4]

Point3df soma::AffineTransformation3dBase::transformNormal ( const Point3df dir) const
inline

Definition at line 272 of file affinetransformation3d_base.h.

References transformNormalPoint3df().

◆ transformNormal() [3/4]

Point3dd soma::AffineTransformation3dBase::transformNormal ( double  x,
double  y,
double  z 
) const
inline

Definition at line 258 of file affinetransformation3d_base.h.

References transformNormalDouble().

◆ transformNormal() [4/4]

Point3df soma::AffineTransformation3dBase::transformNormal ( float  x,
float  y,
float  z 
) const
inline

Definition at line 265 of file affinetransformation3d_base.h.

References transformNormalFloat().

◆ transformNormalDouble()

virtual Point3dd soma::AffineTransformation3dBase::transformNormalDouble ( double  x,
double  y,
double  z 
) const
protectedvirtual

Referenced by matrix(), and transformNormal().

◆ transformNormalFloat()

Point3df soma::AffineTransformation3dBase::transformNormalFloat ( float  x,
float  y,
float  z 
) const
inlineprotectedvirtual

◆ transformNormalPoint3dd()

Point3dd soma::AffineTransformation3dBase::transformNormalPoint3dd ( const Point3dd dir) const
inlineprotectedvirtual

Definition at line 310 of file affinetransformation3d_base.h.

References transformNormal(), and transformNormalFloat().

Referenced by matrix(), and transformNormal().

◆ transformNormalPoint3df()

Point3df soma::AffineTransformation3dBase::transformNormalPoint3df ( const Point3df dir) const
inlineprotectedvirtual

Definition at line 300 of file affinetransformation3d_base.h.

References transformNormal().

Referenced by matrix(), and transformNormal().

◆ transformUnitNormal() [1/4]

Point3dd soma::AffineTransformation3dBase::transformUnitNormal ( const Point3dd dir) const
inline

Definition at line 347 of file affinetransformation3d_base.h.

Referenced by transformNormalFloat(), and transformUnitNormal().

◆ transformUnitNormal() [2/4]

Point3df soma::AffineTransformation3dBase::transformUnitNormal ( const Point3df dir) const
inline

Definition at line 336 of file affinetransformation3d_base.h.

References transformUnitNormal().

◆ transformUnitNormal() [3/4]

Point3dd soma::AffineTransformation3dBase::transformUnitNormal ( double  x,
double  y,
double  z 
) const
inline

◆ transformUnitNormal() [4/4]

Point3df soma::AffineTransformation3dBase::transformUnitNormal ( float  x,
float  y,
float  z 
) const
inline

Definition at line 355 of file affinetransformation3d_base.h.

References transformUnitNormal().

◆ transformVector() [1/4]

Point3dd soma::AffineTransformation3dBase::transformVector ( const Point3dd vec) const
inline

Definition at line 251 of file affinetransformation3d_base.h.

References transformVectorPoint3dd().

Referenced by transformVectorPoint3dd().

◆ transformVector() [2/4]

Point3df soma::AffineTransformation3dBase::transformVector ( const Point3df dir) const
inline

Definition at line 244 of file affinetransformation3d_base.h.

References transformVectorPoint3df().

◆ transformVector() [3/4]

Point3dd soma::AffineTransformation3dBase::transformVector ( double  x,
double  y,
double  z 
) const
inline

Definition at line 230 of file affinetransformation3d_base.h.

References transformVectorDouble().

◆ transformVector() [4/4]

Point3df soma::AffineTransformation3dBase::transformVector ( float  x,
float  y,
float  z 
) const
inline

Definition at line 237 of file affinetransformation3d_base.h.

References transformVectorFloat().

◆ transformVectorDouble()

virtual Point3dd soma::AffineTransformation3dBase::transformVectorDouble ( double  x,
double  y,
double  z 
) const
protectedvirtual

Referenced by matrix(), and transformVector().

◆ transformVectorFloat()

virtual Point3df soma::AffineTransformation3dBase::transformVectorFloat ( float  x,
float  y,
float  z 
) const
protectedvirtual

◆ transformVectorPoint3dd()

Point3dd soma::AffineTransformation3dBase::transformVectorPoint3dd ( const Point3dd vec) const
inlineprotectedvirtual

Definition at line 293 of file affinetransformation3d_base.h.

References transformVector().

Referenced by matrix(), and transformVector().

◆ transformVectorPoint3df()

Point3df soma::AffineTransformation3dBase::transformVectorPoint3df ( const Point3df dir) const
inlineprotectedvirtual

Definition at line 286 of file affinetransformation3d_base.h.

References transformVectorFloat().

Referenced by matrix(), and transformVector().

Member Data Documentation

◆ _matrix

Table<float> soma::AffineTransformation3dBase::_matrix
protected

Definition at line 214 of file affinetransformation3d_base.h.

Referenced by matrix().


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