Smooth 3-D data
W = smooth3( smooths the volumetric data
V and returns the smoothed data in
W is a double array with the same dimensions as
Smooth 3-D Data
mri data set and squeeze the 4-D array stored in the
D variable into three dimensions. Then smooth the data.
load mri D = squeeze(D); W = smooth3(D);
Display the raw data and the smoothed data as an isosurface.
figure tiledlayout(1,2) nexttile p1 = patch(isosurface(D,5),"FaceColor","cyan", ... "EdgeColor","none"); view(3) daspect([1,1,0.4]) camlight isonormals(D,p1) title("Raw Data") nexttile p2 = patch(isosurface(W,5),"FaceColor","cyan", ... "EdgeColor","none"); view(3) daspect([1,1,0.4]) camlight isonormals(W,p2) title("Smoothed Data")
Specify Smoothing Method
Create a 10-by-10-by-10 array of random data. Smooth the data using the
"gaussian" method with a 3-D window size of 5.
data = rand(10,10,10); data = smooth3(data,"gaussian",5);
Display the data as an isosurface with end caps.
patch(isocaps(data,0.5), ... "FaceColor","interp","EdgeColor","none") p1 = patch(isosurface(data,0.5), ... "FaceColor","blue","EdgeColor","none"); isonormals(data,p1) view(3) axis vis3d tight camlight left lighting gouraud
V — Volumetric data
Volumetric data, specified as a 3-D array.
method — Smoothing method
"box" (default) |
Smoothing method, specified as one of these filters:
"box"— Weighted moving average over each window of
"gaussian"— Gaussian-weighted moving average over each window of
The smoothing method determines the convolution kernel.
size — Window size
[3 3 3] (default) | three-element vector of positive odd integers | positive odd integer scalar
Window size of the selected smoothing method, specified as a three-element vector of
positive odd integers or a positive off integer scalar. If
size is interpreted as
The window size determines how much smoothing is applied to the data. As the window size increases, more data points are used for the averaging process, and therefore more smoothing occurs.
When using the
"gaussian" smoothing method, both standard
deviation and window size determine how much smoothing is applied to the data.
sd — Standard deviation
0.65 (default) | numeric value
Standard deviation for the
"gaussian" smoothing method, specified
as a numeric value. As the standard deviation value increases, more averaging is applied
within the filter window.
If the smoothing method is set to
has no effect.
Accelerate code by running on a graphics processing unit (GPU) using Parallel Computing Toolbox™.
Usage notes and limitations:
This function accepts GPU arrays, but does not run on a GPU.
For more information, see Run MATLAB Functions on a GPU (Parallel Computing Toolbox).
Partition large arrays across the combined memory of your cluster using Parallel Computing Toolbox™.
Usage notes and limitations:
This function operates on distributed arrays, but executes in the client MATLAB®.
For more information, see Run MATLAB Functions with Distributed Arrays (Parallel Computing Toolbox).
Introduced before R2006a