Re: Overlays (from plugin) example?

Posted by Michael Schmid on
URL: http://imagej.273.s1.nabble.com/Overlays-from-plugin-example-tp3687749p3687751.html

Hi Kenneth,

probably the easiest would be to create a Roi, e.g.,
     Roi roi = new PolygonRoi(xPoints, yPoints, nPoints, Roi.POLYGON);
where xPoints and yPoints are int arrays of the x and y coordinates,
and then use the setOverlay ImagePlus method
     imp.setOverlay(roi, strokeColor, strokeWidth, fillColor)

Michael
________________________________________________________________

On 1 Jul 2010, at 18:04, Kenneth Sloan wrote:

> I'm writing a plugin, in java (i.e., NOT a macro), and feel the  
> need to
> display results (for now, several sets of points - later, perhaps  
> several
> polylines) as an overlay.  I prefer not to munge the underlying image.
>
> Google tells me that someone implemented "ImageCanvasWithOverlay"  
> about a year ago.
>
> But, I also see references to "Overlay" in the ImageJ  
> documentation, and a flurry of
> changes (as recent as 1 June) that seem to be related to overlays.  
> From what I can
> gather, this overlay feature is closely coupled with ROI's.  It's  
> not entirely clear to me
> that my point sets are "ROIs" - perhaps I'm confused about that?
>
> I checked the Examples, and found a *macro* that uses the ROI  
> manager to create an overlay.
> What I need is an example that does this from a (java) plugin.
>
> My target code for this would look something like:
>
> createOverlay();
> for(int i = 0; i < numPointSets; i++)
> {
>   setColor(color[i]);
>   for(int p = 0; p < numPoints[i]; p++)
>     plotPoint(points[i][p];
> }
> showOverlay();
>
> Bottom line: I want to display several collections of POINTS  
> (perhaps later POLYLINES) as
> an overlay.
>
> Perhaps I need a good "plugin developers' reference manual"?  Feel  
> free to point me at one...please!
> My profound apologies if such a thing exists in plain sight and  
> I've simply missed it.
>
> --
> Kenneth Sloan
> [hidden email]