next up previous contents
Next: 4. Source analysis Up: XIMAGE User's Guide Previous: 2. Getting Started   Contents


3. Plot Images

3.1 Displaying

Three different displays are available to plot an image, one interactive and two via external programs. The interactive display uses PGPLOT as the plotting package. All the commands that plot or query the display use these built-in PGPLOT routines. The command display plots the image on the plotting device, while the command contour provides a contour plot. The plot device may be set using the cpd command (e.g. cpd /xw). XIMAGE supports many different plot devices, although the primary devices are Tk (/xtk) for GUI interactive usage, providing zoom, recenter, and color adjustment capabilities, X-windows (/xw) for simple interactive usage, GIF (/gif) for web-ready output, and Postscript (/ps or /cps) for printer output. The image is displayed with a histogram equalization scaling and a default color table. The cct command changes the color table and cct ? lists the available color tables. On PseudoColor devices, they can be cycled through with the cct/loop command. For devices with limited colors or without image display capability a contour plot can be made with the contour command. The image should be smoothed beforehand using the smooth command.

The external programs to display an image are saoimage and POWplot, useful for panning and zooming of the image. To run these external programs, XIMAGE writes out an intermediate FITS file containing what is currently in memory. SAOIMAGE is run by typing saoimage at the ximage command line, while POWplot is available through the powplot command. When saoimage or POWplot are used as image display , it is not possible to overlay grids and/or return values from the image in XIMAGE.

3.1.1 Tk Details

The /xtk device provides more capabilities than the standard PGPLOT devices. Moving the mouse over a plot continually updates the tracking information at the right side of the window with sky, galactic, detector and image coordinates, as well as the value of the pixel the mouse is positioned over. Clicking on a plot with the left mouse button zooms in by a factor of 2, recentering at the clicked point. The middle button simply recenters the plot with no change in zoom, while the right button zooms out by a factor of 2, also recentering at the clicked point. The Zoom In and Zoom Out buttons also zoom by a factor of 2, however the current plot center is unchanged. The Replot button returns the plot to its original state with a zoom factor of 1. The current zoom factor is displayed under these buttons. When multiple viewports are defined, the area between the zoom buttons and color table sliders will contain a representation of the defined viewports, called the viewport selector. The box outlined in blue represents the current viewport which mouseover coordinates and plotting commands apply to. To switch the current viewport click its associated box in the viewport selector. The brightness and contrast of the color table may also be adjusted with the scales at the lower right of the window. The Reset button returns the color table to the default values of 0.5 for brightness and 1.0 for contrast.

The File menu contains a Print... option which can be used to output the current plot to a PostScript file, a GIF file, or directly to a printer. Note: It is important that all the image maps originally used to make the plot are still present at print time, as everything must be redrawn. The device will present a warning when this is not the case. Continuing despite the warning, will cause the output to be missing some plot elements. A better approach in this case would be to use the Screen Grab... option which simply captures the plot as it appears on the screen.

The Edit menu allows the user to selectively add a sky coordinate grid to the current image with the Show Grid checkbox or add a scale defining which intensity levels are assigned to which colors in the image with the Show Scale checkbox. Unchecking the box removes the plot element.

3.2 Color

3.2.1 Levels

The number of colors that are plotted in an image depends on the number of levels. The default number of levels (n) is 16, however, it may be changed through the levels/num=[n] command. The number of colors used in an image is one more than the number of levels (n+1). To increase the color resolution, the number of levels must be increased.

3.2.2 Color Tables

When displaying an image through the display command, the intensity levels are mapped into a default color table. This may be changed using the cct [color table] command, providing the device allows color table changes, e.g. GIF and PseudoColor Xwindow devices. To plot with a new color table on devices which don't allow color table changes, such as Postscript and TrueColor Xwindow devices, the desired color table must be set before the display command is called. To set a color table use the command cct/set [color table]. All subsequent displays will use that color table, until either another color table is chosen or the command cct/reset is executed. Available color tables are listed with the cct ? command.

3.2.3 User-Defined Tables

Color tables are defined as ASCII files containing a list of RGB values with a line per color, each having three numbers ranging in value from 0 to 1. A color table file does not need to contain the exact number of used colors, as the colors will be interpolated or ignored depending on how many are needed. Custom color tables may be input by giving the filename with the cct command , e.g. cct/set

3.2.4 Brightness and Contrast

The appearance of the specified color table may be further modified by varying brightness and contrast settings. These are qualifiers of the cct command and may be set as cct/contrast=n and cct/brightness=m. The effects of these adjustments on the color table can clearly be seen if a scale is plotted. Brightness (m) can go from 0.0 to 1.0, with a default of 0.5. Increasing the brightness effectively shifts the color scale to the left making the upper end of the scale, which is usually composed of brighter colors more dominant, while lowering the brightness shifts it to the right having the opposite effect. Contrast (n) has a default value of 1.0. Increasing contrast effectively compresses the color scale, while decreasing it stretches the color scale. The most stretched out the scale can get is at 0.0 where the scale is all one color. As the contrast goes negative, the direction of the scale is reversed, also affecting the directional sense of the set brightness. If the image is displayed on an interactive device, such as a PseudoColor Xwindow, the cct/cursor command can be used to experiment with various combinations for brightness and contrast. On the Tk device (/xtk), the adjustment scales at the lower right can be used to modify the brightness and contrast.

3.2.5 Reserved Colors

