NIH LISTSERV
NIH LISTSERV
IMAGEJ archives -- August 2003 (#58)

Go to: Previous Message | Next Message
Previous in Topic | Next in Topic
Previous by Same Author | Next by Same Author
Previous Page (August 2003) | Back to Main IMAGEJ Page


Options: Reply | Post a New Message | Join or Leave IMAGEJ, or Change Options | Search
View: Chronologically | Most Recent First | Wrap Text (Proportional Font) | Don't Wrap Text (Non-proportional Font)
*

Content-Type: text/plain; charset=iso-8859-1
Message-ID:  <[log in to unmask]>
Date:         Sat, 9 Aug 2003 18:13:13 +1000
Reply-To:     ImageJ Interest Group <[log in to unmask]>
Sender:       ImageJ Interest Group <[log in to unmask]>
From:         James Cheong <[log in to unmask]>
Subject:      Help Overlaying Graphics

Hi ImageJ gurus I need some help with coding a plugin in ImageJ. I'm currently drawing cubic splines that are fitted onto points in an image. These points are manually selected by a user using the "crosshair tool". I'm just having some trouble repainting the splines. My code basically just produces the spline on the screen (in video memory) so when the window for that image is moved around, the spline disappears. Does anyone have any code that can be used??? Got the code below from the archives. My code looks a lot like it, with the overlay function called in run(). And using g.draw( ) to draw the spline in overlay(). Thanks a bunch! James import ij.*; import ij.process.*; import ij.gui.*; import java.awt.*; import ij.plugin.*; public class demo_Graphics implements PlugIn { public void run(String arg) { if(WindowManager.getCurrentImage()==null) IJ.run("New...", "name=test type='8-bit Unsigned'"+" fill=Ramp width=400 height=400 slices=1"); overlay(); } void overlay(){ Graphics g=IJ.getImage().getWindow().getCanvas().getGraphics(); g.setColor(Color.red); int[]xs={200,300,300,200,100,100},ys={100,150,250,300,250,150}; g.drawPolygon(xs,ys,xs.length); g.setColor(Color.blue); g.drawLine(50,200,349,200); } }




Back to: Top of message | Previous page | Main IMAGEJ page

NIH LISTSERV Home Page

CIT
Center for Information Technology
National Institutes of Health
Bethesda, Maryland 20892
301 594 6248 (v) 301 496 8294 (TDD)
Comments and Assistance
Accessibility wheelchair icon