Using the Script Editor

Revision as of 14:01, 23 January 2017 by Etarena (talk | contribs) (Add collapse logic for 'scripting' in menu)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Script Editor (ImageJ)
Author Johannes Schindelin, Sumit Dubey (Google Summer of Code 2009)
Maintainer Curtis Rueden
Source on GitHub
Initial release 11 Sep 2008
Development status active

The script editor is an invaluable help when writing scripts in any of ImageJ's supported languages.

Learn
Topics
Introduction
Getting Started
User Guides
Tutorials
Tips and Tricks
Presentations
Plugins
Techniques
All Techniques
Colocalization
Deconvolution
Registration
Segmentation
Stitching
Tracking
Visualization
Scripting
Overview
Parameters
Basics of script writing
Batch processing
Script Editor
Auto Imports
Templates
Running headlessly
Comparisons
Toolbox
Multithreading in Clojure
Multithreading in JavaScript
Chess in Jython
Languages
BeanShell
Groovy
ImageJ Macro
JavaScript
Lisp (Clojure)
MATLAB
Python (Jython)
R (Renjin)
Ruby (JRuby)
Scala


Features

Text Editing
  • Full undo support
  • Auto-indent
  • Configurable white-space options
Programming
  • Syntax highlighting
  • Output console
  • Git integration (file being edited must be part of a Git repository)
  • Language specific templates
  • Find and replace using regex patterns
  • Automatic brace highlighting
  • Line numbers
Language specific tools
Interface
  • Bookmarks
  • Tabs for easy switching between open files
  • Navigation shortcuts

Usage

Starting the editor

To get started, start up the script editor:

Script-Editor-new.jpg

There is also the keyboard shortcut [ (open square bracket) to open the editor.

Choosing a language

Then choose a language from the language menu:

Script-Editor-choose-language.jpg

Now you can write your script. In this tutorial, Jython was chosen as scripting language, but the process is really the same for all scripting languages.

Script-Editor-first-script.jpg

Running the script

Once you are satisfied with the script, run it. This does not require saving, but of course you should save your script later when it works.

Script-Editor-run.jpg

Note that while the script is running, the window title shows the tell-tale (Running).

You can use all of ImageJ's classes right away. Here is an example that shows a dialog where the user can input a number. For details how to write dialogs in the different scripting languages, see Scripting comparisons

Script-Editor-dialog.jpg

Further reading

See the Scripting Help page for an introduction to scripting. For more information about each specific language, see the Languages section of top right sidebar.