Posted by
Michael Schmid on
Jun 01, 2015; 4:47pm
URL: http://imagej.273.s1.nabble.com/getCursorLoc-function-tp5012993p5013001.html
Hi Volko,
if the cursor is inside the selection, you get the insideROI = 32 flag (cursor inside selection) as long as the cursor position selection is inside the selection.
For a PointRoi, the insideROI flag is set if the coordinates are exactly equal to those of a point of the selection. At high magnification, you will see this more often; then it is easier to hit a point exactly with the cursor. At low magnification, it is a matter of luck whether the cursor exactly hits the location of a point.
Typically, for the flags one has to do a bitwise 'and' operation with some mask, e.g.
shift=1;
ctrl=2;
if (flags & (shift+ctrl) != 0) print("position with shift or ctrl down");
For the flags, see
http://imagej.nih.gov/ij/macros//GetCursorLocDemo.txtMichael
________________________________________________________________
On May 31, 2015, at 08:07, Volko Straub wrote:
> Hi Everybody,
>
> I am using the getCursorLoc(x, y, z, modifiers) function in a macro. Using it with most selection tools, the value returned by the variable when clicking the left mouse button is 16. However, I noticed that when using it with thepointselection tool it can be 16, 32 or 48, which appears to depend on the cursor movement as illustrated by the code below. It looks like it has something to do with the cursor movement (i.e. when cursor is moving at start and end of mouse click, it appears to be 16, if it is stationary at start of mouse click it seems to be initially 48 followed by 32 until cursor is moved), but I couldn't find any comments about this in the macro command documentation. Could anybody provide some more detail/explanation?
>
> Thanks,
> Volko
>
>
> setOption("DisablePopupMenu", true);
> setTool(7);
> modifiers=0;
> while (modifiers!=4) {
> getCursorLoc(x,y,z,modifiers);
> print(toolID+" "+modifiers);
> wait(100);
> };
> setOption("DisablePopupMenu", false);*
> **
> *
>
> --
> ImageJ mailing list:
http://imagej.nih.gov/ij/list.html--
ImageJ mailing list:
http://imagej.nih.gov/ij/list.html