Short Description

Python engine for Icy, based on Jython

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

Documentation

The Jython for Icy plugin allows you to write scripts for Icy in the Python language. Scripts can be used to automate processing tasks (the Protocols are another kind of automation tools, where the script is defined graphically).

About Python

Python is a powerful dynamic programming language, that aims to be elegant, powerful and uncomplicated. Some of its key distinguishing features include:

  • very clear, readable syntax
  • strong introspection capabilities
  • intuitive object orientation
  • natural expression of procedural code
  • modularity
  • very high level dynamic data types
  • extensive standard libraries and third party modules for virtually every task

Inside Icy, Python is a great and easy-to-learn language to write down your image processing scripts.

About Jython

Jython is an implementation of the Python programming language for Java. Icy itself is precisely written in Java, so Jython is a natural choice as a scripting engine for Icy.

Please note that there is one major difference between Jython and CPython (the standard implementation of Python in the C programming language): some libraries are designed to run specifically in CPython, and they cannot run directly in Jython. The well-known numerical libraries Numpy and Scipy belong to this category, and will not work directly inside Icy. We are working in an elegant way to use them by bridging CPython and Jython. Stay tuned !

Usage

The Python scripting engine will appear when you open the Script Editor. The first time you open the Script Editor after having installed Jython for Icy, the application may freeze for some time: Jython is going over all of the source code of Icy and its libraries to make them accessible in Python.

Script Editor icon in Icy toolbar

Choose Python in the drop-down list of the editor window.

Select python as the script language

You can write your Python script inside the editor’s text area and then run it by clicking on the “Play” icon.

Running a python script in Icy

In the above example, the script will duplicate the currently-active sequence.

You can also use the console at the bottom of the editor window to interact with Icy. Enter the command lines one-by-one in the text area at the very bottom of the window, and execute each line by hitting Enter.

Python console

In the above example, we asked for the width of the focused sequence (128 pixels), and we were about to ask for its height.

Resources needing this

One review on “Jython for Icy

Leave a Review

Leave a review
Cancel review
View full changelog
Close changelog

Changelog

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

    Implement the new PluginScriptFactory interface from Icy-Kernel 2.4.3 (used to solve issue with ScriptEngine and Java 15)

  • Version 2.8.0.0 • Released on: 2020-10-16 11:00:00
    Download
    Description:

    Bundled Python extractor plugin into Jython for Icy. It's easier to manage and make more sense (Stephane)

  • Version 2.7.2.3 • Released on: 2020-07-23 15:30:00
    Download
    Description:

    Moved PythonLibraries annotation to PythonExtractor, make more sense (Stephane)

  • Version 2.7.2.2 • Released on: 2020-07-22 18:00:00
    Download
    Description:

    Updated to single Jython plugin package again but using the old and weird weird 2.7b1+ version (not really the same as 2.7-b1, be careful) - Stephane

  • Version 2.7.2.1 • Released on: 2020-02-24 14:00:00
    Download
    Description:

    fixed dependency

  • Version 2.7.2.0 • Released on: 2020-02-20 17:30:00
    Download
    Description:

    Reverted to old version fo fix Aleix issue (Stephane).

  • Version 2.7.1.0 • Released on: 2020-02-20 17:00:00
    Download
    Description:

    Reverted Jython library to 2.7b1 as version 2.7.0 can introduce issues with execnet processes.

  • Version 2.7.0.0 • Released on: 2020-01-09 12:00:00
    Download
    Description:

    - updated to Jython 2.7.0 library
    - moved the full jython package into the plugin (making jython extras plugin obsolete)
    - moved pythonLib annotation to this plugin
    (Stephane)

  • Version 1.0.1.0 • Released on: 2020-01-07 16:00:00
    Download
    Description:

    removed update

  • Version 0.7.0.0 • Released on: 2013-12-10 10:50:56
    Download
    Description:

    Fix memory leaks when reloading plugins (after an update for example).

  • Version 0.5.0.0 • Released on: 2013-11-18 13:04:56
    Download
    Description:

    - Update to Jython 2.7b1 (from upstream repository on Bitbucket, commit 7b44ea13, dated 2013-11-18).

    - Fix so that the "site" module is always imported (essential for availability of all modules coming from plugins, or for user customization with sitecustomize.py)

    - Deprecate the PythonLibraries annotation and remove all the code managing it. The annotation is now provided by the "Python Extractor" plugin, which does the extraction job in a more elegant way.

  • Version 0.4.0.0 • Released on: 2013-11-05 14:14:42
    Download
    Description:

    New mechanism to specify that a plugin contains Python files to export and to put in the Python path: the main Plugin class must now be annotated with "@PythonLibraries". The PythonLibrariesBundle interface that was used for the same goal is now removed. Annotations are better suited to this task.

    Also provides JythonLibsManager.addPluginsToPath() as a static method for future use.

  • Version 0.3.0.0 • Released on: 2013-07-04 09:32:52
    Download
    Description:

    Fix the handling of spaces in jar path.

  • Version 0.0.2.0 • Released on: 2013-06-25 15:42:58
    Download
    Description:

    Extract python library files to disk instead of loading from the jars. This improves the readability of backtraces. It also improves the compatibility with python libraries like execnet that play with the source files.

  • Version 0.0.1.0 • Released on: 2013-02-28 14:29:10
    Download