Getting Started Documentation Glish Learn More Programming Contact Us
Version 1.9 Build 1488
News FAQ
Search Home


next up previous contents
Next: 4. Image Analysis Up: Volume 1 - Basic Tools Previous: 2. Processing Tabular Information

Subsections



3. Display of Data

David Barnes, Malte Marquarding & Neil Killeen

3.1 Summary

This chapter describes how to display data with the Viewer tool. You can display images, Glish arrays, measurement sets, and Tables holding source catalogs in a specific format. In the future, display of generic Tables will also be available.

If you are impatient and don't want to know anything about the Viewer, you should look at this 3.13.

There are three different ways to view data using the Viewer tool. The first approach is strictly using graphical user interfaces (GUIs). The second approach shows you how to create Viewer based applications via Glish scripting. The third approach is a combination of these two using the Image tool.

The Viewer tool is available from the Glish command line interface (CLI) and from the Toolmanager GUI. Detailed documentation describing the full interface of the Viewer toolis given in the Viewer module of the Reference Manual. The Viewer tool is made available in Glish with the command

include 'viewer.g'

It will be assumed in all of the code fragment examples that follow, that you have issued this command.

For working through the procedures in this chapter without an image or a Glish array at hand, you may use the following code to generate an example of each:

ar := viewermaketestarray()
im := imagemaketestimage('testimage.im')

Now you have a Glish array in ar and an Image tool in im. If you are interested in a sample source catalog to overlay on your images, you can open the Sources table used in the Measures tool as follows:

msc := vieweropentestskycatalog()

Now you have a table of sources accesses via the Table tool, msc.


3.2 Viewing a raster map of an image or Glish array

It is straightforward to display a raster map of an image or Glish array. A raster map represents pixel intensities in a two-dimensional cross-section of gridded data with colors selected from a finite set of (normally) smooth and continuous colors--a colormap.

3.2.1 Procedures

Because of the toolkit approach, there are a variety of ways to accomplish our display goals.

3.2.1.1 Displaying an image via an Image tool

First let us see the simplest way to display an image. Do this from an Image tool. If the image you wish to display is already present in Glish as an Image tool, (say, im) then all that is necessary to display the image is:

im.view()

If you haven't yet constructed an Image tool for your image, then do that first, e.g.

include 'image.g'
im := image('testimage.im')       # Native aips++ disk image
im.view()

Shortly a display of your image will appear, adorned with a GUI containing a menu bar and various buttons, whose functions are described here. Right now, if you're keen to alter some of the settings of the display, just press the Adjust button near the bottom left of the display! 3.1. The Image.view function uses its own Viewer tool to display the raster map.

Using the Image.view function, while straightforward, imposes some limitations on the flexibility of the display.

We can also easily display a FITS image.

include 'image.g'
im := image('/fits/3c273.fits')    # Detects whether aips++ or FITS image
im.view()

The performance of this native-FITS access display will be fine provided you don't reorder the display axes. If you want to reorder axes in the display, then convert the image to native AIPS++ format first.

include 'image.g'
im := imagefromfits('/data/3c273.im', '/fits/3c273.fits')
im.view()

3.2.1.2 A more flexible way to display a raster map

This describes how to use the general Viewer GUI, step by step.

1.
Include support for the Viewer tool, and display its basic GUI

If you are starting from the Unix prompt, you can type:

viewer

this line is just a wrapper which starts Glish and executes the code in the example immediately below. Otherwise, if you are already in the Glish command line, type:

include 'viewer.g'
dv.gui()

You will see a GUI which consists of two main windows, entitled viewer - Data Manager (AIPS++) and viewer - Display Panel (AIPS++). The tool dv is made for you when the viewer.g script is loaded. It stands for 'default viewer'. It's always there and generally that's the Viewer tool to use (see below for examples of making your own). Here are the GUI descriptions of the Viewer Data Manager

2.
Make a Viewer DisplayData from your data

