Friday 27 September 2013

3D Dicom Testing Dataset: Patient Position And Orientation

ATIENT COORDINATE SYSTEM & INTERPRETATION OF DICOM CT/MR IMAGE SETS 


============================================

This document contains some notes on the patient coordinate system 


conventions which are used in the ACR/NEMA DICOM 3.0 standard.  



Information on how to interpret the location of CT and MR images within a patient coordinate system is also included.   

******************************************************************** 




What does the patient coordinate system look like? 



        HEAD                     +Z(H) 
              POSTERIOR           |  / +Y(P) 

         ()                       | / 

 RIGHT  -/\-  LEFT                |/ 

         ||           -X(R) ------+------ +X(L) 
ANTERIOR                         /| 
        FEET                    / | 
                               /  | 
                          -Y(A)  -Z(F) 


In this diagram the patient is facing forward.  Anterior refers to the  front of the patient.  Posterior refers to the back of the patient.  

The origin of the patient coordinate system is arbitrary, and selected by the imaging modality.  I assume that the modality is free to choose a different origin for each series of images, but the origin is fixed for a given series. 



If you wish to annotate images when displayed with notations such as (L) or (R) to indicate which side of the 2D image is considered the patient's left or right side, you need the Patient Position (0018, 5100) Attribute from the General Series module. 



This attribute contains the position of the patient relative to the imaging equipment space.Valid values are:

 
    1.Head First-Prone 
    2.Head First-Supine
    3.Head First-Decubitus Right
    4.Head First-Decubitus Left
    5.Feet First-Decubitus Left
    6.Feet First-Decubitus Right
    7.Feet First-Prone
    8.Feet First-Supine. 


Definitions:

Head First means the patient was laying on the imaging couch with the head facing the imaging device first. 


Feet first means the patient was laying on the imaging couch with the feet facing the imaging device first. 


Prone means the patient is laying on his/her stomach.  (Patient's face being positioned in a downwards (gravity) direction.) 


Supine means the patient is laying on his/her back.  (Patient's face being in an upwards direction.) 


Decubitus Right means the patient is laying with his/her right side in a downwards direction. 


Decubitus Left means the patient is laying with his/her left side in a downwards direction. 


NOTE -- Patient Position (0018, 5100) is a type 1 required attribute for both the CT and MR modalities.  This attribute is VERY IMPORTANT for accurately interpreting the patient's orientation. 


*************************************************************************************** 
What is a direction cosine? 

Basically, a direction cosine is the cosine of the angle which is created between a unit vector which starts at the origin with some direction, and a unit vector coincident with one of the axis of the coordinate system. 



To fully define the point in space at the end of a vector it requires nine direction cosines.  Since in a right handed cartesian coordinate system the cross product of two unit vectors defines the third, you can fully describe the location using only six direction cosines.  The other three may be calculated. 


******************************************************************** 
Where can I learn about direction cosines? 

The following references may be of help in understanding what a direction cosine is. 

Mathematical Methods for Physicists.  Arfken.  Academic Press, 1996.   


pp 3-5.  pp 143-160. 

Computer Graphics Principles and Practice, 2nd Edition. Foley, van 


Dam, Feiner, Hughes.  Addison Wesley, 1987.  pp 213-222, 1103-1105. 

Vector Mechanics for Engineers, STATICS and DYNAMICS, 3rd Edition.   


Beer, Johnston jr.  McGraw Hill, 1977.  pp 43-46. 

********************************************

How do I orient a single image in the patient coordinate system? 

In order to orient a single image plane in the patient coordinate system a 4x4 transform matrix must be defined.  This matrix is derived as follows: 


Given: 
        xr = x row direction cosine 


        yr = y row direction cosine 

        zr = z row direction cosine 

        xc = x column direction cosine 


        yc = y column direction cosine 

        zc = z column direction cosine 


First calculate the slice direction cosine values for x, y, and z.  This is the cross-product of the row and column direction cosines. 



        xs = (yr * zc) - (zr * yc) 
        ys = (zr * xc) - (xc * zc) 

        zs = (xr * yc) - (yr * xc) 


Then, the 4x4 matrix is as follows: 

       [ xr yr zr 1 ] 
   M = [ xc yc zc 1 ] 

       [ xs ys zs 1 ] 

       [ 0  0  0  1 ]


The image plane is then transformed from the origin to the proper location in the patient coordinate system as follows: 


Given: 

(c,r) = column and row of pixel in 2D image plane (x,y,z) = x, y, and z coordinates for pixel in patient coordinate system. 


Through matrix multiplication, the transformed coordinates are: 


        (c, r, 0, 1) * M = (x, y, z, 1)


David Clunie wrote: 


It really is a piece of cake to derive what you want ... for example in the following code assume "vector" is either a Row vector or Column vector from Image Orientation (Patient)  and "orientation" becomes what you want by picking out the "most significant" axis sequentially, and noting the sign. The DICOM convention is Left Posterior Head +ve.


  char *orientation=new char[4]; 
  char *optr = orientation; 

  *optr='\0'; 

char orientationX=vector.getX()<0?'R' :'L'; 
char orientationY=vector.getY()<0? 'A':'P'; 

char orientationZ=vector.getZ()<0?'F': 'H';

        double absX = fabs(vector.getX()); 
        double absY = fabs(vector.getY()); 

        double absZ = fabs(vector.getZ()); 


int i; 
for (i=0; i<3; ++i) { 
    if(absX>.0001 && absX>absY && absX>absZ)    { 

     *optr++=orientationX; 

     absX=0; 
}
else if(absY>.0001 && absY>absX&& absY>absZ) { 
    *optr++=orientationY; 
     absY=0; 
else if(absZ>.0001 &&absZ>absX && absZ>absY) { 
                                     *optr++=orientationZ; 
 absZ=0; 
else break; 
*optr='\0'; 

No comments: