Login  Register

Re: PolygonRoi getContainedPoints() ???

Posted by ctrueden on Oct 27, 2017; 3:51am
URL: http://imagej.273.s1.nabble.com/PolygonRoi-getContainedPoints-tp5019614p5019616.html

Hi Ken,

The getContainedPoints() feature was added in 1.51a, released 3 May 2016.
(See release notes [1].) Fiji currently ships with 1.51n.

In my tests with an up-to-date Fiji, the following Groovy script works when
you have an image open with a polygon ROI drawn on it:

  #@ ImagePlus imp
  pts = imp.getRoi().getContainedPoints()
  println(pts)

Regards,
Curtis

[1] https://imagej.nih.gov/ij/notes.html

--
Curtis Rueden
LOCI software architect - https://loci.wisc.edu/software
ImageJ2 lead, Fiji maintainer - https://imagej.net/User:Rueden
Did you know ImageJ has a forum? http://forum.imagej.net/


On Thu, Oct 26, 2017 at 7:26 PM, Kenneth Sloan <[hidden email]>
wrote:

> Looking at the API, I see a method:
>  java.awt.Point[] getContainedPoints()
>
> defined in “Roi” (and inherited in PolygonRoi)
>
> But, this code:
> ======================================
> // qAFPolygon is a Polygon
>
>   PolygonRoi qAFPolygonRoi = new PolygonRoi(qAFPolygon, Roi.POLYGON);
>   java.awt.Point[] qAFCoords = qAFPolygonRoi.getContainedPoints();
> ======================================
> fails with the following errors:
>
>  [javac]        java.awt.Point[] qAFCoords = qAFPolygonRoi.
> getContainedPoints();
>     [javac]                                               ^
>     [javac]   symbol:   method getContainedPoints()
>     [javac]   location: variable qAFPolygonRoi of type PolygonRoi
>
> I’ve tried variants that *should* work the same - and they do - they all
> get the same error.
>
>
> Poking around, I see an old (2016) thread where “getContainedPoints” is
> referenced as if it did not exist.  The thread proceeds to offer up a
> solution using a mask.
>
> Am I simply using an out-of-date ImageJ (I’m using the latest FIJI)?  Is
> “getContainedPoints” a new feature not in my version?  (hmmm - “about” says
> Fiji version 1.0 - can that be right?)
>
> If so (since I have to deliver to a customer who will also use this
> version), I’m going to proceed to implement the mask method.
>
> If not - what have I gotten wrong (this time?)
>
> Allow me to take the opportunity to thank thoses who helped with the last
> problem, which was, of course, a classic “face palm”.  Armed with the
> knowledge that my code snippet was correct, it was easy to find the gross
> error elsewhere.
>
>
> In the short term, I think I’ll implement a private “getContainedPoints”,
> using a mask.  That should, at least, work.  If the real
> “getContainedPoints” shows up, I can switch.
>
> --
> Kenneth Sloan
> [hidden email] <mailto:[hidden email]>
> Vision is the art of seeing what is invisible to others.
>
>
>
>
>
> --
> ImageJ mailing list: http://imagej.nih.gov/ij/list.html
>

--
ImageJ mailing list: http://imagej.nih.gov/ij/list.html