Short Description

Create powerful scripts to implement what’s missing with plugins. Syntax Color and Autocomplete features implemented (still need testing).

Team: Bio Image Analysis unit
Institution: Institut Pasteur
Website: https://icy.bioimageanalysis.org

Documentation

Introduction

ROIs and Loops

Batch processing

Running scripts in headless mode

If you need to run a script without using any user interface (using a system terminal), you can use the headless mode available for Icy.

In order to use scripts in headless mode you need first a protocol using either Javascript or Pythonscript blocks. On these blocks you can set the inputs and outputs of the script. Once the script is complete, save the protocol in a file (it will be used in headless mode).

Note: Please make sure to name all your input blocks with a name to make sure they can be read from a terminal.

Finally, to execute the script in headless mode you can type on a terminal

icy.sh -hl -x plugins.adufour.protocols.Protocols protocol=/my/great.protocol input1=/my/inputFile output1=/my/outputFile

An example protocol file can be acessed in the following link: Javascript headless block example. To execute it use the following line:

icy.sh -hl -x plugins.adufour.protocols.Protocols protocol=/full/path to/test.protocol input1=/my/inputImageFile.tif output1=/my/outputImageFile.tif

Here, you have to specify the path of the protocol, the input file and the output file.

F.A.Q.

  1. On my Mac OS X, Ctrl + Space opens Spotlight and does not auto-complete.
    Currently, you have to change the shortcut of Spotlight by going to “System Preferences > Spotlight” and change the shortcut (lower part of the window).
    Why did we choose this shortcut? In fact, Ctrl + Space is a standard for developers in their IDEs (Eclipse, Netbeans, Qt Creator, etc), but Apple decided to use F5 in their own IDE and Ctrl + Space for Spotlight.
    In the future, there will be an option in the Script Editor to change the auto-complete shortcut.
  2. Will my ImageJ macro work in ScriptEditor?
    Currently, ImageJ macros are fully usable, please look at the script “callIJMacro.js” to do it.
  3. Will my MicroManager scripts work in ScriptEditor?
    MicroManager’s scripts are compiled with Beanshell and not Rhino. You will have to adapt the script to make it work in Icy.
  4. In JavaScript, I got the following error: “ambiguous”, what did I do wrong?
    Because there is a bridge between JavaScript and Java, some objects are not interpreted correctly, and JavaScript does not know which method to call between two (or more). When this happens, you will have to tell JavaScript exactly which one you want to use.
    For instance: Thresholder.threshold(seq, 1, [127], false) => doesn’t workBut some functions are proposed instead:
    class icy.sequence.Sequence threshold(icy.sequence.Sequence,int,double[],boolean)
    class icy.sequence.Sequence threshold(icy.sequence.Sequence,int,double[][],boolean)If you want to use the first one, write:
    Thresholder[“threshold(icy.sequence.Sequence,int,double[],boolean)”](seq, 1, [127], false)As you see, you just copy and paste the needed function (without the “class” and the return type).
    This is an explicit call. It works the same way for non static access.
  5. How can I create an array in JavaScript?
    Arrays are created using the following syntax:
    var myArray = [12, 0.1, 96]An array can contain anything: numbers, objects, chains of characters. However, for Java inter-connection, please avoid mixing the types in an array.
  6. Some method in the autocomplete contains an “s” on their icon, what is it?
    These methods are “static” method, meaning they are meant to be called on the class directly, and not on an instance of the class. If you are not familiar with the Oriented Object Programming, simply remember this example:cos(arg) in class Math is staticWhen you want to use it, you don’t do:
    math = new Math()
    math.cos(x)You do:
    Math.cos(x)
    It is the same with SequenceUtil and IcyBufferedImageUtil: SequenceUtil.getCopy(seq).

Resources needing this

5 reviews on “Script Editor

  1. Anonymous
    great mix of flexibility and accessibility! I use it a lot.
  2. t
    Thomas Boudier
    Looks fine, but java sun required ;-) ; does not work with openjdk. OK works with 1.7 openjdk, thanks !
  3. Alexandre Dufour
    Amazing tool, with auto-completion, multi-language support, and access to the entire Icy codebase including documentation. BRAVO.
  4. E
    Emmanuel
    A good complement to protocol plugin that allowed scientist to implement new function. What could help is to have the list of all function and argument we can use. Many thanks

Leave a Review

Leave a review
Cancel review
View full changelog
Close changelog

