Converting Dicom Patient orientation to OPenGL ... - WordPress.com

plainspecialSoftware and s/w Development

Dec 14, 2013 (3 years and 7 months ago)

86 views




Converting Dicom Patient orientation to O
p
enGL format.




Dicom is the standard used
in

medical imaging

field
.

The ImageOrientationPatient
tag

(
0020,0037

)

of dicom data
specifies the patient orientation in the dicom image. This
t
ag
contains two vectors defining the row and column

cosines of the patient position.
Hence 6 components from two vectors. But in reality we need 9 components to represent
an entity. Here the third vector
can be

calculated from the above two vectors. The th
ird
vector will be

normal to the row and column cosines, so we can calculate it as the cross
product of row and column cosines.

Let the value ImageorientationPatient( 0020,0037 ) tag is 0.1286
\
0.8848
\
-
0.4478
\
0.
0234
\
-
0.4541
\
-
0.8906. Here 0.1286
\
0.8848
\
-
0.4478 value specifies the row
vector and 0.0234
\
-
0.4541
\
-
0.8906 specifies the column vector. The normal can be
calculated from their cross product as
-
0.9914
\
0.1041
\
-
0.0791 . Their matrix
representation will be as





R =



Here R is the rotation matrix in Dicom coordinate system. Problems can arise when we
use this matrix

directly

in OpenGL which is of a different coordinate

system. So we have
to
convert
it
to OpenGL coordinates before use in such an environment.

The
patient
coordinate system is as follows:





It is clear from the above picture is that Y and Z axis of Patient and OpenGL coordinates
are opposite in direction.

To correct the matrix we have to flip Y and Z axis. Flipping Y
and Z axis is equal to flipping X axis. So to convert Patient coordinate to OpenGL
coordinate we should flip X axis. To flip X axis we only modification we need i s
+
y

+
x

+
z

+
x

+
y

+
z

Patient Coordinate system

OpenGL Coordinate system

0.1286 8848
-
0.4478

0.0234
-
0.4541
-
0.8906


-
0.9914 0.1041
-
.0791

negating the X axis. That is negate the
X vector and X component of all vectors. Thus X
co
mponent of X axis remain unchanged. Like below.






The
rotation
matrix in the above example can be converted as below.



Xx Xy ' X
z '
Yx ' Yy Yz
Zx ' Zy Zz

Xx Xy Xz
Yx Yy Yz
Zx Zy Zz

0.1286 8848
-
0.4478

0.0234
-
0.4541
-
0.8906


-
0.9914 0.1041
-
.0791

0.1286
-
8848 0.4478

-
0.0234
-
0.4541
-
0.8906


0.9914 0.1041
-
.0791

Patient Coordinate system

OpenGL Coordinate system

Patient Coordinate system

OpenGL Coordinate system