Displaying Surfaces with Direct Graphics

Working with images using Direct graphics is not as convenient as using the iImage tool, but may be desirable if you are incorporating images into a larger widget-based application, or if you need to programatically create a large number of processed images.

In this example, we will display three-dimensional surface data using IDL Direct graphics. Enter the following commands at the IDL command line:

  1. If you have not already done so, restore the marbells.dat SAVE file.
  2. RESTORE, FILEPATH('marbells.dat', $
        SUBDIRECTORY=['examples', 'data'])

  3. Since we are using Direct graphics, tell IDL to use a maximum of 256 colors and load a simple grayscale color map.
  4. DEVICE, RETAIN=2, DECOMPOSED=0
    LOADCT, 0


    surface_grid_1.gif

  5. Use the CONGRID procedure to resample the data set so that the grid can be displayed at a visible size. In this case, resample the array size to 35 x 45, or one-tenth its original size.
  6. MARBELLS=CONGRID(elev,35,45)

  7. Visualize the grid.
  8. SURFACE, MARBELLS

The SURFACE procedure can be used to view your data from different angles. The AX keyword specifies the surface angle of rotation (in degrees towards the viewer) about the X axis. The AZ keyword specifies the surface rotation in degrees, counterclockwise about the Z axis.

surface_grid_2.gif

  1. View the array from a different angle.