Color table changes only affect the image itself, not the color of the image frame or the device background. The color indices 0 through 15 are reserved colors and are independent from the color table setting. The device background is index 0 and the device foreground (used for image title and frame) is index 1. The defaults for the background and foreground colors are device-dependent. For example, Postscript files have a white background and a black foreground, while XWindow devices are the opposite. The remaining reserved colors are defined by PGPLOT defaults and are recommended for use with any XIMAGE command that has /color qualifier. To view these reserved colors, list them with colors or plot them to an open device with colors/plot. If the default colors set for indices 0-15 are unsuitable, they may be altered also through the colors command.

3.3 Image Placement

3.3.1 Split screen

Images can be placed side by side for comparison purposes using disp/left and disp/right/overlay. The currently active window is the last one displayed.

    read/fits im1.fits            ! read the 1st image
    display/left                  ! display the 1st image
    grid                          ! overlay the sky grid
    read/fits im2.fits            ! read the 2nd image
    disp/right/overlay            ! display the two side by side
    grid                          ! overlay the sky grid

Note: The left and right qualifiers are now emulated using a viewport file, 1lef1rig. It is recommended that the user begin a new page by plotting on the left side first.

3.3.2 Viewports

The exact position and size of the image on the screen can be controlled by defining a viewport. Viewport coordinates number the device from 0 to 1 from left to right, and 0 to 1 from bottom to top. A viewport is defined by four values, v1 (the left edge), v2 (the right edge), v3 (the bottom edge), and v4 (the top edge). These may be specified in the display or contour commands using the v1-4 qualifiers or may be specified for all subsequent display and contour commands issued within a XIMAGE session with the viewport command.

        v1   v2
         !    !
         ^    ^
        v1   v2

The image will be plotted as the largest size that will fit within the viewport boundaries. If one dimension of the viewport is larger than the other, the image will be centered in the larger dimension and will exactly fill the smaller dimension. Most devices are larger in one direction than the other, while viewport coordinates always map both directions from 0 to 1. Consequently, viewport coordinates that may appear square, such as v1=0.5/v2=0.9/v3=0.5/v4=0.9, are in fact rectangular.

When displaying multiple images on a plotting device, setting up the necessary viewports becomes cumbersome. Viewport configuration files can make this process easier. A viewport configuration file is an ASCII list of viewport definitions given one per each line. Viewport configurations are set through the viewport filename command. For each image displayed, a new viewport from the list is used until the end is reached, then a new device is opened and the sequence repeats from the first viewport. There are already made viewport configuration files these are:

       1+2           (One image on left, 2 on right)
       1+2gif        (One image on left, 2 on right for a gif device)
       1in1botlef    (One image inset into large image's bottom-left corner)
       1in1botrig    (One image inset into large image's bottom-right corner)
       1in1toplef    (One image inset into large image's top-left corner)
       1in1toprig    (One image inset into large image's top-right corner)
       1lef1rig      (One image left, one right with labelling)
       2x1           (Two images side by side)
       2x2           (4 images in a square)
       2x2gif        (4 images in a square for a gif device)
       3diag         (3 images going left to right diagonally downward)
       3x1           (3 images in a row left to right)
       3x2           (6 images 3 on top 3 on the bottom)
       3x2gif        (6 images 3 top and 3 bottom for a gif device)
       3x3           (9 images 3 on top 3 in center 3 on the bottom)
       3x3gif        (9 images 3 on top 3 in center 3 on the bottom for gif)

(to get the list use the syntax viewport ?). Most installed configuration files are optimized for square images plotted on Postscript and Xwindow devices. Those with gif in their name, however, are optimized for the GIF device. This optimization takes into account the aspect ratio of the device to get the precise layout desired.

3.3.3 User-Defined Configurations

The viewport command will also accept user-defined viewport configuration files. These are text files with a line for each viewport, consisting of the v1-v4 values separated by spaces. To form precise viewport configurations, it may be necessary to know the exact size of the plotting device. The command viewport/devsz will provide this information for the currently open device.

3.3.4 Viewport Configuration Example

For example, the installed configuration, 2x1, is defined in the file, 2x1.vpc:

    !  Viewport configuration file (2x1)
    !        -------------
    !        |     |     |
    !        |  1  |  2  |
    !        |     |     |
    !        -------------
    !v1  v2  v3  v4
    !-- --- --- ---
    0.1 0.5 0.2 0.8
    0.5 0.9 0.2 0.8

Start using this configuration by executing the command viewport 2x1. To see which viewport number will be displayed next, use the show command. The following line shows the viewport configuration file currently in use:

      Viewport                  : 2x1 - 1

The number following the dash (-) represents the viewport number in the file. If you display or contour at this point the image will be displayed in square #1 represented in the ASCII grid above. Using show again:

      Viewport                  : 2x1 - 2

The next display or contour will plot the image in square #2, leaving the image already plotted in #1 on the device.

Note: The /overlay qualifier should be omitted unless you wish the contour to be overlayed on top of the currently displayed image, rather than in the next viewport.

When the last viewport in the the configuration is reached, a new plotting device page will be opened and the numbering will begin again at 1.

XIMAGE will continue in this mode until the viewport is changed or viewport/reset is executed to erase any viewport settings.

next up previous contents
Next: 4. Source analysis Up: XIMAGE User's Guide Previous: 2. Getting Started   Contents
Alex Padgett 2010-03-25