6.4 Interactive TV displays of your data

The AIPS TV display allows you to look at your image data in detail and to set parameters by pointing at interesting features visible on the screen. Although AIPS will run on a variety of hardware display devices (e.g.I2S Models 70, 75 and IVAS and DeAnza), it is now used almost exclusively with the X-Windows TV-simulation program called XAS. See §2.3.2 for information on using this basic AIPS tool. Information on TV verbs and tasks may be found by entering ABOUT TV  C R, ABOUT INTERACT  C R, and ABOUT TV-APPL  C R, or by consulting the corresponding sections of Chapter 13 of this CookBook.

6.4.1 Loading an image to the TV

The simplest way to load an image from your catalog to the TV and then to manipulate the display is with the procedure called TVALL:

> INP TVALL  C R

to review the input parameters.

> INDI n ; GETN ctn  C R

to select the disk and image name parameters from the catalog.

Use one of the following commands to specify the initial transfer function that converts your image file intensities to display pixel intensities:

> FUNC LN  C R

linear—this is the default.

> FUNC ’LG’  C R

logarithmic.

> FUNC ’L2’  C R

“extra” logarithmic.

> FUNC ’SQ’  C R

square-root, often a good compromise

> FUNC ’NE’  C R

negative linear.

> FUNC ’NG’  C R

inverse logarithmic.

> FUNC ’N2’  C R

inverse “extra” logarithmic.

> FUNC ’NQ’  C R

negative square root.

> PIXRA x1, x2  C R

to load only image intensities x1 to x2 in the units of the image. The default is to load the full range of intensities in the image.

(The slopes and intercepts of the display transfer functions can be modified later, but the above options let you choose initially between linear, square-root, logarithmic, and negative displays and restrict the range of intensities that is loaded). Then:

> TVALL  C R

to load the selected image.

The image should appear on the TV screen in black-and-white. If you see a new image but it is not what you expected, hit button D to end TVALL and then review your inputs with:

> INP TVALL  C R

If no image appears, make sure that AIPS started up with your workstation assigned as the display; see §2.2.3 for information on starting up AIPS and assigning the TV display.

After your image has been displayed on the TV by TVALL, your trackball with its buttons (which should be labeled A, B, C, and D) — or your workstation mouse with keyboard buttons A, B, C, and D) — can be used to modify the display transfer functions, coloring and zoom. Pressing button A alone enables black-and-white and color-contour coding of the image intensities, successively. Adjust the cursor position on the TV (using the trackball or mouse) to vary the slope and intercept of the display transfer function. TVALL will superpose a calibrated horizontal wedge on the image. This should help you to choose the optimum cursor setting for the display. Black-and-white displays are generally much more suitable than color for high-dynamic-range images, while color contouring may be used to accentuate interesting features. (Note also that a much wider range of image-coloring options is available outside TVALL by invoking TVPSEUDO and TVPHLAME.) Pressing buttons B and C adjusts the zoom of the display: B to increase the magnification and C to decrease it. When these buttons are enabled, the cursor controls the position of the center of the zoomed field of view. Magnification factors of 1 through 16 are available on most workstations. Note that your terminal issues instructions when buttons are pressed, but that it is in the death-like grip of TVALL otherwise until you press button D to exit from it.

The size of the image which can be displayed depends on the size (in pixels) of your workstation screen or TV display and some other parameters which can vary from site to site. A typical Sun workstation can display up to 1024 by 900 pixels. Then, if the image is larger than about 800 pixels or so in the y-direction, portions of the labeling of the wedge (the units) will be omitted or superposed on top of the wedge (the tick numeric values). A useful technique for displaying large images is to load only alternate pixels. The command:

> TXINC 2 ; TYINC 2  C R

to load every other x and y pixel.

before TVALL would do this. Also use:

> TBLC = n1, n2, n3,  C R

bottom left pixel to load.

> TTRC = m1, m2, n3,  C R

top right pixel to load.

