soma-io 6.0.6
soma::Transformation Class Referenceabstract

Polymorphic base class for spatial transformations. More...

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

Inheritance diagram for soma::Transformation:
Collaboration diagram for soma::Transformation:

Public Member Functions

virtual ~Transformation ()
 
virtual Transformationoperator= (const Transformation &other)
 
virtual bool isIdentity () const
 Test if the transformation can safely be omitted.
 
carto::Object header ()
 
const carto::Object header () const
 
void setHeader (carto::Object ph)
 
virtual std::vector< double > transform (const std::vector< double > &pos) const =0
 
virtual std::vector< float > transform (const std::vector< float > &pos) const
 
virtual std::vector< int > transform (const std::vector< int > &pos) 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
 
virtual bool invertible () const
 Test if the transformation can be inverted.
 
virtual std::unique_ptr< TransformationgetInverse () const
 Obtain the inverse transformation.
 
virtual bool isDirect () const =0
 true if the transformation is direct, false if it changes orientation
 
- Public Member Functions inherited from carto::RCObject
 RCObject ()
 
 RCObject (const RCObject &)
 
RCObjectoperator= (const RCObject &)
 
virtual ~RCObject ()
 

Static Public Member Functions

template<typename T>
static std::vector< T > vadd (const std::vector< T > &v1, const std::vector< T > &v2)
 vector arithmetics, as convenience static functions
 
template<typename T>
static std::vector< T > vsub (const std::vector< T > &v1, const std::vector< T > &v2)
 vector arithmetics, as convenience static functions
 
template<typename T>
static std::vector< T > vadd (const std::vector< T > &v1, const T &v2)
 vector arithmetics, as convenience static functions
 
template<typename T>
static std::vector< T > vsub (const std::vector< T > &v1, const T &v2)
 vector arithmetics, as convenience static functions
 
template<typename T>
static std::vector< T > vadd (const T &v1, const std::vector< T > &v2)
 vector arithmetics, as convenience static functions
 
template<typename T>
static std::vector< T > vsub (const T &v1, const std::vector< T > &v2)
 vector arithmetics, as convenience static functions
 

Protected Member Functions

 Transformation ()
 

Protected Attributes

carto::Object _header
 

Additional Inherited Members

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

Detailed Description

Polymorphic base class for spatial transformations.

In Soma-IO 5.1 (2022) the header() has beed added in the base Transformation class, whereas it used to be only in Aims AffineTransformation3d. Now all transformations variants have a header.

Definition at line 57 of file transformation.h.

Constructor & Destructor Documentation

◆ ~Transformation()

virtual soma::Transformation::~Transformation ( )
virtual

◆ Transformation()

soma::Transformation::Transformation ( )
protected

Member Function Documentation

◆ getInverse()

virtual std::unique_ptr< Transformation > soma::Transformation::getInverse ( ) const
inlinevirtual

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 in soma::AffineTransformation3dBase, and soma::AffineTransformationBase.

Definition at line 112 of file transformation.h.

◆ header() [1/2]

carto::Object soma::Transformation::header ( )
inline

Definition at line 80 of file transformation.h.

References _header.

◆ header() [2/2]

const carto::Object soma::Transformation::header ( ) const
inline

Definition at line 81 of file transformation.h.

References _header.

◆ invertible()

virtual bool soma::Transformation::invertible ( ) const
inlinevirtual

Test if the transformation can be inverted.

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

Reimplemented in soma::AffineTransformation3dBase, and soma::AffineTransformationBase.

Definition at line 102 of file transformation.h.

◆ isDirect()

virtual bool soma::Transformation::isDirect ( ) const
pure virtual

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

Implemented in soma::AffineTransformationBase.

References vadd(), and vsub().

◆ isIdentity()

virtual bool soma::Transformation::isIdentity ( ) const
inlinevirtual

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 in soma::AffineTransformation3dBase, and soma::AffineTransformationBase.

Definition at line 75 of file transformation.h.

◆ operator=()

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

References Transformation().

◆ setHeader()

void soma::Transformation::setHeader ( carto::Object ph)

◆ transform() [1/3]

◆ transform() [2/3]

std::vector< float > soma::Transformation::transform ( const std::vector< float > & pos) const
inlinevirtual

◆ transform() [3/3]

std::vector< int > soma::Transformation::transform ( const std::vector< int > & pos) const
inlinevirtual

◆ transformVector() [1/3]

std::vector< double > soma::Transformation::transformVector ( const std::vector< double > & pos) const
inlinevirtual

◆ transformVector() [2/3]

std::vector< float > soma::Transformation::transformVector ( const std::vector< float > & pos) const
inlinevirtual

Reimplemented in soma::AffineTransformation3dBase, and soma::Transformation3d.

Definition at line 229 of file transformation.h.

References transformVector().

◆ transformVector() [3/3]

std::vector< int > soma::Transformation::transformVector ( const std::vector< int > & pos) const
inlinevirtual

Reimplemented in soma::AffineTransformation3dBase, and soma::Transformation3d.

Definition at line 238 of file transformation.h.

References transformVector().

◆ vadd() [1/3]

template<typename T>
std::vector< T > soma::Transformation::vadd ( const std::vector< T > & v1,
const std::vector< T > & v2 )
inlinestatic

vector arithmetics, as convenience static functions

Definition at line 435 of file transformation.h.

References vadd().

Referenced by isDirect(), vadd(), vadd(), and vadd().

◆ vadd() [2/3]

template<typename T>
std::vector< T > soma::Transformation::vadd ( const std::vector< T > & v1,
const T & v2 )
inlinestatic

vector arithmetics, as convenience static functions

Definition at line 479 of file transformation.h.

References vadd().

◆ vadd() [3/3]

template<typename T>
std::vector< T > soma::Transformation::vadd ( const T & v1,
const std::vector< T > & v2 )
inlinestatic

vector arithmetics, as convenience static functions

Definition at line 509 of file transformation.h.

References vadd().

◆ vsub() [1/3]

template<typename T>
std::vector< T > soma::Transformation::vsub ( const std::vector< T > & v1,
const std::vector< T > & v2 )
inlinestatic

vector arithmetics, as convenience static functions

Definition at line 457 of file transformation.h.

References vsub().

Referenced by isDirect(), vsub(), vsub(), and vsub().

◆ vsub() [2/3]

template<typename T>
std::vector< T > soma::Transformation::vsub ( const std::vector< T > & v1,
const T & v2 )
inlinestatic

vector arithmetics, as convenience static functions

Definition at line 494 of file transformation.h.

References vsub().

◆ vsub() [3/3]

template<typename T>
std::vector< T > soma::Transformation::vsub ( const T & v1,
const std::vector< T > & v2 )
inlinestatic

vector arithmetics, as convenience static functions

Definition at line 524 of file transformation.h.

References vsub().

Member Data Documentation

◆ _header

carto::Object soma::Transformation::_header
protected

Definition at line 146 of file transformation.h.

Referenced by header(), and header().


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