color overlay

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

color overlay

Jeff Spector
Hello list,
 I have a simple question but I can't seem to find the answer anywhere.
I would like my plugin to draw some colored lines on an image (actually
some slices in a stack) but my images are 16-bit grayscale .tiff´s. I
try using  ip.setColor but no matter what color I set it to I always get
some shade of gray or black. My question is simple. How (in a plugin) do
I draw a color overlay on a grayscale image..
thanks in advance
-Jeff
Reply | Threaded
Open this post in threaded view
|

Re: color overlay

Michael Ellis
Jeff,

Take a look at:

http://rsbweb.nih.gov/ij/plugins/graphic-overlay.html and
http://rsbweb.nih.gov/ij/plugins/concentric-circles.html

Hope that sorts you out.

Regards -- Michael ELlis


On 19 May 2010, at 18:58, jeff spector wrote:

> Hello list,
> I have a simple question but I can't seem to find the answer  
> anywhere. I would like my plugin to draw some colored lines on an  
> image (actually some slices in a stack) but my images are 16-bit  
> grayscale .tiff´s. I try using  ip.setColor but no matter what color  
> I set it to I always get some shade of gray or black. My question is  
> simple. How (in a plugin) do I draw a color overlay on a grayscale  
> image..
> thanks in advance
> -Jeff

Michael Ellis
Managing Director
Digital Scientific UK Ltd.
http://www.digitalscientific.co.uk
[hidden email]
tel: +44(0)1223 329993
fax: +44(0)1223 370040

Sheraton House
Castle Park
Cambridge
CB3 0AX


The contents of this e-mail may be privileged and are confidential.  
It may not be disclosed to or used by anyone other than the  
addressee(s), nor copied in any way.  If received in error, please  
advise the sender and delete it from your system.
Reply | Threaded
Open this post in threaded view
|

Re: color overlay

Michael Ellis
In reply to this post by Jeff Spector
Jeff,

Another stripped down example.

Regards -- Michael Ellis

import java.awt.Color;
import ij.ImagePlus;
import ij.gui.Line;
import ij.gui.OvalRoi;
import ij.gui.Overlay;
import ij.plugin.filter.PlugInFilter;
import ij.process.ImageProcessor;

/**
  * @author Michael Ellis
  *
  */
public class Show_Colour_Overlay implements PlugInFilter {
        ImagePlus imp = null;

        public Show_Colour_Overlay() {
        }

        /**
         *
         * @see ij.plugin.filter.PlugInFilter#run(ij.process.ImageProcessor)
         */
        public void run(ImageProcessor ip) {
                Overlay overlay = new Overlay();
                final int width = imp.getWidth();
                final int height = imp.getHeight();

                OvalRoi oval = new OvalRoi((width / 2) - 50 , (height / 2) -50, 100,  
100);
                oval.setFillColor(Color.yellow);
                overlay.add(oval);

                oval = new OvalRoi((width / 2) - 30 , (height / 2) -30, 60, 60);
                oval.setStrokeColor(Color.blue);
                overlay.add(oval);

                Line line = new Line(10, 10, width - 10, height - 10);
                line.setStrokeColor(Color.red);
                overlay.add(line);

                line = new Line(width - 10, 10, 10, height - 10);
                line.setStrokeColor(Color.black);
                overlay.add(line);

                imp.setOverlay(overlay);
        }

        /**
         *
         * @see ij.plugin.filter.PlugInFilter#setup(java.lang.String,  
ij.ImagePlus)
         */
        public int setup(String arg, ImagePlus imp) {
                this.imp = imp;
                return PlugInFilter.DOES_ALL;
        }

}



On 19 May 2010, at 18:58, jeff spector wrote:

> Hello list,
> I have a simple question but I can't seem to find the answer  
> anywhere. I would like my plugin to draw some colored lines on an  
> image (actually some slices in a stack) but my images are 16-bit  
> grayscale .tiff´s. I try using  ip.setColor but no matter what color  
> I set it to I always get some shade of gray or black. My question is  
> simple. How (in a plugin) do I draw a color overlay on a grayscale  
> image..
> thanks in advance
> -Jeff

Michael Ellis
Managing Director
Digital Scientific UK Ltd.
http://www.digitalscientific.co.uk
[hidden email]
tel: +44(0)1223 329993
fax: +44(0)1223 370040

Sheraton House
Castle Park
Cambridge
CB3 0AX


The contents of this e-mail may be privileged and are confidential.  
It may not be disclosed to or used by anyone other than the  
addressee(s), nor copied in any way.  If received in error, please  
advise the sender and delete it from your system.