NPL
Neurological Programs and Libraries
npl::Rigid3DTrans Struct Reference

Struct for holding information about a rigid transform. Note that rotation R = Rx*Ry*Rz, where Rx, Ry, and Rz are the rotations about x, y and z aaxes, and the angles are stored (in radians) in the rotation member. More...

#include <registration.h>

Public Member Functions

 Rigid3DTrans ()
 
void invert ()
 Inverts rigid transform, where: More...
 
Matrix3d rotMatrix ()
 Constructs and returns rotation Matrix. More...
 
void setRotation (const Matrix3d &rot)
 Constructs rotation vector from rotation matrix. More...
 
void toRASCoords (ptr< const MRImage > in)
 Converts to world coordinates based on the orientation stored in input image. More...
 
void toIndexCoords (ptr< const MRImage > in, bool forcegridcenter)
 Converts from world coordinates to index coordinates based on the orientation stored in input image. More...
 

Public Attributes

Vector3d rotation
 
Vector3d shift
 
Vector3d center
 
bool ras_coord
 Indicates the stored transform is relative to physical coordintes rather than index coordinates. More...
 

Detailed Description

Struct for holding information about a rigid transform. Note that rotation R = Rx*Ry*Rz, where Rx, Ry, and Rz are the rotations about x, y and z aaxes, and the angles are stored (in radians) in the rotation member.

$ \hat y = R(\hat x- \hat c)+ \hat s+ \hat c $

Definition at line 855 of file registration.h.

Constructor & Destructor Documentation

npl::Rigid3DTrans::Rigid3DTrans ( )
inline

Definition at line 867 of file registration.h.

Member Function Documentation

void npl::Rigid3DTrans::invert ( )

Inverts rigid transform, where:

Original: $ \hat y = R(\hat x- \hat c)+ \hat s+ \hat c $

Inverse: $ \hat x = R^{-1}(\hat y - \hat s - \hat c) + \hat c $

So the new parameters, interms of the old are:

\[ \hat c' = \hat s+ \hat c \]

\[ \hat s' = -\hat s \]

\[ \hat R' = R^{-1} \]

Matrix3d npl::Rigid3DTrans::rotMatrix ( )

Constructs and returns rotation Matrix.

Returns
Rotation matrix
void npl::Rigid3DTrans::setRotation ( const Matrix3d &  rot)

Constructs rotation vector from rotation matrix.

Parameters
rotRotation matrix
void npl::Rigid3DTrans::toIndexCoords ( ptr< const MRImage in,
bool  forcegridcenter 
)

Converts from world coordinates to index coordinates based on the orientation stored in input image.

The center of rotation is assumed to be the center of the grid which is (SIZE-1)/2 in each dimension.

The Rotation ( $R$) and Shift( $ \hat s $) are given by:

\begin{eqnarray*} R &=& A^{-1}QA \\ \hat s &=& R\hat c -\hat c - A^{-1}(\hat b + Q\hat b - Q\hat d + \hat t + \hat d ) \end{eqnarray*}

where $A$ is the rotation of the grid, $\hat c$ is the center of the grid, $\hat b $ is the origin of the grid, $ Q $ is the rotation matrix in RAS coordinate space, $ \hat d $ is the given center of roation (in RAS coordinates), and $ \hat t $ is the original shift in RAS coordinates.

Parameters
inSource of index->world transform
forcegridcenterForce the center to be the center of the grid rather than using the location corresponding to the current center
void npl::Rigid3DTrans::toRASCoords ( ptr< const MRImage in)

Converts to world coordinates based on the orientation stored in input image.

For a rotation in RAS coordinates, with rotation $Q$, shift $t$ and center $d$:

\[ \hat u = Q(A\hat x + \hat b - \hat d) + \hat t + \hat d \]

From a rotation in index space with rotation $R$, shift $s$ and center $c$:

\begin{eqnarray*} Q &=& A^{-1}AR \\ \hat t &=& -Q\hat b + Q\hat d - \hat d - AR\hat c + A\hat s + A\hat c + \hat b \\ \end{eqnarray*}

Parameters
inSource of index->world transform

Member Data Documentation

Vector3d npl::Rigid3DTrans::center

Definition at line 859 of file registration.h.

bool npl::Rigid3DTrans::ras_coord

Indicates the stored transform is relative to physical coordintes rather than index coordinates.

Definition at line 865 of file registration.h.

Vector3d npl::Rigid3DTrans::rotation

Definition at line 857 of file registration.h.

Vector3d npl::Rigid3DTrans::shift

Definition at line 858 of file registration.h.


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