Login  Register

Re: ImageJ as a java library?

Posted by Sami Badawi-2 on Apr 09, 2008; 8:31pm
URL: http://imagej.273.s1.nabble.com/Color-profile-for-calcium-waves-tp3696594p3696600.html

Hi Glenn,

I am not sure I understood your issue, so let me give 2 answers.

1: If your issue is how to run an ImageJ PlugInFilter with other Java
code without starting a ImageJ program up.

This is how I run unit tests for plugins that I have written in
ImageJ, without starting the GUI. I run them either from Eclipse or
from command line using Maven.

public ByteProcessor runPluginFilterOnImage(String fileName, PlugInFilter
plugInFilter) {
       Opener opener = new Opener();
       ImagePlus image = opener.openImage(fileName);
       ByteProcessor bp = (ByteProcessor) image.getProcessor();
       plugInFilter.setup("", image);
       plugInFilter.run(bp);
       return bp;
}

This works if you have written the PlugInFilter. If you want to use
this method for other people's PluginFilter, what ImageJ is doing is
just have the class loader load the PlugInFilter, but class name. You
can do the same.

You can also use a GUI less branch of ImageJ called headless described here:
http://imagejdocu.tudor.lu/imagej-documentation-wiki/faq/how-do-i-run-imagej-without-a-graphics-environment-headless


2: If you issue is how to combine ImageJ with a lot of different
libraries in a somewhat organized way.

I did that using Maven as a build system, and build all my code into a
jar file. I have a little description of what I did here:
http://www.shapelogic.org/setup.html

-Sami Badawi
http://www.shapelogic.org

On Wed, Apr 9, 2008 at 3:19 PM, Ford, Glenn (NIH/NLM/LHC) [C]
<[hidden email]> wrote:

> Thank you Guido,
>
>  The API can be a bit daunting at first so was hoping some examples to show the different requirements, such as initialization, etc that may not be obvious from reading JavaDoc which can be a bit obscure.
>
>  Glenn
>
>
>
>  -----Original Message-----
>  From: Guido Lütke Wöstmann [mailto:[hidden email]]
>  Sent: Wednesday, April 09, 2008 9:50 AM
>  To: List IMAGEJ
>  Subject: Re: ImageJ as a java library?
>
>  Ford, Glenn (NIH/NLM/LHC) [C] schrieb:
>  > Hello All,
>  >
>  > I am new to ImageJ and interested in integrating ImageJ into a large application dealing with multiple media and data types.
>  >
>  > Are there any examples of how I can use ImageJ as an imaging library in my Java application?  I am specifically interested in the DICOM and Volume rendering rendering/viewing parts but also want to do standard image types (jpeg, etc) as well.
>  >
>  > Any help in pointing me to some tutorials/examples is greatly appreciate.
>  >
>  > Thank you in advance,
>  >
>  > Glenn Ford
>  > Lockheed Martin MSD Consultant
>  > Communications Engineering Branch
>  > National Library of Medicine, Bld 38A
>
>  Hello,
>
>  just download the Javadoc for ImageJ under:
>
>  http://rsb.info.nih.gov/ij/download/docs/api.zip
>
>  and use the ImageJ-Classes like every other Java-API.
>  You may start with the Class "ImagePlus" and its Subclass
>  "DICOM".
>
>  Guido
>