Login  Register

Re: Fill an ROI with transparent color (alpha value)

Posted by Jan Eglinger-3 on May 22, 2011; 9:39am
URL: http://imagej.273.s1.nabble.com/Fill-an-ROI-with-transparent-color-alpha-value-tp3684492p3684494.html

Dear Wayne,

thanks a lot for the helpful example!

On 21.05.2011 7:17 PM, Rasband, Wayne (NIH/NIMH) [E] wrote:
> You can do this by using the ImagePlus flatten() method. Here is an example:
>
>   imp = IJ.openImage("http://imagej.nih.gov/ij/images/FluorescentCells.zip");
>   roi = new OvalRoi(130, 118, 254, 239);
>   r=150; g=0; b=150; alpha=0.5;
>   roi.setFillColor(new Color(r/255,g/255,b/255,alpha));
>   imp.setOverlay(new Overlay(roi));
>   imp = imp.flatten();
>   imp.show();

As far as I understand, this wouldn't work on a single slice of a stack,
since imp.flatten() will flatten the whole stack, right?

Best regards,
Jan