Changelog

  • Version 1.18.0.0 • Released on: 2022-11-18 14:30:00
    Download
    Description:

    Updated to work with Java15 or above

  • Version 1.16.3.0 • Released on: 2020-01-23 13:48:00
    Download
    Description:

    Fixed minimum java version compatibility. Now set to Java 6

  • Version 1.16.2.0 • Released on: 2020-01-23 11:07:00
    Download
    Description:

    Fixed minimum java version compatibility. Now set to Java 7

  • Version 1.16.1.0 • Released on: 2020-01-22 14:26:00
    Download
    Description:

    Fixed bug converting VarMutable to VarMutableScript when not needed.

  • Version 1.16.0.0 • Released on: 2020-01-21 13:06:00
    Download
    Description:

    Added headless mode for Javascript and Pythonscript blocks. Old codes for these plugins were kept in OldJavascript and OldPythonscript blocks.

  • Version 1.15.0.0 • Released on: 2019-04-15 16:24:55
    Download
    Description:

    Updated online search URL (was using very old icy URL).

  • Version 1.14.2.1 • Released on: 2016-11-16 16:36:34
    Download
    Description:

    - Fixed NPE when loading Script block in Protocol.

  • Version 1.14.2.0 • Released on: 2016-11-14 18:10:06
    Download
    Description:

    Added font size setting in preferences.

  • Version 1.14.1.0 • Released on: 2016-01-05 18:59:03
    Download
    Description:

    Fixed several bugs with the javascript block.

  • Version 1.14.0.3 • Released on: 2015-10-06 10:29:14
    Download
    Description:

    fixed search provider accidentally broken.

  • Version 1.14.0.2 • Released on: 2015-10-02 10:56:05
    Download
    Description:

    Minor fix on close operation.

  • Version 1.14.0.1 • Released on: 2015-09-30 16:31:12
    Download
    Description:

    Added file existence checking when auto loading script file from command line arguments.

  • Version 1.14.0.0 • Released on: 2015-09-30 15:10:49
    Download
    Description:

    * added support to 'command line arguments' so we can now launch a script directly from the command line (headless not yet supported though).

  • Version 1.13.2.0 • Released on: 2014-07-23 18:46:58
    Download
    Description:

    Added Boolean type for script editor block in protocol.

  • Version 1.13.1.0 • Released on: 2014-07-07 12:39:00
    Download
    Description:

    Fixed bug on label completion parsing.

  • Version 1.13.0.4 • Released on: 2014-06-26 15:15:50
    Download
    Description:

    some bug fixes.

  • Version 1.13.0.3 • Released on: 2014-06-16 12:16:44
    Download
    Description:

    Fixed NPE in JSScriptingHandlerRhino.buildFunctionRecursive(..) method.

  • Version 1.13.0.1 • Released on: 2014-06-05 12:08:41
    Download
    Description:

    Fixed a minor issue on executing a script directly from the search bar.

  • Version 1.13.0.0 • Released on: 2014-02-26 23:13:34
    Download
    Description:

    Fix two possible exceptions related to JavaScript auto-completion.

  • Version 1.12.0.0 • Released on: 2014-01-13 12:43:08
    Download
    Description:

    Fix bug preventing the editor to be opened (tab index errors when restoring the saved state of the editor).

  • Version 1.11.0.0 • Released on: 2013-12-26 13:45:35
    Download
    Description:

    - Fix errors in tab opening, and code the closing more defensively.

  • Version 1.10.0.0 • Released on: 2013-12-26 12:53:34
    Download
    Description:

    -The absolute path of the current file is shown in the title bar of the editor

    -The language combobox has a fixed size

    -The 'Run' button is re-enabled after switching to AppleScript and back

    -Fix BadLocationExceptions appearing when deleting lines on a script with errors (coming from asynchronous gutter update)

    -Fix '+' button for new tabs (the user could have selected the small region between the button and the edge of the tab component, and it would not have created a new tab as expected)

    -Code Cleanup

  • Version 1.9.0.0 • Released on: 2013-12-19 12:38:18
    Download
    Description:

    - Really completely remove the possibility of an inifinte loop causing Icy to freeze (bug in syntax check).

    - Improve syntax checks to handle multiple errors on the same line.

  • Version 1.8.0.0 • Released on: 2013-12-18 16:50:18
    Download
    Description:

    - Fix an error that could freeze Icy completely in the Javascript editor.

    - Re-throw Python exceptions so that syntax errors can be highlighted in the GUI.

    - Fix the "stop" button when running in the same engine.

    - Fix the language selection of the console when changing the current tab.

    - Performance optimisation (replace CaretListener with DocumentListener).

  • Version 1.7.0.2 • Released on: 2013-12-17 11:22:17
    Download
    Description:

    Fix a NullPointerException with the Javascript block.

  • Version 1.7.0.1 • Released on: 2013-12-17 10:13:39
    Download
    Description:

    Regression from version 1.6.0.0

  • Version 1.7.0.0 • Released on: 2013-12-16 17:05:04
    Download
    Description:

    Please note that this update will erase the list of recent files, reset the editor state (opened files) and the editor preferences. This was needed to completely fix some issues.

    - Fix the scrolling of the console output. Now properly stops scrolling when the scrollbar is used.

    - Implement real "Apply", "Ok", "Cancel" for the Preferences. Also properly apply the Preferences when a file is opened.

    - Make the saving of the editor state (opened files, recent files) more robust.

    - Fix the logic for "soft tabs" (was inverted).

    - Do not format the files when applying the Preferences, but only when clicking on 'Format'.

  • Version 1.6.0.0 • Released on: 2013-12-09 16:57:00
    Download
    Description:

    - allow Icy to release more memory when the Script editor is closed (remove listeners and release engines)

    - save the editor state more often (at each file open and close) to prevent state loss in case Icy crashes (which does not happen ;) )

  • Version 1.5.0.0 • Released on: 2013-12-02 16:53:50
    Download
    Description:

    - Fix a memory leak that was causing Icy to freeze with an OutOfMemory exception after several script runs.

    - Fix the parsing of Python scripts where the encoding is explicitly specified.

    - Small code cleanups related to the Python script engine.

  • Version 1.4.0.0 • Released on: 2013-10-10 13:49:40
    Download
    Description:

    * corrected issue with infinite loop due to an error in line interpretation.

  • Version 1.3.3.0 • Released on: 2013-09-20 17:09:07
    Download
    Description:

    * will not try to reopen a file that does not exist
    * now remembers previous launch type
    * corrected issue with save

  • Version 1.3.2.0 • Released on: 2013-09-02 10:36:30
    Download
    Description:

    * Handles errors better

  • Version 1.3.1.0 • Released on: 2013-08-26 15:34:19
    Download
    Description:

    * previous version was compiled for next release.

  • Version 1.3.0.0 • Released on: 2013-08-26 15:29:34
    Download
    Description:

    * added support for the search bar

  • Version 1.2.0.0 • Released on: 2013-07-17 16:50:41
    Download
    Description:

    * added a feature in FileDialog to open directories
    * auto save all file types when run, but only if filename already set
    * added eval() method for JS
    * better module support in Python

  • Version 1.1.0.0 • Released on: 2013-07-12 10:31:50
    Download
    Description:

    * Removed (for now) interpretation of functions : was too cheap
    * added interpretation of module and auto complete

  • Version 1.0.4.0 • Released on: 2013-07-08 17:59:34
    Download
    Description:

    * if an image is dragged into Icy, the script editor gives it to Icy to open it.
    * corrected issue with constructors not having a source.

  • Version 1.0.3.0 • Released on: 2013-07-08 10:56:56
    Download
    Description:

    * changed interpretatoin of imports, should not bring any more infinite loop.

  • Version 1.0.2.0 • Released on: 2013-07-03 17:04:30
    Download
  • Version 1.0.1.0 • Released on: 2013-07-02 17:35:35
    Download
    Description:

    * started autocompletion with Python, more to come

  • Version 1.0.0.0 • Released on: 2013-06-25 17:09:20
    Download
    Description:

    * Path corrections added for Python and Execnet

  • Version 0.9.9.1b • Released on: 2013-06-21 13:08:33
    Download
    Description:

    * removed sun JVM requirement on loading

  • Version 0.9.9.0b • Released on: 2013-06-21 10:47:59
    Download
    Description:

    * Beta build for linux compatibility

  • Version 0.9.7.1 • Released on: 2013-06-13 15:39:19
    Download
    Description:

    * corrected run issue in python

  • Version 0.9.7.0 • Released on: 2013-06-13 14:28:20
    Download
    Description:

    * issue with interpretation of python corrected
    * now opens the right previously selected tab when opening the Script Editor
    * now evaluates the file in Python, not the string

  • Version 0.9.6.2 • Released on: 2013-06-12 17:24:06
    Download
    Description:

    * corrected issue with Python console.

  • Version 0.9.6.1 • Released on: 2013-06-12 14:08:41
    Download
    Description:

    * corrected few issues:
    - now able to add an input after the xml has been loaded
    - autocomplete now fully works on variables in both editors

  • Version 0.9.6.0 • Released on: 2013-06-04 17:22:06
    Download
    Description:

    * corrected issue with importClass and spaces
    * now the autocomplete feature show the variables defined in the Javascript block

  • Version 0.9.5.1 • Released on: 2013-05-27 17:30:54
    Download
    Description:

    * Corrected an issue that appeared with previous version.

  • Version 0.9.5.0 • Released on: 2013-05-22 17:12:35
    Download
    Description:

    * console is now shared between scripts
    * added a button to choose the type of run
    * corrected multi occurences of "gui" variable
    * added a new feature : clear or not the console everytime the script is run
    * in Javascript block, the internal text editor is disabled while using
    the external one
    * the external editor is now name "External Editor" instead of
    "untitled"
    * memory of the engine is released when the no more Script Editor frames remain

  • Version 0.9.4.1 • Released on: 2013-05-14 17:35:19
    Download
    Description:

    * Corrected Memory Leaks

  • Version 0.9.4.0 • Released on: 2013-05-14 10:59:43
    Download
    Description:

    * Better conversion between java and javascript for Javascript block's outputs.

  • Version 0.9.3.0 • Released on: 2013-05-13 10:33:18
    Download
    Description:

    * Corrected issue with warning and Javascript block

  • Version 0.9.2.0 • Released on: 2013-04-17 12:27:26
    Download
    Description:

    * added a full autompletion feature: now proposes solution after every character when pausing for 0.5 s

    * corrected few interpretation errors

  • Version 0.9.1.0 • Released on: 2013-04-11 16:07:45
    Download
    Description:

    * added a Javascript block
    * corrected a few issues concerning Arraylists (still need testing)

  • Version 0.9.0.0 • Released on: 2013-03-14 19:02:03
    Download
    Description:

    * added a Javascript block
    * correct a few issues

  • Version 0.8.6.1 • Released on: 2013-03-13 16:32:23
    Download
    Description:

    * Uncommited work added (gécomitilapapoule)

  • Version 0.8.6.0 • Released on: 2013-03-13 16:21:42
    Download
    Description:

    * Corrected issue with opened recent files feature on Mac OS X.

  • Version 0.8.5.0 • Released on: 2013-03-12 17:09:00
    Download
    Description:

    * corrected bug importing twice some classes
    * now imports only needed imports (previously, the script editor imported too many classes, not necessarily needed by the engine)

  • Version 0.8.4.0 • Released on: 2013-03-12 11:09:42
    Download
    Description:

    Corrected issue with "Python" insteand of "python", leading to Templates bug and null engines.

  • Version 0.8.3.0 • Released on: 2013-03-11 16:36:44
    Download
    Description:

    * added "View Source" in autocompletion
    * corrected few bugs for coming Script Block V2
    * Activated autocomplete by default

  • Version 0.8.2.0 • Released on: 2013-03-06 10:17:29
    Download
    Description:

    * Corrections for JPython
    * Added Drag'n Drop feature
    * Better support for Enums

  • Version 0.8.1.2 • Released on: 2013-02-28 11:46:20
    Download
    Description:

    * corrected null on populate() methods for functions in a class in autocomplete.

  • Version 0.8.1.1 • Released on: 2013-02-27 10:43:03
    Download
    Description:

    * Corrected issue that appeared in 8.1 with auto parsing.

  • Version 0.8.1.0 • Released on: 2013-02-27 09:31:50
    Download
    Description:

    Corrected Threading issues.

  • Version 0.8.0.0 • Released on: 2013-02-25 17:32:44
    Download
    Description:

    * added sourcing for methods / constructors / classes.
    * added Ctrl + Shift + C for line commenting

  • Version 0.7.0.0 • Released on: 2013-02-20 10:33:20
    Download
    Description:

    * Python now supported thanks to new Kernel and small corrections
    * Added Hyperlinks Ctrl+click feature

  • Version 0.6.3.0 • Released on: 2013-02-19 11:01:36
    Download
    Description:

    * added new feature: Find/Replace
    * added "Go To" feature
    * new and [] now works, but will not verify if the constructor exists.
    * Better support of declaration of multiple variables.
    * Corrected asynchronous issue with FileDialog class.

  • Version 0.6.2.0 • Released on: 2013-02-13 19:04:14
    Download
    Description:

    * corrected issue with FileDialog

  • Version 0.6.1.0 • Released on: 2013-02-13 18:20:51
    Download
    Description:

    * corrected few issues with detection
    * "var" keywork taken into account

  • Version 0.6.0.0 • Released on: 2013-02-12 16:41:45
    Download
    Description:

    * added GUI items easy to use for scripting:
    * * simple dialog creation
    * * simple file save/open dialog
    * better error support

  • Version 0.5.0.0 • Released on: 2013-02-08 16:25:17
    Download
    Description:

    * added support for "new" in autocompletion
    * changed layout policy for tabs
    * cell renderer compatible with new autocompletion type
    * fixed issue with BasicJavaClassCompletion
    * changes in indentation
    * deprecated displayed on methods and fields
    * corrected another automatic import issue
    * preferences now have advanced mode for method detection
    * commented static functions used for binding
    * better method resolver
    * added "gui" variable in the engine
    * added Interface icon
    * corrected an issue with same name functions not appearing in
    autocomplete
    * displays only public members / classes / methods
    * corrected issue when opening templates
    * static function to display text in the scripteditor from another
    source
    * better array support

  • Version 0.4.1.2 • Released on: 2013-02-06 11:31:47
    Download
    Description:

    * Corrected issue with Release version
    * added a textpane for some issues to have color

  • Version 0.4.1.1 • Released on: 2013-02-05 17:04:55
    Download
    Description:

    * corrected null issues
    * multi line errors now back
    * handle assignment of arrays

  • Version 0.4.1.0 • Released on: 2013-02-05 14:35:26
    Download
    Description:

    * removed debug info
    * corrected few null pointer exceptions happening in specific cases

  • Version 0.4.0.0 • Released on: 2013-02-05 11:03:04
    Download
    Description:

    * Now uses Rhino Library for JavaScript Parsing: fully compatibility between Java 6 and 7.
    * Advanced mode for AutoCompletion: all methods. Activated by default in code for testing, will add an option in preferences later (less information)

  • Version 0.2.0.0 • Released on: 2013-01-31 17:17:30
    Download
    Description:

    * added copy/paste features in console and output.
    * switched order buttons run
    * preferences with soft tab working
    * added text when running in new engine
    * added scroll lock
    * tooltips on run buttons

  • Version 0.1.2.0 • Released on: 2013-01-21 15:47:35
    Download
    Description:

    Corrected a bug preventing from using plugins with the script editor in release.

  • Version 0.1.1.2 • Released on: 2013-01-14 10:11:55
    Download
    Description:

    * if a library has an issue with findBindingMethods(), now catches it.

  • Version 0.1.1.1 • Released on: 2013-01-11 15:52:30
    Download
    Description:

    * Updated to last kernel
    * few modifications in detection, although still disabled for now

  • Version 0.1.1.0 • Released on: 2013-01-07 16:34:58
    Download
    Description:

    * corrected memory leak when closing

  • Version 0.1.0.0 • Released on: 2013-01-03 17:38:40
    Download
    Description:

    * stable enough for RC 1
    * added a few corrections in first load
    * now fewer options in Preferences Panel, autocomplete is now for later versions, not stable enough

  • Version 0.0.3.0 • Released on: 2013-01-02 13:34:32
    Download
  • Version 0.0.2.3 • Released on: 2012-12-20 18:09:49
    Download
    Description:

    * console separated
    * output should work better

  • Version 0.0.2.2b • Released on: 2012-12-20 12:47:40
    Download
    Description:

    * new interpretation in python now completly functionnal
    * next version will feature a real Python Console.

  • Version 0.0.2.1b • Released on: 2012-12-18 16:57:35
    Download
    Description:

    * corrected open python files issue

  • Version 0.0.2.0b • Released on: 2012-12-17 18:10:45
    Download
    Description:

    * console added
    * lots of bug corrected
    * preferences panel

  • Version 0.0.1.4b • Released on: 2012-12-13 15:49:29
    Download
    Description:

    * scripts are run in a thread
    * possibility to stop a thread (needs testing)

  • Version 0.0.1.3 • Released on: 2012-12-11 16:21:43
    Download
    Description:

    * added a preferences panel (no save as of now)
    * all verification features disabled by default
    * few corrections

  • Version 0.0.1.2b • Released on: 2012-12-05 13:37:07
    Download
    Description:

    Corrected java.lang.ClassNotFoundException: org.python.antlr.base.mod issue

  • Version 0.0.1.1b • Released on: 2012-12-05 10:20:10
    Download
    Description:

    Uses plugin libraries instead of own jars for developers to be able to try the plugin without issues.

  • Version 0.0.1.0b • Released on: 2012-12-04 17:45:20
    Download