Previous IDL Demo Library Next

Slicer

The Slicer program is a widget based application to visualize 3D data. For details on the calling sequence of the SLICER3 program see the entry in the Reference Manual.

Menu Options

File Menu

Load

Select a file containing a 3D array (or arrays) to load into Slicer3. The file must have been written in a certain binary format. For each data array in the file, the following values are present:

Table 5-1: Slicer Load 

Table 5-1: Slicer Load 
data item
data type
bytes
Number of dimensions in array.
long
4
Note that this is always 3 for valid Slicer3 data.
Size of first dimension.
long
4
Size of second dimension.
long
4
Size of third dimension.
long
4
If multiple arrays are present in the file, they must all have the same dimensions.
Data type (1 through 5)
long
4
(see the IDL "SIZE" function for types).
Total number of elements.
long
4
(dimX*dimY*dimZ).
Note that the all of the above values are the exact output of the IDL "SIZE" function.
Number of characters in data name.
long
4
Note that the above value is the output from the IDL "STRLEN" function.
Data name.
byte
strlen()
3D data.
varies
varies
Note that the 3D data type and number of bytes is specified by the "size" information above.

Any number of 3D datasets can be concatenated into a single file of this type (as long as they all have the same dimensions).

(See EXAMPLE, below.)

NOTE: Files saved by the "Save Subset" operation (see below) are suitable for input via the "Load" operation.

Data files that are moved from one platform to another may not load as expected, due to differing byte order. See the "BYTEORDER" and "SWAP_ENDIAN" IDL commands for details.

Save / Save Subset

Slicer3 must be in "Block" mode for this operation to be available. When selected, a subset of the 3D data enclosed in the current block is written to the chosen save file. This subset can then be loaded back into Slicer3 at any time. If multiple 3D arrays are currently available in Slicer3, then multiple subsets are saved to the file.

Save / Save Tiff Image

When selected, a tiff image of the current Slicer3 contents is saved to the chosen file. When running in 8-bit mode, a "Class P" palette color Tiff file is created. In 24-bit mode, a "Class R" (interleaved by image) Tiff file is created.

Quit

Exits Slicer3.

Tools Menu

Erase

Erases the display window and deletes all the objects in the display list.

Delete / ...

As graphical objects are created, they are added to the display list. The "Delete" menu allows the user to delete a specific object from the list. When an object is deleted, the screen is redrawn with the remaining objects.

Colors / Reset Colors

Selecting this will cause the original color scheme to be restored.

Colors / Differential Shading

This allows the user to change the percentage of differential shading applied to the X, Y, and Z slices.

Colors / Slice/Block

This allows the user to use the "XLOADCT" operation to modify the colors used for slices and blocks. In some cases, the new colors will not be visible until the user selects "Done" in the XLOADCT tool.

Colors / Surface

This allows the user to use the "XLOADCT" operation to modify the colors used for iso-surfaces.

Colors / Projection

This allows the user to use the "XLOADCT" operation to modify the colors used for projections. Note that on some platforms, the selected colors may not become visible until after the XLOADCT tool is exited.

Options

This brings up a panel allowing the user to set:

The X and Y dimensions are always the same. If the user selects "Ok", then the display is redrawn.

Help Menu

About Slicer

Brings up help information about Slicer3.

Data pull-down Menu

If multiple datasets are currently available in Slicer3, this menu allows the selection of the current data. Slices, blocks, iso-surfaces, etc. are created from the currently selected data. If only one dataset is currently loaded, then this menu is inactive.

Mode pull-down Menu

This menu is used to select the current mode of operation.

Main Draw Window

Interaction in the main draw window is dependent upon the currently selected mode ("Slice", "Block", "Surface", etc., see below). In general, when coordinate input is required from the user, it is performed by clicking a mouse button on the "surface" of the wire-frame cube that surrounds the data. This 3D location is then used as the basis for whatever input is needed. In most cases, the "front" side of the cube is used. In a few cases, the coordinate input is on the "back" side of the cube.

Slice mode

To display a slice, click and drag the left mouse button on the wire-frame cube. When the button is released, a slice through the data will be drawn at that location.

Draw mode

When in Draw mode, new slices will be merged into the current Z-buffer contents.

Expose mode

When in Expose mode, new slices will be drawn in front of everything else.

Orthogonal mode

When in Orthogonal mode, use the left mouse button in the big window to position and draw an orthogonal slicing plane. Clicking the right mouse button in the big window (or any mouse button in the small window) will toggle the slicing plane orientation.

