How to install and use Jython with ImageJ
by Edoardo ''Dado'' Marcora
- Install ImageJ by extracting
ij131.zip
to 'C:\ImageJ' (Note: When extracting the zip files make sure you preserve
folder information)
- Install Jython
- Download
jython-21.class and start installer by typing 'C:\ImageJ\jre\bin\java
-cp . jython-21' in a command window assuming your current working directory
is where you downloaded the jython-21.class file
- Follow instructions and install Jython in 'C:\Jython21\'
- Replace 'Target' property of ImageJ shortcut with 'C:\ImageJ\jre\bin\javaw.exe
-mx80m -cp ij.jar;jimi.jar;C:\Jython21\jython.jar; ij.ImageJ'
- Install
Jython plugin
by extracting
jython_plugin.zip to 'C:\ImageJ\plugins\Jython' (Note: When extracting
the zip files make sure you preserve folder information)
- Add 'C:\ImageJ' and 'C:\Jython21' to system path
- Extract this to 'C:\Jython21'. If asked,
confirm replacing files
- To test the installation, extract this to
'C:\ImageJ\plugins\Jython', then:
- run ImageJ
- select menu Plugins>Jython>Jython Editor
- select menu File>Open and open 'C:\ImageJ\plugins\Jython\HelloWorld.py'
- click Evaluate. You should see a dialog box saying 'Hello World!'
- quit ImageJ
- open command window and goto 'C:\ImageJ\plugins\Jython'
- type 'jythonc _HelloWorld.py'
- exit command window
- run ImageJ
- select menu Plugins>Compile and Run...
- open 'C:\ImageJ\plugins\Jython\_HelloWorld.java'
- disregard the warning... you should see a dialog box saying 'Hello
World!'
- restart ImageJ
- select menu Plugins>Jython>HelloWorld... you should see a dialog box
saying 'Hello World!' w/o warnings.
- Open 'C:\ImageJ\plugins\Jython\HelloWorld.py' in your favorite text
editor to get a glimpse at how to write ImageJ plugins using Jython.
- Have fun!!! :)
Please do not hesitate to contact me (marcora at caltech.edu) if you have any
question, comment, or suggestion.