# Direction of X, Y and Z axis in DICOM patient coordinates

Hi All,

I am developing DICOM Viewer with help of VTK/ITK and for one 3D model I need from DICOM data (dcm files) to get Direction of X, Y and Z-axis in DICOM patient coordinates.
For this purpose I believe I will need help of follow DICOM Tags:

• Image Position (0020,0032) specifies the x, y, and z coordinates of the upper left hand corner of the image; it is the center of the first voxel transmitted.
• Image Orientation (0020,0037) specifies the direction cosines of the first row and the first column with respectto the patient. These Attributes shall be provide as a pair. Row value for the x, y, and z axes respectively followed by the Column value for the x, y, and z axes respectively.

To calculate:

• Direction of X-axis in DICOM patient coordinates
• Direction of Y-axis in DICOM patient coordinates
• Direction of Z-axis in DICOM patient coordinates

I will give 2 examples how should looks DICOM input values and result output values (Direction of X, Y and Z-axis in DICOM patient coordinates):

Example 1:
Input values:
Image Position (0020,0032) = -90.587402322119, -109.07805985037, -54.313941027148
Image Orientation (0020,0037) = 0.99980097943443, -0.0052184900275, 0.01925535987173, 5.1979E-11, 0.96518213254221, 0.26157876638076

Output values:
Direction of X-axis in DICOM patient coordinates: 0.999800979434429, -0.00521849002749999, 0.01925535987173
Direction of Y-axis in DICOM patient coordinates: 5.19383355768177e-11, 0.965182132542206, 0.261578766380758
Direction of Z-axis in DICOM patient coordinates: -0.0199499754876277, -0.261526706825732, 0.964990041448579

Example 2:
Input values:
Image Position (0020,0032) = -88.948269885356, 31.931496794475, 81.739738901004
Image Orientation (0020,0037) = 0.79547348593335, 0.60598839359928, -4.0729377E-9, -0.234829907807, 0.30825831580772, -0.9218631813533

Output values:
Direction of X-axis in DICOM patient coordinates: 0.795473485933353, 0.605988393599283, -4.07293770000002e-09
Direction of Y-axis in DICOM patient coordinates: -0.234829907806982, 0.308258315807713, -0.921863181353261
Direction of Z-axis in DICOM patient coordinates: -0.5586383871310699, 0.733317719381138, 0.387515515644527

So my question what is connection between values of input and output in my examples, how is calculate output (directions of X, Y, Z axis) from input values (Image Position (0020,0032) and Image Orientation (0020,0037))

Tim

Hi Tim -