help on text tool

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

help on text tool

Lee Berndt
Hello and hope everyone is safe:
I'm trying to add text to an image which is easy.....however, what appears not to be so easy is adding delta ∆ symbol and or subscript.....can someone please tell me how to add special symbols using text...thank you


William L. Berndt, Ph.D.  
@Dr_Lee_Berndt

--
ImageJ mailing list: http://imagej.nih.gov/ij/list.html
Reply | Threaded
Open this post in threaded view
|

Re: help on text tool

Fred Damen
Greetings,

Any where ImageJ lets you enter text, TextField(s) Widgets and Editor
windows you can paste unicode, and this will most likely be used
correctly.  Unfortunate, save and retrieving from files does not seem to
preserve the appropriate glyph. I generally google the name of the
character and then copy and paste.  Unfortunately there is a poultry set
of sub/sup characters available.

If you are compiling a java program and put the unicode values in as such
"\u0394B\u2080" you should get DELTA B_0, or ΔB₀.

Enjoy,

Fred


On Sat, April 4, 2020 3:34 pm, Lee Berndt wrote:

> Hello and hope everyone is safe:
> I'm trying to add text to an image which is easy.....however, what appears
> not to be so easy is adding delta ∆ symbol and or subscript.....can
> someone please tell me how to add special symbols using text...thank you
>
>
> William L. Berndt, Ph.D.  
> @Dr_Lee_Berndt
>
> --
> ImageJ mailing list: http://imagej.nih.gov/ij/list.html
>

--
ImageJ mailing list: http://imagej.nih.gov/ij/list.html
Reply | Threaded
Open this post in threaded view
|

Re: help on text tool

Gabriel Landini
On Wednesday, 8 April 2020 05:26:06 BST you wrote:
> Any where ImageJ lets you enter text, TextField(s) Widgets and Editor
> windows you can paste unicode, and this will most likely be used
> correctly.

Unfortunately the text tool does not seem to allow pasting, at least under
linux.
If you just paste, it opens the string in a text window called "Clipboard".
The text tool only appears to accept an input from the keyboard.

Cheers

Gabriel

--
ImageJ mailing list: http://imagej.nih.gov/ij/list.html
Reply | Threaded
Open this post in threaded view
|

Re: help on text tool

Fred Damen
Greetings,

Well my statements were partially correct, TextField(s) and Editor(s) do
let you enter unicode, both by cut-n-paste and super-secret-OS-specific
keyboard gymnastics (on Linux/Fedora Left-Shift-Control-U and then hex
version of the unicode and Enter).

Since I only seem to have created TextRoi(s) from my plugins I thought
there was already a way to edit the Roi's text in a java widget...

Plugins>New>Plugin
Replace contents with below...
With the Image to be texted as the last image visited, Editor>File>Compile
and Run...  and name it Create_TextRoi.java

Enjoy,

Fred

==================import ij.*;
import ij.process.*;
import ij.gui.*;
import java.awt.*;
import ij.plugin.*;
import ij.plugin.frame.*;

public class Create_TextRoi implements PlugIn {

   public void run(String arg) {
      ImagePlus imp = IJ.getImage();
      GenericDialog gd = new GenericDialog("Create TextRoi");
      gd.addNumericField("x :", 10, 0);
      gd.addNumericField("y :", 10, 0);
      gd.addStringField("String:", "",30);
      gd.showDialog();
      if (gd.wasCanceled()) return;
      imp.setRoi(new
TextRoi(gd.getNextNumber(),gd.getNextNumber(),gd.getNextString()));
      }
}
==================

On Wed, April 8, 2020 3:13 am, Gabriel Landini wrote:

> On Wednesday, 8 April 2020 05:26:06 BST you wrote:
>> Any where ImageJ lets you enter text, TextField(s) Widgets and Editor
>> windows you can paste unicode, and this will most likely be used
>> correctly.
>
> Unfortunately the text tool does not seem to allow pasting, at least under
> linux.
> If you just paste, it opens the string in a text window called
> "Clipboard".
> The text tool only appears to accept an input from the keyboard.
>
> Cheers
>
> Gabriel
>
> --
> ImageJ mailing list: http://imagej.nih.gov/ij/list.html
>

--
ImageJ mailing list: http://imagej.nih.gov/ij/list.html
Reply | Threaded
Open this post in threaded view
|

