Align Image by line ROI: How to return parameters?


The Align Image by line ROI plugin works well for my registration needs. I would like to use the values of the parameters used by the plugin (scale, rotation, translation) and apply them to the corresponding ROI files. It would be ideal if the plugin printed them to the log, or anywhere else.

Approach 1:
My original strategy was to find the source code of the already installed plugin, and google my way to a couple of extra lines of java code (this approach has worked for my macros so far). However, I guess this will be more complicated.

I have located Align_Image.class in VIB_-3.0.2. When I open it with any of my editors, e.g. Notepad++ set to java language mode, I get:

So I gave up this route.

Approach 2:*
I expect the code to be mostly identical to I can run this from the Fiji editor, saving it in

Running it will give me the error
[DEBUG]: Couldn’t find ClassFile for: Interpolator
No javac.jar found (looked in C:\Users\thaider\DOWNLO~1\FIJI-W~1\\jars)!

I guess it has to do with the plugin not working in isolation (I had hoped it would find the files from the already installed plugin).

Approach 3:*
Find different plugin that does the job and easily hands me the values.

Could somebody please point me in the right direction?


Hi @terhai,

You were most of the way there, just missing some information about scripting with fiji.

Short answer:

I copied the java code you linked to into a groovy script viewable here, and printed the parameters in the relevant place.

If you copy that code into the script editor and hit run, it should act just like the align by line roi plugin youve been using, but it will also print out the transformation parameters.


Depending on the details of what you’re doing, you may need to apply the inverse transformation to your rois. This is because, to transform an image, one needs to transform point coordinates from the target space to the moving space and interpolate in moving space. You can read more about why here.

Hope this works, and please post back if anything weird happens.

My understanding of why putting the java code threw that error:

If the fiji editor sees java code, it expects to need to compile it. The program to compile java code is called “javac” and lives in a file called javac.jar which is missing I guess…


Hi @bogovicj,

Thank you for your fast and throurough solution! (The warning was very useful, I encountered this already this morning and saved it for future me to solve.)

Will report back if indeed something weird happens.

1 Like