Oblique mode

Clicking any mouse button in the small window will reset the oblique slicing plane to its default orientation.

Normal mode

When in this mode, click and drag the left mouse button in the big window to set the surface normal for the oblique slicing plane.

Center mode

When in this mode, click and drag the left mouse button in the big window to set the center point for the surface normal.

Display

Clicking this button will cause an oblique slicing plane to be drawn.

Block mode

When in Block mode, use the left mouse button in the big window to set the location for the "purple" corner of the block. Use the right mouse button to locate the opposite "blue" corner of the block.

When in Block mode, the "Save Subset" operation under the main "File" menu is available.

Add mode

When in this mode, the block will be "added" to the current Z-buffer contents.

Subtract mode

When in this mode, the block will be "subtracted" from the current Z-buffer contents. Subtract mode is only effective when the block intersects some other object in the display (such as an iso-surface).

Display

Clicking this button will cause the block to be drawn.

Surface mode

In iso-surface is like a contour line on a contour map. On one side of the line, the elevation is higher than the contour level, and on the other side of the line, the elevation is lower than the contour level. An iso-surface, however, is a 3D surface that passes through the data such that the data values on one side of the surface are higher than the threshold value, and on the other side of the surface, the data values are lower than the threshold value.

When in Surface mode, a logarithmic histogram plot of the data is displayed in the small draw window. Click and drag a mouse button on this plot to set the iso-surface threshold value. This value is also shown in the text widget below the plot. The threshold value may also be set by typing a new value in this text widget. The histogram plot is affected by the current threshold settings. (See Threshold mode, below).

Low

Selecting this mode will cause the iso-surface polygon facing to face towards the lower data values. Usually, this is the mode to use when the iso-surface is desired to surround high data values.

High

Selecting this mode will cause the iso-surface polygon facing to face towards the higher data values. Usually, this is the mode to use when the iso-surface is desired to surround low data values.

Shading pull-down Menu

Iso-surfaces are normally rendered with light-source shading. If multiple datasets are currently loaded, then this menu allows the selection of a different 3D array for the source of the iso-surface shading values. If only one dataset is currently loaded, then this menu is inactive.

Display

Clicking this button will cause the iso-surface to be created and drawn. Iso-surfaces often consist of tens of thousands of polygons, and can sometimes take considerable time to create and render.

Projection mode

A "voxel" projection of a 3D array is the projection of the data values within that array onto a viewing plane. This is similar to taking an X-ray image of a 3D object.

Max mode

Select this mode for a Maximum intensity projection.

Avg mode

Select this mode for an Average intensity projection.

Low mode

Select this mode for a Low resolution projection.

Med mode

Select this mode for a Medium resolution projection.

High mode

Select this mode for a High resolution projection.

Depth Queue %

Use the slider to set the depth queue percent. A value of 50, for example, indicates that the farthest part of the projection will be 50% as bright as the closest part of the projection.

Display

Clicking this button will cause the projection to be calculated and drawn. Projections can sometimes take considerable time to display. Higher resolution projections take more computation time.

Threshold mode

When in Threshold mode, a logarithmic histogram plot of the data is displayed in the small draw window. Click and drag the left mouse button on this plot to set the minimum and maximum threshold values. To expand a narrow range of data values into the full range of available colors, set the threshold range before displaying slices, blocks, or projections. The threshold settings also affect the histogram plot in "Surface" mode. The minimum and maximum threshold values are also shown in the text widgets below the histogram plot.

Click and drag the right mouse button on the histogram plot to set the transparency threshold. Portions of any slice, block, or projection that are less than the transparency value are not drawn (clear). Iso-surfaces are not affected by the transparency threshold. The transparency threshold value is also shown in a text widget below the histogram plot.

Min

In this text widget, a minimum threshold value can be entered.

Max

In this text widget, a maximum threshold value can be entered.

Transp.

In this text widget, a transparency threshold value can be entered.

Profile mode

In Profile mode, a plot is displayed showing the data values along a line. This line is also shown superimposed on the data in the main draw window. The bottom of the plot corresponds to the "purple" end of the line, and the top of the plot corresponds to the "blue" end of the line.

Orthogonal mode

Click and drag the left mouse button to position the profile line, based upon a point on the "front" faces of the wire-frame cube. Click and drag the right mouse button to position the profile line, based upon a point on the "back" faces of the wire-frame cube. As the profile line is moved, The profile plot is dynamically updated.

