Login  Register

Live Image window ImageListener

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options Options
Embed post
Permalink
Reply | Threaded
Open this post in threaded view
| More
Print post
Permalink

Live Image window ImageListener

edsimmons
Hi MM devs,

Please could someone steer me in the right direction? Ideally I need to
attach an imageListener to the live image window. I have tried the
following but it does not work for MM's live window. Is there any way to
get an ImageUpdated event to run when the live/snap window's image is
updated?

This works for IJ windows, but with the MM live window, only the window
closed event is triggered:

public class analysisImageListener implements ImageListener {
     public void imageOpened(ImagePlus ip) {
         IJ.log("Image opened");
     }
     public void imageClosed(ImagePlus ip) {
         IJ.log("Image closed");
     }
     public void imageUpdated(ImagePlus ip) {
         IJ.log("Image updated");
}

Attached like so:
         ImageWindow snapLiveWin = null;
         try {
             snapLiveWin = gui_.getSnapLiveWin();
         } catch (Exception e) {
             IJ.log("no live/snap window instance");
         }
         if(snapLiveWin != null){
             imp = snapLiveWin.getImagePlus();
             if(imp != null){
                 IJ.log("adding listener to live window");
                 imp.addImageListener(new analysisImageListener());

             }

         }

The problem with the above is that only the imageClosed() method is
called for the live/snap window.

If I add the image to album the imageUpdated() method is run many times,
but only for the newly created album window, so I know the code mostly
works... We need to do live analysis without saving any images if at all
possible.

Thanks very much for your help.

Best regards,
Ed

--
Ed Simmons
[hidden email]
www.esimaging.co.uk

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