Login  Register

PolygonRoi getContainedPoints() ???

Posted by Kenneth Sloan-2 on Oct 27, 2017; 12:26am
URL: http://imagej.273.s1.nabble.com/PolygonRoi-getContainedPoints-tp5019614.html

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