Re: Image J - overlay

Posted by DeBarr, Gabriel on
URL: http://imagej.273.s1.nabble.com/Image-J-overlay-tp3701104p3701105.html

You could use a "CustomCanvas" and override the "public void
paint(Graphics g)" to fill in your overlay.  This would allow you to
non-destructively layer one set of data on top of another.  e.g.:
<code>
//a custom canvas to apply a non-destructive graphic overlay to image
display
                CustomCanvas(ImagePlus imp) {
                        super(imp);
                }//~ctor

                public void paint(Graphics g) {
                        super.paint(g);
                        drawOverlay(g);
                }//~cc paint

                void drawOverlay(Graphics g) {
//draw the graphic overlay (non-destructively) showing user's selected
points.
                        g.setColor(Color.blue);
                        if(pending) {//draw crosshair for current
location
                                g.drawLine(screenX((int)cl_x-2),
screenY((int)cl_y), screenX((int)cl_x+2), screenY((int)cl_y));
                                g.drawLine(screenX((int)cl_x),
screenY((int)cl_y-2), screenX((int)cl_x), screenY((int)cl_y+2));
                        }
                        if(n_pts>0) {//draw crosshair cursors over
previously selected locations
                                int i,lx,ly;
                                for(i=0;i<n_pts;i++) {
                                        if(i<3)

g.setColor(Color.green);//our transform defining points
                                        else

g.setColor(Color.yellow);//the rest of them

lx=(int)((mPointDouble)mPoints.elementAt(i)).getX();

ly=(int)((mPointDouble)mPoints.elementAt(i)).getY();
                                        g.drawLine(screenX(lx-2),
screenY(ly), screenX(lx+2), screenY(ly));
                                        g.drawLine(screenX(lx),
screenY(ly-2), screenX(lx), screenY(ly+2));
                                }
                        }
                }//~cc drawOverlay

        }//~ custom canvas class
</code>

Another option would be to just create a new image, as a composite of
your data sets.

        -Gabriel

-----Original Message-----
From: ImageJ Interest Group [mailto:[hidden email]]On Behalf Of
Johannes Schindelin
Sent: Thursday, November 02, 2006 10:40 AM
To: [hidden email]
Subject: Re: Image J - overlay


Hi,

On Thu, 2 Nov 2006, O'Brien.Joseph wrote:

> It's a cold afternoon here in the UK [...]

Funny, I was in Scotland until Tuesday, and it was warmer than here in
Germany!

> The question is.......Can imageJ perform an 'overlay' function?

You might want to copy the image to be overlayed, and play with
"Edit/Paste Control..." I got what I wanted with "Max".

Hth,
Dscho

****************************************************************************************

Note:  If the reader of this message is not the intended recipient, or an employee or agent responsible for delivering this message to the intended recipient, you are hereby notified that any dissemination, distribution or copying of this communication is strictly prohibited. If you have received this communication in error, please notify us immediately by replying to the message and deleting it from your computer. Thank you.

****************************************************************************************