Labelled 4x4 FIFF affine: source frame, destination frame, rotation, translation and cached inverse. More...
#include <fiff_coord_trans.h>
Public Types | |
| using | SPtr = QSharedPointer<FiffCoordTrans> |
| using | ConstSPtr = QSharedPointer<const FiffCoordTrans> |
| using | UPtr = std::unique_ptr<FiffCoordTrans> |
| using | ConstUPtr = std::unique_ptr<const FiffCoordTrans> |
Public Member Functions | |
| FiffCoordTrans () | |
| FiffCoordTrans (QIODevice &p_IODevice) | |
| FiffCoordTrans (const FiffCoordTrans &p_FiffCoordTrans) | |
| FiffCoordTrans (int from, int to, const Eigen::Matrix3f &rot, const Eigen::Vector3f &move) | |
| FiffCoordTrans (int from, int to, const Eigen::Matrix4f &matTrans, bool bStandard=false) | |
| ~FiffCoordTrans () | |
| void | clear () |
| bool | invert_transform () |
| bool | isEmpty () const |
| Eigen::MatrixX3f | apply_trans (const Eigen::MatrixX3f &rr, bool do_move=true) const |
| Eigen::MatrixX3f | apply_inverse_trans (const Eigen::MatrixX3f &rr, bool do_move=true) const |
| FiffCoordTrans | inverted () const |
| void | print () const |
| void | write (QIODevice &p_IODevice) |
| Writes the transformation to file. | |
| void | writeToStream (FiffStream *p_pStream) |
| Writes the transformation to a FIFF stream. | |
| float | angleTo (Eigen::MatrixX4f mTransDest) |
| float | translationTo (Eigen::MatrixX4f mTransDest) |
Rotation/Translation Accessors | |
Provide Matrix3f/Vector3f views into the 4×4 homogeneous matrices, matching the legacy FiffCoordTransOld member layout (rot, move, invrot, invmove). Mutable overloads allow direct modification of the underlying matrix blocks. | |
| auto | rot () |
| auto | rot () const |
| auto | move () |
| auto | move () const |
| auto | invrot () |
| auto | invrot () const |
| auto | invmove () |
| auto | invmove () const |
Static Public Member Functions | |
| static bool | read (QIODevice &p_IODevice, FiffCoordTrans &p_Trans) |
| static FiffCoordTrans | readTransform (const QString &name, int from, int to) |
| static FiffCoordTrans | readMriTransform (const QString &name) |
| static FiffCoordTrans | readMeasTransform (const QString &name) |
| static FiffCoordTrans | readTransformAscii (const QString &name, int from, int to) |
| static FiffCoordTrans | readFShead2mriTransform (const QString &name) |
| static void | apply_trans (float r[3], const FiffCoordTrans &t, bool do_move) |
| static void | apply_inverse_trans (float r[3], const FiffCoordTrans &t, bool do_move) |
| static QString | frame_name (int frame) |
| static FiffCoordTrans | identity (int from, int to) |
| static FiffCoordTrans | combine (int from, int to, const FiffCoordTrans &t1, const FiffCoordTrans &t2) |
| static FiffCoordTrans | fromCardinalPoints (int from, int to, const float *rL, const float *rN, const float *rR) |
| static bool | addInverse (FiffCoordTrans &t) |
| static qint32 | storageSize () |
| static FiffCoordTrans | readFromTag (const std::unique_ptr< FiffTag > &tag) |
| static FiffCoordTrans | readTransformFromNode (FiffStream::SPtr &stream, const FiffDirNode::SPtr &node, int from, int to) |
| static FiffCoordTrans | procrustesAlign (int from_frame, int to_frame, const Eigen::MatrixXf &fromp, const Eigen::MatrixXf &top, const Eigen::VectorXf &w, float max_diff) |
Public Attributes | |
| fiff_int_t | from |
| fiff_int_t | to |
| Eigen::Matrix< float, 4, 4, Eigen::DontAlign > | trans |
| Eigen::Matrix< float, 4, 4, Eigen::DontAlign > | invtrans |
Friends | |
| bool | operator== (const FiffCoordTrans &a, const FiffCoordTrans &b) |
Labelled 4x4 FIFF affine: source frame, destination frame, rotation, translation and cached inverse.
Each transform carries its source (from) and destination (to) FIFFV_COORD_* frame identifiers so the inverse and any chained composition can be type-checked at runtime. The inverse is stored alongside the forward transform because both directions are routinely needed (device→head for head-position tracking, head→MRI for source space registration, etc.).
Definition at line 81 of file fiff_coord_trans.h.
| using FIFFLIB::FiffCoordTrans::ConstSPtr = QSharedPointer<const FiffCoordTrans> |
Const shared pointer type for FiffCoordTrans.
Definition at line 85 of file fiff_coord_trans.h.
| using FIFFLIB::FiffCoordTrans::ConstUPtr = std::unique_ptr<const FiffCoordTrans> |
Const unique pointer type for FiffCoordTrans.
Definition at line 87 of file fiff_coord_trans.h.
| using FIFFLIB::FiffCoordTrans::SPtr = QSharedPointer<FiffCoordTrans> |
Shared pointer type for FiffCoordTrans.
Definition at line 84 of file fiff_coord_trans.h.
| using FIFFLIB::FiffCoordTrans::UPtr = std::unique_ptr<FiffCoordTrans> |
Unique pointer type for FiffCoordTrans.
Definition at line 86 of file fiff_coord_trans.h.
| FIFFLIB::FiffCoordTrans::FiffCoordTrans | ( | ) |
Constructs the coordinate transformation descriptor.
| FIFFLIB::FiffCoordTrans::FiffCoordTrans | ( | QIODevice & | p_IODevice | ) |
Constructs a coordinate transformation, by reading from a IO device.
| [in] | p_IODevice | IO device to read from the coordinate transform. |
| FIFFLIB::FiffCoordTrans::FiffCoordTrans | ( | const FiffCoordTrans & | p_FiffCoordTrans | ) |
Copy constructor.
| [in] | p_FiffCoordTrans | Coordinate transformation description which should be copied. |
| FIFFLIB::FiffCoordTrans::FiffCoordTrans | ( | int | from, |
| int | to, | ||
| const Eigen::Matrix3f & | rot, | ||
| const Eigen::Vector3f & | move ) |
| FIFFLIB::FiffCoordTrans::FiffCoordTrans | ( | int | from, |
| int | to, | ||
| const Eigen::Matrix4f & | matTrans, | ||
| bool | bStandard = false ) |
| FIFFLIB::FiffCoordTrans::~FiffCoordTrans | ( | ) |
Destroys the coordinate transformation descriptor.
|
static |
| [in] | t | Fiff coordinate transform to which the inverse should be added. |
| float FIFFLIB::FiffCoordTrans::angleTo | ( | Eigen::MatrixX4f | mTransDest | ) |
Calculate rotation as angle between two rotation matrices
| [in] | mTransDest | The destination transformation matrix. |
| Eigen::MatrixX3f FIFFLIB::FiffCoordTrans::apply_inverse_trans | ( | const Eigen::MatrixX3f & | rr, |
| bool | do_move = true ) const |
Applies the inverse coordinate transform to given coordinates and returns the transformed coordinates
| [in] | rr | The coordinates. |
| [in] | do_move | Perform translation next to rotation yes/no. |
|
static |
Applies the inverse coordinate transform to a single 3D point in place.
| [in,out] | r | 3-element float array to transform in place. |
| [in] | t | The coordinate transformation whose inverse to apply. |
| [in] | do_move | If true, apply translation; if false, rotation only. |
| Eigen::MatrixX3f FIFFLIB::FiffCoordTrans::apply_trans | ( | const Eigen::MatrixX3f & | rr, |
| bool | do_move = true ) const |
TODO: dest - The id of the destination coordinate system (FIFFV_COORD_...)
Applies the coordinate transform to given coordinates and returns the transformed coordinates
| [in] | rr | The coordinates. |
| [in] | do_move | Perform translation next to rotation yes/no. |
|
static |
Applies the coordinate transform to a single 3D point in place.
| [in,out] | r | 3-element float array to transform in place. |
| [in] | t | The coordinate transformation to apply. |
| [in] | do_move | If true, apply translation; if false, rotation only. |
| void FIFFLIB::FiffCoordTrans::clear | ( | ) |
Initializes the coordinate transformation descriptor.
|
static |
Combines two coordinate transformations to yield a transform from from to to. Automatically handles inversion and ordering of the input transforms.
| [in] | from | Desired source coordinate system. |
| [in] | to | Desired destination coordinate system. |
| [in] | t1 | First transformation. |
| [in] | t2 | Second transformation. |
|
static |
Map coordinate frame integers to human-readable names
| [in] | frame | The coordinate frame integer. |
|
static |
Constructs a coordinate transformation from cardinal points (LPA, Nasion, RPA).
| [in] | from | Source coordinate system. |
| [in] | to | Destination coordinate system (in which the points are expressed). |
| [in] | rL | Left auricular point (3 floats). |
| [in] | rN | Nasion point (3 floats). |
| [in] | rR | Right auricular point (3 floats). |
|
static |
| bool FIFFLIB::FiffCoordTrans::invert_transform | ( | ) |
Invert a coordinate transformation (actual obsolete - cause trans and inverse are both stored)
| FiffCoordTrans FIFFLIB::FiffCoordTrans::inverted | ( | ) | const |
Returns a new inverted copy of this transformation (swaps from/to and trans/invtrans).
|
inline |
Inverse translation (column 3 of invtrans).
Definition at line 190 of file fiff_coord_trans.h.
|
inline |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
Definition at line 192 of file fiff_coord_trans.h.
|
inline |
Inverse rotation (3×3 block of invtrans).
Definition at line 185 of file fiff_coord_trans.h.
|
inline |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
Definition at line 187 of file fiff_coord_trans.h.
|
inline |
Returns true if coordinate transform contains no data.
Definition at line 160 of file fiff_coord_trans.h.
|
inline |
Forward translation (column 3 of trans).
Definition at line 180 of file fiff_coord_trans.h.
|
inline |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
Definition at line 182 of file fiff_coord_trans.h.
| void FIFFLIB::FiffCoordTrans::print | ( | ) | const |
Prints the coordinate transform.
|
static |
Performs a Procrustes alignment between two sets of corresponding 3D points.
| [in] | from_frame | Source coordinate frame ID. |
| [in] | to_frame | Destination coordinate frame ID. |
| [in] | fromp | Point locations in the source frame (np×3 matrix). |
| [in] | top | Point locations in the destination frame (np×3 matrix). |
| [in] | w | Weights (np elements), or empty vector for equal weight. |
| [in] | max_diff | Maximum allowed difference between transformed and target. |
|
static |
Reads a coordinate transform from a fif file
| [in] | p_IODevice | A fiff IO device like a fiff QFile or QTCPSocket. |
| [out] | p_Trans | A coordinate transform from a fif file. |
|
static |
Reads a coordinate transform from a FIFF tag.
| [in] | tag | The FIFF tag to read from. |
|
static |
Reads the FreeSurfer head → MRI transform from an ASCII file.
| [in] | name | ASCII file path. |
|
static |
Reads the MEG device → head coordinate transform from a FIFF file.
| [in] | name | FIFF file path. |
|
static |
Reads the MRI → head coordinate transform from a FIFF file.
| [in] | name | FIFF file path. |
|
static |
|
static |
|
static |
|
inline |
Forward rotation (3×3 block of trans).
Definition at line 175 of file fiff_coord_trans.h.
|
inline |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
Definition at line 177 of file fiff_coord_trans.h.
|
inlinestatic |
Size of the old struct (fiffCoordTransRec) 26*int = 26*4 = 104
Definition at line 485 of file fiff_coord_trans.h.
| float FIFFLIB::FiffCoordTrans::translationTo | ( | Eigen::MatrixX4f | mTransDest | ) |
Calculate translation between two rotation matrices in meter
| [in] | mTransDest | The destination transformation matrix. |
| void FIFFLIB::FiffCoordTrans::write | ( | QIODevice & | p_IODevice | ) |
Writes the transformation to file.
| [in] | p_IODevice | IO device to write the transformation to. |
| void FIFFLIB::FiffCoordTrans::writeToStream | ( | FiffStream * | p_pStream | ) |
Writes the transformation to a FIFF stream.
| [in] | p_pStream | Pointer to the FIFF stream to write to. |
|
friend |
Overloaded == operator to compare an object to this instance.
| [in] | object | The object which should be compared to. |
Definition at line 494 of file fiff_coord_trans.h.
| fiff_int_t FIFFLIB::FiffCoordTrans::from |
Source coordinate system.
Definition at line 474 of file fiff_coord_trans.h.
| Eigen::Matrix<float, 4,4, Eigen::DontAlign> FIFFLIB::FiffCoordTrans::invtrans |
The inverse transform.
Definition at line 477 of file fiff_coord_trans.h.
| fiff_int_t FIFFLIB::FiffCoordTrans::to |
Destination coordinate system.
Definition at line 475 of file fiff_coord_trans.h.
| Eigen::Matrix<float, 4,4, Eigen::DontAlign> FIFFLIB::FiffCoordTrans::trans |
The forward transform.
Definition at line 476 of file fiff_coord_trans.h.