Polygon.Roi

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

Polygon.Roi

Cazic_Thule
Hi,
 I am creating a program to scan an image for pixels of a certain gs value then connect them using a polygon ROI. I have the program set up except I can't get the polygon to print. What is the syntax for getting the polygon to display on the image? Or atleast to get the points connected and the image masked.

Heres a program for just making a polygon. I'm using it to trouble shoot the issue.


public class poly_  implements PlugInFilter {
 
    public int setup (String arg, ImagePlus im) {
                return DOES_8G; //This is to let it except 8bit grayscale
        }

        public void run (ImageProcessor ip) {
                int x[] = {10,20,10,20};
                int y[] = {10,10,20,20};
                Roi p = new PolygonRoi(x, y, 4, Roi.POLYGON);
                ip.getPolygon();
                }
}


Thanks for any help,
Kevin
Reply | Threaded
Open this post in threaded view
|

Re: Polygon.Roi

dscho
Hi,

On Thu, 27 May 2010, Cazic_Thule wrote:

> public class poly_  implements PlugInFilter {

Here, you want to have a field "ImagePlus image;"

>     public int setup (String arg, ImagePlus im) {

Here, you want to save the ImagePlus: "image = im;"

> return DOES_8G; //This is to let it except 8bit grayscale
> }
>
> public void run (ImageProcessor ip) {
> int x[] = {10,20,10,20};
> int y[] = {10,10,20,20};
> Roi p = new PolygonRoi(x, y, 4, Roi.POLYGON);

Here, you want to set the ROI: "image.setRoi(p);"

> ip.getPolygon();
> }
> }

Ciao,
Johannes