Pushbuttons in ImageJ macro dialog

Dear Forum,

I wrote a macro which I’d like to make a bit easier to use for non-programming people.
The macro currently features a couple of lines where users have to define a few paths with data input and set a few numerical options. It kind of looks like this:

Input_file_1 = "...";
Input_file_2 = "...";
Input_file_3 = "...";

Option_1 = true;
Option_2 = 10:

What I’d like to do is to make this a bit more streamlined, and do these settings within a DialogBox. The filename inputs should have a textfield and a browse button next to them, and that’s where the trouble starts. I know the GenericDialog class in javascript and ImageJ macro, but these don’t provide an option for pushbuttons, let alone a possibility to link such a button to a OpenFileDialog.

Does anyone know of a way to do this in ImageJ macro or, if necessary in Jython or JavaScript. I’d like to avoid the latter as I’m not very familiar with it.

Thanks in advance!

As long as you use Fiji, I recommend using script parameters (independent of the scripting language you use) – which are a feature of ImageJ2, by the way.

This is how your macro would start:

#@ File Input_file_1
#@ File Input_file_2
#@ File Input_file_3

#@ Boolean (value=true) Option_1
#@ Integer (value=10) Option_2

… which will generate a dialog like this:


Love it. Much obliged!