A Viewer DisplayData is itself a tool which holds both data and functions which can display those data. A Viewer DisplayData for a raster map, for example, has attributes describing what colormap to use, what data range to display, etc.

3.
If the Autoregister button on the Viewer Data Manager wasn't checked, register the newly created DisplayData for display on the provided Viewer DisplayPanel: in the viewer - Display Panel (AIPS++) window, select the DisplayData you have just created from the Register... submenu of the DisplayData menu. Shortly thereafter, a raster map of your image or Glish array should appear on the Viewer DisplayPanel.

The result of this procedure, for the test Glish array generated with the viewermaketestarray function, is shown in Figure 3.1. The array is displayed as a greyscale raster map in the viewer - Display Panel (AIPS++) window. The DisplayData menu is extended in the figure to show that the DisplayData array:mar(Raster Image:1) has been registered for display (i.e. the checkbox is lit).

Figure 3.1: Registering a DisplayData on a Viewer DisplayPanel
\begin{figure}
\begin{center}
\epsfig{file=cookbook.dir/dpregister.ps,width=3.7in}\end{center}\end{figure}

In Figure 3.1, the main parts of the Viewer DisplayPanel GUI are visible: the menubar along the top; the control buttons down the left side, which are used to assign functions to up to three mouse buttons; the animation buttons down the right hand side which are disabled in this case because the array has only two dimensions; the button bar along the bottom, and just above that, the position information box. These are described in detail here.

3.2.1.3 Command line procedure

This final offering of how to viewer a raster map of some appropriate data, is wholly command-line based. Thus it forms a nice introduction to actually doing some more sophisticated things with the Viewer tool, like using it in your own Glish application.

First, construct a Viewer tool:

mv := viewer();

See the Viewer documentation in the Reference Manual for a description of the parameters that can be supplied to the Viewer tool constructor. Rather than constructing your own Viewer tool, you could also use the default Viewer tool (dv) that we have seen earlier. It is constructed upon inclusion of the viewer.g Glish script. Now construct a Viewer DisplayPanel in which the raster map will be displayed:

mdp := mv.newdisplaypanel();

At this point, you will have a Viewer DisplayPanel on the screen, ready to display data. The tool mdp can be used to control this Viewer DisplayPanel. For example, you could temporarily remove the Viewer DisplayPanel from the screen by entering mdp.unmap() at the command-line. Once again, see the Viewer.newdisplayapanel documentation for the available parameters for the viewer.newdisplaypanel function, and the Viewer displaypanel documentation for the functions available in the newly created Viewer DisplayPanel.

If you have an image to display, then load the data as follows, substituting '/data/3c273.im' for the name of your image file. The quotes are required, and you may need to specify the path to the image if it is not in the current directory.

mdd := mv.loaddata('/data/3c273.im', 'raster');

If instead you have a Glish array to display, then load the data as follows, substituting data for the name of the global Glish variable in which the array is stored (note this time without quotes)

mdd := mv.loaddata(data, 'raster');
Note that your image or array should have at least two dimensions.

Once you have completed the above steps, mdd is a Viewer DisplayData, which needs to be registered on a Viewer DisplayPanel (e.g. mdp) so that it can be displayed. This is done like this:

mdp.register(mdd);

and after a brief delay, the length of which is in some way proportional to the size of your image or array, you should see an initial raster map of your image or Glish array.


3.3 Viewing a contour map of an image or Glish array

With only very slight modifications to the above procedures, it is possible to display a contour map generated from an image or Glish array. A contour map shows lines of equal pixel intensity (e.g. flux density) in a two dimensional cross-section of gridded data. Contour maps are particularly useful for overlaying on raster images, so that two different measurements of the same part of the sky can be shown simultaneously.

3.3.1 Procedures

3.3.1.1 Simple ways to display a contour map of an image

As in the case of a Raster Image, select the image tool in the Tool Name listbox or the image name in the file browser. Now click on Contour Map instead of Raster Image. Register the Viewer DisplayData on the Viewer DisplayPanel as before using the Register... submenu of the DisplayData menu.

