1

I am relatively new with working with dicom files.Thanks in advance.

I have 2 dicom files of the same patient taken at different intervals. They are not exactly the same dimensions.

The first one is: dimesions of cube1 104X163X140 and the second one is dimesions of cube2 107X164X140. I would like to align both cubes at the origin and compare them.

The ImagePositionPatient of the first file is: [-207.4748, -151.3715 -198.7500]

The ImagePositionPatient of the second file is: [-207.4500, -156.3500 -198.7500]

Both files have the same ImageOrientationPatient - [ 1 0 0 0 1 0]

Any chance someone could please show me an example? I am not sure how to map the physical plane back to the image plane?

Thanks a lot in advance,

Ash

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

Added: 23/2/17

I have used the matrix formula below based on the link where in my case :

IPP (Sxyz) of cube 1 = [-207.4748, -151.3715-198.7500]

Xxyz (IOP) = [1,0,0]

Yxyz (IOP) = [1,0,0]

delta_i = 2.5

delta_j = 2.5

enter image description here

So for values of i = 0: 103 and j = 0:162 of cube1, I should compute the values of Pxyz?

What is the next step? Sorry, I do not see how this will help me to align the two cubes with different IPP to the image plane?

Sorry for the newbie question ...

Ash
  • 59
  • 1
  • 6
  • See here: http://stackoverflow.com/questions/36996353/finding-the-coordinates-mm-of-identical-slice-locations-for-two-mr-datasets-ac/36997168#36997168 and here: http://stackoverflow.com/questions/40008507/how-to-spatially-order-files-in-a-dicom-data-sequence/40014740#40014740 – Markus Sabin Feb 22 '17 at 15:28
  • 1
    Please note that none (as of Feb 22nd 2017) of above suggested links described 'Frame of Reference UID', so aligning based on IOP and IPP makes only sense when this attribute is equal in both Series. – malat Feb 22 '17 at 16:02
  • @kritzel_sw Any chance I could get an example? Do I need to compute the inverse of the matrx --I am not sure how to map the physical plane back to the image plane? – Ash Feb 22 '17 at 19:46
  • @Ash: This article explains quite well how to calculate transformation matrices from the DICOM header information: http://nipy.org/nibabel/dicom/dicom_orientation.html – Markus Sabin Feb 23 '17 at 06:34
  • @malat: Agreed, but one of the links in the links does it: http://stackoverflow.com/questions/37322856/interpolation-between-two-images-with-different-pixelsize/37339630#37339630 ;-) – Markus Sabin Feb 23 '17 at 06:36
  • @kritzel_sw good catch ! So this makes this question not a duplicate but some kind of triplicate :) – malat Feb 23 '17 at 07:16
  • 2
    Possible duplicate of [Interpolation between two images with different pixelsize](http://stackoverflow.com/questions/37322856/interpolation-between-two-images-with-different-pixelsize) – malat Feb 23 '17 at 07:16
  • Be aware that even using ImagePositionPatient the images won't line up precisely, because they are not derived from the same scan - ImagePositionPatient does not take into account the change in position of the patient between scans - see [article linked by @kritzel_sw](http://stackoverflow.com/questions/36996353/finding-the-coordinates-mm-of-identical-slice-locations-for-two-mr-datasets-ac/36997168#36997168). Also, as @malat said, the scans must have the same Frame of Reference UID (i.e. from the same scanner), otherwise comparing the ImagePositionPatient is meaningless. – Tom Feb 23 '17 at 11:23
  • I have updated the work I have done so far. I am still unsure what the next step would be? Thanks a lot in advance – Ash Feb 23 '17 at 20:51

1 Answers1

1

I did not verify the matrix you built. But if it is calculated correctly, you can transform between the volume coordinate system (VCS) (x1,y1,z1), where x1 = column, y1 = row and z1 = slice number to the patient coordinate system (PCS) (x2, y2, z2) - these coordinates define the point within the patient in milimeters.

By inverting the matrix, you can transform back from PCS to VCS.

Let's say, the transformation matrix for volume 1 := M1 and the transformation matrix PCS -> VCS for volume 2 := M2. Then you can transform a point p1 from volume 1 to the corresponding point p2 in volume 2 by transforming it to the PCS using M1 and transforming from PCS to volume 2 using M2' (the inverted M2).

By multiplying M1 and M2', you can calculate a matrix transforming directly from volume1 to volume2.

So:

p2 = (M1 * M2') * p1

Markus Sabin
  • 3,916
  • 14
  • 32