Skip to content, Skip to search


Jython Scripting

2,600 bytes added, 08:33, 30 August 2016
first step of rewriting this article.
You can view the original content of this page at [[Jython Scripting Examples]].
== Introduction ==
Jython is an implementation of the Python programming language designed to run on the Java platform. <ref>[ Wikipedia entry on Jython]. Accessed: 2016-08-30</ref> In ImageJ Jython is one of several [[Scripting#Supported_languages|supported languages]].
== When to use Jython ==
* If you have experience with Python you can easily use Jython for ImageJ scripting. But you have to keep in mind that tools commonly used in many Python projects (e.g. Numpy) are not available in Jython. By building your [[Jython_Scripting#Self_written_Jython_modules_for_ImageJ|own modules]] you can create complex scripts that otherwise are only possible by writing ImageJ plugins in Java.
* If don't have any experience in programming, the Python language is a good choice to start with. If your only aim is to write scripts for ImageJ, there are other languages you should try first (e.g. [[Groovy_Scripting|Groovy]]).
=== Explanation ===
The Java implementation of Python is limited in functionality. One can use the [ standard library], but it's not possible to install additional Python modules. Moreover a growing number of projects build on Python 3 which is not fully compatible with Python 2 Jython is based on. If you want to start learning Python it's recommended to learn Python 3.x instead of Python 2.
== Jython basics for ImageJ ==
=== Introduction ===
The aim of this page is not to teach how to program Python. This purpose is much better fulfilled by the [ documentation of Python 2]. The focus of this page is to show how features of the Python language can be useful for ImageJ scripting.
That is why examples are used that are fully functional. Just copy the code to the [[|Script Editor]] and try them by yourself.
=== Image selection using the GenericDialog class ===
coming soon...
=== Using ImageJ-Ops ===
coming soon...
== Self written Jython modules for ImageJ ==
coming soon...
== References ==
<references />