Alternatively, for an image already present in Glish as an image tool, (say, im), use the contour option of Image.view on the command line, i.e.

im.view(contour=T);
This will register the image for you automatically.

3.3.1.2 Other possibilities

The procedure via the Viewer tool GUI is easily modified to produce a contour map display: simply select Contour Image where previously you selected Raster Image.

The command-line procedure for creating a raster map display can be modified to create a contour map display by simply replacing the line:

mdd := mv.loaddata('/data/3c273.im', 'raster');
with:
mdd := mv.loaddata('/data/3c273.im', 'contour');


3.4 Viewing a vector map of an image or Glish array

Consider a Complex image or array. At each pixel, this represents an amplitude and phase (position angle). A common method of displaying amplitude and position angle data is via vectors (line-segments) where the length of the vector is proportional to the amplitude. For example, it is usual to view linear polarization data in which the fractional polarization is the vector amplitude and the the linearly-polarized position angle is the vector position angle. This may be overlaid on total-intensity raster displays. Another example might be the display of fluid-flow.

Since amplitude and phase can be conveniently represented as a Complex number, the data source for this kind of vector display is either a Complex image or a Complex Glish array (later we will describe how you might create such data).

However, you can also provide Float images and arrays, in which case the data values specify the position angle and the amplitude is assumed to be unity. The angular units should be specified by the brightness unit of the image. If none, degrees are assumed.

The position angle is measured positive North through East when you display a plane holding a celestial coordinate (the usual astronomical convention). For other axis/coordinate combinations, a positive position angle is measured from +x to +y in the absolute world coordinate frame.

The procedures already described for raster and contour displays are appropriate as well for vector displays.

3.4.1 Procedures

3.4.1.1 How to display a vector map with Float images

At present, Image tools can only be associated with Float images. You will get an error if you attempt to associate an Image tool with a Complex image disk file. This will be rectified in the future.

For a Float image, you can make a vector map display via the Image tool function Image.view.

include 'image.g'
im := imagefromshape('zz', [64,64])    # Make empty image
im.set(20)                             # Set to 20 degrees
im.view(vector=T, axislabels=T)        # Display

For Complex images (and optionally for Float images) you must use the native Viewer interface as described below. This also gives you more flexibility in combining displays (raster, contour, vector etc).

3.4.1.2 A more flexible way to display vector maps

The procedure via the Viewer tool GUI is easily modified to produce a vector map display. After selecting an image, Image tool or Glish array (Complex or Float), simply select Vector Map where previously you selected Raster Image.

The command-line procedure for creating a raster image display can be modified to create a vector map display by simply replacing the line:

mdd := mv.loaddata('/data/3c273.im', 'raster');
with:
mdd := mv.loaddata('/data/3c273.im', 'vector');
although in this case drawing vectors of the intensity of 3C273 wouldn't be very illuminating ! You might try

im := imagefromshape('zz', [128,128])
im.set(45.0)
im.setbrightnessunit('deg')
im.done()
mdd := mv.loaddata('zz', 'vector')
mdp.register(mdd);

which will make an image with value 45 deg and then display lots of vectors all of the same length aligned in the same direction.

3.4.1.3 Making Complex images and arrays

Complex images are not yet fully supported in AIPS++. Most notably, the Image tool cannot open a Complex image which is unfortunate. This will be rectified in a future release.

However, selected functions of the Imagepol tool do write out Complex disk images which can be used as a data source for the vector displays.

These functions are:


3.5 Viewing a marker map of an image or Glish array

A marker map represents pixel intensities by a particular marker shape and fill style. For example, the marker shape may be a square. The size of the square is proportional to the absolute pixel intensity. If the pixel is positive the square is filled, if the pixel intensity is negative, the square is open.

