Posted by
Douglas Benn-2 on
Mar 27, 2010; 6:09am
URL: http://imagej.273.s1.nabble.com/Clearing-text-from-image-tp3688768p3688770.html
Dear Wayne,
The makeText works fine. However, is it possible to write several labels on the same image which are all visible at the same time? Your two examples are not able to do this even though I experimented with them.
Thank you.
Douglas
Dr Douglas K Benn, BDS, M.Phil., Ph.D., Dipl. Dental Radiology (Royal College of Radiologists, England).
Professor
Dept of General Dentistry
Creighton University Dental School
2500 California Plaza
Omaha
Nebraska 68178
Tel: (402)280 5025
Fax: (402)280 5094
-----Original Message-----
From: ImageJ Interest Group on behalf of Rasband, Wayne (NIH/NIMH) [E]
Sent: Fri 3/26/2010 11:39 PM
To:
[hidden email]
Subject: Re: Clearing text from image
On Mar 26, 2010, at 11:09 PM, Benn, Douglas K. wrote:
> Could anybody please tell me if there is a simple way to clear a text string written as a label onto an image using drawString() ? I tried writing the same string but with 0,0,0 as the color - I am assuming that is black. I cannot find a simple description of how overlay text is represented. I thought of importing the original image slice but this seems very clumsy so I expect there are easier ways. Also is there a description of different colors and their numeric representations?
The drawString() macro function destructively renders the text onto the image. Use makeText() and the Image>Overlay>Add Selection command to display text using a non-destructive overlay. Here is a macro that displays "Hello" in red as an an overlay, clears it two seconds later, and two seconds after that displays "Goodbye" in green.
requires("1.43p");
makeText("Hello", 50, 50);
run("Add Selection...", "stroke=red font=48 new");
run("Select None");
wait(2000);
run("Hide Overlay");
wait(2000);
makeText("Goodbye", 50, 50);
run("Add Selection...", "stroke=green font=48 new");
run("Select None");
Another example is at
http://rsbweb.nih.gov/ij/macros/examples/BlinkingText.txt-wayne