The features described in this topic are obsolete
and should not be used in new IDL code.
SLICER
This routine is obsolete and should not be used in new IDL code.
The IDL SLICER is a widget-based application to show 3D volume slices and isosurfaces. On exit, the Z-buffer contains the most recent image generated by the SLICER. The image may be redisplayed on a different device by reading the Z-buffer contents plus the current color table. Note that the volume data must fit in memory.
Using the SLICER
Data is passed to the SLICER via the common block VOLUME_DATA. Note that the variable used to contain the volume data must be defined as part of the common block before the volume data is read into the variable. (See the Example section, below.)
The SLICER has the following modes:
- Slices: Displays or removes orthogonal or oblique slices through the data volume.
- Block: Displays the surfaces of a selected block inside the volume.
- Cutout: Cuts blocks from previously drawn objects.
- Isosurface: Draws an isosurface contour.
- Probe: Displays the position and value of objects using the mouse.
- Colors: Manipulates the color tables and contrast.
- Rotations: Sets the orientation of the display.
- Journal: Records or plays back files of SLICER commands.
See the SLICER's help file (available by clicking the "Help" button on the SLICER widget) for more information about drawing slices and images.
Syntax
COMMON VOLUME_DATA, A
A = your_volume_data
SLICER
Arguments
A
A 3D array containing volume data. Note that the variable A must be included in the common block VOLUME_DATA before being equated with the volume data. A is not an explicit argument to SLICER.
Keywords
CMD_FILE
Set this keyword to a string that contains the name of a file containing SLICER commands to execute as described under SLICER Commands, below. The file should contain one command per line.
Command files can be created interactively, using the SLICER's "Journal" feature.
COMMAND
Set this keyword equal to a 1 x n string array containing commands to be executed by the SLICER before entering interactive mode. Available commands are described under SLICER Commands, below.
Note that commands passed to the SLICER with the COMMAND keyword must be in a 1 x n array, rather than in an n-element vector. String arrays can be easily specified in the proper format using the TRANSPOSE command. For example, the following passes three commands to the slicer:
DETACHED
Set this keyword to put the drawable in a separate window. This can be useful when working with large images.
GROUP
Set this keyword to the widget ID of the widget that calls SLICER. When GROUP is specified, a command to destroy the calling widget also destroys the SLICER.
NO_BLOCK
Set this keyword equal to zero to have XMANAGER block when this application is registered. By default, NO_BLOCK is set equal to one, providing access to the command line if active command line processing is available. Setting NO_BLOCK=0 will cause all widget applications to block, not just this application. For more information, see the documentation for the NO_BLOCK keyword to XMANAGER.
RANGE
Set this keyword to a two-element array containing minimum and maximum data values of interest. If RANGE is omitted, the data is scanned for the minimum and maximum values.
RESOLUTION
Set this keyword to a two-element vector specifying the width and height of the drawing window. The default is 55% by 44% of the screen width.
SLICER Commands
The slicer accepts a number of commands that replicate the action of controls in the graphical user interface. These commands can be specified at the IDL command line using either CMD_FILE keyword or the COMMAND keyword. Files of SLICER commands can also be created and played back from within the SLICER, using the "Journal" feature.
Commands, in this context, are strings that include a command identifier and (in some cases) one or more numeric parameters separated by blanks. The following are the available SLICER commands, with parameters.
COLOR Table_Index Low High Shading
Set the color tables. Table_Index is the pre-defined color table number (see LOADCT), or -1 to retain the present table. Low is the contrast minimum, High is the contrast maximum, and Shading is the differential shading, all expressed in percent. For example, the following command picks color table number 2, sets the minimum contrast to 10%, the maximum contrast to 90%, and the differential shading to 50%:
CUBE Mode Cut_Ovr Interp X0 Y0 Z0 X1 Y1 Z1
Defines the volume used for "Block" and "Cutout" operations. Set Mode=1 for Block mode or Mode=2 for Cutout mode. Set Cut_Ovr=0 to mimic selecting the "Cut Into" button or Cut_Ovr=1 to mimic selecting the "Cut Over" button.
Note
These buttons have no effect in Block mode. See the online help on SLICER for further explanation of Cut Into and Cut Over.
Set Interp=1 for bilinear interpolation sampling or Interp=0 for nearest neighbor sampling.
X0,Y0,Z0 are the coordinates of the lower corner of the volume, and X1,Y1,Z1 are the coordinates of the upper corner. For example:
selects Block mode, the "Cut Into" button, bilinear interpolation and defines the volume's corners at (20, 0, 56) and (60, 75, 42).
ERASE
Erases the display. Mimics clicking on the "Erase" button.
ISO Threshold Hi_Lo
Draws an iso-surface. Threshold is the isosurface threshold value. Set Hi_Lo equal to 1 to view the low side, or equal to 0 to view the high side.
ORI X_Axis Y_Axis Z_axis X_Rev Y_Rev Z_Rev X_Rot Z_Rot Asp
Sets the orientation for the SLICER display, mimicking the action of the "Orientation" button. Set X_Axis, Y_Axis, and Z_Axis to 0, 1, or 2, where 0 represents the data X axis, 1 the data Y axis, and 2 the data Z axis. Set X_Rev, Y_Rev, and Z_Rev to 0 for normal orientation or to 1 for reversed. Set X_Rot and Z_Rot to the desired rotations of the X and Z axes, in degrees (30 is the default). Set Asp to the desired Z axis aspect ratio with respect to X and Y. For example, to interchange the X and Z axes and reverse the Y use the string:
SLICE Axis Value Interp Expose 0
Draws an orthogonal slice. Set Axis to 0 to draw a slice parallel to the X axis, to 1 for the Y axis, or to 2 for the Z axis. Set Value to the pixel value of the slice. Set Interp=1 for bilinear interpolation sampling or Interp=0 for nearest neighbor sampling. Set Expose=1 to cut out of an existing image (mimicking the "Expose" button) or set Expose=0 to draw the slice on top of the current display (mimicking the "Draw" button). The final zero indicates that the slice is orthogonal rather than oblique. For example, the following command draws an orthogonal slice parallel to the X axis, at the pixel value 31, using bilinear interpolation.
SLICE Azimuth Elev Interp Expose 1 X0 Y0 Z0
Draws an oblique slice. The oblique plane crosses the XY plane at angle Azimuth, with an elevation of Elev. Set Interp=1 for bilinear interpolation sampling or Interp=0 for nearest neighbor sampling. Set Expose=1 to cut out of an existing image (mimicking the "Expose" button) or set Expose=0 to draw the slice on top of the current display (mimicking the "Draw" button). The one indicates that the slice is oblique rather than orthogonal. The plane passes through the point (X0, Y0, Z0). For example, the following command exposes an oblique slice with an azimuth of 42 and an elevation of 24, using bilinear interpolation. The plane passes through the point (52, 57, 39).
TRANS On_Off Threshold
Turns transparency on or off and sets the transparency threshold value. Set On_Off=1 to turn transparency on, On_Off=0 to turn transparency off. Threshold is expressed in percent of data range (0 = minimum data value, 100 = maximum data value). For example, this command turns transparency on and sets the threshold at 20 percent:
UNDO
Undoes the previous operation.
WAIT Secs
Causes the SLICER to pause for the specified time, in seconds.
Example
Data is transferred to the SLICER via the VOLUME_DATA common block instead of as an argument. This technique is used because volume datasets can be very large and the duplication that occurs when passing values as arguments is a waste of memory.
Suppose that you want to read some data from the file head.dat, which is included in the IDL examples directory, into IDL for use in the SLICER. Before you read the data, establish the VOLUME_DATA common block with the following command:
The VOLUME_DATA common block has just one variable in it. (The variable can have any name; here, we're using the name VOL.) Now read the data from the file into VOL. For example:
OPENR, UNIT, /GET, FILEPATH('head.dat', SUBDIRECTORY=['examples',
'data'])
VOL = BYTARR(80, 100, 57, /NOZERO)
READU, UNIT, VOL
CLOSE, UNIT
Now you can run the SLICER widget application by entering:
The data stored in VOL is the data being worked on by the SLICER.
To obtain the image in the slicer window after slicer is finished: