|
cartodata 6.0.0
|
Referential holds information about coordinates system and axes. More...
#include <cartodata/transformation/referential.h>


Public Types | |
| enum | Orientation { Undefined , L , R , A , P , S , I , T , t , U , u , V , v , W , w , X , x , Y , y , Z , z } |
| Axis orientation enum. More... | |
Public Member Functions | |
| Referential (unsigned ndim=3) | |
| Build a referential with the given number of dimensions. | |
| Referential (const Referential &ref) | |
| Referential (Object ref) | |
| ~Referential () | |
| Referential & | operator= (const Referential &ref) |
| unsigned | order () const |
| number of axes (or space dimensions) | |
| void | ensureOrder (unsigned ndim) |
| update the order, keeping existing orientation information | |
| const std::string & | uuid () const |
| a referential has an unique identifier | |
| std::string & | uuid () |
| std::string | orientationStr () const |
| orientation of the referential, as a string of one letter per axis | |
| std::string | orientationStr (const std::string &orient) const |
| extended orientation information according to the needed number of axes | |
| std::vector< int > | axesOrientation () const |
| orientation of the referential, as a vector of constants. | |
| bool | isDirect () const |
| rc_ptr< Transformation > | toOrientation (const std::string &orient, const std::vector< float > &transl=std::vector< float >(), bool allow_resize=false) const |
| Build a transformation matrix to go from this referential to a given orientation. | |
| rc_ptr< Transformation > | toOrientation (const std::string &orient, const std::vector< int > &transl, bool allow_resize=false) const |
| same as above but translation is given as ints | |
| rc_ptr< Transformation > | toOrientation (const std::vector< int > &orient, const std::vector< float > &transl=std::vector< float >()) const |
| Build a transformation matrix to go from this referential to a given orientation. | |
| std::string | lpiReferentialUuid () const |
| LPI oriented referential. | |
| void | setUuid (const std::string &uuid) |
| force a new UUID | |
| void | setOrientation (const std::string &orient, bool allow_resize=false) |
| set a new orientation for the referential. | |
| void | setOrientation (const std::vector< int > &orient) |
| set a new orientation for the referential. | |
| void | setLpiReferential (const std::string &lpi_uuid) |
| set the LPI original referential UUID | |
| Object | header () const |
| referential header, may contain anything useful | |
| void | setHeader (const Object header) |
| Object | exportedHeader () const |
| export a ready-to-save version of the header, where, especially, the axes_orientation property is an orientation string | |
| bool | is3DOriented () const |
| tells if the orientation is comatible with a 3D transformation (all axes after the 3th are the default ones) | |
| bool | is3DOriented (const std::string &orient) const |
| tells if the given orientation is 3D compatible | |
| bool | isLpiOriented () const |
| tells if the orientation is the default LPI one. | |
| std::vector< int > | orientationFromTransform (const AffineTransformationBase &tr) const |
| target orientation for a given transform matrix. | |
Static Public Member Functions | |
| static std::string | orientationStr (Orientation orient) |
| orientation string for a single axis orientation (1 char) | |
| static std::string | orientationStr (const std::vector< int > &orient) |
| build the orientation string from a vector of constants | |
| static Orientation | orientationCode (const std::string &orient) |
| orientation constant for a single orientation axis character | |
| static std::vector< int > | orientationVector (const std::string &orient, unsigned dim=0) |
| build an orientation vector from a string. | |
| static void | setAxisTransform (AffineTransformationBase &tr, int src_axis, int dst_axis, int inv_mult, const std::vector< float > &transl=std::vector< float >()) |
| Build one line of transformation matrix. | |
| static bool | is3DOriented (const std::vector< int > &orient) |
| tells if the given orientation is 3D compatible | |
| static Referential | fromHeader (const Object header, bool except_if_undefined=false) |
| Build a Referential object from a header. | |
Referential holds information about coordinates system and axes.
It also provides utility methods to transform to other coordinates orientations.
Orientation describes the coordinates system axes, what they represent and in which direction they go.
The orientation description is either a vector of constants (Orientaton enum), or a string containing one letter per axis. Each letter or Orientation enum value describes the axis and its direction. It is based on the Left/Right, Anterior/Posterior, Superior/Inferior convention, see:
http://www.grahamwideman.com/gw/brain/orientation/orientterms.htm
For brain images, axes orientations are described relatively to the head: AP (anterior to posterior) or PA, LR (left to right) or RL, SI (superior to inferior) or IS. To summarize the 3 axes we sometimes use the 3 initials of the directions axes are pointing to: RAS (X: to Right, Y: to Anterior, Z: to Superior), LAS, LPI, etc.
This convention used in the neuroimaging community is valid for 3D images. Here we extend it to up to 10 dimensions, using letters T to Z, with uppercase for increasing order, and lowercase for decreasing order. Thus, T can hopefully correspond to "time". But be careful that letters X, Y, Z here do not correspond to the common "1st, 2nd and 3rd axes": here it is the meaning of axes.
Orientation strings may be given as "incomplete" strings, and will in most cases be extended to the actual number of dimensions, using default axes to complement. Thus, for a 5D referential, "LPI" is the same sas "LPITU".
Definition at line 77 of file referential.h.
Axis orientation enum.
| Enumerator | |
|---|---|
| Undefined | |
| L | |
| R | |
| A | |
| P | |
| S | |
| I | |
| T | |
| t | |
| U | |
| u | |
| V | |
| v | |
| W | |
| w | |
| X | |
| x | |
| Y | |
| y | |
| Z | |
| z | |
Definition at line 82 of file referential.h.
| carto::Referential::Referential | ( | unsigned | ndim = 3 | ) |
Build a referential with the given number of dimensions.
Referenced by fromHeader(), operator=(), and Referential().
| carto::Referential::Referential | ( | const Referential & | ref | ) |
References carto::RCObject::ref, and Referential().
| carto::Referential::Referential | ( | Object | ref | ) |
References carto::RCObject::ref.
| carto::Referential::~Referential | ( | ) |
|
inline |
orientation of the referential, as a vector of constants.
Each number corresponds to an Orientation enum value, but cast to int
Definition at line 128 of file referential.h.
| void carto::Referential::ensureOrder | ( | unsigned | ndim | ) |
update the order, keeping existing orientation information
| Object carto::Referential::exportedHeader | ( | ) | const |
export a ready-to-save version of the header, where, especially, the axes_orientation property is an orientation string
|
static |
Build a Referential object from a header.
This is basically the same as the constructor Referential( Object ) except that if except_if_undefined is set, and if the header does not specify an orientation, then an exception is thrown.
References header(), and Referential().
|
inline |
referential header, may contain anything useful
Definition at line 199 of file referential.h.
Referenced by fromHeader(), and setHeader().
| bool carto::Referential::is3DOriented | ( | ) | const |
tells if the orientation is comatible with a 3D transformation (all axes after the 3th are the default ones)
| bool carto::Referential::is3DOriented | ( | const std::string & | orient | ) | const |
tells if the given orientation is 3D compatible
|
static |
tells if the given orientation is 3D compatible
| bool carto::Referential::isDirect | ( | ) | const |
| bool carto::Referential::isLpiOriented | ( | ) | const |
tells if the orientation is the default LPI one.
Referenced by lpiReferentialUuid().
|
inline |
LPI oriented referential.
AIMS volumes are initially in LPI orientation. If flipped, the referential will change to a diferent one. The LPI referential is the original one before any flip is applied.
Definition at line 174 of file referential.h.
References isLpiOriented().
| Referential & carto::Referential::operator= | ( | const Referential & | ref | ) |
References carto::RCObject::ref, and Referential().
|
inline |
number of axes (or space dimensions)
Definition at line 116 of file referential.h.
|
static |
orientation constant for a single orientation axis character
| std::vector< int > carto::Referential::orientationFromTransform | ( | const AffineTransformationBase & | tr | ) | const |
target orientation for a given transform matrix.
The matrix should be a flip matrix, not any affine transform.
| std::string carto::Referential::orientationStr | ( | ) | const |
orientation of the referential, as a string of one letter per axis
| std::string carto::Referential::orientationStr | ( | const std::string & | orient | ) | const |
extended orientation information according to the needed number of axes
|
static |
build the orientation string from a vector of constants
|
static |
orientation string for a single axis orientation (1 char)
|
static |
build an orientation vector from a string.
If dim is given, the vector will be extended to this number of dimensions.
|
static |
Build one line of transformation matrix.
This rather internal function is used to build a transformation matrix. This function builds one line to get from a source axis to a destination one.
| void carto::Referential::setLpiReferential | ( | const std::string & | lpi_uuid | ) |
set the LPI original referential UUID
| void carto::Referential::setOrientation | ( | const std::string & | orient, |
| bool | allow_resize = false ) |
set a new orientation for the referential.
if allow_resize is false, the given orientation will decide the new axes number. If true, it will be updated to keep the older number of dimensions.
No other information will be changed.
Referenced by carto::Creator< Volume< T > >::create().
| void carto::Referential::setOrientation | ( | const std::vector< int > & | orient | ) |
set a new orientation for the referential.
| rc_ptr< Transformation > carto::Referential::toOrientation | ( | const std::string & | orient, |
| const std::vector< float > & | transl = std::vector< float >(), | ||
| bool | allow_resize = false ) const |
Build a transformation matrix to go from this referential to a given orientation.
If allow_resize is false, the matrix will have exactly the order of the given orientation. If it it true, it will be extended to the order of the referential.
The translation vector is used to build the last column of the transformation matrix: it is the origin shift needed when an axis is reversed. Typically it is the volume dimension (in mm, or the dimension -1 in voxels)
Referenced by toOrientation().
|
inline |
same as above but translation is given as ints
Definition at line 149 of file referential.h.
References toOrientation().
| rc_ptr< Transformation > carto::Referential::toOrientation | ( | const std::vector< int > & | orient, |
| const std::vector< float > & | transl = std::vector< float >() ) const |
Build a transformation matrix to go from this referential to a given orientation.
Same as above, but orientation is given as a vector of constants.
|
inline |
Definition at line 121 of file referential.h.
|
inline |
a referential has an unique identifier
Definition at line 120 of file referential.h.
Referenced by setUuid().