Extracting transformation matrix of feature based registration (SIFT)

Hi all,

I am using Linear_Stack_Alignment_with_SIFT to align a stack of images. The registration itself works well, but I am actually interested in the transformation matrices. However, I could not find any way to get the transformation parameters returned (which I would then want to save to disk as csv/txt etc file). Does anyone know if it is possible to access these parameters?

I have also tried to use Extract SIFT Correspondences which I think uses the same algorithm under the hood. Here, the matrix is dumped to the log window which is better but still tedious to extract for further processing.

A previous mailing list post suggested Register Virtual Stack Slices, but as soon as I try to run it with “Save Transforms” checked, Fiji completely freezes and has to be restarted, so this is not an option.

Any help on how to extract the matrix or hints on other feature-based matching plugins is highly appreciated!

Hello Noreen -

As an aside, although (the version that ships with Fiji / ImageJ
of) Linear Stack Alignment with SIFT does not expose the
alignment transformation, it would be easy to modify it to do

I can successfully run:
Plugins > Registration > Register Virtual Stack Slices
with “Save transformations” checked. Doing so writes the
transformations to “Source directory” as .xml files. (I ran
the plugin on a source directory containing three copies of
the Clown.jpg sample image, each slightly rotated from one
to the next.)

I am using a recently auto-updated version of ImageJ / Fiji
(2.0.0-rc69/1.52i on ubuntu 16.04 LTS).

Your best bet might be to track down why “Register Virtual Stack
Slices” hangs for you since this plugin will write the transformations
to disk.

It would also be practical to modify “Linear Stack Alignment with
SIFT” to expose the transformations, although this would take
some modest programming effort.

Thanks, mm

1 Like


it turns out I had run into the issue that Register Virtual Stack Slices hangs on Mac OSX. Running the registration via a jython script did the trick because I can then avoid the file chooser dialog. So that solution will work for extracting the transformations.


Hi @noreenw,

You’re right about this.

What would you like to do with the transformation matrices? and how would you like the matrices to be output (if not to the log?)

If you’re coding / building a script or plugin, I’d probably recommend calling the relevant code more directly and storing the matrix as a variable.

Alternatively, would a modification of the SIFT-based plugins that write the matrix to file be helpful?


Hi @bogovicj,

sorry for delayed reply. For now I just needed the matrices stored in any text-like format to disk so that I could analyze the transformations (especially drift) over time. “Register Virtual Stack Slices” worked for this.

That sounds like a good plan for the next step, I will try this. The project is still right now still in early feasibility though, so this will come later.