Position of the results table

imagej
macro

#1

Hi,
is there a way to set the location of the results table and the ROI manager via a macro.
setlocation function seems useless in this case.
Thanks


#2

Hi @Alban_Favre,

you need to select the respective Windows first. Then setLocation(x, y);works. You can test the following macro when the table and the roi manager are open.

selectWindow("Results");
setLocation(0,0);

selectWindow("ROI Manager");
setLocation(50, 50);

#3

Thanks but what bout the size of the windows as well?
“setLocation(x, y, width, height)” does not work…
Any alternatives?


#4

Hi @Alban_Favre,

via a macro this is not possible (at least not that I would know of it).

See the specification of the macro commands. It only applies to image windows.

setLocation(x, y, width, height)
Moves and resizes the active image window. The new location of the top-left corner is specified by x and y, and the new size by width and height.

With a script this will be possible.
I am actually not familiar with groovy scripts so far but trying the following worked as a groovy script from the Fiji script editor.

import ij.plugin.frame.RoiManager;
import ij.measure.ResultsTable;

rm = RoiManager.getInstance();
rm.setSize(250,300);
rm.setLocation(0, 0);


rt = ResultsTable.getResultsWindow();
rt.setSize(800,500);
rt.setLocation(251, 0);

[…Edit…]

Alternatively you can add the upper groovy script with the following line directly into your macro.

eval("bsh", "rm = RoiManager.getInstance();rm.setSize(250,300);rm.setLocation(0, 0);rt = ResultsTable.getResultsWindow();rt.setSize(800,500);rt.setLocation(251, 0);");

I just figured out that interpreting it as a BeanShell script via the eval("bsh", script); macro command works (at least for this type of commands).


How to save my counter results on my image?
#5

That’s because your script uses semicolons (;) to end every line. This is not required (but allowed) in Groovy, but is required in Beanshell, so it turns out your script has valid syntax for both Groovy and Beanshell :slight_smile:


#6

Serendipity of the ignoramus is a b… :wink: (the good old penicillin-effect :stuck_out_tongue_winking_eye: )

Thanks for pointing that out :+1:

…need to learn more on Groovy