Need help or advice ? Come to the Icy club ! - Every Wenesday morning from 9h30 to 12h30 - Francois Jacob Building - Main hall - Pasteur
Register

Associated publications

Don't forget the authors !
If you use this plugin, please cite it in your publication !

User reviews

(1)
5 star
1
4 star
0
3 star
0
2 star
0
1 star
0
average rating: 5


Please log-in to post a review
Thomas Provoost
28 Feb 2013 16:26

Jython for Icy

by Timothée Lecomte

Python engine for Icy, based on Jython

Publication Id
ICY-M7U7Y5
See technical details
View complete changelog

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.