Hi,

I have the following issue - I’m registering two images with different physical domains using bspline. afterwards, im transforming some points from images. since the points needs to be at the same frame of reference as the registered images, i’m inverting the transformation (because the result transformation of the registration process transforms fixed to moving but the images are at the fixed frame of reference so i need to transform points from moving to fixed)

i’m transforming points from the moving to the fixed frame of reference. the issue is that all the points from the moving frame of reference that are originally outside the **fixed** domain do not transformed. it make sense that bspline can’t transform points from outside the fixed domain to the moving domain but the inverse should work (transform points from moving domain that are originally outside the fixed domain but after transformation they are inside). as evidence, the images are registered well (also parts that originally were outside the fixed domain).

hope I was clear enough

any help would be appreciated,

thanks

Ilay

BSpline, in order to work properly, needs to be composed with an affine (or rigid) transform. I think that one variant of BSpline in ITK implicitly has an affine embedded, while the other doesn’t and requires an explicit affine transform. The BSpline portion only transforms the points within its domain, but the affine portion is unbounded. The help you answer your question, you should provide some details of the BSpline transform you are using.

You may consider using VTK bspline transform, because it smoothly extrapolates outside the original domain. This smooth extrapolation is also essential for computing inverse transform near the domain boundary. Another amazing feature of the VTK transforms infrastructure that inverse transform is computed on-the-fly, so you can easily apply the same transform to meshes and images, without the costly computation of an inverse displacement field for an entire 3D region.

I wish ITK would implement these features. The VTK license would allow copying over code or transform computations could be factored out to a separate library (or remote module), but of course it would require significant effort.

If you need these advanced transform features now then you can convert the ITK transform to VTK transform using 3D Slicer. You can simply drag-and-drop the ITK transforms and images into Slicer then apply and harden the transform on the image. Slicer automatically converts affine, bspline, grid, and thin-plate spline transforms (and any combination of these) to VTK transforms as needed.

Thank you both for your answers.

dzenanz - I do compose it with affine transformation. the affine transformation indeed align the images in a rough way, and bspline refine the alignment. when looking at the registered image it looks like everything works as expected but, as I mentioned, some points aren’t transformed

If the composite transform does not transform all the points, have you tried using affine transform alone, i.e. ignore BSpline?

Hello @Ilay_Kamai,

Are you working with a `CompositeTransform`

? Based on the discussion it sounds like you are managing the transformations and inverting them yourself, possibly a bug there. See this SimpleITK notebook `invert_composite_transform`

function for details.