Two imagePlus in one window

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

Two imagePlus in one window

Abderahmane Habaieb
Hello all,

I'm currently making a plugin and I need to have two images (which are
hyperstacks) in one window. Each image has to have its scrollbar, and
stuff. In other words, the images share the same window, but are
independant of each other.
I imagined two ways of doing but I don't know if it's possible and how
implement them :

1) Extend the StackWindow class and add one panel for each image.
2) Have a JInternalFrame for each image, but it implies to mix AWT and
Swing...

As alternative, I can, at least, have two StackWindow glued with a
componentListener but the best deal would be to have just a single window.

Thanks,
Abdou

--
ImageJ mailing list: http://imagej.nih.gov/ij/list.html
Reply | Threaded
Open this post in threaded view
|

Re: Two imagePlus in one window

Unruh, Jay-2
Hi Abdou,

Note that if you want to still utilize all of the stack tools within ImageJ, you need to leave the Stacks as separate windows.  The Analyze>Tools>SyncWindows function does something like this.

If you really want to hack things, I think that your two suggested ways of doing things would work, but I would suggest another approach.  You can easily highjack the ImageWindow and add buttons and sliders to it.  The displayed image is then simply a single image as far as ImageJ is concerned.  The ImageJ PlotWindow does this: http://rsb.info.nih.gov/ij/developer/source/ij/gui/PlotWindow.java.html.  I have a plot stack that extends this concept to have a slider selecting between different plots here: http://research.stowers.org/imagejplugins/Jay_Plugins_HTML_source/jguis/PlotStack4.java.html.

Jay

-----Original Message-----
From: ImageJ Interest Group [mailto:[hidden email]] On Behalf Of Abderahmane Habaieb
Sent: Thursday, July 10, 2014 7:34 AM
To: [hidden email]
Subject: Two imagePlus in one window

Hello all,

I'm currently making a plugin and I need to have two images (which are
hyperstacks) in one window. Each image has to have its scrollbar, and stuff. In other words, the images share the same window, but are independant of each other.
I imagined two ways of doing but I don't know if it's possible and how implement them :

1) Extend the StackWindow class and add one panel for each image.
2) Have a JInternalFrame for each image, but it implies to mix AWT and Swing...

As alternative, I can, at least, have two StackWindow glued with a componentListener but the best deal would be to have just a single window.

Thanks,
Abdou

--
ImageJ mailing list: http://imagej.nih.gov/ij/list.html

--
ImageJ mailing list: http://imagej.nih.gov/ij/list.html
Reply | Threaded
Open this post in threaded view
|

Re: Two imagePlus in one window

Abderahmane Habaieb
Thank you Jay for your answer,

I preferred to use SyncWindows but in a non conventional way. I didn't want to have the SyncWindow GUI (the little form with list and checkboxes), so I tried to extend from SyncWindows. It is now something like that :

import ij.ImagePlus;
import ij.WindowManager;
import ij.gui.ImageWindow;
import ij.plugin.frame.SyncWindows;

public class CustomSyncWindows extends SyncWindows {
    public CustomSyncWindows() {
        super();
        this.close();
    }
   
    public void addWindows(int ID) {
        ImagePlus imp;
        ImageWindow iw;
        imp = WindowManager.getImage(ID);
        if (imp != null) {
            iw = imp.getWindow();
            iw.getCanvas().addMouseMotionListener(this);
            iw.getCanvas().addMouseListener(this);
        }
    }
}

The addWindows function is somewhat odd because the original SyncWindows' addWindows function is private, so I managed to reproduce its behavior but it still doesn't work :(

Any idea about how to do it ?

Thank you :D