Text justification in text ROIs

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

Text justification in text ROIs

Jan Eglinger-3
Dear all,

is it possible to have Text ROIs centered or right-justified?

I know of the macro functions setJustification("center") and
drawString("line\nbreak", x, y), but I would like to have a multi-line
text selection centered without the need of using macros, if possible.

Thanks,
Jan
Reply | Threaded
Open this post in threaded view
|

Re: Text justification in text ROIs

Johannes Weissmann
On 07.06.2011 10:34, Jan Eglinger wrote:

> Dear all,
>
> is it possible to have Text ROIs centered or right-justified?
>
> I know of the macro functions setJustification("center") and
> drawString("line\nbreak", x, y), but I would like to have a multi-line
> text selection centered without the need of using macros, if possible.
>
> Thanks,
> Jan

Hi,
yes it is possible. Here's a line of code I use:

   ip.setJustification(ImageProcessor.LEFT_JUSTIFY);

This sets the justification for all TextROIs that are drawn afterwards.

Jo

--
Johannes Weissmann

Nedre Ferstadveg 26 | 7023 Trondheim
mail: [hidden email]
fon: +47 45 124 191

"The truth, as always, will be far stranger." [Sir Arthur C. Clarke]
Reply | Threaded
Open this post in threaded view
|

Re: Text justification in text ROIs

Jan Eglinger-3
Hi again,

On 07.06.2011 10:40 AM, Johannes Weissmann wrote:
> On 07.06.2011 10:34, Jan Eglinger wrote:
>> is it possible to have Text ROIs centered or right-justified?
>>
>
>   ip.setJustification(ImageProcessor.LEFT_JUSTIFY);
>
> This sets the justification for all TextROIs that are drawn afterwards.

I tried to set the justification to centered using:

  ip.setJustification(ImageProcessor.CENTER_JUSTIFY);

but the resulting behaviour is even worse:

When I make a new TextRoi using the Text tool, the typed text is still
displayed left-justified, but when I press Cmd-D to draw it into the
image, the text gets drawn centered on the upper left corner of the
TextRoi, which is understandable regarding the command I used, but
unintuitive with regard to the TextRoi that was overlayed at the wrong
position.

In addition, I observed that when you hold down the mouse button while
selecting a TextRoi with the Text tool, and then you mouse the mouse
vertically upwards, the example text get drawn repeatedly onto the image
without being erased as long as the width of the selection is 0, which
results in a smear of text on the image (that disappears after the next
display update, e.g. if you scroll through a stack).

Anyone else seeing this behaviour?

(I'm using Fiji with ij.jar 1.45i on MacOS 10.5 and 10.6)

Cheers,
Jan
Reply | Threaded
Open this post in threaded view
|

Re: Text justification in text ROIs

Rasband, Wayne (NIH/NIMH) [E]
In reply to this post by Jan Eglinger-3
On Jun 7, 2011, at 4:34 AM, Jan Eglinger wrote:

> Dear all,
>
> is it possible to have Text ROIs centered or right-justified?
>
> I know of the macro functions setJustification("center") and
> drawString("line\nbreak", x, y), but I would like to have a multi-line
> text selection centered without the need of using macros, if possible.

Text selections can be centered or right-justified in the 1.45j daily build. Simply select "Center" or "Right" in the third drop down menu in the "Fonts" window, which is opened by using the Edit>Options>Fonts command or by double clicking on the text tool icon.

-wayne