MATLAB Function Reference Previous page   Next Page
slice

Volumetric slice plot

Syntax

Description

slice displays orthogonal slice planes through volumetric data.

slice(V,sx,sy,sz) draws slices along the x, y, z directions in the volume V at the points in the vectors sx, sy, and sz. V is an m-by-n-by-p volume array containing data values at the default location X = 1:n, Y = 1:m, Z = 1:p. Each element in the vectors sx, sy, and sz defines a slice plane in the x-, y-, or z-axis direction.

slice(X,Y,Z,V,sx,sy,sz) draws slices of the volume V. X, Y, and Z are three-dimensional arrays specifying the coordinates for V. X, Y, and Z must be monotonic and orthogonally spaced (as if produced by the function meshgrid). The color at each point is determined by 3-D interpolation into the volume V.

slice(V,XI,YI,ZI) draws data in the volume V for the slices defined by XI, YI, and ZI. XI, YI, and ZI are matrices that define a surface, and the volume is evaluated at the surface points. XI, YI, and ZI must all be the same size.

slice(X,Y,Z,V,XI,YI,ZI) draws slices through the volume V along the surface defined by the arrays XI, YI, ZI.

slice(...,'method') specifies the interpolation method. 'method' is 'linear', 'cubic', or 'nearest'.

slice(axes_handles,...) plots into the axes with handle axes_handle instead of the current axes object (gca).

h = slice(...) returns a vector of handles to surface graphics objects.

Remarks

The color drawn at each point is determined by interpolation into the volume V.

Examples

Visualize the function

over the range -2 x 2, -2 y 2, - 2 z 2:

Slicing At Arbitrary Angles

You can also create slices that are oriented in arbitrary planes. To do this,

For example, these statements slice the volume in the first example with a rotated plane. Placing these commands within a for loop "passes" the plane through the volume along the z-axis.

The following picture illustrates three positions of the same slice surface as it passes through the volume.

Slicing with a Nonplanar Surface

You can slice the volume with any surface. This example probes the volume created in the previous example by passing a spherical slice surface through the volume.

The following picture illustrates three positions of the spherical slice surface as it passes through the volume.

See Also

interp3, meshgrid

Volume Visualization for related functions

Exploring Volumes with Slice Planes for more examples


Previous page  size smooth3 Next page

© 1994-2005 The MathWorks, Inc.