3Dslicer medical image three-dimensional coordinate system (xyz, RAS, IJK) difference, transformation, rotation, plane angle

Table of contents

World coordinate system world coordinate system xyz

Anatomical coordinate system Anatomical coordinate system (LPS/RAS/RAI)

Image coordinate system image coordinate system ijk

Image transformationImage conversion

3D coordinate transformation

A. Rotation matrix and rotation vector

B. Euler angles

C. QuaternionsEdit

Calculate plane angle Angle Planes plugin

reference link



One of the problems when dealing with medical images and applications is the difference between coordinate systems. Three coordinate systems are commonly used in imaging applications:

xyz is the world coordinate system

RAS is the anatomical coordinate system, the unit is mm
IJK is the pixel/voxel coordinate system, the unit is pixel/voxel

World (xyz axis)                                 Anatomy ( RAS axis )                         Image coordinate system ( IJK axis )

 
Each coordinate system serves a purpose and represents its data differently.

World coordinate system world coordinate system xyz

The world coordinate system is usually a Cartesian coordinate system in which the model (such as an MRI scanner or patient) is positioned. Each model has its own coordinate system, but there is only one world coordinate system to define each model's position and orientation.

Anatomical coordinate system Anatomical coordinate system (LPS/RAS/RAI)

The most important model coordinate system for medical imaging technology is the anatomical space (also known as the patient coordinate system). This space consists of three planes used to describe the standard anatomical positions of humans:

  • The axial plane is parallel to the ground and separates top from bottom
  • The coronal plane is perpendicular to the ground and separates the front from the back
  • The sagittal plane separates left from right

As can be seen from these planes, the signs of all the axes are in the positive direction (for example, a negative upper axis is represented by a lower axis).

The anatomical coordinate system is a continuous three-dimensional space in which images are sampled. In neuroimaging, this space is often defined in terms of the person whose brain is being scanned. Thus, 3D bases are defined along the anatomical axes of anterior-posterior, inferior-superior, and left-right.

However, different medical applications use different definitions of this 3D basis. The most common are the following bases:

  • LPS (left, back, top) for DICOM image and ITK kit
  • RAS (Right, Front, Top) is similar to LPS, with the first two axes flipped and used by the 3D slicer

  • LPS(Left, Posterior, Superior):  MHD image (meta image),  ITK toolkit , ITK-Snap software (the software is written as RAI)
  • RAS(Right, Anterior, Superior):  Nifti image and 3D Slicer software use

Note that the above two are right-handed coordinate systems . Other options (such as: RPI) and left-handed coordinate systems (such as: LAS) are also possible, and need to be distinguished.

Warning:  People don't always use three consecutive letters to indicate the positive direction, sometimes it also indicates the direction of departure (from) (that is, the negative direction), at this time the above LPS will be written as RAI, and the corresponding arrival (to) The direction is the LPS. For example, the ITK-Snap software Tools->Image Information->Orientationwrites RAI, which means that  from RAI --> to LPS the MHD format image exported by ITK also uses the From mode.

Both bases are equally useful and logical. Just need to know which base the image is referenced to.

Image coordinate system image coordinate system ijk

The image coordinate system describes how to acquire the image relative to the anatomy. Medical scanners create a regular rectangular array of dots and cells starting in the upper left corner. The i  axis increases to the right, the j  axis increases to the right, and the k  axis increases backward.

In addition to the intensity values ​​(ijk) for each voxel , the origin and spacing of the anatomical coordinates are stored.

  • The origin origin represents the position of the first voxel voxel (0, 0, 0) in the anatomical coordinate system, for example (100mm, 50mm, -25mm)
  • spacing specifies the distance between voxels along each axis, for example (1.5mm, 0.5mm, 0.5mm)

The following 2D example shows what origin and spacing mean:

Using the origin and spacing , the corresponding position of each (image coordinate) voxel in anatomical coordinates can be calculated .

Image transformationImage conversion

The transformation (ijk)' from the image space vector to the anatomical space vector x is an affine transformation, a linear transformation A

The transformation matrix A is a 3×3 matrix and contains all information about spatial orientation and axis scaling.

t is a 3×1 vector and contains information about the geometric location of the first voxel.

The last equation shows that linear transformations are performed by matrix multiplication and translation by vector addition. In order to represent transformations and translations, matrix multiplication must be used to represent the augmentation matrix. This technique requires a matrix with an extra row of zeros at the bottom, a column at the right (the translation vector ), and a "1" at the bottom right. Also, all vectors must be written in homogeneous coordinates, which means "1"s are augmented at the end.

Depending on the anatomical space used (LPS or RAS), the 4 × 4 matrix is ​​called the  IJK to linear function matrix or  the IJK topological matrix because it represents the transition from IJK to LPS or RAS

3D coordinate transformation

A. Rotation matrix and rotation vector

a coordinate transformation

b rotation vector

insert image description here In 3D graphics, the most commonly used rotation representation methods are quaternions and Euler angles , which have the advantages of saving storage space and facilitating interpolation compared to matrices.

B. Euler angles

Definition \psi, \theta, \phiare the rotation angles around the Z-axis, Y-axis, and X-axis, respectively, if represented by Tait-Bryan angle, they are Yaw, Pitch, and Roll, respectively.

(1) The representation of Euler angles is not unique. Given a certain starting orientation and target orientation, even if the order of yaw, pitch, and roll is given, the required rotation can be represented by different angle combinations of yaw/pitch/roll. For example, the same yaw-pitch-roll order, (0,90,0) and (90,90,90) will roll the rigidbody to the same position. This is actually mainly caused by the Gimbal Lock (2) The interpolation of Euler angles is relatively difficult.  

(3) When calculating the rotation transformation, it generally needs to be converted into a rotation matrix. At this time, a lot of sin and cos need to be calculated, and the calculation amount is relatively large.

C. Quaternions

Calculate plane angle Angle Planes plugin

Download the Angle Planes plugin 

This module is used to calculate the angle between two planes using normals. Users can choose to use two planes already implemented on Slicer, or define a plane using landmarks (at least 3 landmarks). Planes can also be saved for reuse in other models.

Pitch Anglecomplementary angle补角

 

 The right hand is xyz straight (corresponding to roll, pitch, yaw respectively)

reference link

Orientation and Voxel Order Terminology: RAS, Laser, LDPE, Resource Sheet, XYZ, and All That (grahamwideman.com)

Coordinate System - Slicer Wiki (slicer.org)

In the slicer software, RAS is converted to pixel coordinate method,
the meaning of rotation matrix and left and right multiplication, it is enough to read this article.

Quaternion to Euler Angle (Yaw, Pitch , Roll) Conversion

Three-dimensional rotation: conversion between Euler angles, quaternions, rotation matrices, and axis angles - know the difference between pitch, yaw, and roll angles

Guess you like

Origin blog.csdn.net/qq_28838891/article/details/127455132