WgIsoSurfTool Procedure

Creates a window with a built-in set of controls; these controls allow you to easily view and modify an iso-surface taken from a three-dimensional block of data.

Usage

WgIsoSurfTool, surface_data 

Input Parameters

surface_data — A 3D variable containing volumetric surface data. The dimensions of  surface_data define the size of the cube that you see when the WgIsoSurfTool window is first opened.

Output Parameters

None.

Keywords

Cmap — The index of the color table to load when the widget is created; a positive integer in the range (0–18).

Cube_color — The color in which the rotatable cube is drawn; a positive integer in the range (0–255). The number that is provided for cube_color is used as an index into the current color table.

Parent — The widget or shell ID of the parent widget (long). If parent is not specified, WgIsoSurfTool runs on its own (i.e., in its own event loop).

Position — A two-element vector specifying the x- and y-coordinates of the upper-left corner of the IsoSurfTool window (long integer). The elements of the vector are [x, y], where x (horizontal) and y (vertical) are specified in pixels. These coordinates are measured from the upper-left corner of the screen.

Shell — The ID of the newly created widget. If the procedure fails, zero (0) is returned.

Thresh_range — The range of values to display in the threshold slider. The default is to use the entire range of values defined by surface_data, or in other words, the range:

(min_surface_data¼max_surface_data)

Thresh_value — The initial position of the threshold slider. By default, the movable portion of the slider is positioned in the middle of the threshold range.

Title — A string containing the title that appears in the header of the IsoSurfTool window. Default value is “Isosurface Tool”.

View_persp — The initial perspective distance. If View_persp is zero, then the initial setting on the Perspective Distance slider is 0.5, but the Perspective pushbutton is initially deselected. If View_persp is nonzero, then the initial setting on the Perspective Distance slider is the value specified by View_persp and the Perspective pushbutton is selected.

Note:

Using no perspective to draw the cube is equivalent to having the eyepoint an infinite distance away from the cube, and will produce a cube with sides that all appear to be parallel to one another.

View_rot — A three-element vector specifying the initial view rotation, in degrees. If not supplied, the initial rotation of the cube and the iso-surface is [30, 30, 0] — in other words, 30 degrees rotation around the x-axis, 30 degrees rotation around the y-axis, and 0 degrees rotation around the z-axis.

View_zoom — The initial zoom factor. (Default: 0.5)

Color/Font Keywords

For additional information on the color and font keywords, see Setting Colors and Fonts in the PV‑WAVE Application Developer’s Guide.

Background — Specifies the background color name.

Basecolor — Specifies the base color.

Font — Specifies the name of the font used for text.

Foreground — Specifies the foreground color name.

Discussion

WgIsoSurfTool is an interactive window, shown in WgIsoSurfTool Window, that lets you use the mouse to view and modify iso-surfaces; you can view any iso-surface contained within the three-dimensional input dataset, surface_data.

If the zoom factor is large, or the perspective parameter is small, then the cube display in the View Orientation window may be erroneous. To cure the problem, reduce the zoom or increase the perspective (or disable the perspective entirely).

Note:

Some iso-surfaces can be time-consuming to render, especially those that compose many polygons. PV‑WAVE will display its “wait cursor” while it is performing the calculations necessary to display the iso-surface.

 

WgIsoSurfTool Window

Event Handling

You can use the IsoSurfTool widget in one of the following two ways:

From the WAVE> prompt — Enter the procedure name at the WAVE> prompt to display the IsoSurfTool widget. The IsoSurfTool widget handles its own event loop by calling WwLoop.

Stand-alone widget in its own window created by another application — The IsoSurfTool widget has its own Main window, but the application (not the IsoSurfTool widget) handles the event loop by calling WwLoop.

The output parameter shell can be returned only if you also supply the input parameter parent.

Contents of the Window

The IsoSurfTool window has two main parts — the display area and the control area.

IsoSurfTool Display Area

The display area is towards the right of the window; it is divided into an upper and lower region:

View orientation area — The cube establishes a frame of reference for viewing the iso-surface.

