Login  Register

Re: Getting cursor location upon mouse click...

Posted by Wayne Rasband on Aug 18, 2005; 5:55pm
URL: http://imagej.273.s1.nabble.com/Getting-cursor-location-upon-mouse-click-tp3705022p3705023.html

> I am trying to set up a macro in order to analyse iem gold
> labeled micrographs.  What I need to do is click on a
> location in an image, and then have the x,y value of the
> cursor at the time of the mouse click be put into an x,y
> variable pair in the macro.
>
> I have seen the mouse-listener plugin but don't know if that
> is appropriate or how to use it in a macro.

Use a tool macro. Here is an example:

    macro "Color Picker Tool -C44f-o4499" {
         getCursorLoc(x, y, z, flags);
         print(x, y, z, getPixel(x,y));
    }

More information about tool macros can be found at:

      http://rsb.info.nih.gov/ij/developer/macro/macros.html#tools

-wayne