aimsdata  5.0.5
Neuroimaging data handling
aims::TransformationChain3d Class Reference

Container for a composition of multiple transformations. More...

#include <aims/transformation/transformation_chain.h>

Inheritance diagram for aims::TransformationChain3d:
Collaboration diagram for aims::TransformationChain3d:

Public Types

typedef std::list< carto::const_ref< Transformation3d > > ListType
 
- Public Types inherited from carto::RCObject
typedef int RefCounterType
 

Public Member Functions

 TransformationChain3d ()
 
void push_back (const carto::const_ref< Transformation3d > &transformation)
 Add a transformation to the back of the list (applied last) More...
 
void pop_back ()
 Remove the last transformation from the list. More...
 
void push_front (const carto::const_ref< Transformation3d > &transformation)
 Add a transformation to the front of the list (applied first) More...
 
void pop_front ()
 Remove the first transformation from the list. More...
 
bool isIdentity () const CARTO_OVERRIDE
 
bool invertible () const CARTO_OVERRIDE
 
std::unique_ptr< soma::Transformation3dgetInverse () const CARTO_OVERRIDE
 
carto::const_ref< soma::Transformation3dsimplify () const
 Compute a simpler transformation that is equivalent to the chain. More...
 
- 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
 
Point3dd transformPoint3dd (const Point3dd &pos) const CARTO_OVERRIDE
 
Point3df transformPoint3df (const Point3df &dir) const CARTO_OVERRIDE
 
- Protected Member Functions inherited from soma::Transformation3d
 Transformation3d ()
 
virtual Point3d transformPoint3d (const Point3d &p) const
 
- Protected Member Functions inherited from soma::Transformation
 Transformation ()
 

Protected Attributes

ListType _transformations
 

Detailed Description

Container for a composition of multiple transformations.

This container holds a list of transformations, and acts as the composition of all transformations. Transformations are composed from the front to the back of the list:

rc_ptr<TransformationChain3d>(new TransformationChain3d())
chain->push_back(t1)
chain->push_back(t2)
// chain->transform(p) == t2->transform(t1->transform(p))
Warning
{Do not modify the transformations once you have passed them to push_back() or push_front(): it is unspecified if the changes will be noticed by TransformationChain3d (a reference to the same object may be kept internally, or a copy could be made). This behaviour will allow optimizations to be implemented (e.g. composing adjacent affine transformations by multiplying their matrices).

Definition at line 65 of file transformation_chain.h.

Member Typedef Documentation

◆ ListType

Constructor & Destructor Documentation

◆ TransformationChain3d()

aims::TransformationChain3d::TransformationChain3d ( )

Member Function Documentation

◆ getInverse()

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

Reimplemented from soma::Transformation3d.

◆ invertible()

bool aims::TransformationChain3d::invertible ( ) const
virtual

Reimplemented from soma::Transformation3d.

◆ isIdentity()

bool aims::TransformationChain3d::isIdentity ( ) const
virtual

Reimplemented from soma::Transformation.

◆ pop_back()

void aims::TransformationChain3d::pop_back ( )

Remove the last transformation from the list.

◆ pop_front()

void aims::TransformationChain3d::pop_front ( )

Remove the first transformation from the list.

◆ push_back()

void aims::TransformationChain3d::push_back ( const carto::const_ref< Transformation3d > &  transformation)

Add a transformation to the back of the list (applied last)

◆ push_front()

void aims::TransformationChain3d::push_front ( const carto::const_ref< Transformation3d > &  transformation)

Add a transformation to the front of the list (applied first)

◆ simplify()

carto::const_ref<soma::Transformation3d> aims::TransformationChain3d::simplify ( ) const

Compute a simpler transformation that is equivalent to the chain.

The transformation chain is simplified by applying the following rules, so that it should provide equivalent results to the original chain, up to numerical precision:

  • The simplification is applied recursively to any sub-chain.
  • Transformations of the simplified sub-chains are inserted at the top level (i.e. the simplified chain is flat, it contains no sub-chains).
  • Consecutive affine transformations are composed using matrix multiplication.
  • Identity transforms (i.e. transforms for which Transformation::isIdentity() returns true) are removed from the list.
  • If the simplified chain consists of only one transformation, no chain is returned, the contained transformation is returned directly. However, the transformation is not necessarily the same instance that was inserted in the chain (it will be a copy if it is an AffineTransformation3d).
  • If the simplified chain is empty, an empty chain is returned.

No deep copy is made, so the result can contain pointers to the same transformations as the original chain.

◆ transformDouble()

Point3dd aims::TransformationChain3d::transformDouble ( double  x,
double  y,
double  z 
) const
protectedvirtual

◆ transformFloat()

Point3df aims::TransformationChain3d::transformFloat ( float  x,
float  y,
float  z 
) const
protectedvirtual

Reimplemented from soma::Transformation3d.

◆ transformPoint3dd()

Point3dd aims::TransformationChain3d::transformPoint3dd ( const Point3dd pos) const
protectedvirtual

Reimplemented from soma::Transformation3d.

◆ transformPoint3df()

Point3df aims::TransformationChain3d::transformPoint3df ( const Point3df dir) const
protectedvirtual

Reimplemented from soma::Transformation3d.

Member Data Documentation

◆ _transformations

ListType aims::TransformationChain3d::_transformations
protected

Definition at line 116 of file transformation_chain.h.


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