This kind of display is useful for quantities such as the Rotation Measure. The RM may be positive or negative with a distribution that may well be quite discontinuous. Displaying RM images as rasters is not very useful because the strongly negative values (which are equally important as the strongly positive values) will come out dark. Contouring usually fails because of continuity issues. With the marker map display you are biased against seeing small absolute values (square size becomes smaller). So you really have to decide what you are interested in and what display is most useful.

3.5.1 Procedures

3.5.1.1 Simple ways to display a marker map of an image

As in the case of a Raster Image, select the image tool in the Tool Name listbox or the image name in the file browser. Now click on Marker Map instead of Raster Image. Register the Viewer DisplayData on the Viewer DisplayPanel as before using the Register... submenu of the DisplayData menu.

Alternatively, for an image already present in Glish as an image tool, (say, im), use the contour option of Image.view on the command line, i.e.

im.view(marker=T);
This will register the image for you automatically.

3.5.1.2 Other possibilities

The procedure via the Viewer tool GUI is easily modified to produce a contour map display: simply select Contour Image where previously you selected Raster Image.

The command-line procedure for creating a raster map display can be modified to create a contour map display by simply replacing the line:

mdd := mv.loaddata('/data/3c273.im', 'raster');
with:
mdd := mv.loaddata('/data/3c273.im', 'marker');


3.6 Viewing a source catalog overlay

The Viewer can be used to plot overlays of sources from catalogs stored in AIPS++ tables, on raster images or contour maps. Note though, that it is only an overlay feature--you MUST have another DisplayData already registered on a Viewer DisplayPanel in order for the catalog sources to be drawn.3.2

3.6.0.0.1 Creating a Skycatalog

The Viewer module comes with a skycatalog tool to convert from ASCII tables and componentlists to the skycatalog table format. Most commonly you will have an ASCII file e.g. mydata.txt like this:

NED 16 19:44:47 -14:46:51 NGC6822 159.8
NED 22 01:04:46 +02:07:04 IC1613 328.1

The best way to prepare this file for import is to prepend a header with information about what is in the columns. (Note that this is not necessary and the skycatalog tool can automatically determine the column data and name the columns Column1..ColumnN if no header is present.)

So after inserting the header into your file it looks like this:

Name No RA DEC NED-ID mom0
A A A A A R
NED 16 19:44:47 -14:46:51 NGC6822 159.8
NED 22 01:04:46 +02:07:04 IC1613 328.1

The first line specifies the names you would like to use to identify the columns. The second line indicates what data type your column holds. Most commonly you'll only need these:

A = ASCII(String)
R = Real(Float)
See tablefromascii for more on table headers.

All you need to do now is:

include 'skycatalog.g'
sca := skycatalog('myscat.tbl')
sca.fromascii(asciifile='mydata.txt',hasheader=T, # tell the tool which columns
              longcol='RA',latcol='DEC')          # are longitude and latitude
sca.browse()                                      # invokes table browser 
sca.done()

You can re-access this skycatalog table in the Viewer Data Manager via the table myscat.tbl.

Look at the skycatalog tool in the reference manual for more details on how to use this tool.

3.6.1 Procedures

As for viewing raster and contour maps, viewing catalog overlays is pretty straightforward, and can be accomplished a number of ways:

1.
Use the viewer GUI: click on a a suitable table in the Data manager window, and the Display Types will show SkyCatalog Overlay. If you click on this a DisplayData will be created. Then in a Viewer DisplayPanel which already has a raster and/or contour map registered, register the newly made DisplayData for display. Any sources in your catalog table, which are in the region of sky currently displayed in the Viewer DisplayPanel, will be drawn with crosses.

2.
Use the command-line interface as follows:
mdd := dv.loaddata('myscat.tbl', 'skycatalog');
mdp.register(mdd);
In this example, mdp is an existing Viewer DisplayPanel with a raster or contour map already registered.

Once you have a sky catalog overlay registered on a Viewer DisplayPanel you can adjust a number of parameters to obtain the desired display.

3.6.2 Notes

3.7 Viewing a measurement set

