This EXTRACT_SLICE function returns a two-dimensional planar slice extracted from 3D volumetric data. The slicing plane can be oriented at any angle and pass through any desired location in the volume.
This routine is written in the IDL language. Its source code can be found in the file
extract_slice.pro
in the
lib
subdirectory of the IDL distribution.
Result = EXTRACT_SLICE( Vol, Xsize, Ysize, Xcenter, Ycenter, Zcenter, Xrot, Yrot, Zrot )
The volume of data to slice. This argument is a three-dimensional array of any type except string or structure. The planar slice returned by EXTRACT_SLICE has the same data type as Vol .
The desired X size (dimension 0) of the returned slice. To preserve the correct aspect ratio of the data, Xsize should equal Ysize. For optimal results, set Xsize and Ysize to be greater than or equal to the largest of the three dimensions of Vol .
The desired Ysize (dimension 1) of the returned slice. To preserve the correct aspect ratio of the data, Ysize should equal Xsize. For optimal results, set Xsize and Ysize to be greater than or equal to the largest of the three dimensions of Vol .
The X coordinate (index) of the point within the volume that the slicing plane passes through. The center of the slicing plane passes through Vol at the coordinate ( Xcenter, YCenter, Zcenter ).
The Y coordinate (index) of the point within the volume that the slicing plane passes through. The center of the slicing plane passes through Vol at the coordinate ( Xcenter, YCenter, Zcenter ).
The Z coordinate (index) of the point within the volume that the slicing plane passes through. The center of the slicing plane passes through Vol at the coordinate ( Xcenter, YCenter, Zcenter ).
Set this keyword to indicate that Xrot, Yrot, and Zrot are in radians. The default is degrees.
Display an oblique slice through volumetric data:
vol = RANDOMU(s, 40, 40, 40) ; Create some data.
FOR i=0, 10 DO vol = SMOOTH(vol, 3) ; Smooth the data.
vol = BYTSCL(vol(3:37, 3:37, 3:37)); Scale the smoothed part into the range of bytes
slice = EXTRACT_SLICE(vol, 40, 40, 17, 17, 17, 30.0, 30.0, 0.0, $
OUT_VAL=0B) ; Extract a slice.
TVSCL, REBIN(slice, 400, 400) ; Display the 2D slice as a magnified image.