Coordinate transformation description. More...
#include <fiff_coord_trans.h>
Public Types | |
| typedef QSharedPointer< FiffCoordTrans > | SPtr |
| typedef QSharedPointer< const FiffCoordTrans > | ConstSPtr |
| typedef std::unique_ptr< FiffCoordTrans > | UPtr |
| typedef std::unique_ptr< const FiffCoordTrans > | ConstUPtr |
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 QSharedPointer< 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, float **fromp, float **top, float *w, int np, 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) |
Coordinate transformation description.
Coordinate transformation description.
Definition at line 80 of file fiff_coord_trans.h.
| typedef QSharedPointer<const FiffCoordTrans> FIFFLIB::FiffCoordTrans::ConstSPtr |
Const shared pointer type for FiffCoordTrans.
Definition at line 84 of file fiff_coord_trans.h.
| typedef std::unique_ptr<const FiffCoordTrans> FIFFLIB::FiffCoordTrans::ConstUPtr |
Const unique pointer type for FiffCoordTrans.
Definition at line 86 of file fiff_coord_trans.h.
| typedef QSharedPointer<FiffCoordTrans> FIFFLIB::FiffCoordTrans::SPtr |
Shared pointer type for FiffCoordTrans.
Definition at line 83 of file fiff_coord_trans.h.
| typedef std::unique_ptr<FiffCoordTrans> FIFFLIB::FiffCoordTrans::UPtr |
Unique pointer type for FiffCoordTrans.
Definition at line 85 of file fiff_coord_trans.h.
| FiffCoordTrans::FiffCoordTrans | ( | ) |
Constructs the coordinate transformation descriptor.
Definition at line 72 of file fiff_coord_trans.cpp.
| 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. |
Definition at line 82 of file fiff_coord_trans.cpp.
| FiffCoordTrans::FiffCoordTrans | ( | const FiffCoordTrans & | p_FiffCoordTrans | ) |
Copy constructor.
| [in] | p_FiffCoordTrans | Coordinate transformation description which should be copied. |
Definition at line 97 of file fiff_coord_trans.cpp.
| 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 ) |
| FiffCoordTrans::~FiffCoordTrans | ( | ) |
Destroys the coordinate transformation descriptor.
Definition at line 107 of file fiff_coord_trans.cpp.
|
static |
| [in] | t | Fiff coordinate transform to which the inverse should be added. |
Definition at line 271 of file fiff_coord_trans.cpp.
| float FiffCoordTrans::angleTo | ( | Eigen::MatrixX4f | mTransDest | ) |
Calculate rotation as angle between two rotation matrices
| [in] | mTransDest | The destination transformation matrix. |
Definition at line 291 of file fiff_coord_trans.cpp.
| 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. |
Definition at line 339 of file fiff_coord_trans.cpp.
| 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. |
Definition at line 325 of file fiff_coord_trans.cpp.
| void FiffCoordTrans::clear | ( | ) |
Initializes the coordinate transformation descriptor.
Definition at line 113 of file fiff_coord_trans.cpp.
|
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. |
Definition at line 376 of file fiff_coord_trans.cpp.
|
static |
Map coordinate frame integers to human-readable names
| [in] | frame | The coordinate frame integer. |
Definition at line 215 of file fiff_coord_trans.cpp.
|
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). |
Definition at line 413 of file fiff_coord_trans.cpp.
|
static |
Creates an identity transformation between two coordinate systems.
Definition at line 353 of file fiff_coord_trans.cpp.
| bool FiffCoordTrans::invert_transform | ( | ) |
Invert a coordinate transformation (actual obsolete - cause trans and inverse are both stored)
Definition at line 123 of file fiff_coord_trans.cpp.
| FiffCoordTrans FiffCoordTrans::inverted | ( | ) | const |
Returns a new inverted copy of this transformation (swaps from/to and trans/invtrans).
Definition at line 364 of file fiff_coord_trans.cpp.
|
inline |
Inverse translation (column 3 of invtrans).
Definition at line 189 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 191 of file fiff_coord_trans.h.
|
inline |
Inverse rotation (3×3 block of invtrans).
Definition at line 184 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 186 of file fiff_coord_trans.h.
|
inline |
Returns true if coordinate transform contains no data.
Definition at line 159 of file fiff_coord_trans.h.
|
inline |
Forward translation (column 3 of trans).
Definition at line 179 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 181 of file fiff_coord_trans.h.
| void FiffCoordTrans::print | ( | ) | const |
Prints the coordinate transform.
Definition at line 279 of file fiff_coord_trans.cpp.
|
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 C matrix). |
| [in] | top | Point locations in the destination frame (np×3 C matrix). |
| [in] | w | Optional weights (np elements), or nullptr for equal weight. |
| [in] | np | Number of points. |
| [in] | max_diff | Maximum allowed difference between transformed and target. |
Definition at line 621 of file fiff_coord_trans.cpp.
|
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. |
Definition at line 136 of file fiff_coord_trans.cpp.
|
static |
Reads a coordinate transform from a FIFF tag.
| [in] | tag | The FIFF tag to read from. |
Definition at line 554 of file fiff_coord_trans.cpp.
|
static |
Reads the FreeSurfer head → MRI transform from an ASCII file.
| [in] | name | ASCII file path. |
Definition at line 547 of file fiff_coord_trans.cpp.
|
static |
Reads the MEG device → head coordinate transform from a FIFF file.
| [in] | name | FIFF file path. |
Definition at line 485 of file fiff_coord_trans.cpp.
|
static |
Reads the MRI → head coordinate transform from a FIFF file.
| [in] | name | FIFF file path. |
Definition at line 478 of file fiff_coord_trans.cpp.
|
static |
Reads a specified coordinate transform from a FIFF file.
| [in] | name | FIFF file path. |
| [in] | from | Expected source coordinate system. |
| [in] | to | Expected destination coordinate system. |
Definition at line 444 of file fiff_coord_trans.cpp.
|
static |
Reads a coordinate transform from an ASCII 4×3 matrix file (mm-to-m conversion applied).
| [in] | name | ASCII file path. |
| [in] | from | Source coordinate system. |
| [in] | to | Destination coordinate system. |
Definition at line 492 of file fiff_coord_trans.cpp.
|
static |
Reads a coordinate transform from a FIFF stream node.
| [in] | stream | The FIFF stream. |
| [in] | node | The directory node to search. |
| [in] | from | Expected source coordinate system. |
| [in] | to | Expected destination coordinate system. |
Definition at line 591 of file fiff_coord_trans.cpp.
|
inline |
Forward rotation (3×3 block of trans).
Definition at line 174 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 176 of file fiff_coord_trans.h.
|
inlinestatic |
Size of the old struct (fiffCoordTransRec) 26*int = 26*4 = 104
Definition at line 484 of file fiff_coord_trans.h.
| float FiffCoordTrans::translationTo | ( | Eigen::MatrixX4f | mTransDest | ) |
Calculate translation between two rotation matrices in meter
| [in] | mTransDest | The destination transformation matrix. |
Definition at line 314 of file fiff_coord_trans.cpp.
| void FiffCoordTrans::write | ( | QIODevice & | p_IODevice | ) |
Writes the transformation to file.
| [in] | p_IODevice | IO device to write the transformation to. |
Definition at line 168 of file fiff_coord_trans.cpp.
| void FiffCoordTrans::writeToStream | ( | FiffStream * | p_pStream | ) |
Writes the transformation to a FIFF stream.
| [in] | p_pStream | Pointer to the FIFF stream to write to. |
Definition at line 180 of file fiff_coord_trans.cpp.
|
friend |
Overloaded == operator to compare an object to this instance.
| [in] | object | The object which should be compared to. |
Definition at line 493 of file fiff_coord_trans.h.
Source coordinate system.
Definition at line 473 of file fiff_coord_trans.h.
| Eigen::Matrix<float, 4,4, Eigen::DontAlign> FIFFLIB::FiffCoordTrans::invtrans |
The inverse transform.
Definition at line 476 of file fiff_coord_trans.h.
Destination coordinate system.
Definition at line 474 of file fiff_coord_trans.h.
| Eigen::Matrix<float, 4,4, Eigen::DontAlign> FIFFLIB::FiffCoordTrans::trans |
The forward transform.
Definition at line 475 of file fiff_coord_trans.h.