Python scripts with imageJ

Hi everyone

I am trying to make scripts with python language and use the abilities of imageJ Commands like show image make a stack images and layout of some images, Doe’s anyone have any idea how can I make scripts with python and operate the imageJ?

I tries the Jython but it is very not useful because there is no debug and I cannot use modules like numpy and scipy

thanks you all

1 Like

Hey @amirffff,

Welcome to the forum.

That’s a hard problem that @hanslovsky has put lots of time and effort into, with a (imo) nice solution:

Examples here:

Edit: specifically amazing is the example of visualizing an image stored in numpy with the Fiji Bigdataviewer plugin.



adding just a note after very nice @bogovicj reply… about debugging jython you can try with this approach using an IDE like eclipse

1 Like

There is a Jupyter notebook example that mixes and calls ImgLib2 from Python. Go to and click the “ImgLyb: ImgLib2 + scikit-image” example. You can also launch the tutorials live in the cloud using Binder via this link.

We are working on making the Python-Java integration layer extensible, so that you can dynamically load more JAR files than just ImgLib2 (e.g., ImageJ Ops). But this is not yet working. Big announcement when it does.


Hi @emartini emartini
Thank you very much about your help,
Can I ask you some questions?

  1. What is the different between this method that you showed with eclipse and the scipts editor of the imageJ?
    2.Can I import modules of python like numpy and scipy and TKinter wiht the eclipse method?
    3.Do I have to download the ij module in order to make an import to this within the scripts?
    4.Have you ever made a use with the fijibin module of python?

Thnaks you and everyone that make an effort to help

Dear @microb1,
first of all sorry for delay but it’s busy period at work…

The main difference is that you can debug easily your code taking the advantage of using an IDE.

Never tried but I presume no because you are using a jython interpreter and then you would like to use the jython plugin written in Eclipse in Fiji with jython.

yes you have to add it as external libraries in the pythonpath (see the 3rd point of the link I mentioned in my first reply), you can also add other apis from other Fiji plugins and setting the plugins.dir (see point 4 of the same link)

honestly I dont know this module but in principle you can import it and try to use it (adding it as an external libraries)
At least I think it can work, I will try to test it but as I was saying it’s a real busy period at work so I don’t know when I can report back to you…

Have a nice day,

Thank a lot.
Thank a lot.

You can now fully integrate ImageJ into Python using the pyimagej module. See this work-in-progress notebook for details:

For a summary of Python/ImageJ integration mechanisms, see the Python wiki page:


2 posts were split to a new topic: How do I install pyimagej?

2 posts were split to a new topic: Cannot find imagej module after installing pyimagej with conda