Annotating IDL Graphics Windows and Images

QUESTION: I would like to be able to annotate an IDL graphics window or image, and then save the annotated ouput to a JPEG, or PNG, or even a PostScript file. Is there some way to do that in IDL.

ANSWER: Yes, you can use a Catalyst program named AnnotateWindow to do this. To run this program you must install on your IDL path both the Catalyst Library programs and the Coyote Library programs, which are freely available. See the article How to Install the Catalyst and Coyote Libraries for details on how to install these two libraries and add them to your IDL path. The AnnotateWindow program can be called in several ways. If it is called without an argument, it makes a copy of the current IDL graphics window to annotate.

   IDL> AnnotateWindow

Or, the program can be called with an argument. The argument can be either the window index number of a graphics window you wish to annotate, or it can be any 2D image array or true-color image. For example, here are various ways you can call AnnotateWindow:

   IDL> AnnotateWindow, 2 ; Copy the window with window index 2 into the program.
   IDL> image2D = LoadData(12)
   IDL> AnnotateWindow, image2D ; Annotate a 2D image array.
   IDL> image24 = LoadData(16)
   IDL> AnnotateWindow, image24 ; Annotate a 24-bit image.

You see an illustration of what the AnnotateWindow program looks like in the figure below. Button icons along the top row give you access to drawing tools for drawing rectangles, circles and ellipses, polygons, arrows, and text. In addition, there is a point-to-point measuring tool available for measuring distances on your image, and an angle measuring tool for calculating angles on your image. The annotations can be turned on or off, and the entire window can be saved to various file formats, including PostScript (where everything in the window is rendered in PostScript resolution, not screen resolution).

The AnnotateWindow program.
This is now the AnnotateWindow program looks on the display.

Annotations can be selected and moved individually, or they can be grouped together and moved as a single unit. If you right click on an annotation, you will have access to that annotation's properties and you can change such things as the color of the annotation, the thickness with which it is rendered, its background color, etc. Annotation properties can also be set globally from a button on the toolbar. The annotation window is completely resizable, and when resized the annotations maintain their current relative positions.

It is possible to add your own annotations directly to the program when the program is called.

Version of IDL used to prepare this article: IDL 7.0.3.

Web Coyote's Guide to IDL Programming