Login  Register

Re: Imagewindow swing controls?

Posted by Albert Cardona on Dec 23, 2006; 10:28am
URL: http://imagej.273.s1.nabble.com/Imagewindow-swing-controls-tp3700736p3700739.html

Hi Nick,

> As I see it all the functionality is not available if the canvas is not on an ImageWindow, eg. I cannot add the window to the list of images. Also unless I'm doing somthing wrong I cannot edit the picture unless it is on an ImageWindow. I'm I right?
>  

You can create a sublass of ImageWindow which cancels its show() and
setVisible() methods, and redirects them to your own Swing classes. And
never needs to create an ImageCanvas of its own.

The same sublass of ImageWindow can wrap your ImagePlus and as such can
be added to the WindowManager.

And don't forget the WindowManager.setTempCurrentImage(my_image_plus), a
very useful method to make any plugin run on any image you want, no
matter whether the image is being displayed at all or not (and don't
forget to set it to null when done if necessary).

The ImageCanvas is useful for zoom/pan/ROIs and its popup menu.  It's
the ImagePlus, when active in the WindowManager (and thus returned by
WindowManager.getCurrentImage() or what is almost the same,
IJ.getImage() ), that gives access to user manipulations on the image
pixels.

Albert