Iso-surface area — This region contains an image displaying an iso-surface; the iso-surface shows similarities in whatever property the data is measuring.

Note:

The orientation of the iso-surface is copied from the orientation of the cube.

IsoSurfTool Control Area

Use the following controls to operate the IsoSurfTool window:

X, Y, and Z Rotation — These controls allow you to rotate the cube (counter-clockwise around the desired axis) a specified number of degrees. The current rotation is shown in the text field to the right of the slider. To modify the rotation, either enter a new value in one of the text fields, or use the left mouse button to drag one of the sliders. If you enter a new value into a text field, press <Return> to apply the new value to the slider and the surface. If you use the sliders, the change is applied immediately as the slider moves.

Perspective — If enabled, the cube is drawn with perspective; if disabled, the cube is drawn without perspective.

Perspective Distance — Controls the amount of perspective used when drawing the cube; in other words, how close the eyepoint is to the cube. The closer the eyepoint gets to the cube, the greater the amount of perspective exaggeration that is used to draw the cube.

Zoom Factor — Controls the amount of magnification used to draw the cube.

High side/low side — If High Side is enabled, only data values above the threshold value are highlighted on the surface; if Low Side is enabled, only data values below the threshold value are highlighted.

For more information about High Side/Low Side, refer to the description of the Low keyword for the SHADE_VOLUME procedure.

Threshold Value — Only data values above or below this value are highlighted on the surface, depending on whether High Side or Low Side is enabled.

Apply — Redraw the iso-surface with the specified viewing parameters.

Reset — Return to the default viewing parameters and the initial threshold value.

Histogram — Draw a histogram of surface_data in the iso-surface display area. Viewing this histogram can be useful in determining where to place the threshold value.

Dismiss — Destroy the IsoSurfTool window and erase it from the screen.

Note:

When you click Apply, the graphics you see being redrawn in the iso-surface portion of the display area are being sent to this window via the Z-buffer virtual graphics device. This reduces the time required to redraw the iso-surface by about fourfold. For more information on the Z-buffer graphics device, refer to Output Devices and Window Systems .

Example

Enter the commands shown below into a file, and compile the procedure with the .RUN command. If the variable parent is defined, WgIsoSurfTool is created as a child of parent; otherwise, WgIsoSurfTool runs on its own (i.e., in its own event loop).

When you are finished interacting with the WgIsoSurfTool window, close it by clicking the Dismiss button.

PRO Sample_wgisosurftool, parent, tool_shell
   ; Define a variable to hold the data.
   head = BYTARR(115, 75, 105)
   OPENR, u, !Data_DIR+'man_head.dat',/Get_lun
   ; Read the man_head.dat file that contains three-dimensional
   ; volumetric data.
   READU, u, head
   ; Close the file and free the LUN.
   CLOSE, u
   FREE_LUN, u
   ; Sample the data so fewer data points are passed in to 
   ; WgIsoSurfTool. Doing this improves performance 
   ; significantly, because WgIsoSurfTool has fewer polygons to
   ; process.
   reduced_head = REBIN(head, 23, 15, 21)
   IF N_ELEMENTS(parent) NE 0 THEN BEGIN
      ; Create WgIsoSurfTool as a child of the widget known as
      ; "parent". The window of the newly created widget is
      ; returned via the optional output parameter "tool_shell".
      WgIsoSurfTool, reduced_head, Parent=parent,$
         Shell=tool_shell
   ENDIF ELSE BEGIN
      ; Create WgIsoSurfTool and display it as its own Main
      ; window. In other words, the WgIsoSurfTool window runs on 
      ; its own (i.e., in its own event loop).
      WgIsoSurfTool, reduced_head
   ENDELSE
END

See Also

RENDER, SHADE_VOLUME

For information about drawing iso-surfaces using voxel data, see the PV‑WAVE User Guide. This chapter includes a number of examples showing iso-surfaces that have been drawn using the RENDER function.

For more information about how to write an application program based on PV‑WAVE Widgets or Widget Toolbox, refer to the PV‑WAVE Application Developer’s Guide.