 # How to apply transform to strictly a subset of an image?

Hello. I have some conceptual understanding of registration and very little of its math so I’m looking for a practical solution. Thank you in advance for any help offered.

Say I registered 3D image A to 3D image B in a 2-step process by first finding the best-fit affine transform and then a deformation field on top of that. Applying these two transforms (affine first then dense deformable as a composite transformation) will warp the whole of image A to the space of image B.

How do I use this composite transformation to now map an arbitrary subset of image A to that of image B? For example, how do I warp a 2D slice of image A to the space of image B? What if I just wanted to map a point (1D)?

One solution is to put that subset of points into the same 3D space of image A and then apply the transform as I would on a full image of A. I have tried this and it works as it should. However, that’s costly in terms of memory and, I suspect, computationally. How do I strictly work on an arbitrary and smaller subset of image A?

Hello @jingxuan,

Assuming the following registration configuration:
image A - used as fixed image in registration.
image B - used as moving image in registration.
T_A^B - the final transformation (composite or any other type). Maps points from image A’s coordinate system to image B’s coordinate system.

Most often we resample image B onto the grid defined by image A. If you want to define a different grid, possibly smaller than the whole of image A, you need to define it in terms of: origin, spacing, direction cosine matrix, and size. The origin and direction cosine matrix are with respect to the coordinate system of image A. So a point on this grid is always ^AP. Please see this jupyter notebook for various approaches to defining a resampling grid. Note that you can also resample using an arbitrary set of points that are not defined by a grid (see section Resampling at a set of locations in that notebook).

1 Like