to limit the displayed field. A small image may be interpolated to fill the TV screen by setting TXINC = -1 ; TYINC = -1  C R. Recent versions of XAS allow the verb TVROAM to function again. This verb loads adjacent portions of an image to 4 memories and then “roams” with a split screen to allow you to view any contiguous quarter of the loaded image.

TVALL is a procedure that insures that the desired graphics and TV channels are on and cleared and the others off, then loads the image with verb TVLOD, loads a wedge with TVWEDGE, and labels the wedge with TVWLABEL. You do not have to use TVALL, which can be rather slow, simply to load a new image on the TV. Use TVLOD instead. TVWEDGE has a variety of options concerning the width of the wedge and its position; type HELP TVWED  C R for details.

6.4.2 Manipulating the TV display

There are a number of verbs which allow you to manipulate the display, including:

> TVINIT  C R

to initialize the entire TV and TV image catalog. The image catalog is now kept in XAS and so is always current.

> TVON n  C R

to turn on TV grey channel n; you may have to turn off other channels to see n since the sum of two images may be rather odd.

> TVOFF m  C R

to turn off channel m, where m is “decimal coded,” meaning that m = 12 refers to both channel 1 and channel 2.

> GRON n  C R

to turn on one or more of the 8 graphics channels, where n is decimal coded.

> GROFF m  C R

to turn off one or more graphics channels.

> TVCHAN n ; TVCLEAR  C R

to zero one or more TV channels.

> GRCHAN m ; GRCLEAR  C R

to zero one or more graphics channels.

> TVZOOM  C R

to set the zoom magnification and center interactively, follow instructions on the screen.

> OFFZOOM  C R

to reset the zoom and zoom center to null.

> GREAD  C R

to read the current color of a specified graphics overlay channel into RGBCOLOR.

> GWRITE  C R

to change the color of a graphics overlay channel to that specified by RGBCOLOR. This may be done for aesthetic reasons or because the default colors may not show up well when captured by TVCPS and printed on a color printer.

> TVPOS  C R

to read the TV cursor position, returning adverbs for use in procedures or other verbs.

> IM2TV  C R

to convert an image pixel in PIXXY to the corresponding TV pixel.

6.4.3 Intensity and color transfer functions

The AIPS model of a TV postulates two intensity transfer functions, called the LUT and the OFM, which are basically multiplicative. In most circumstances, the LUT is used for black-and-white enhancements and the OFM for coloring, but both can be used for either. To manipulate the LUT interactively, while leaving the pseudo-coloring alone, use the TVTRAN verb. The cursor position controls the slope and intercept of the transfer function, buttons A and B switch a plot of the transfer function on and off, button C switches the sign of the slope, and button D (as always) exits. To turn the LUT back to normal, enter OFFTRAN.

A rich zoo of color coding is available with TVPSEUDO, which alters the OFM while leaving the LUT alone. Repeated hits on button A select a variety of color triangles, button B selects a circle on hue, and repeated hits on button C select a variety of color contours. First-time users should experiment with the AIPS coloring options until they develop an intuitive feel for the effects of cursor settings on the image appearance. The wedge displayed by TVALL adjusts to the alternative colorations selected with TVPSEUDO, and it is helpful to watch changes in both the wedge and the image. A flame-like coloring is available with TVPHLAME, or variations on the scheme with repeated hits on buttons A or B. In both these verbs the cursor position controls aspects of the coloring such as enhancements, richness, or cycles of hue. To turn off pseudo-coloring, enter OFFPSEUD.

A set of less well-known verbs is available to allow you to create, manipulate, and save desirable versions of the OFM table. OFMSAVE allows you to save a named OFM, OFMDIR lists all saved OFMs belonging to you or generally available from the AIPS distribution, OFMGET loads a named OFM, OFMZAP deletes a named OFM, and OFMLIST prints the current OFM. OFMCONT is an elaborate interactive verb which allows you to set the hue, intensity, and saturation of the OFM divided up into a number of color contours. Each of these contours can be a constant level or a step wedge. OFMADJUS is another elaborate interactive verb to alter pieces of the OFM, while OFMTWEAK is a simpler verb to stretch the OFM.

