Multiline ImageWindow Subtitle

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

Multiline ImageWindow Subtitle

Joachim Wesner
Hi list,

I like the possibility to override createSubTitle of an ImageWindow to add
my own specific info. Would it be /is it possible to have a
multiline-subtitle, because often
there is not enough space to for the infor I would like to show.

OR, what would be the easiest way to "permanently" add some text to an
ImageWindow?

Mit freundlichen Grüßen / Best regards

Joachim Wesner

Leica Microsystems CMS GmbH | GmbH mit Sitz in Wetzlar | Amtsgericht
Wetzlar  HRB 2432
Geschäftsführer:  Dr. Stefan Traeger | Dr. Wolf-Otto Reuter | Dr. David Roy
Martyr | Colin Davis
www.leica-microsystems.com


______________________________________________________________________
This email has been scanned by the MessageLabs Email Security System.
For more information please visit http://www.messagelabs.com/email 
______________________________________________________________________
Reply | Threaded
Open this post in threaded view
|

Re: Multiline ImageWindow Subtitle

Wayne Rasband
On Aug 24, 2009, at 1:21 PM, Joachim Wesner wrote:

> Hi list,
>
> I like the possibility to override createSubTitle of an ImageWindow to
> add
> my own specific info. Would it be /is it possible to have a
> multiline-subtitle, because often
> there is not enough space to for the infor I would like to show.
>
> OR, what would be the easiest way to "permanently" add some text to an
> ImageWindow?
You can probably do this by extending the ImageWindow class and
overriding its drawInfo() and getInsets() methods. Or, with the v1.43g
daily build, you can non-destructively overlay multiple lines of text
on the image by creating a display list containing a TextRoi.

Here is a JavaScript example:

   text = "These three lines of\ntext will be overlayed on\nthe current
image";
   font = new Font("SansSerif", Font.PLAIN, 16);
   color = Color.red;
   roi = new TextRoi(10, 10, text, font, color);
   img = IJ.getImage();
   img.getCanvas().createDisplayList(roi);

I attached a screenshot that shows what it looks like.

-wayne




screenshot.png (48K) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Antwort: Re: Multiline ImageWindow Subtitle

Joachim Wesner
<JavaScript example using TextRoi and  createDisplayList>

Hi list,

this is great stuff, nevertheles some questions/comments:

1) Can I have a TextRoi with an (optional) opaque background? Otherwise
IMHO the text is very difficult to read (also in the "official"
TextOverlay.js example)

2) Is there more info about the createDisplayList method (besides the
sourcecode) ? I imagine that it could be used to create all kinds of fancy
nondistructive overlays!

3) With all the great features that are added constantly added to the
ImageJ core, it seems that the docs are gettinng more and more behind,
createDisplayList isn´t even found in the latest API on the website!? (also
not the more advanced setfont() methods od TextRoi that might answer 1)

Cheers

Mit freundlichen Grüßen / Best regards

Joachim Wesner

Leica Microsystems CMS GmbH | GmbH mit Sitz in Wetzlar | Amtsgericht
Wetzlar  HRB 2432
Geschäftsführer:  Dr. Stefan Traeger | Dr. Wolf-Otto Reuter | Dr. David Roy
Martyr | Colin Davis
www.leica-microsystems.com


______________________________________________________________________
This email has been scanned by the MessageLabs Email Security System.
For more information please visit http://www.messagelabs.com/email 
______________________________________________________________________