Measurement sets can now be displayed and flagged directly from the viewer. The interface is fairly basic at present, but further refinements are in progress. From the Viewer Data Manager window, simply choose your measurement set file, then click 'Raster Image'.

You could do the same thing from the command line with:

mv := viewer();
mdp := mv.newdisplaypanel();
mdd := mv.loaddata('mydata.ms', 'raster');
mdp.register(mdd);

You should use the filename rather than the variable name of an ms tool. You should also assure that no other Display Data is registered on the Viewer DisplayPanel.

The only type of display currently available is 'raster', which is similar to msplot's 'Display data as an image' mode (or to TVFLG). A plotting-style Display Data for measurement sets is planned for the future.

Usually, the measurement set data is loaded automatically when the Viewer DisplayData is created. Loading data for large measurement sets can take some time. Look at the AIPS++ console window (rather than the logger) to monitor progress.

For very large measurement sets, you must press 'Apply' on the 'Adjust' panel to load the data yourself. This gives you the opportunity to choose something other than Observed Amplitude, for example, before a time-consuming data load.

A complete description of the 'Adjust' panel interface for controlling display and editing of the measurement set can be found at this link.


3.8 Operating the Viewer DisplayPanel

The Reference Manual gives a complete description on how to operate the Viewer DisplayPanel GUI. Just follow this link


3.9 Adjusting display parameters

On the Viewer DisplayPanel, there is a button at the bottom left labelled Adjust.... If you click it, then for each DisplayData that is currently registered on the Viewer DisplayPanel, a window labelled Adjustment (AIPS++) (and prefixed by the name of the DisplayData so that you know which is which) will appear (a little patience is sometimes needed). Each of these adjustment GUIs consists of a series of roll-up windows, which can be exposed or hidden by clicking the text next to the up or down arrow. The options available for adjustment depend on the type of display. The settings common to raster, contour and vector and are described here Each of them have specific settings as well:

At the bottom of the adjustment window, are a couple of buttons with which you can save current settings, and restore previously saved settings. Just type a unique name which you will remember for this DisplayData, and hit save or restore. The new parameters (if they exist) will be installed and the displays updated accordingly. Note: You have to be in the directory you started the viewer in to be able to retrieve the parameters.


3.10 Advanced, worked examples

In this section, a few fully-worked examples are given which cover quite advanced uses of the viewer. The examples are generally accomplished from the command-line so that you can easily replicate them yourself.

3.10.1 Overlaying contours on raster maps

A common operation is to overlay contours of one image on a raster map of another image to show, for example, the HI emission in relation to the starlight in a galaxy. The Viewer tool can easily produce such a display, provided the two images have the same coordinate type, epoch, projection and projection parameters. Yes, that's a long list of requirements, but most of them will be relaxed in the near future. Since there is only one test image available however, in this example we will overlay contours from the test image on a raster map of the very same image. Let's begin by creating the test image and making a DisplayPanel and two DisplayData:

include 'image.g';
im := imagemaketestimage('test.im');
#
mdp := dv.newdisplaypanel();
mdd1 := dv.loaddata(im.name(), 'raster');
mdd2 := dv.loaddata(im.name(), 'contour');

Immediately we can see the overlay by simply registering the two DisplayData on the DisplayPanel. For a single refresh cycle, we wrap the registration between a hold and release pair:

dv.hold();
mdp.register(mdd1);
mdp.register(mdd2);
dv.release();

There are plenty of ways to improve the display, by adjusting various parameters for the raster and contour maps. This can be done by pressing the Adjust... button on the Viewer DisplayPanel, and modifying the parameters in the GUI. The GUI can also be displayed for each DisplayData by doing:

tmp := mdd1.gui();
tmp := mdd2.gui();

Why don't you do this now and start playing away ?

3.10.2 Blinking Between Images - Side-by-Side Display

This example shows how to use the 'Blink' mode of the viewer to flip between views of several different Images, or to view them side-by-side.

Figure 3.2: Side-by-Side Image Display
\begin{figure}
\begin{center}
\epsfig{file=cookbook.dir/sidebyside.ps,width=3.9in}\end{center}\end{figure}

