Using ImageJ directly from Java code

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
8 messages Options
Reply | Threaded
Open this post in threaded view
|

Using ImageJ directly from Java code

Mathias Zech
Hello to everyone,

I am new to working with ImageJ and intend to use it in my master thesis
at my university. I already worked a bit with ImageJ as well as some
plugins from the UI. The documentation on how to use ImageJ directly
from a program seems a bit thin to me and I am having troubles with it.
I want to do the following things:

- Process/Binary/Make Binary
- Process/Binary/Outline
- Run a plugin (Plugins/Hough Circles)
http://rsbweb.nih.gov/ij/plugins/hough-circles.html

Can anyone give me a few pointers into the right direction or some code
examples on how to use ImageJ in this fashion? I don't want to use it as
an external tool via macros/scripting but integrate it into my
application. If there is a better library to do this I would also be
grateful for information in this direction.

Thanks a lot in advance,
Mathias
Reply | Threaded
Open this post in threaded view
|

Re: Using ImageJ directly from Java code

Joris FA Meys
Hi Mathias,

I'm not really sure what you want to know. Did you write your own program
for image processing and you want to use some of the methods of ImageJ?

kind regards
Joris

On Thu, Mar 12, 2009 at 2:37 PM, Mathias Zech
<[hidden email]>wrote:

> Hello to everyone,
>
> I am new to working with ImageJ and intend to use it in my master thesis at
> my university. I already worked a bit with ImageJ as well as some plugins
> from the UI. The documentation on how to use ImageJ directly from a program
> seems a bit thin to me and I am having troubles with it. I want to do the
> following things:
>
> - Process/Binary/Make Binary
> - Process/Binary/Outline
> - Run a plugin (Plugins/Hough Circles)
> http://rsbweb.nih.gov/ij/plugins/hough-circles.html
>
> Can anyone give me a few pointers into the right direction or some code
> examples on how to use ImageJ in this fashion? I don't want to use it as an
> external tool via macros/scripting but integrate it into my application. If
> there is a better library to do this I would also be grateful for
> information in this direction.
>
> Thanks a lot in advance,
> Mathias
>
Reply | Threaded
Open this post in threaded view
|

Re: Using ImageJ directly from Java code

Mathias Zech
Hi,

my program should use ImageJ to open images, process and analyze them
and then continue working with the collected data. To task is to scan
old postal stamps (from around 1900) and analyze the perforation on the
edges and calculate an individual fingerprint for each stamp. I can do
those steps manually in ImageJ but what I want to do is use ImageJ
directly from my code which then uses the data from ImageJ to actually
calculate the fingerprint and compare it to known fingerprints.

All I would need to continue with my task would be some information on
how to access ImageJ functionality directly (i.e. run
Process/Binary/Make Binary on an ImagePlus). My program itself does not
do anything regarding image processing, that should be done by ImageJ
but I would like to include it as a library instead of using macros or
scripting to run it.

I hope I could make it a bit clearer.

Kind regards,
Mathias

joris meys wrote:

> Hi Mathias,
>
> I'm not really sure what you want to know. Did you write your own program
> for image processing and you want to use some of the methods of ImageJ?
>
> kind regards
> Joris
>
> On Thu, Mar 12, 2009 at 2:37 PM, Mathias Zech
> <[hidden email]>wrote:
>
>  
>> Hello to everyone,
>>
>> I am new to working with ImageJ and intend to use it in my master thesis at
>> my university. I already worked a bit with ImageJ as well as some plugins
>> from the UI. The documentation on how to use ImageJ directly from a program
>> seems a bit thin to me and I am having troubles with it. I want to do the
>> following things:
>>
>> - Process/Binary/Make Binary
>> - Process/Binary/Outline
>> - Run a plugin (Plugins/Hough Circles)
>> http://rsbweb.nih.gov/ij/plugins/hough-circles.html
>>
>> Can anyone give me a few pointers into the right direction or some code
>> examples on how to use ImageJ in this fashion? I don't want to use it as an
>> external tool via macros/scripting but integrate it into my application. If
>> there is a better library to do this I would also be grateful for
>> information in this direction.
>>
>> Thanks a lot in advance,
>> Mathias
>>
>>    
Reply | Threaded
Open this post in threaded view
|

Re: Using ImageJ directly from Java code

Burger Wilhelm
In reply to this post by Mathias Zech
Mathias,

asssuming that you already have a stand-alone Java program now, I would
create an ImageJ plugin by basically porting your existing main() method
to the plugin's run() method and putting all your other code into a
suitable Java package. Then you run your program by simply invoking the
plugin on your open image(s).

Wilhelm