6.4.4 Setting parameters with the TV

One reason to load the image to the TV is to set adverbs for use by other verbs and tasks. Verbs which use the TV cursor to set adverbs include:

> TVNAME  C R

to set INDISK, INNAME, etc. to the name parameters of the image currently visible. If there is an ambiguity, you will be asked to move the cursor to the desired image and press a button.

> TVWIN  C R

reads pixel coordinates from the next two cursor positions at which a trackball button is depressed. The TV graphics shows the current shape and position of the window. Button A allows you to switch to (re)setting the other corner while the other buttons exit after both corners have been set. TVWIN uses the pixel coordinates to set up the bottom left (BLC) and top right (TRC) corners of an image subsection, e.g., for input to the contouring programs CNTR and PCNTR, to the mean/rms calculator IMEAN, and to many other tasks.

> SETXWIN (dx,dy)  C R

reads pixel coordinate of the center of a dx-pixel by dy-pixel window and sets the adverbs BLC and TRC.

> TVBOX  C R

is similar to TVWIN above except that it is used to set up pixel coordinates to define rectangular or circular Cleaning areas for the AIPS Clean tasks. The adverbs NBOXES and CLBOX are set. The circular option appeared in the 15JUL95 release and is not supported by APCLN and MX.

> REBOX  C R

allows revision using the TV of the Cleaning areas set previously with TVBOX. Revises NBOXES too.

> DELBOX  C R

allows deletion using the TV of the Cleaning areas set previously with TVBOX. Revises NBOXES too.

> FILEBOX  C R

is REBOX for boxes in the text file used with IMAGR; multiple fields and many more boxes are allowed.

> DFILEBOX  C R

is DELBOX for boxes in the text file used with IMAGR; multiple fields and many more boxes are allowed.

> SETSLICE  C R

works like TVWIN above to set BLC and TRC. Instead of a rectangle however, the display shows a diagonal line which is useful for setting the ends of slices.

6.4.5 Reading image values from the TV

There are several facilities for reading out intensity and position information from displayed images using the TV cursor:

> IMPOS  C R

displays the two coordinate values (e.g., RA and Dec) from the cursor position when any button is depressed. Adverbs TVBUT and COORDINA are returned.

> IMXY ; IMVAL  C R

displays the image intensity and the two coordinate values (e.g., RA and Dec) from the cursor position when any button is depressed. Adverbs PIXXY, TVBUT, PIXVAL, and COORDINA are set.

> TVFLUX  C R

displays image intensities and coordinates whenever a TV button is pressed, looping until button D is pressed. Adverbs for the first image name are set as well as PIXXY, TVBUT, PIXVAL, and COORDINA for the last pixel selected.

> TVDIST  C R

displays the angular length and position angle of the spherical vector between two pixels in one or two images shown on the TV. Name adverbs for input files 1 and 2 are set as well as adverbs PIXXY, PIX2XY and DIST.

> TVMAXFIT  C R

whenever a TV button is pressed, fits a quadratic function to the image to find the position and strength of an extremum, looping until button D is pressed. Adverbs for the first image name are set as well as PIXXY, TVBUT, PIXVAL, and COORDINA for the last object selected.

> CURVAL  C R

continuously displays (in the upper-left corner of the TV) the pixel coordinates and the image intensity in user-recognizable units at the position selected by the TV cursor.

> TVSTAT  C R

determines the mean, rms, extrema and integrated intensity (if appropriate) in user-defined “blotch” regions within the image currently displayed on the TV. The regions are irregular polygons selected with the TV cursor. Type EXPLAIN TVSTAT  C R for details. Adverbs PIXAVG, PIXSTD, PIXVAL, PIXXY, PIX2VAL, and PIX2XY are set.

> COPIXEL  C R

to convert between pixel and astronomical coordinates for an image; allows determination that a coordinate is not inside an image.

6.4.6 Labeling images on the TV

There are a number of facilities for labeling images on the TV including:

