ij-Groovy Tutorials

Create Groovy Scripts Using ImageJ Macro Recorder

You can use ImageJ Macro Recorder to recorder to commands for a Groovy script. Simply set macro type to JavaScript, record commands, create script, copy content to Groovy Console and add imports as needed.

Step by step instructions are provided this tutorial.

Tips and Tricks

  • Lear more about Groovy Console at Groovy website
  • Use Ctrl-R to run a script in GroovyConsole. This is equivalent to selecting menu Script > Run.
  • Use Ctrl-W to clear output window. If too many things accumulated in the Groovy Console output window, clean it up. Alternatively select View > Auto Clear Output On Run to have output window cleaned up every time you run a script.
  • Use Script > Compile to test script syntax without executing.
  • Use IDE to develop scripts, use Groovy Console to run them in ImageJ. The Groovy Console provides a convenient way for lightweight editing running scripts, including integration with ImageJ. However, an IDE can add many advanced development features. You can create and modify scripts in IDE and use Groovy Console to run them in ImageJ.

    The IntelliJ IDEA has great support for working with Groovy (in both Community and Ultimate editions). You can debug scripts and classes, inspect runtime variables. Editor provides syntax highlighting and error marking, code completion, class search, code inspections. You can quickly access API documentation for Groovy, ImageJ, and other libraries in use. And much more.

    You may also try Groovy options provided by NetBeans and Eclipse.