Re: help on text tool

Gabriel Landini
On Wednesday, 8 April 2020 20:37:46 BST you wrote:
> Well my statements were partially correct, TextField(s) and Editor(s) do
> let you enter unicode, both by cut-n-paste and super-secret-OS-specific
> keyboard gymnastics (on Linux/Fedora Left-Shift-Control-U and then hex
> version of the unicode and Enter).

Hi,
I think you got the question wrong (or I got the question wrong).
The "text tool" the OP is referring to is (I think) the button with the "A" in
the tool bar.
I cannot see a way of pasting anything that has been copied into the clipboard
so it can be burnt into the image. In my install it only accepts keyboard
input.

BTW, Left Shift+Ctrl+U in my linux machine brings up IJ's Control Panel

Cheers

Gabriel

--
ImageJ mailing list: http://imagej.nih.gov/ij/list.html
Reply | Threaded
Open this post in threaded view
|

Re: help on text tool

Fred Damen
Greetings,

Nobody gets my humor...

The first part (below) is lead in...

The punchline, and what the OP would need to accomplish their task at hand
is the second part ... I could not find anywhere in the existing GUI
interface to enter/edit a TextRoi using a java GUI widget, so ...

Enjoy,

Fred

PS It comforting that someone else feels my pain with unicode and the
keyboard.

On Wed, April 8, 2020 4:35 pm, Gabriel Landini wrote:

> On Wednesday, 8 April 2020 20:37:46 BST you wrote:
>> Well my statements were partially correct, TextField(s) and Editor(s) do
>> let you enter unicode, both by cut-n-paste and super-secret-OS-specific
>> keyboard gymnastics (on Linux/Fedora Left-Shift-Control-U and then hex
>> version of the unicode and Enter).
>
> Hi,
> I think you got the question wrong (or I got the question wrong).
> The "text tool" the OP is referring to is (I think) the button with the
> "A" in
> the tool bar.
> I cannot see a way of pasting anything that has been copied into the
> clipboard
> so it can be burnt into the image. In my install it only accepts keyboard
> input.
>
> BTW, Left Shift+Ctrl+U in my linux machine brings up IJ's Control Panel
>
> Cheers
>
> Gabriel
>
> --
> ImageJ mailing list: http://imagej.nih.gov/ij/list.html
>

--
ImageJ mailing list: http://imagej.nih.gov/ij/list.html
Reply | Threaded
Open this post in threaded view
|

Re: help on text tool

Kenneth Sloan-2
In the category of "things I learned while debugging something else", and apropos of "hating unicode", I offer this tidbit.

If you print the string "\ufeff\t" to the Terminal app in macOS...it crashes the app.  That exact sequence.  Two characters.  Remove either one, or put a space between them, and all is well.  But together...disaster.

Don't try this at home.

Also - if you process .csv files written by Excel, take the time to remove the \ufeff at the beginning of the file...  I understand that this Excel-lossage affects some widely used .csv file parsers.

And now...back to debugging keyPressed()...

--
Kenneth Sloan
[hidden email]
Vision is the art of seeing what is invisible to others.

--
ImageJ mailing list: http://imagej.nih.gov/ij/list.html
Reply | Threaded
Open this post in threaded view
|

Re: help on text tool

Wayne Rasband-2
In reply to this post by Lee Berndt

> On Apr 4, 2020, at 4:34 PM, Lee Berndt <[hidden email]> wrote:
>
> Hello and hope everyone is safe:
> I'm trying to add text to an image which is easy.....however, what appears not to be so easy is adding delta ∆ symbol and or subscript.....can someone please tell me how to add special symbols using text...thank you

The following JavaScript code displays the delta, micron and angstrom symbols in an overlay on a composite color image.

-wayne

  text = "Delta (\u0394), micron (\u00B5) and angstrom (\u00C5)";
  img = IJ.openImage("http://wsr.imagej.net/images/hela-cells.zip");
  font = new Font("SansSerif", Font.PLAIN, 24);
  roi = new TextRoi(20, 20, text, font);
  roi.setStrokeColor(Color.yellow);
  overlay = new Overlay(roi);
  img.setOverlay(overlay);
  img.show();


--
ImageJ mailing list: http://imagej.nih.gov/ij/list.html

Screenshot.png (255K) Download Attachment