0
votes

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)
1
You may want to look at this question: stackoverflow.com/questions/36996353/…kritzel_sw
@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

1 Answers

1
votes

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.