Skip to content, Skip to search


Generic dialog

24 bytes removed, 6 June
Use Javadoc template for javadoc links
== Introduction ==
The [{{Javadoc | project = ImageJ1/| package = ij/gui/| class = GenericDialog.html Generic Dialog] }} class is part of [[ImageJ1]] and can be used to make simple graphical user interfaces for scripts and plugins. It requires a bit more of work than with the [[Script Parameters|script parameters]] option but offers more possibilities.<br>Fiji offers an additional [{{Javadoc | project = Fiji/| package = fiji/util/gui/| class = GenericDialogPlus.html GenericDialogPlus] }} subclass which include additional GUI item like a file input with a browse button.<br>
Like the script parameters, plugins using the Generic Dialog (or one of its subclass) are macro recordable.
By default, script and plugins process the last selected image.<br>
However sometime one needs to specify different images or files as input.<br>
The subclass [{{Javadoc | project = Fiji/| package = fiji/util/gui/GenericDialogPlus.html | class = GenericDialogPlus] }} provides a couple of handful methods for such cases, while all methods shown above are inherited from the GenericDialog class.
<source lang="python">
Fortunately, it is still possible to make it works using the PrefService.
Services are some ImageJ2/SciJava features that can be though as some kind of package import at runtime. Here 's the link to the [{{Javadoc | project = SciJava/| package = org/scijava/prefs/| class = PrefService.html PrefService Javadoc]}}.<br>
And below is a Jython example of how to use it.
<source lang=python>
#@PrefService prefs
from fiji.util.gui import GenericDialogPlus
Bureaucrat, emailconfirmed, incoming, administrator, uploaders