loading imageJ instance with full Services

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

loading imageJ instance with full Services

Mohamed Tleis
Dear Developers,

from inside my code I am calling imageJ through

ImageJ ij = new ImageJ.Main.launch();

If I use this instance to open an lsm image with 2 channels, the image
isn't loaded properly, only one channel is visable and trying to split
channels will ask me for arguments and won't be done.
Note that opening the imageJ from the provided executable works fine. I
suppose the launch method needs some arguments to be passed. Can you
please show me an example to how to do this?

Best Regards,
M. Tleis

_______________________________________________
ImageJ-devel mailing list
[hidden email]
http://imagej.net/mailman/listinfo/imagej-devel
Reply | Threaded
Open this post in threaded view
|

Re: loading imageJ instance with full Services

dscho
Administrator
Hi Mohamed,

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/

Ciao,
Johannes

_______________________________________________
ImageJ-devel mailing list
[hidden email]
http://imagej.net/mailman/listinfo/imagej-devel
Reply | Threaded
Open this post in threaded view
|

Re: loading imageJ instance with full Services

dscho
Administrator
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

_______________________________________________
ImageJ-devel mailing list
[hidden email]
http://imagej.net/mailman/listinfo/imagej-devel
Reply | Threaded
Open this post in threaded view
|

Re: loading imageJ instance with full Services

Curtis Rueden
In reply to this post by Mohamed Tleis
Hi Mohamed and everyone,

I agree with Johannes that using "new ImageJ()" is better for programmatic use, in that it is more flexible. That said, there is nothing "wrong" per se with calling "imagej.Main.launch()" if what you really want is for the ImageJ application to pop up. So no worries there.

As for your reported problem, I have a couple of questions:

> If I use this instance to open an lsm image with 2 channels

Please note that ImageJ2 does not support LSM out of the box. You need either Bio-Formats or LSM_Reader for that (which at the moment are ImageJ1 plugins, and will be run using the IJ2's legacy layer). If you open an LSM with File > Open right now, I believe it will open as a vanilla TIFF file, which may not read all the metadata, and may misinterpret some Zeiss-specific image parameters.

> Note that opening the imageJ from the provided executable works fine.

Hmm, you mean if you launch ImageJ2 from the launcher, then open your LSM file, it behaves as expected? Then there may indeed be a bug lurking here somewhere. Do you have a sample non-working image file you can upload via the Help > Upload Sample Image command? That, along with specific brief instructions about what doesn't work, would be very helpful to diagnose and fix the problem.

Thanks,
Curtis


On Mon, Jun 24, 2013 at 9:54 AM, Mohamed Tleis <[hidden email]> wrote:
Dear Developers,

from inside my code I am calling imageJ through

ImageJ ij = new ImageJ.Main.launch();

If I use this instance to open an lsm image with 2 channels, the image isn't loaded properly, only one channel is visable and trying to split channels will ask me for arguments and won't be done.
Note that opening the imageJ from the provided executable works fine. I suppose the launch method needs some arguments to be passed. Can you please show me an example to how to do this?

Best Regards,
M. Tleis

_______________________________________________
ImageJ-devel mailing list
[hidden email]
http://imagej.net/mailman/listinfo/imagej-devel


_______________________________________________
ImageJ-devel mailing list
[hidden email]
http://imagej.net/mailman/listinfo/imagej-devel