reducevolume
Keeps every n-th sample of 3-D volume data along each direction.
Category: Graphics > 2-D and 3-D Plots
Syntax
Vr = reducevolume(V, R)
Keeps every R-th element along each of the three dimensions.
Vr = reducevolume(V, [Rx Ry Rz])
Uses a different step for each dimension.
[Xr, Yr, Zr, Vr] = reducevolume(X, Y, Z, V, R)
Also reduces the coordinate arrays.
Description
The operation picks the elements 1:R:end along each direction, so a step of 2 leaves about one eighth of the data. It speeds up slices, isosurfaces and other volume plots of big arrays. Note that the x direction corresponds to the second array dimension, as in meshgrid, so [Rx Ry Rz] is applied to dimensions 2, 1 and 3.
Input arguments
V- 3-D array of volume data.
R- Step: scalar, or three values
[Rx Ry Rz]for the x, y and z directions.
Output arguments
Vr- Reduced volume.
Example
Subsample a volume
V = reshape(1:64, 4, 4, 4);
size(reducevolume(V, 2))
size(reducevolume(V, [2 2 1]))
Output
ans = 1×3
2 2 2
ans = 1×3
2 2 4