Answering my own question - I implemented a work-around. I’m assuming that the “getContainedPoints()” method
shown in the current API is not present in my outdated version of ImageJ (the one packaged with FIJI).
So, I wrote a quick hack to work around it.
It’s almost plug-to-plug compatible (minor calling convention differences)
and it’s specialized to my particular uses case, but - if anyone else needs it, here it is.
I would welcome constructive criticism. Please excuse my indentation style -
I learned it 40 years ago, and have difficulty changing it.
It has the major advantage of working.
Credits to an old (2016) thread that got me 95% of the way there.
Point[] getContainedPoints(PolygonRoi roi)
{
List<Point> resultList = new ArrayList<Point>();
ImageProcessor mask = roi.getMask();
Rectangle bounds = roi.getBounds();
for(int y=0; y<bounds.height; y++)
for(int x=0; x<bounds.width; x++)
if (mask.getPixel(x,y)!=0)
{
resultList.add(new Point(x+bounds.x,y+bounds.y));
}
Point[] result = new Point[resultList.size()];
result = resultList.toArray(result);
return result;
}
--
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