As in raster/contour overlaying, the images should have the same coordinate projections and extents on the display axes, and (ideally) the same number of channels on the 'Z' or 'movie' axis. We'll discuss ways around these restrictions later, but begin with the simple case. Trial images from the same raw data, in different stages of calibration or deconvolution (as shown in the Figure) are ideal. Follow the steps below.

# for review--you may already have done these steps in examples above.
include 'viewer.g'
mdp := dv.newdisplaypanel();

If you have any DisplayDatas left on the DisplayPanel from previous examples, remove them now using the 'DisplayData/Remove...' menu, to start fresh.

The following images may already be included in your aips++ installation. If not, you can use two of your own images from different 'Clean' stages, but which have the same resolution.

mdd1 := dv.loaddata('/aips++/data/bima/test/sgrb2n.spw1.dirty', 'raster');
mdd2 := dv.loaddata('/aips++/data/bima/test/sgrb2n.spw1.restored', 'raster');
# (For '/aips++', you may need to substitute the directory where
# aips++ is installed on your system).

You may notice considerable delay loading the 33MByte images above if you are accessing them over the net. To avoid these delays, store or copy your data to the machine where you run aips++.

If you don't find these images and have none of your own, you can still try out blink mode by loading the test image of previous examples twice. In that case, change the colormap of the second DisplayData to 'Rainbow 2' to make them easy to tell apart.

# use these steps instead, if you couldn't find the images above.

include 'image.g';                     # If not done
im := imagemaketestimage('test.im');   # previously...

mdd1 := dv.loaddata(im.name(), 'raster');
mdd2 := dv.loaddata(im.name(), 'raster');

mdd2.setoptions([colormap='Rainbow 2']);

Whichever pair of DisplayDatas you use, register them onto the DisplayPanel now.

mdp.register(mdd1);
mdp.register(mdd2);

You will see only the last-registered DisplayData, since they are drawn in that order and there is no transparency mode at present.

If you are using the sgrb2n data, notice that the animator indicates that you are on frame (channel) 1 of 128. Move to channel 61 or so, by typing 61 <Enter> into the text box that indicates the current frame. The script commands to do the same thing are:

an := mdp.animator();
an.goto(61);

Position the cursor somewhere around the left border of this image, hold down the middle mouse button, and move it around a bit, to lighten up the image as desired.

That last scripted command used the animator in its 'Normal' mode, which moves to a chosen plane on a third axis of your image(s). (If you are using 'test.im', it has no third axis, and the animator is disabled). In order to blink between different images or view them side-by-side, change the animator's mode to 'Blink', either by pressing the 'Blink' radio button on the panel, or entering:

an.setmode('blink');

The animator now indicates that you are viewing image 1 of 2. You can 'blink' between the two images now by using the animator's 'tapedeck' buttons. For reference, the corresponding animator script commands are:

an.forwardplay(); an.stop();
an.reverseplay();
an.forwardstep(); an.reversestep();
an.tostart();     an.toend();

To view the two images side-by-side, bring up the 'Canvas manager' window from the File menu of the DisplayPanel, and set 'Number of panels in x' to 2. Stop the animator if it is playing and set it to the beginning as well, so that the first-registered image is on the left, just to avoid confusion. In script commands, this is:

an.stop();
an.tostart();
cm := mdp.canvasmanager();
cm.setoptions([nxpanels=2]);

Three (or more) images can be accommodated in a similar manner. You can zoom into both images in synchronization by sweeping out a rectangle on either image with the left mouse button and then double-clicking inside the rectangle.

3.10.2.1 Blink mode limitations (and ways around them)

If you used the sgrb2n images in the example above, you'll notice that both images remained on channel 61 during blink mode. To look at a different channel, you could move back to normal mode, select a different channel, and return to blink mode to view both images on the new channel. A shortcut command for this is:

an.gotoz(67);     # change to channel 67, while still in 'blink' mode.

