[Insight-users] Re: Dicom Tag(0020,0037) (Alireza Salamy)

Antoine Leimgruber antoine.leimgruber at sokal.ch
Thu Jun 7 17:01:16 EDT 2007


Hi Alireza,

no you did nothing wrong.

i,j and k are your 3D pixel coordinates, lets say that i runs from left to right on your screen, j from top to bottom and k from first to last slice.

x,y,z are the space coordinates.

Your orientation tags is approx (0,1,0,0,0,-1) so let's use these values in the following computations.

It means that the left to right on your screen has space components described by (0,1,0)
and that top to bottom has space components described by (0,0,-1).

In other words, a point moving to the right of your screen has the y space coordinate increasing
a point moving to the bottom has it z coordinate *decreasing*

If you open your image in a dicom viewer, that's what you'll see. Pixels i are increasing when moving the cursor to the right but the coordinates will say that y is increasing.

The third direction cosine is given by the cross product of the two first and is (-1,0,0). So when you go from one slice to the next, this is x space coordinate that is decreasing.

Since in dicom y runs from anterior to posterior OF THE PATIENT and z from feet to head OF THE PATIENT, your images are sagittal slices, the head is on the top and the first slices might be on the left side of the patient.

Once again, please check the slice direction with the origin tag of two consecutive slices.

For your problem, your computation is right. If I assume that deltai=deltaj=1mm and origin=(0,0,0) then I get

0	0	0	0		67.5pix		0mm
1	0	0	0	*	140pix	   =	67.5mm
0	-1	0	0		170pix		-140mm
0	0	0	1		1		1 

for your first point and

0	0	0	0		85pix		0mm
1	0	0	0	*	140.5pix   =	85mm
0	-1	0	0		17.5pix		-140.5mm
0	0	0	1		1		1

Again, since L->R is y and T->B is -z this means that your two points are on the same row (well not exactly since -140mm is not equal to -140.5mm).
They are not in the same column however: the first point is on the left of the second (67.5mm < 85mm).
Finally, what you miss is in which slice is each point. If you replace the 3rd column of the matrix with the 3rd direction cosines vector, you do not get 0 for the x coordinate but -170mm for the first one and -17.5mm for the other one. Since the x space coordinates *decreases* when going from first to last slice, you'll see your 2nd point first while browsing your volume in the dicom viewer (-17.5mm > -170mm).

Do not forget that the assumption for this example is that origin==0 and spacing is 1mm so your points have pixel coordinates [67.5 140 170] and [85 140.5 17.5] but space coordinates IN MILLIMETERS [-170 67.5 -140] and [-17.5 85 140.5]

If you have other values than zeroes and ones, then 1st direction cosine vectors gives you the coordinates of the x unit vector in the i,j,k image frame, 2nd gives you y and 3rd z.

But check that it is consistent with the origin of two consecutive slices.

Antoine

>HI,
>Let me clarify my problem in more detail .I have some points in my 3D image that I would like to >calculate their coordinates in Patient coordinate system.
>suppose two points with coordinate system [67.5 140 170] and [85 140.5 17.5] and I am interested to >calculate the coordinates of two points in patient coordinate system.
>As you mension in paragraph C 7.6.2.1.1 page 301-2 of dicom standard 07_03pu.pdf
>the transform matrix is M.
>I calculate each element of three string(0020,0032) and (0020,0037) and (0028,0030).as an example for >(0020,0037)=0.0\1.0\7.8969176684E-5\0.0\7.8969176684E-5\-1.0
>and I seprate each element to put in the matrix M,and make the matrix as bellow:
>currentTensor[0][0]=xx*deltai;
>currentTensor[1][0]=xy*deltai;
>currentTensor[2][0]=xz*deltai;
>currentTensor[3][0]=0;
>currentTensor[0][1]=yx*deltaj;
>currentTensor[1][1]=yy*deltaj;
>currentTensor[2][1]=yz*deltaj;
>currentTensor[3][1]=0;
>currentTensor[0][2]=0;
>currentTensor[1][2]=0;
>currentTensor[2][2]=0;
>currentTensor[3][2]=0;
>currentTensor[3][3]=1;
>but as I put the x of my point instead of i and y of my point instead of j ,I get the same PX  for the two >points.
>that is because xx and yx which are the first and fourth element of (0020,0037) are 0.
>Did I do something wrong?
>Please let me know if I did a mistake.
>Thanks,
>Alireza


More information about the Insight-users mailing list