how do I determine when cursor is over a point Roi in an overlay?

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

how do I determine when cursor is over a point Roi in an overlay?

JonNathan
I'm writing a Java plugin in which I'd like to be able to dynamically detect when the cursor is directly over an Roi label in an overlay.  I know ImageJ is already doing this behind the scenes, because if I have an image with an overlay consisting of several point Roi's, the cursor changes from a cross to a "hand" if I'm over any of the point selections (indicating the underlying point Roi can be moved).  I can't seem to find the right EventListener to detect this kind of change.

Any hints on how to track this kind of event?

Thanks in advance,

Jon Marsh
Reply | Threaded
Open this post in threaded view
|

Re: how do I determine when cursor is over a point Roi in an overlay?

Herbie
Jon Marsh,

isn't this a pure Java-question?

Get the cursor coordinates and compare them to the known point coordinates.

HTH

Herbie

:::::::::::::::::::::::::::::::::::::::
Am 21.12.16 um 19:15 schrieb JonNathan:

> I'm writing a Java plugin in which I'd like to be able to dynamically detect
> when the cursor is directly over an Roi label in an overlay.  I know ImageJ
> is already doing this behind the scenes, because if I have an image with an
> overlay consisting of several point Roi's, the cursor changes from a cross
> to a "hand" if I'm over any of the point selections (indicating the
> underlying point Roi can be moved).  I can't seem to find the right
> EventListener to detect this kind of change.
>
> Any hints on how to track this kind of event?
>
> Thanks in advance,
>
> Jon Marsh
>
>
>
> --
> View this message in context: http://imagej.1557.x6.nabble.com/how-do-I-determine-when-cursor-is-over-a-point-Roi-in-an-overlay-tp5017801.html
> Sent from the ImageJ mailing list archive at Nabble.com.
>
> --
> 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: how do I determine when cursor is over a point Roi in an overlay?

JonNathan
Hi Herbie,

Thanks for your suggestion.  My only issue with doing a comparison as you suggest is that the cursor is only rarely over the exact pixel in a point selection, whereas the behavior I'd like to replicate is capturing an event when the cursor is appropriately near the point selection.  Just so the user doesn't have to "hunt down" the exact pixel.  I could probably just define a radius around the point selection and proceed from there, but I'd rather not reinvent the wheel if something easier exists in ImageJ's current API.

Cheers,

Jon
Reply | Threaded
Open this post in threaded view
|

Re: how do I determine when cursor is over a point Roi in an overlay?

Herbie
Good day Jon,

of course that's to the point, but why not simply copy the approach
applied by ImageJ? The source code is available!

Hopefully you may find the answer here:
<https://imagej.nih.gov/ij/source/ij/gui/ImageCanvas.java>

Best

Herbie

:::::::::::::::::::::::::::::::::::::::
Am 21.12.16 um 19:52 schrieb JonNathan:

> Hi Herbie,
>
> Thanks for your suggestion.  My only issue with doing a comparison as you
> suggest is that the cursor is only rarely over the *exact* pixel in a point
> selection, whereas the behavior I'd like to replicate is capturing an event
> when the cursor is appropriately *near* the point selection.  Just so the
> user doesn't have to "hunt down" the exact pixel.  I could probably just
> define a radius around the point selection and proceed from there, but I'd
> rather not reinvent the wheel if something easier exists in ImageJ's current
> API.
>
> Cheers,
>
> Jon
>
>
>
> --
> View this message in context: http://imagej.1557.x6.nabble.com/how-do-I-determine-when-cursor-is-over-a-point-Roi-in-an-overlay-tp5017801p5017803.html
> Sent from the ImageJ mailing list archive at Nabble.com.
>
> --
> ImageJ mailing list: http://imagej.nih.gov/ij/list.html
>

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