There is no way for the animator to tell the various images to display different channels; it has only a single frame number setting, which is communicated to all the images. There are several ways around this limitation, however.

If your images cover a similar portion of the sky but have different projections or extents on it, you can view them both by regridding one to the projection and shape of the other, as follows:

im1 := image('first.im');       # use the file names of your
im2 := image('second.im');      # images here.
cs1 := im1.coordsys();          # coordinate system of the first image.
im2r:= im2.regrid(outfile='second-regrid.im', csys=cs1, shape=im1.shape());

im2r contains the second image regridded to the projection and shape of the first image. You can omit the outfile parameter if you don't need to save the regridded image permanently. You can now display and blink between the images im1 and im2r.

dd1 := dv.loaddata(im1,  'raster');  mdp.register(dd1);
dd2 := dv.loaddata(im2r, 'raster');  mdp.register(dd2);

Different images can always be displayed 'side-by-side' in completely separate DisplayPanel windows as well. In that case the the images need have nothing in common at all. There is no zoom synchronization or other 'linkage' between different DisplayDatas in the different panels, however.

The first item under the 'File' menu in one panel will bring up a new panel; registration of DisplayDatas, zooming, and animation can be controlled separately in each panel.

3.10.3 Displaying complex data

In this example, we generate a complex data array, and use some special features of the Viewer tool to visualize the data. Let's commence by taking the standard Viewer tool test array data, and Fourier transform it to obtain a complex array:

myrealdata := viewermaketestarray(180);
include 'fftserver.g';
mfft := fftserver();
mycxdata := mfft.realtocomplexfft(myrealdata);

At this point, mycxdata is a complex array, storing the Fourier transform of the real array myrealdata. We can immediately view the complex array with the Viewer tool as follows:

mrdp := dv.newdisplaypanel();
mrdd := dv.loaddata(mycxdata, 'raster');
mrdp.register(mrdd);

The image has a rather high dynamic range, so let's ramp up the ``magnifying'' power of the colormap, and zoom in by a factor of three:

mrdd.setoptions([powercycles=-3.0]);
mrdp.zoom(3);

Now, the default behavior of the raster map, when provided with complex data, is to shade pixels according to the magnitude of the pixel values. Valid alternatives are the phase, real and imaginary components. Select which you like according to the following examples:

mrdd.setoptions([complexmode='phase']);     # display phase
mrdd.setoptions([complexmode='real']);      # display real component
mrdd.setoptions([complexmode='imaginary']); # display imaginary component
mrdd.setoptions([complexmode='magnitude']); # back to magnitude display

Make sure you execute at least the last line here, so that at this point you are back viewing the magnitude of the data. Note that if you have the adjustment panel open for this DisplayData as you are making changes from the command line, you will see the adjustment panel update in response to your changes!

Let's get a little more sophisticated. We can actually display two (or even three) components of the complex data at once, using a multi-channel raster map. Such a map has different data being mapped to either the red, green and blue components of each pixel on the screen, or instead the hue, saturation and value components of each pixel on the screen. First we shall avail ourselves of a different type of Viewer DisplayPanel, an RGB DisplayPanel, and make two new DisplayData:

mcxdp := dv.newdisplaypanel(maptype='rgb');
mcxdd1 := dv.loaddata(mycxdata, 'raster');
mcxdd2 := dv.loaddata(mycxdata, 'raster');

Now we will set the mcxdd1 DisplayData to display the real component of the pixels, and place this on the red channel, and set mcxdd2 to display the imaginary component via the green channel:

mcxdd1.setoptions([complexmode='real', colormode='red']);
mcxdd2.setoptions([complexmode='imaginary', colormode='green']);

Now we should be able to make a really cool display by registering both these DisplayData on the one Viewer DisplayPanel. We make use of the hold and release functions of the Viewer tool to do this in one refresh cycle:

