Hi Forum,
I’m having a (bit theoretical) question regarding transformations of images as determined with Elastix.
My scenario is as follows:
I am registering consecutive histological slices (~30k x 30k) of different stainings (HE & IF) with each other. This is the workflow:
- Downsampling and masking the fixed and the moving images. Both images are downsampled by the same factor s.
- Use Elastix to align the images (similarity)
- Multiply the translation part of the transformation parameters with s and apply transformation to original resolution.
This works for most cases. In some cases, however, both input images differ in size a lot (25k x 25k vs 20k x 20k), which is troublesome for Elastix because the relative difference in size is maintained after downsampling the moving and fixed image. One workaround is setting the registration to very aggressive optimization as described in the Elastix manual. I tried to go another way, but couldn’t get my head around it - that’s where the actual question starts:
Experience shows that registration with Elastix works extremely well if the objects to be matched in both images have about the same size. So I downsampled the moving and fixed images (let them be called M and F) by factors s_1 and s_2 so that I have images M’ and F’ of equal size. The respective transformations are S1 and S2.
The similarity transform in Elastix is defined as:
T(F’) = sR(x’ - c) + t + c
with R being the rotational matrix, s being the scaling factor and t, c being translational and center of rotation components.
Now theoretically, in order to find the transformation T(F) → M for the high res image, I should just have to do the following substitution:
T(F) = S1^{-1}( T(S2(x) ) ) = \frac{1}{s_1} \cdot (s\textbf{R}(s_2 \cdot x - c) + t + c)
then rewrite this to match the similarity transform formulation in the transformation parameter file and let transformix to the job. The registration works well in low resolution, but I can not seem to find the correct parameters to write into the elastix transformation file for a correct output in high res. Is there a flaw in my argument? Has anyone tried something similar?
I do understand that running the registration on images of equal downsampling factors with aggressive settings is a legit workaround - but I would consider the chained transformations as described above a more elegant solution. The concept should also work for affine transformations. Thanks in advance!
Best, Johannes