> -----Original Message-----
> From: ImageJ Interest Group [mailto:[hidden email]] On
> Behalf Of Mathias Zech
> Sent: Thursday, March 12, 2009 10:39 PM
> To: [hidden email]
> Subject: Re: Using ImageJ directly from Java code
>
> Hi,
>
> my program should use ImageJ to open images, process and analyze them
> and then continue working with the collected data. To task is to scan
> old postal stamps (from around 1900) and analyze the
> perforation on the
> edges and calculate an individual fingerprint for each stamp.
> I can do
> those steps manually in ImageJ but what I want to do is use ImageJ
> directly from my code which then uses the data from ImageJ to
> actually
> calculate the fingerprint and compare it to known fingerprints.
>
> All I would need to continue with my task would be some
> information on
> how to access ImageJ functionality directly (i.e. run
> Process/Binary/Make Binary on an ImagePlus). My program
> itself does not
> do anything regarding image processing, that should be done by ImageJ
> but I would like to include it as a library instead of using
> macros or
> scripting to run it.
>
> I hope I could make it a bit clearer.
>
> Kind regards,
> Mathias
>
> joris meys wrote:
> > Hi Mathias,
> >
> > I'm not really sure what you want to know. Did you write
> your own program
> > for image processing and you want to use some of the
> methods of ImageJ?
> >
> > kind regards
> > Joris
> >
> > On Thu, Mar 12, 2009 at 2:37 PM, Mathias Zech
> > <[hidden email]>wrote:
> >
> >  
> >> Hello to everyone,
> >>
> >> I am new to working with ImageJ and intend to use it in my
> master thesis at
> >> my university. I already worked a bit with ImageJ as well
> as some plugins
> >> from the UI. The documentation on how to use ImageJ
> directly from a program
> >> seems a bit thin to me and I am having troubles with it. I
> want to do the
> >> following things:
> >>
> >> - Process/Binary/Make Binary
> >> - Process/Binary/Outline
> >> - Run a plugin (Plugins/Hough Circles)
> >> http://rsbweb.nih.gov/ij/plugins/hough-circles.html
> >>
> >> Can anyone give me a few pointers into the right direction
> or some code
> >> examples on how to use ImageJ in this fashion? I don't
> want to use it as an
> >> external tool via macros/scripting but integrate it into
> my application. If
> >> there is a better library to do this I would also be grateful for
> >> information in this direction.
> >>
> >> Thanks a lot in advance,
> >> Mathias
> >>
> >>    
>
Reply | Threaded
Open this post in threaded view
|

Re: Using ImageJ directly from Java code

Matthew Eichenfield
In reply to this post by Mathias Zech
What you are looking to do is create an instance of ImageJ which is embedded
within your program.  You can then write a plug-in / script to open your
images and execute commands.  The good news is that ImageJ can be modified
fairly easily.

All you need to do is modify the main ImageJ class,
http://rsb.info.nih.gov/ij/developer/source/ij/ImageJ.java.html, and
remove/modify "public static void main()" to work with your Java program.
[Making sure that the "EMBEDDED" flag is set.]  ImageJ has no copyright but
please make sure to give credit where it's due.

If you need more information there also exists a tutorial for including
ImageJ in Eclipse for Plugin development.
http://imagejdocu.tudor.lu/doku.php?id=howto:plugins:the_imagej_eclipse_howto

Hope this helps,
Matthew
Reply | Threaded
Open this post in threaded view
|

Re: Using ImageJ directly from Java code

dscho
In reply to this post by Mathias Zech
Hi,

On Thu, 12 Mar 2009, Mathias Zech wrote:

> Can anyone give me a few pointers into the right direction or some code
> examples on how to use ImageJ in this fashion? I don't want to use it as
> an external tool via macros/scripting but integrate it into my
> application. If there is a better library to do this I would also be
> grateful for information in this direction.

I think this might help you:

http://www.imagingbook.com/fileadmin/goodies/ijtutorial/ssij171.zip

It contains sample code that calls ImageJ from a Java servlet (i.e.
without any GUI).

Hth,
Dscho
Reply | Threaded
Open this post in threaded view
|

Re: Using ImageJ directly from Java code

Mathias Zech
Hi,

thanks a lot, that was exactly what I was looking for! Also thanks to
everyone who replied to my request, I will try to make the results
available when I am finished so that it is possible for you to take a
look at what my task was.

Kind Regards,
Mathias

Johannes Schindelin wrote:

> Hi,
>
> On Thu, 12 Mar 2009, Mathias Zech wrote:
>
>  
>> Can anyone give me a few pointers into the right direction or some code
>> examples on how to use ImageJ in this fashion? I don't want to use it as
>> an external tool via macros/scripting but integrate it into my
>> application. If there is a better library to do this I would also be
>> grateful for information in this direction.
>>    
>
> I think this might help you:
>
> http://www.imagingbook.com/fileadmin/goodies/ijtutorial/ssij171.zip
>
> It contains sample code that calls ImageJ from a Java servlet (i.e.
> without any GUI).
>
> Hth,
> Dscho
>
>  
Reply | Threaded
Open this post in threaded view
|

Re: Using ImageJ directly from Java code

yicosy
Hey Mathias,

I am facing the same problem you had and i am trying to find a solution for that. Have u been able to embed imagej into ur application?

What i am looking for is basically that. I do not want to have imagej in a different frame. Say it will be a jpanel for my application with some of the toolbar items. And i will give it a series of images to process. After processing done i will follow with my own application for further steps!

Thanks for all the help