resampling

hello every one ,
sorry for my english, i have a question about this part of code (you can find here the complete code )

def resample(image, transform):
reference_image = image
interpolator = sitk.sitkCosineWindowedSinc
default_value = 100.0
return sitk.Resample(image, reference_image, transform,interpolator, default_value)

translation.SetOffset((3.1, 4.6))
transform_point(translation, point)
resampled = resample(grid, translation)
myshow(resampled, ‘Resampled Translation’)
so here we are resampling a image,the output image is called resampled and the input image is called grid
normally the intensity of the output image OutputImage(x, y) is equal to the intensity of the input image in the point InputImage(x+3.1,y+4.6 ) because the offset here for the translation =(3.1,4.6) but when I want to check that using GetPixel () I don’t find the same result
could you explain to me why?

THANK YOU

In the example notebook the grid image has a pixel spacing of [.2, .2], so simply offsetting your points by [3.1,4.6] won’t get you the same locations in the images.

1 Like

what exactly should i write in order to verify the result? is there a mathematical formula for that
Thank you :blush:

Well, in this case you could divide the offset by the spacing, i.e, [3.1/.2, 4.6/.2].

1 Like

Thank you very much.
Have a good day

1 Like

You are very welcome. :grinning: