Point Selections

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

Point Selections

Tony Shepherd
It seems that the "Point Selections" (cross-hair) tool has no return value.
I want to put something like this inside my code...

Toolbar Tb = Toolbar.getInstance();
Tb.setTool(7);    // override the current tool with the Point Selections tool

int[] xy_coordinates = new int[2];
xy_coordinates = <where ever the Point Selections object is placed>

Is there a standard way of doing this?

Thanks.
Reply | Threaded
Open this post in threaded view
|

Re: Point Selections

Wayne Rasband
> It seems that the "Point Selections" (cross-hair) tool has no
> return value. I want to put something like this inside my code...
>
> Toolbar Tb = Toolbar.getInstance();
> Tb.setTool(7);    // override the current tool with the Point
> Selections tool
>
> int[] xy_coordinates = new int[2];
> xy_coordinates = <where ever the Point Selections object is placed>
>
> Is there a standard way of doing this?

In a macro, you can get the coordinates of a selection, including a
point selection, using:

     getSelectionCoordinates(x, y);
     for (i=0; i<x.length; i++)
         print(i, x[i], y[i]);

In a plugin, use:

     ImagePlus img = IJ.getImage();
     Roi roi = img.getRoi();
     Polygon p = roi.getPolygon();
     for (int i=0; i<p.npoints; i++)
         IJ.log(i+" "+p.xpoints[i]+" "+p.ypoints[i]);

-wayne
Reply | Threaded
Open this post in threaded view
|

Radial Corrections

Robert Martin-3
I am wondering if anyone has written a plugin that corrects for  
circular artifacts in an image. The program Radial Profile height  
does a good job of plotting the variation of a region of interest yet  
this could be easily adapted to correct for circular artifacts in the  
image by multiplying each pixel by

(the average of the region of interest)/(the average of the bin  
within which the pixel falls)

Robert Martin