Posted by
Kenneth Sloan-2 on
May 14, 2016; 1:39am
URL: http://imagej.273.s1.nabble.com/custom-cursor-tp5016417p5016438.html
Thank you. I’ll probably do something like this with the overlay (in full Java - it will be embedded in an existing application). It looks like I don’t really want to modify the cursor - what I want to do instead is to produce the “sizing tool” on command. Perhaps a keypress to display a fixed-size (in scaled dimensions) circle. I think the user really only needs one “reference” size. I’m guessing (without implementing it, yet, that it would be overkill to re-draw the circle every time the cursor moves - but a singe keypress that displays the sizing gauge might just do it. I’ll test. If re-drawing on cursor move is acceptable, I might do that - but that might raise other issues.
Strange…almost 40 years ago I had this working on an AppleIIc with graphics overlaid on a video feed (they said it was impossible, but we managed it).
It seemed easier, then…
Ah…I remember - there was a “make it bigger” button and a “make it smaller” button (one pill makes you big, the other makes you small - it was the 70s).
Perhaps a slider.
Which leads to…I’m using 1 slider to control an integer. Is there an easy method of using a slider to control a real number? One “frill” I’ve been asked for is a slider to set gamma.
I couldn’t come up with anything easier that using the standard ImageJ menus. But, now, I might want a slider to control diameter. I suppose I could make the units nanometers.
That works. But, as long as I’ve already asked: is there a “double” slider as easy to use as the “int” slider?
--
Kenneth Sloan
[hidden email]
Vision is the art of seeing what is invisible to others.
> On May 13, 2016, at 04:51 , Bio7 <
[hidden email]> wrote:
>
> Dear Kenneth,
>
> here is my suggestion as a macro using overlays and hiding the cursor. The
> space key exits the painting of a ellipse which you can resize with the
> Shift (+) and Alt key (-). Of course this is a rough draft but maybee fits
> your needs. A custom cursor could also be set:
>
> isDown=false;
> width=50;
> height=50;
> eval("script","ImageCanvas.setCursor(Toolkit.getDefaultToolkit().createCustomCursor(new
> BufferedImage(16, 16, BufferedImage.TYPE_INT_ARGB), new Point(0, 0), \"blank
> cursor\"),1)");
> while(isDown==false) {
> isDown=isKeyDown("space");
> if(isKeyDown("shift")){
> width++;
> height++;
> }
> if(isKeyDown("alt")){
> if(width>1&&height>1){
> width--;
> height--;
> }
> }
> getCursorLoc(x, y, z, flags);
> Overlay.drawEllipse(x-(width/2), y-(height/2), width, height);
> Overlay.show;
> wait(30);
> Overlay.remove;
> }
> eval("script","ImageCanvas.setCursor(Cursor.getPredefinedCursor(Cursor.CROSSHAIR_CURSOR),1)");
>
> For scaled coordinates, see:
>
>
http://rsb.info.nih.gov/ij/developer/macro/functions.html#toScaled>
> Best,
>
> Marcel
>
>
>
>
>
>
> --
> View this message in context:
http://imagej.1557.x6.nabble.com/custom-cursor-tp5016417p5016421.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