Login  Register

Re: Getting the ImagePlus in an ImageCanvas

Posted by Benjamin Schmid-2 on Dec 02, 2009; 3:09pm
URL: http://imagej.273.s1.nabble.com/Getting-the-ImagePlus-in-an-ImageCanvas-tp3690250p3690254.html

Hi Jean-Yves,

> I am writing something involving user interaction.
> In one of the steps, I catch mouse events: when the user clicks in a
> frame, I get the source of the click as an ImageCanvas.
>
> But of course, what I would like to get is the ImagePlus within this
> canvas. How would you do that, knowing that there is not getter for
> the ImagePlus in the ImageCanvas class?

One way would be to create a new MouseListener for each ImagePlus you
want to listen to, and store a reference to the ImagePlus as a field of
the MouseListener, at the time you register the listener.

I don't know if this is possible in your case.

Best wishes,
Bene