0

I am completely new to CT image world. So thank you in advance I have two dicom series of Same patient. For both of the series, first slice information is

Series 1 
'ImagePositionPatient',
['-205.0966796875', '-384.0966796875', '-1496.5']
'Pixelspacing',['0.806640625', '0.806640625']
slice Thickness' 2mm
Image Orientation (Patient)['1', '0', '0', '0', '1', '0']

Series 2
'ImagePositionPatient', 
['-171.650390625', '-356.650390625', '-1099.7']
'Pixelspacing', ['0.69921875', '0.69921875']
'slice Thickness', 2mm
Image Orientation (Patient)['1', '0', '0', '0', '1', '0']
In both series slices are of  512*512 in size

. I want to overlap Series 2 on series 1.

But to overlap they have to share same coordinates as per my understanding. Also there is difference of pixel spacing and number of files. So my question is:

  • How to overlap two series ?

  • How to match Indices. As both series has different number of slices. For example, In series 1, a slice index is 220 or Z value is -976, How to get the the Z value or the Index in Series 2 of that particular slice of series 1?

I am using pydicom python package. Any example code or the idea to handle this problem would be great :)

Edit: sitk.resample code I am using

def resample_image(self,itk_image, ref_imge, is_label=False):
        original_spacing = itk_image.GetSpacing()
        original_size = itk_image.GetSize()
        out_spacing = ref_imge.GetSpacing()
        out_size = ref_imge.GetSize()
        resample = sitk.ResampleImageFilter()
        resample.SetOutputSpacing(out_spacing)
        resample.SetSize(out_size)
        resample.SetOutputDirection(itk_image.GetDirection())
        resample.SetOutputOrigin(ref_imge.GetOrigin()) 
        resample.SetTransform(sitk.Transform())
        resample.SetDefaultPixelValue(itk_image.GetPixelIDValue())

        if is_label:
            resample.SetInterpolator(sitk.sitkNearestNeighbor)
        else:
            resample.SetInterpolator(sitk.sitkLinear)#sitkBSpline)

        return resample.Execute(itk_image)
Makau
  • 71
  • 2
  • 10
  • You may want to look at this question: https://stackoverflow.com/questions/36996353/finding-the-coordinates-mm-of-identical-slice-locations-for-two-mr-datasets-ac/36997168#36997168 – Markus Sabin Jan 28 '19 at 06:17
  • @kritzel_sw Thanks for the link. I have read. I tried to construct the transformation matrix but still failed. Can you please formulate how to construct the transformation matrix for given scenario. Thanks a lot . – Makau Feb 02 '19 at 15:32

1 Answers1

1

It sounds like you want to resample one image onto another so that they have matching pixel dimensions and sizes. If so you can use the ResampleImageFilter or the Resample function. Here are their documentation page.

Filter: https://itk.org/SimpleITKDoxygen/html/classitk_1_1simple_1_1ResampleImageFilter.html

Function: https://itk.org/SimpleITKDoxygen/html/namespaceitk_1_1simple.html#ab02a58cf3633d810fac5821749b49a74

The basic idea is to set up the image coordinate system of one image, and then tell Resample to sample the other image using that system.

Dave Chen
  • 1,905
  • 1
  • 12
  • 18
  • Thanks a lot for your reply. 1. Actually I did use sitk.resample filter. But I am not sure If I am using it correct or not. Added the code , please have a look. 2. Still another the problem is , is It enough to resample all the image with one single reference Image ? Because I dnt know how to match the Z value or Slice number of series with 485 files with another series with 160 file. – Makau Jan 25 '19 at 20:25
  • As far as Z slicing goes, you need to read the series of images into a single 3d image. You would do this for both series to produces 3d images. So then you can resample the source 3d image onto the target 3d image. – Dave Chen Jan 25 '19 at 20:49
  • But, 1. Is it ok, if i Use only single slice as reference for all of the slice I want to resample ? 2. How to relate the idexes or Z value between two series ? Because in this way I have to resample all the images beforehand. And then there is no way to distinguish which one of the series 1 actually relates to series 2. Because In the end I will need to 20-30 slices to overlap between the two series. – Makau Jan 25 '19 at 20:51
  • Dave, But if I resample the source image into target 3D image then would not be the data of source 3D image lost ?? I mean then the source data would be filled with reference Data ? Please correct me, if I am wrong. In the end I woud compute dice coefficient. – Makau Jan 25 '19 at 20:55
  • Yes, you could miss parts of the source image if it is not contained in the target image. If you really want to ensure you sample all the data, you want to create a target image that encompasses both of your images, and the two images onto this new target. – Dave Chen Jan 25 '19 at 20:57
  • As far as the slice question, no you can't use a single slice as a reference. You need to create a 3d volume image of all the slices for a reference. – Dave Chen Jan 25 '19 at 20:59
  • If this answer and the comments are not enough to get you on your way, maybe think about getting some hands-on help. Not meant as a derogatory comment, but as one to save you some headache and possibly a lot of time :) – g_uint Feb 04 '19 at 07:14
  • 1
    @g_uint you are correct. your remark is welcomed :) sometimes, hands-on help works as ice breaker. – Makau Feb 15 '19 at 13:30