Resampling Image: Finding original point in new resampled Image

I have a smaller image that is (512x512). I resampled it to a new space (692x512) and am now wondering how I can determine of a point in the smaller image, for example: location 25,25, in the larger image.

I tried using resampler.GetTranform(), but it says none. Is there a certain function that will allow me to track specific points after the resampling?

Thank you!

Hello @elapins,

A key concept in ITK/SimpleITK is that images are a physical object, they occupy a region in space. Hence we treat them as continuous objects, working with physical points and not indexes, though it is easy to move between the two representations using the following Image methods:

  • TransformContinuousIndexToPhysicalPoint
  • TransformIndexToPhysicalPoint
  • TransformPhysicalPointToContinuousIndex
  • TransformPhysicalPointToIndex

Note: transformations are always applied to physical points.

More specifically to your question, the following pseudo-code should clarify how indexes are mapped from a resampled_image to the original_image given the transformation mapping between the two tx:

original_image

#resampled_image_grid_info can be an image or an explicit description of the grid, i.e. origin, spacing, size, direction cosine
resampled_image = sitk.Resample(original_image, resampled_image_grid_info, tx)
resampled_image_index = []

original_image_point = tx.TransformPoint(resampled_image.TransformIndexToPhysicalPoint(resampled_image_index))
original_image_index = original_image.TransformPhysicalPointToIndex(original_image_point)

The other way round requires inverting tx.

2 Likes