Imagewindow swing controls?

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

Imagewindow swing controls?

Nick Mortimer
Hi I've been writing some code for processing plankton pictures, I have
made a multiple view Imagewindow, lets you display images in a grid and
edit them, now I'm trying to add a JTable to the display the
measurements etc.

I think in order for my window to be used to edit the images it had to
be descended from ImageWindow... my problem is that ImageWindows frame
is not a JFrame, and hence I'm mixing lightweight and heavyweight
components.

Is there any way in embed and ImageWindow inside a JFrame?

Or for that matter the whole of ImageJ?

Any advice appreciated

Thanks

Nick
Reply | Threaded
Open this post in threaded view
|

Re: Imagewindow swing controls?

Albert Cardona
All the functionality you want is in the ImageCanvas, not the
ImageWindow (which contains an ImageCanvas, by the way). Just embed the
ImageCanvas in a JPanel and feed that into your JFrame's content pane.
Be aware that the ImageCanvas, as an awt component, is heavy-weight and
will overlay any overhanging panes such as those from popup menus. Be
sure to set those as heavy weight.

In any case, the java.awt.Window and java.awt.Frame would serve your
purposes just as well as their swing counterparts. I would explore those
first.

Search the archives for many entries on this topic.


Albert
Reply | Threaded
Open this post in threaded view
|

Re: Imagewindow swing controls?

Nick Mortimer
Hi Albert,

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?

Thanks  

Nick




-----Original Message-----
From: ImageJ Interest Group on behalf of Albert Cardona
Sent: Fri 12/22/2006 7:36 PM
To: [hidden email]
Cc:
Subject: Re: Imagewindow swing controls?
All the functionality you want is in the ImageCanvas, not the
ImageWindow (which contains an ImageCanvas, by the way). Just embed the
ImageCanvas in a JPanel and feed that into your JFrame's content pane.
Be aware that the ImageCanvas, as an awt component, is heavy-weight and
will overlay any overhanging panes such as those from popup menus. Be
sure to set those as heavy weight.

In any case, the java.awt.Window and java.awt.Frame would serve your
purposes just as well as their swing counterparts. I would explore those
first.

Search the archives for many entries on this topic.


Albert
Reply | Threaded
Open this post in threaded view
|

Re: Imagewindow swing controls?

Albert Cardona
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
Reply | Threaded
Open this post in threaded view
|

Re: Imagewindow swing controls?

Nick Mortimer
Thanks Albert,

Its a bit advance for me but I think I understand you, create a JFrame on show()? Yes in the area of presdigitation redirection is everything, thanks I'm thinking along another track!

Albert the more I read it the more it makes sense.

Cheers

Nick