> TVLABEL  C R

to draw standard axis labels around the visible image. You may control the type of labeling and whether coordinates are shown as a grid or short tick marks. If more than one image is visible, you will be asked to indicate which one you want with the cursor and any button.

> TVWLABEL  C R

to draw axis labels around the visible intensity wedge.

> TVANOT  C R

to draw a text string into a grey-scale channel or a graphics plane at a location specified via an adverb or via the TV cursor.

> TVLINE  C R

to draw a straight line into a grey-scale channel or a graphics plane at locations specified in part or in whole via adverbs or via the TV cursor.

> TVILINE  C R

to draw a straight line into a grey-scale channel or a graphics plane between two image pixel coordinates.

> COSTAR  C R

to plot a “star” positions at a user-specified coordinate on the TV image.

> TVSTAR  C R

to plot “star” positions from an ST file on top of the visible image; see §6.3.2.

6.4.7 Comparing images on the TV

It is often useful to compare two images, e.g., to decide whether one contains artifacts that are not present in another at the same frequency, or to look for frequency-dependent features at constant resolution. AIPS provides several tools for such image comparisons.

The first tool is a capability for loading multiple images to the same plane (or channel) of the TV device. The parameter TVCORN specifies where the bottom left corner of the image or image subsection will be positioned in the TV frame by TVLOD or TVALL. If TVCORN is left at zero, TVLOD and TVALL adjust it to center the displayed image. You may however use TVCORN to control loading successive images to different regions of the display with successive executions of TVLOD. For example, the following commands would load two 512 by 512 pixel images from slots 1 and 2 on disk 1 side-by-side on channel 1 of a 1024 by 900 TV display:

> INDI 1; GETN 1  C R

to select the input disk and the first image.

> TVCH 1  C R

to select TV channel 1 for the loading.

> TVCORN 1 193 ; TVLOD  C R

to load the first image.

> GETN 2  C R

to select the second image.

> TVCORN 513 193; TVLOD  C R

to load the second beside the first.

You could then adjust the color coding, transfer function, etc. for both images simultaneously with TVFIDDLE or TVTRAN. You may load as many as 256 images to a single TV plane with this technique, which is therefore a powerful method for making “montages.” The number of simultaneous images is limited mostly by your image sizes, the need to avoid overlaps (which are allowed if you want) — and your ability to do the arithmetic for appropriate TVCORN settings! You are also limited by the need for all the images in one plane to share that plane’s transfer function. Judicious use of the PIXRANGE and FUNC inputs to TVLOD permits making useful montages of disparate images, however.

A second tool is the classic “blink” technique from optical astronomy. TVBLINK allows you to load images to two different planes of the TV memory and then to alternate the display rapidly between the two. The two images described above could be “blinked” against each other by the following command sequence:

> INDI 1; GETN 1  C R

to select the input disk and first image.

> TVINIT; TVCORN 0

to clear the TV and restore the default positioning.

> TVCH 1; TVLOD  C R

to load the first image on plane 1.

> GETN 2  C R

to select the second image.

> TVCH 2 ; TVLOD  C R

to load the second image on plane 2.

> TVCH 12 ; TVBLINK  C R

to blink planes 1 and 2.

The rate and duty cycle of the blinking, and the transfer functions applied to the planes, are controlled interactively with the TV cursor. Instructions for these operations appear on your terminal while TVBLINK is running.

The task PLAYR provides a menu-driven method to enhance and blink two images and to develop and save TV color tables (“OFMs”).

For data cubes (e.g., frequency or time sequences of images), the verbs TVMOVIE and TVCUBE combine the two previous techniques. These are described in more detail in §8.5.4. Both verbs load one or more image planes with as many planes from the cube as possible (and as requested). Then they display each frame in sequence with interactive controls over the frame rate in movie mode, the chosen frame in single-frame mode, and the brightness, contrast, and color of the displayed images. TVMOVIE makes a somewhat more efficient movie sequence, but TVCUBE makes a better montage by using a more normal arrangement of the image planes.

