Hi All
I have an image and I have drawn a circle on the image using Oval Roi and filled it with a random colour. Code snippet is below > ImagePlus imp = WindowManager.getCurrentImage(); > ip = imp.getProcessor(); > Roi roi = new OvalRoi(10,10,100,100); > ip.setColor(new Color(13,14,23)); > ip.setMask(roi.getMask()); > ip.setRoi(roi.getBoundingRect()); > ip.fill(ip.getMask()); > imp.updateAndDraw(); Now when the circle is filled it is opaque and it hides the portion of the image over which it is dawn. Nw I want it to be tranparent so that the circl is also filles with colour and at the same time the image bhind is also seen transparently.. Is there a way to do this... Any help is most welcome Thanks in advance ganesh --------------------------------- Choose the right car based on your needs. Check out Yahoo! Autos new Car Finder tool. |
Hi,
On Wed, 1 Aug 2007, Ganesh Jothikumar wrote: > I have an image and I have drawn a circle on the image using Oval Roi and filled it with a random colour. Code snippet is below > > > ImagePlus imp = WindowManager.getCurrentImage(); > > ip = imp.getProcessor(); > > Roi roi = new OvalRoi(10,10,100,100); > > ip.setColor(new Color(13,14,23)); > > ip.setMask(roi.getMask()); > > ip.setRoi(roi.getBoundingRect()); > > ip.fill(ip.getMask()); > > imp.updateAndDraw(); > > Now when the circle is filled it is opaque and it hides the portion of the image over which it is dawn. Nw I want it to be tranparent so that the circl is also filles with colour and at the same time the image bhind is also seen transparently.. Is there a way to do this... Any help is most welcome I think that you have to use the "getImage()" method of ColorProcessor to get a java.awt.Image, use "getGraphics()" on the result to get a java.awt.Graphics instance. On this instance, you can use "setColor()" with a transparent colour, "fillRectangle()" to fill it, and then use the original ImageProcessor's "setPixels()" method with the pixels obtained by "new ColorProcessor(image).getPixels()" on the java.awt.Image. Maybe you have to call ColorProcessor's "setSnapshotPixels(ip.getPixels())" method before, and "reset(ip.getMask())" after. I don't know off-hand. ImageJ does not know about transparency. Hth, Dscho |
Ganesh and Dscho,
> > ImageJ does not know about transparency. > ImageJ knows a little about transparency: ColorBlitter. See my Layers plugin for use. Bob Robert P. Dougherty, Ph.D. President, OptiNav, Inc. Phone (425) 990-5912 Fax (425) 467-1119 www.optinav.com |
One work-around would be to duplicate the ROI, fill the copy, copy the
filled image, and paste it back to the original image using "paste control" blend option. Robert Dougherty wrote: > Ganesh and Dscho, > >> ImageJ does not know about transparency. >> >> > ImageJ knows a little about transparency: ColorBlitter. See my Layers > plugin for use. > > Bob > > > Robert P. Dougherty, Ph.D. > President, OptiNav, Inc. > Phone (425) 990-5912 > Fax (425) 467-1119 > www.optinav.com > -- __ Vytas Bindokas, Ph.D. Research Assoc. / Assoc. Prof., Director, BSD Light Microscopy Core Facility Dept Neurobiol Pharmacol Physiol MC0926 947 E 58th Street The University of Chicago Chicago IL 60637 Room Abbott 120 773-702-4875 email [hidden email] web site for LMCF: http://digital.bsd.uchicago.edu/index.html This email is intended only for the use of the individual or entity to which it is addressed and may contain information that is privileged and confidential. If the reader of this email message is not the intended recipient, you are hereby notified that any dissemination, distribution, or copying of this communication is prohibited. If you have received this email in error, please notify the sender and destroy/delete all copies of the transmittal. Thank you. |
Free forum by Nabble | Edit this page |