NIH LISTSERV
NIH LISTSERV
IMAGEJ archives -- May 2002 (#185)

Go to: Previous Message | Next Message
Previous in Topic | Next in Topic
Previous by Same Author | Next by Same Author
Previous Page (May 2002) | 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=US-ASCII; format=flowed
Message-ID:  <[log in to unmask]>
Date:         Wed, 29 May 2002 13:14:09 -0400
Reply-To:     ImageJ Interest Group <[log in to unmask]>
Sender:       ImageJ Interest Group <[log in to unmask]>
From:         Wayne Rasband <[log in to unmask]>
Subject:      Re: adding filenames to a stack
In-Reply-To:  <[log in to unmask]>

> Is there any way, when making a stack from a series of images, to have > the > individual file names added to the images as a destructive overlay??? Here is a plugin that does this. -wayne /****************** Add_Filenames.java **************/ import ij.*; import ij.process.*; import ij.gui.*; import java.awt.*; import ij.plugin.*; public class Add_Filenames implements PlugIn { Font font = new Font("SansSerif", Font.PLAIN, 12); int xloc = 5; int yloc = 15; public void run(String arg) { ImagePlus imp = WindowManager.getCurrentImage(); if (imp==null) {IJ.noImage(); return;} ImageStack stack = imp.getStack(); int nImages = imp.getStackSize(); for (int i=1; i<=nImages; i++) { String name = stack.getSliceLabel(i); if (name==null || name.equals("")) { name = imp.getTitle(); if (nImages>1) { String s = ""+i; while (s.length()<4) s = "0"+s; name += "-"+s; } } imp.setSlice(i); ImageProcessor ip = imp.getProcessor(); ip.setFont(font); ip.setColor(Toolbar.getForegroundColor()); ip.drawString(name, xloc, yloc); } imp.updateAndDraw(); } }




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