dv.hold();
mcxdp.register(mcxdd1);
mcxdp.register(mcxdd2);
dv.release();
Again, let's just improve things by spreading out the colors, switching to a smoother resampling mode, and zooming in:
dv.hold();
mcxdd1.setoptions([powercycles=-1.0, resample='bilinear']);
mcxdd2.setoptions([powercycles=-1.0, resample='bilinear']);
mcxdp.zoom(5);
dv.release();

Finally, we can allocate more colors to the red and green channels by taking them away from the blue channel. Find out the current color cube dimensions:

print mcxdp.status().pixelcanvas.colorcubesize;

Chances are the result will look something like [7 6 6] if you are using an 8-bit screen, or [256 256 256] if you are using a TrueColor screen. If the numbers are low, you can rearrange them as follows:

dv.hold()
tmp := mcxdp.setoptions([colorcubeblueaxislength=1]);
tmp := mcxdp.setoptions([colorcuberedaxislength=12]);
tmp := mcxdp.setoptions([colorcubegreenaxislength=12]);
dv.release();

If you are on a TrueColor (24bit) screen, you cannot modify the color allocations at this point.

In the final display, you can now see the areas where the real component is dominant (red-dominant pixels), areas where the imaginary component is dominant (green-dominant pixels), and the in-between areas where the real and imaginary components have roughly the same magnitudes (yellow colored pixels).

3.11 3D slice display of data cubes

The Viewer tool also provides a slightly modified Viewer DisplayPanel, the Viewer Slice DisplayPanel. It has most of the functionality of the Viewer DisplayPanel. You might notice that some of the tools in the control box don't appear. These tools will be available soon. In addition the Viewer Slice DisplayPanel provides an extra tool, the Multi panel crosshair. This controls the slicing action. Dragging it over one of the three different displays of the data will control the animation of the other two. The top-left display will show a XY slice, the top-right a ZY and the bottom-left panel a XZ slice of the data. Note that only a Viewer DisplayData with at least three axes and more than one pixel along the third axis will register on the Viewer Slice DisplayPanel. The slices probably will not fill the panels evenly. This is because the ratio of the pair of displayed axes

The button bar at the bottom of the Viewer Slice DisplayPanel shows a Preload... button. It executes an animation loop on each of the slices of data. By doing this, the display caches all views of the data and will improve the speed of the Multi panel crosshair tool. Note: This can take a while for large data cubes, although it is recommended to use this if you chose to have axis labels.

Note: Don't use FITS images on this DisplayPanel. Convert them to native AIPS++ images first. The access of FITS images with re-ordered axes is very slow.

3.12 Displaying channel maps of a data cube

The viewercanvasmanager gui accessible via the File menu of Viewer DisplayPanel, gives you control over the number of channels in a data cube you want to display at the same time - so called channel maps. The Layout rollup drives this application. Select the number of views you want to see in x and y and the animator will take care of the distribution. These will be arranged from top-left to right-bottom, starting at the frame selected in the animator. Be careful here: If your margins are too big this can get out of control. Always reduce the margins in the Geometry rollup first.


3.13 A step-by-step recipe to make a post-script plot of your image

This section gives a detailed description on how to get from your image on disk to a publishable PS file just using the GUI.

Let's say we have an image called ngc253.fits:

1.
Starting the viewer

To start the viewer type viewer at your Unix command line.

2.
loading the image into the viewer

3.
Adjust (fiddle) the colormap

The displayed might not show a nice contrast. You can use the colormap fiddling tool to adjust this.

4.
Turning on axis labels

Your axis labels might be cut off right now or you think that there is too much space around them. In this case you should go to point 4, otherwise continue skip this.

5.
Adjusting the axis label space

6.
Printing the image/ save it to a PS file

Now either save it to a file:

or print it directly:

7.
press the Dismiss button on the canvas print manager window.

That's it you have successfully create a post-script file of your image. You might have noticed all the other options you have in the Adjust panel. Just play around and look what they do.


next up previous contents
Next: 4. Image Analysis Up: Volume 1 - Basic Tools Previous: 2. Processing Tabular Information   Contents