Certain real TV displays used to provide powerful tools to compare images using color as well as intensity to represent real information. Unfortunately, some workstations can display only 256 simultaneous colors (or even fewer), but now most are capable of full color displays. XAS supports both kinds of workstation. The full-color displays tend to be slower which is no longer significant, but users may select to restrict themselves to pseudo-color displays; see §2.3.2 for details. For the limited workstations, there are two tasks, also discussed in §8.6, which attempt to recover much of this capability by trying to optimize color assignments over the limited range available. The first of these, TVHUI produces a composite display in which the intensity is set by one image, the hue is derived from another image, and the saturation is optionally derived from a third image. An interactive menu allows you to enhance each of the images individually, to select linear or logarithmic transfer functions for the intensity image, to select the subimage used during interactive enhancements, to repaint the full image, and to exit with or without writing out the final three-color image. A number of uses for this are obvious, including spectral-line moment images (velocity setting color, line width setting saturation), polarization images (polarization angle setting color in a circular scheme, polarization intensity setting saturation), and depolarization observations (color set by a two-frequency depolarization image). TVHUI is also useful on full-color displays, but for such displays, you may do much of the work of this task in a verb:

> INDI d1; GETN ctn1  C R

to select the intensity image.

> TVINIT; TVCORN 0

to clear the TV and restore the default positioning.

> TVCH 1; TVLOD  C R

to load the first image on plane 1.

> INDI d2; GETN ctn2  C R

to select the hue image.

> TVCH 2 ; TVLOD  C R

to load the second image on plane 2.

> TVCH 12 ; TVHUEINT  C R

to display a full-color view where the intensity is controlled by image 1 and the hue by image 2 and to interactively adjust that display.

Instructions for altering transfer functions and reversing the roles of the two images appear on your terminal while TVHUEINT is running.

TVHUI can be instructed to write out a three-color image cube containing one plane for red, one for green and one for blue. It does this using the transfer functions established interactively, but with full accuracy unlimited by the TV display. There is also an AIPS task called RGBMP which writes three-color cubes using weighted sums over a data cube. Three-color cubes also arise when digitizing color photographs of real scenes. The second task, TVRGB, can be used to display these three-color cubes or to generate a three-color display from any three AIPS image planes. Common examples of the latter are the superposition of radio continuum and/or line data on optical or X-ray images, and color-coding of effective temperatures or spectral indices from 3-channel continuum data. TVRGB can also be used to color-code different types of depolarization effects from multi-frequency polarimetry. Like TVHUI, TVRGB offers a simple menu to enhance each of the images individually or all together, to select the window specifying the subimage which is used during interactive enhancements, to repaint the full image on the TV, and to exit. TVRGB does not write an output image per se, but it can be instructed to write out a full 24-bit color PostScript plot file to be sent to a color printer. Its display (or any other TV display including that of TVHUI) can be captured and sent to a color printer; see §6.4.10 below.

On full-color workstations, three-color images may be displayed by loading each color plane to a separate TV memory. Then each memory is turned on in the desired color only using TVON with the usually ignored COLORS adverb. If the red image is in TV channel 1, the green in 2 and the blue in 3, the verb TV3COLOR is a short-cut for all the parameter setting.

> FOR TVCH=1:3; TBLC(3)=TVCH; TVLOD; END; TV3COLOR  C R

6.4.8 Slice files and the TV display

In Chapter 8 we discuss the computation and use of “slices,” one-dimensional profiles interpolated along any line in an image plane. Once a slice has been computed, it may be plotted by TVSLICE on the TV display in your choice of graphics channel. A second slice may be plotted on top of the first with TVASLICE. The TV graphics display is used to prepare initial guesses for SLFIT, which fits Gaussians to slices. The verbs involved are:

> NGAUS n ; TVSET  C R

to set the number of Gaussians to be fitted to n and then to prepare an initial guess at the parameters by pointing at the peaks and half width points on a graphics plot of the slice.

> TV1SET j  C R

to revise the initial guess for the jth Gaussian.

