StackReg transformation matrix output

I have 16 images of biological tissue that I ran on the StackReg plugin and I got their alignment to each other. The program also returned an affine transformation matrix for each of those 16. I was hoping to have further clarification on what the values in the affine transformation matrix represent.

I believe the first two rows are coefficients a11,a12,a21,a22 and the third row is u and delta u, although I don’t know which is which. This website (http://bigwww.epfl.ch/thevenaz/stackreg/) details the affine transformation equation: x = {{a11, a12}, {a21,a22}} * u + delta u. I was unsure how to apply these values to transform one of the original images into its aligned form.

Thanks!

Just curious, how did you get the matrices out of StackReg? When I run it it registers the stack correctly but does not print any matrices neither on file nor in the log window.

Hi Steinr,

We used custom code in JEX, an open-source Java application built on ImageJ. We get as an output the expression localTransform that passes from TurboReg to StackReg… not sure how to apply that matrix though

Hi @Louie,

Do you want to transform points or images with the transform you get?

John

Hi John,

I want to use the transformation to transform points within the original image to their new location in the transformed image.

-L

Hi @Louie,

That delta u is the translation part of the transformation and it should have two components (x and y). I would have called that t for “translation”, so I’m going to call those components tx and ty.

Once you have that

x_transformed = (a11 * x_in) + (a12 * y_in) + tx
y_transformed = (a21 * x_in) + (a22 * y_in) + ty

but you might have to apply the inverse of the transformation (depends on the convention that StackReg uses- I’m not sure).

John

2 Likes

Ok, thanks @Louie. I just modified the source code myself of StackReg to print the matrices to the log window. I just wondered if there was already a simpler way to do it.