Login  Register

Re: Image Management in ImageJ

Posted by Michael Schmid on Jun 24, 2010; 4:54pm
URL: http://imagej.273.s1.nabble.com/Image-Management-in-ImageJ-tp3687820p3687821.html

Hi Anderson,

as far as I can say, you need to write a subclass of ImageWindow  
(which is a subclass of Frame). The WindowManager of ImageJ accesses  
the getImagePlus() method of an ImageWindow to get the ImagePlus for  
processing.

A few more relevant methods:
   WindowManager.addWindow
to get it into the list and
   WindowManager.setCurrentWindow(ImageWindow win)
makes it the foreground window.

I don't see much chance with a JFrame for a seamless integration --  
there is no multiple inheritance in Java.

It also seems to me that WindowManager.setTempCurrentImage is no  
workaround for your needs, because you can set it only for a thread  
that is known in advance. ImageJ commands from the menu (or  
shortcuts) create their own threads.

There might be an awful workaround of very limited use using the  
Macro Interpreter, but it may become invalid with any version change,  
as soon as the Macro Interpreter becomes more multithreading-aware.

But maybe someone else has a solution?

If this is a common problem, maybe it would be worth to add an  
interface to ImageJ, say 'ImagePlusContainer' ?
ImagePlusContainer would be implemented by ImageWindow.
Various getImagePlus() calls in WindowManager would then use the  
ImagePlusContainer interface, not the ImageWindow.

Michael
________________________________________________________________

On 23 Jun 2010, at 16:45, Anderson Vinícius wrote:

> Hi,
>
> I'm developing an application which implements the ImageJ PlugIn  
> interface
> and has its own user interface. That user interface is a JFrame and  
> the
> application is launched like any other ImageJ plugin.
>
> What I want to do is to show an image inside my user interface but
> continuing to have all the ImageJ functionalities to process this  
> image. Is
> that possible?
> I know I can put an ImageCanvas inside a JFrame and then I can show an
> image. But by doing that I lost all the ImageJ functionalities  
> because my
> ImageJ instance does not know there's an image open.
> Could I "tell" ImageJ the image in my user interface is also its  
> image so
> that I can process the image with ImageJ user interface?
>
> Thank you.
>
> []s