Understanding Coordinates

Summary

 

When a volume dataset is loaded using the F.A.S.T. Cloud SDK  it is mapped to the F.A.S.T. Cloud SDK coordinate system. This is a right-handed coordinate system with the +Z axis pointing forward, the +X axis pointing to the right, and the +Y axis pointing down. The origin is at the physical center of the volume. For medical scans, the +Z axis points from the center of the body towards the head, the +X axis points towards the subject's left side, and the +Y axis points from the center of the body towards the back. The position and orientation of the view can be set with a transformation matrix.

 

BodyAxes

F.A.S.T. Cloud SDK coordinate system

 

Coordinate Transformations

 

It is important to understand that the volume is fixed in space, and only the view position can be manipulated. However, the position and orientation of polygon objects can be manipulated independently of the volume or viewpoint. See Polygon Concepts for more information on manipulating polygon objects. The position and orientation of the viewpoint can be set using the RenderParams.transform member. This member variable is a 4x4 transformation matrix stored in a Matrix class. This matrix is depicted below.

 

 

form_17_hdvr_cpp

form_18_hdvr_cpp

form_19_hdvr_cpp

form_11_hdvr_cpp

 

The viewpoint position is defined by setting the offset vector component of the matrix. Three matrix components (m14, m24, m34) represent the X, Y, and Z coordinates for the view position within the F.A.S.T. Cloud SDK coordinate system. These matrix components can be set directly with the Matrix.setOffsetVector() method. This method takes three parameters, which are the X, Y, and Z coordinates of the view position. 

 

The orientation of the view is defined by setting the X vector (m11, m21, m31), Y vector (m12, m22, m32) and Z vector (m13, m23, m33) components of the matrix. When the matrix is first initialized to the identity matrix the X vector, Y vector, and Z vector components of the matrix point along their respective Cartesian axes. For example, X vector equals (1, 0, 0), Y vector equals (0, 1, 0), and Z vector equals (0, 0, 1). To set a different view orientation, these vectors can be set to different values that represent a new orientation for the view. As with any transformation matrix, the X vector, Y vector, and Z vector components must be normalized and orthogonal. They must also define a right-handed coordinate system. Use of the mouse to manipulate the view position and orientation can be enabled with the Visualization Mouse Adaptors. The source code for these adaptors is provided with the F.A.S.T. Cloud SDK distribution, and can be used as a reference for matrix manipulation.

 

A rotation matrix can be set directly by setting values for the X, Y, and Z rotation vectors with the Matrix.setXVector(), Matrix.setYVector(), and Matrix.setZVector() methods.

A number of utility methods are available to set matrices with specific clinincal view orientations. These are Matrix.setAxial(), Matrix.setCoronal(), Matrix.setSagittal(), Matrix.setAntiAxial(), Matrix.setAntiCoronal(), and Matrix.setAntiSagittal().

 

Basis Matrices

 

These matrices will place the camera at the origin with the view direction as indicated.

 

Anterior

1

0

0

0

0

0

1

0

0

-1

0

0

0

0

0

1

 

Posterior

-1

0

0

0

0

0

-1

0

0

-1

0

0

0

0

0

1

 

Superior

-1

0

0

0

0

1

0

0

0

0

-1

0

0

0

0

1

 

Inferior

1

0

0

0

0

1

0

0

0

0

1

0

0

0

0

1

 

Right Lateral

0

0

1

0

-1

0

0

0

0

-1

0

0

0

0

0

1

 

Left Lateral

0

0

-1

0

1

0

0

0

0

-1

0

0

0

0

0

1

Coordinate matching for 2D and 3D viewports

For 2D viewports

Mapping between DICOM frame of reference and rendered image space coordinates. We provide the following functions in the RenderEngineContext2D class for this purpose.

To convert from 3D location in 3D patient space to DICOM image coordinates and further onto rendered image coordinates, use the methods found in RenderEngineContext2D Class.

mapPointFromFrameOfReference: Maps a point from 3D location in 3D patient space using the DICOM frame of reference origin to image coordinates of the DICOM image. (It also returns the perpendicular distance in mm from the 3D location to image slice.)

dicomImagePixelToRenderImagePixel: Converts a point from DICOM image coordinates to rendered image coordinates. It takes into account zoom, pan rotate operations.

To convert from rendered image coordinates to DICOM image coordinates and further onto 3D location in 3D patient space.

renderImagePixelToDicomImagePixel: Converts a point from rendered image coordinates (viewport coordinates) to DICOM image coordinates. This also takes into account the zom, pan, rotate operations performed on the viewport.

mapPointToFrameOfReference: Maps a point from the DICOM image coordinates to 3D location in 3D patient space in mm using the DICOM frame of reference.
 

For 3D viewports

Mapping between DICOM Frame of reference to Fovia standard 3D world with its origin (0, 0,0) at center of the dataset  to image space coordinates and the reverse order for the same. We provide the following functions in the RenderEngineContext3D and VolumeDataContext class for this purpose.

To convert from image space coordinates to Fovia standard 3D world coordinates to DICOM Frame of reference

RenderengineContext shootRay: Shoots ray from a 2D pixel in image space coordinates and returns Fovia standard 3D world coordinates with its origin (0, 0,0) at center of the dataset.

VolmeDataContext mapFovia3DToFrameOfReference: maps a point from the Fovia standard coordinates to 3D location in 3D patient space using DICOM Frame of reference origin. All units are in mm.

To convert to from DICOM Frame of reference  to Fovia standard 3D world coordinates to image space coordinates

VolumeDataContext mapFovia3DFromFrameOfReference: maps a point from the 3D location in 3D patient space using the DICOM Frame of Reference origin to Fovia standard coordinates. All units are in mm.

RenderEngineContext 3D projectPoint: Given a point with its voxel value coordinates, project it onto the image space and return the 2D coordinates of the point in the image space. Fovia.Util. volume2ProjectionPlaneParallel and Fovia.Util. volume2ProjectionPlanePerspective will also in this computation on the client side synchronously.