[ImageJ-devel] loading imageJ instance with full Services

Johannes Schindelin Johannes.Schindelin at gmx.de
Tue Jun 25 12:47:27 CDT 2013


Hi Mohamed,

to avoid making me feel like a commodity, please keep the list in Cc:.
This helps other people having the same question, and myself not having to
answer the same question multiple times. It also keeps an open
communication, a crucial part of what science is all about.

On Tue, 25 Jun 2013, Mohamed Tleis wrote:

> On 06/24/2013 05:22 PM, Johannes Schindelin wrote:
> >
> > On Mon, 24 Jun 2013, Mohamed Tleis wrote:
> >
> > > ImageJ ij = new ImageJ.Main.launch();
> > As I said, this is not the correct way to launch ImageJ.
> >
> > First of all, ImageJ.Main.launch is not a class, therefore you cannot
> > instantiate it with "new". Second, the correct call to obtain an
> > ImageJ context is:
> >
> >  final ImageJ ij = new ImageJ();
> >
> > Please have a look at the examples Curtis put so much TLC and effort
> > into:
> >
> >  https://github.com/imagej/imagej-tutorials/
>
> Thank you Johannes for you reply,
>
> Although calling new ImageJ() loads the services, it don't show the
> interface.

That is correct. You have to ask the UIService to show the user interface.
Otherwise, truly headless operation would be impossible! And that was an
express goal of ImageJ2: to be modular enough so as to make it as useful
as possible.

> From the tutorial GradientImage.java, the launch method was used.  In my
> application I want to load the interface with full functionality at a
> certain point.  Is there any class that shows the interface after
> creating ImgeJ ij = new ImageJ(); ?
> 
> /** Tests our command. (GradientImage.java : imageJ-tutorials*/
>     public static void main(final String... args) throws Exception {
>         // Launch ImageJ as usual.
>         final ImageJ ij = imagej.Main.launch(args);
> 
>         // Launch the "Gradient Image" command right away.
>         ij.command().run(GradientImage.class);
>     }

As I said, ij.ui().showUI() should do it.

Ciao,
Johannes



More information about the ImageJ-devel mailing list