Oblique mode

Click and drag the left mouse button to position the "purple" end of the profile line on one of the "front" faces of the wire-frame cube. Click and drag the right mouse button to position the "blue" end of the profile line on one of the "back" faces of the wire-frame cube. As the profile line is moved, The profile plot is dynamically updated.

Probe mode

In Probe mode, click and drag a mouse button over an object in the main draw window. The actual X-Y-Z location within the data volume is displayed in the three text widgets. Also, the data value at that 3D location is displayed in the status window, above the main draw window. If the cursor is inside the wire-frame cube, but not on any object, then the status window displays "No data value", and the three text widgets are empty. If the cursor is outside the wire-frame cube, then the status window and text widgets are empty.

X

Use this text widget to enter the X coordinate for the probe.

Y

Use this text widget to enter the Y coordinate for the probe.

Z

Use this text widget to enter the Z coordinate for the probe.

View mode

In view mode, a small window shows the orientation of the data cube in the current view. As view parameters are changed, this window is dynamically updated. The main draw window is then updated when the user clicks on "Display", or exits View mode.

Display

Clicking on this button will cause the objects in the main view window to be drawn in the new view. If any view parameters have been changed since the last time the main view was updated, the main view will be automatically redrawn when the user exits View mode.

1st Rotation

Use this slider to set the angle of the first view rotation (in degrees). The droplist widget adjacent to the slider indicates which axis this rotation is about.

2nd Rotation

Use this slider to set the angle of the second view rotation (in degrees). The droplist widget adjacent to the slider indicates which axis this rotation is about.

Zoom %

Use this slider to set the zoom factor percent. Depending upon the view rotations, Slicer3 may override this setting to ensure that all eight corners of the data cube are within the window.

Z %

Use this slider to set a scale factor for the Z axis (to compensate for the data's aspect ratio).

Examples

Example 1

Create a data save file suitable for dynamic loading into Slicer3.

; Store some 3D data in a variable called "data_1".  
data_1 = INDGEN(20,30,40)  
  
; Store some 3D data in a variable called "data_2".  
data_2 = FINDGEN(20,30,40)  
  
; Define the names for the datasets (their names will  
; appear in the "Data:" pull-down menu in Slicer3.  
  
data_1_name = `Test Data 1'  
data_2_name = `Data 2'  
  
; Select a data file name.  
dataFile = PICKFILE()  
  
; Write the file.  
  
GET_LUN, lun  
OPENW, lun, dataFile  
  
WRITEU, lun, SIZE(data_1)  
WRITEU, lun, STRLEN(data_1_name)  
WRITEU, lun, BYTE(data_1_name)  
WRITEU, lun, data_1  
  
WRITEU, lun, SIZE(data_2)  
WRITEU, lun, STRLEN(data_2_name)  
WRITEU, lun, BYTE(data_2_name)  
WRITEU, lun, data_2  
  
CLOSE, lun  
FREE_LUN, lun  

Example 2

Run Slicer3 with data passed to it at startup.

; Create some 3D data.  
data = INDGEN(20,30,40)  
  
; Create a pointer to the data, and use the "/NO_COPY"  
; keyword to save memory.  
h_data = PTR_NEW(data, /NO_COPY)  
  
; Start up Slicer3.  
SLICER3, h_data, /MODAL  
  
; If the user did not interactively load any data into  
; Slicer3 (via the "File/Load" menu), then the original  
; pointer to the data still exists (and the original data  
; will still reside in memory). To free it, use:  
  
if PTR_VALID(h_data) then PTR_FREE, h_data  
  
; If the pointer is no longer valid, then that indicates  
; that the user interactively loaded data into Slicer3.  
; Any data that is loaded interactively is automatically  
; deleted when the user exits Slicer3.  
  
; Note that the last contents of the main view window in  
; Slicer3 still resides in the Z-buffer. To access this  
; image after exiting Slicer3, perform the following actions:  
  
current_device = !D.Name  
SET_PLOT, `Z'  
image_buffer = TVRD()  
depth_buffer = TVRD(CHANNEL=1, /WORDS)  
SET_PLOT, current_device  
TV, image_buffer  

Note that the image contained in "image_buffer" will look "correct" only if the colors loaded by Slicer3 have not been changed since the user exited Slicer3.

  IDL Demo Online Help (October 11, 2006)