> TVGUESS  C R

to plot the initial guess of the model on the graphics device, erasing any previous plot.

> TVAGUESS  C R

to add a plot of the initial guess of the model to the current slice plot on the graphics device.

> TVMODEL  C R

to plot the fit model on the graphics device, erasing any previous plot.

> TVAMODEL  C R

to add a plot of the fit model to the current slice plot on the graphics device.

> TVRESID  C R

to plot the data minus the fit model on the graphics device, erasing any previous plot.

> TVARESID  C R

to add a plot of the residuals (data minus model) to the current slice plot on the graphics device.

The units for slice model parameters are those of the plot, so it is convenient to set them with these verbs. These same operations may also be done on the TEK graphics device (§6.5.2), but modern X-Windows emulations of such devices seem to have problems with cursor reading. They also do allow the use of multiple graphics planes while the TV verbs allow multiple colors or plot comparisons using different GRCHANs.

6.4.9 Other functions using the TV

There are a number of tasks which use the TV to give the user real interactive input to the operation based on the images displayed by the task on the TV. These include BLANK (§8.6) to blank out non-signal portions of an image, BLSUM (§8.6) to sum images over irregular blotch regions printing out summed spectra, TVFLG (§4.4.3) to edit visibility data based on grey-scale displays of some function of the visibility with baseline on the x axis and time on the y axis, SPFLG (§8.1, §10.2.2) to edit visibility data based on grey-scale displays of some function of the visibility with spectral channel for all IFs on the x axis and time on the y axis, EDITR (§5.5.2) to edit visibility data based on plots of visibility versus time, 1–11 baselines at a time, EDITA (§4.4.2) to edit visibility data based on plots of system temperature (TY tables) or antenna gains (SN or CL tables), WIPER to edit visibility data using UVPLT-like displays, and SNEDT to edit TY, SN, and CL tables themselves.

The imaging tasks, IMAGR, SCIMG, and SCMAP display the results of the computation at its current stage on the TV and provide a menu of interactive options to the user. The menu includes the usual display enhancements, the ability to choose among the images being computed, the ability to set Clean windows in those images, and the ability to end the computation at its current stage. The computation will resume when instructed via the menu or after a period of inactivity. A number of older iterative tasks use the TV to display the results of the computation so far and then prompt the user to hit button D within some number of seconds to stop the computation. Tasks that do this include APCLN, MX, SDCLN, VTESS, and several less significant tasks. UVMAP uses the TV simply to draw a picture indicating which cells are sampled in the uv plane. All of these tasks are described in Chapter 5.

There is a set of related tasks for analysis of data cubes transposed so that the first axis is the one on which baselines or Gaussians are to be fit. In the case of a spectral-line cube, the image would be transposed so that velocity is the first axis. These tasks were all written to use the Tektronix graphics device, but have been rewritten to run on the TV as well. Set DOTV=1, to use the TV; it is a more reliable graphics input device. Use XPLOT first to get an idea of what the profiles really look like. It uses a flux cutoff to determine which profiles to display and prompts you for permission to continue after each plot. XBASL is used to remove nth-order polynomial baselines from each spectrum. It has a batch mode of operation and an interactive mode which uses the graphics display to plot each spectrum and to accept guidance on which channels to use in determining the baselines. XGAUS is a similar task, with the rather harder job of fitting up to four Gaussians plus a linear baseline to each profile. In its interactive mode it plots each selected spectrum on the graphics device and accepts guidance on the baseline regions and the initial guesses for the Gaussians. XGAUS writes images of the fit Gaussian parameters and XBASL can be asked to write images of the baseline parameters. Unfortunately, these tasks require you to do the full cube in a single execution, which is rather an endurance contest.

6.4.10 Capturing the TV

Having done all the work to prepare the absolutely perfect display on your TV screen, it would be a good idea to capture it before someone, such as the local power company, does a TVINIT. See §Z.1.2.2 for a discussion of Unix tools to do this. We recommend, however, TVCPS to capture the image on your