Is there an interactive command interpreter available for Fiji? I can type commands a macro and run them, but a real time option would be nice.
Plugins > Scripting > Script Interpreter
and you can choose your preferred language .
Here is an example session:
Hello Wayne -
This is not a feature request, but more a question to satisfy my
curiosity: Can something similar be done for jython (python),
itself an interpreted language? Would there be any impediment
to adding jython to the Interactive Interpreter (other than the
obvious issue of time and resources)?
The script interpreter mentioned by @bogovicj above (Plugins > Scripting > Script Interpreter; included with Fiji) ships this functionality for several years now (for all supported script languages). I’d be interested if it matches your requirements, or if there’s anything missing to make it useful for you and others.
There has been a Jython Interpreter since Fiji was created, pretty much. Perhaps 10 years.
For unknown reasons, the Jython Interpreter and others were moved a few years ago to the fiji-legacy update site. Activate it to get them.
The new “Scripting Interpreter”, despite all many faults (https://github.com/scijava/scijava-common/issues/308), can run Jython code interactively.
The “Script Editor” now has a command prompt, AKA a script interpreter. So any language that is not compiled (like java) that runs in the Script Editor now has a script interpreter. The pull request is here https://github.com/scijava/script-editor/pull/28 and should be merged soon, bringing these new features of the Script Editor to a near-future fiji update.
For the record: the reasons were explained here:
Thanks for pointing to the original report on why the script interpreters were moved to the fiji-legacy update site. The report is unfortunate in that it announces the new Script Interpreter as replacing the old ones, when it didn’t: the new one has a number of severe issues, such as not being able to store the command history (a pretty basic feature), in addition to having undergone limited testing (resulting in e.g. using “:lang” commands to switch languages, when in e.g. clojure the ‘:’ is reserved for map keys), and a number of issues with the UI (lack of collapsible window displaying variables table, no info on what the variable table is for or why these variables are not available from the prompt).
Hello Albert (and John and Wayne et al.) -
Okay, it’s starting to look like an embarrassment of riches. Does this
Plugins > Scripting > Script Interpreter
Been around for a while; I just didn’t know about it.
Plugins > Macros > Interactive Interpreter...
New with Wayne’s recent
Help > Update ImageJ...
New > Script...
If I understand Albert correctly, the new “command prompt”
feature will be coming soon, but is not yet part of stock Fiji.
A “legacy” “Jython Interpreter and others,” not distributed
with stock Fiji, but available from the fiji-legacy update site.
A couple of questions: Which to use for common tasks? Do some offer
features (other than the obvious issue of specific language support) that
would be of use in special cases?
If I install the “legacy” interpreter(s) where will they show up in the Fiji
Thanks to all for letting me know that this functionality exists. It should
be a nice convenience when monkeying around.
The “legacy” interpreters actually work, as opposed to the new “Script Interpreter” which has errors such as failing to save your entered command line history. These “legacy” interpreters will show up in the “Plugins - Scripting” menu.
For common tasks I use these “legacy” ones, been doing so for years.
Wayne’s new macro interpreter I haven’t tried. I prefer a full-fledged programming language like python and clojure over macros.
I feel obligated to push back on @albertcardona’s vehemence—I used the new Script Interpreter sometimes, and it works OK for me. It’s true that there are some bugs we need to fix, but implying it “doesn’t work” is highly unfair. It works for me and others. @mountain_man I suggest you simply try all available options for yourself and use the one(s) that work for your needs.
To complete your list above: there is yet another way to execute script one-liners, using the “hash bang” (
#!) syntax in the search bar. It uses the same REPL instance as the Script Interpreter. Here is an example:
Okay, @ctrueden, now you’re just messing with my head.