How to use ImageJ as an image processing library?

I want use ImageJ as 2D and images stack image processing library but going through tutorials I feel confused.
Is ImageJ the gui app?
Can I import only image processing libarary?
Where can I find any tutorials for 2D and images stack processing?
I think I need some guidence where to start.

Hi Przemek,

There is ImageJ (ImageJ1 actually), and ImageJ2. And there is FIJI, BoneJ and many more flavours around what once started off as NIH-Image. ImageJ has its own wiki page

And there is the command line interface. I guess you are looking for this piece of information:
Running ImageJ from the Command Line and a visual reference to Stack manipulation found on this page.

Please find here the function references and manuals of ImageJ

Hi,

In a nutshell ImageJ (ImageJ2 to be most correct: https://imagej.net/ImageJ2) is an application and a software library based on SciJava (https://imagej.net/SciJava).

Here is a tutorial for using ImageJ2 with groovy: https://github.com/imagej/tutorials/blob/simplify_tutorials/notebooks/ImageJ-Tutorials-and-Demo.ipynb

This should cover the basic 2D image processing.
Maybe you could specify your usecase then we could direct you in more specific directions :slight_smile:

Maybe you could specify your usecase then we could direct you in more specific directions

I want to develop java application for presenting DICOM images. I was looking for the java library for image processing and started with ImageJ.
After first tryout I’m a little bit confused about the usage. What in need is image processing libarary and what I got after including ImageJ to my project is full app (I guess).
Every example starts with instantiation of new ImageJ(). Can’t I just get image processing library?
It’s still a little bit vague for me but if I could defined my first steps it would be:
Read in DICOM image file.
Do basic processing.
Read in DICOM imges into stack.
Make same roi operations over stack to get images.

I don’t have too much experience with that, maybe others can give you better answers. Also please anybody correct me if I am wrong.

I think the simple answer is that you get both. If you want to use ImageJ just as a library you don’t use the GUI methods that come with it. At least with ImageJ2. The tutorial I linked shows how to use it in this manner.

I think the complicated answer is in ImageJ1 the GUI and library were closely tied together. Some methods you could use without the app but a lot would need it. With ImageJ2 the developers started to separate the GUI and the library. If you stay within ImageJ2 you don’t need to bother with the app. Since ImageJ2 is still growing you however sometimes need to still use ImageJ1 methods and then it becomes complicated…

1 Like

Hello Przemek -

If you want an “application for presenting DICOM images,” have
you considered using Fiji / ImageJ itself? Because you can extend
ImageJ (java plugins, scripts in various scripting languages), you
can make it do anything you want. Any special processing or image
display that you were intending to write for your free-standing
application, you could package as a plugin.

I will speak of IJ1. As Eric mentioned, IJ1’s gui and “business logic”
are in some cases intertwined. In general, IJ1 is not that modular.

Having said that, there are many IJ1 classes that you can use in
your own “main” program without launching ImageJ, but because
of the interdependencies in IJ1, a lot of the higher level stuff will
be most conveniently used in the context of a running instance of
ImageJ. This is especially true if you want to display images (using
IJ1, rather than writing your own display code).

Fiji / ImageJ can do this out of the box (depending on what you
mean by “basic processing,” etc.). You would likely have to write
a script or plugin to link the steps you outlined into a single
“command.”

If you explain possible limitations you see in using Fiji / ImageJ
as your (extensible) application, rather than writing your own,
people would likely be able to suggest whether (and how) Fiji /
ImageJ could be made to work for you, or whether writing your own
application (using parts of ImageJ and/or other image-processing
libraries) would be more practical.

Thanks, mm