Matlab functions    from  BioméCardio    

 
   evar
hmf   

fspecial3

Create predefined 3-D filters

Contents

Download

fspecial3.m

Syntax

   h = fspecial3(type)
   h = fspecial3(type,size)

Description

f = fspecial3(type,size) creates a 3-dimensional filter h of the specified type and size. Possible values for type are:

The default size is [5 5 5]. If size is a scalar then h is a 3D cubic filter of dimension size^3.

h = fspecial3('average',size) returns an averaging filter h of size size. size can be a 3-element vector specifying the dimensions in h or a scalar, in which case h is a cubic array.

h = fspecial3('ellipsoid',size) returns an ellipsoidal averaging filter.

h = fspecial3('gaussian',size) returns a centered Gaussian lowpass filter of size size with standard deviations defined as size/(4*sqrt(2*log(2))) so that FWHM equals half filter size. Such a FWHM-dependent standard deviation yields a congruous Gaussian shape.

h = fspecial3('laplacian') returns a 3-by-3-by-3 filter approximating the shape of the three-dimensional Laplacian operator. Remark: the shape of the Laplacian cannot be adjusted. An infinite number of 3D Laplacian could be defined. If you know any simple formulation allowing one to control the shape, please contact me.

h = fspecial3('log',size) returns a rotationally symmetric Laplacian of Gaussian filter with standard deviation defined as size/(4*sqrt(2*log(2))).

Class Support: h is of class double.

Note: fspecial3 can be used with imfilter.

Example

This examples uses a 3D Gaussian filter. First create a 3-D flow data and add some noise:

[x,y,z,V] = flow(50);
noisyV = V + 0.1*randn(size(V));

Filter the flow data with a 3D Gaussian filter using fspecial3 and imfilter:

h = fspecial3('gaussian',9);
filteredV = imfilter(noisyV,h);

And display the result:

subplot(121)
hpatch = patch(isosurface(x,y,z,noisyV,0));
isonormals(x,y,z,noisyV,hpatch)
set(hpatch,'FaceColor','red','EdgeColor','none')
daspect([1,4,4]), view([-65,20]), axis tight off
camlight left; lighting phong
title('Noisy data')
subplot(122)
hpatch = patch(isosurface(x,y,z,filteredV,0));
isonormals(x,y,z,filteredV,hpatch)
set(hpatch,'FaceColor','red','EdgeColor','none')
daspect([1,4,4]), view([-65,20]), axis tight off
camlight left; lighting phong
title('Filtered data')

See also

fspecial, medfilt3, imfilter, sffilt

About the author

Damien Garcia, Eng., Ph.D.
Assistant professor, Department of radiology
CRCHUM, University of Montreal Hospital
Montreal, QC, Canada
Damien.Garcia.REMOVE-THIS@BiomeCardio.com

www.biomecardio.com