algorithms.kernel_smooth¶
Module: algorithms.kernel_smooth¶
Inheritance diagram for nipy.algorithms.kernel_smooth:

Linear filter(s). For the moment, only a Gaussian smoothing filter
Class¶
LinearFilter¶
-
class
nipy.algorithms.kernel_smooth.LinearFilter(coordmap, shape, fwhm=6.0, scale=1.0, location=0.0, cov=None)¶ Bases:
objectA class to implement some FFT smoothers for Image objects. By default, this does a Gaussian kernel smooth. More choices would be better!
-
__init__(coordmap, shape, fwhm=6.0, scale=1.0, location=0.0, cov=None)¶ Parameters: coordmap :
CoordinateMapshape : sequence
fwhm : float, optional
fwhm for Gaussian kernel, default is 6.0
scale : float, optional
scaling to apply to data after smooth, default 1.0
location : float
offset to apply to data after smooth and scaling, default 0
cov : None or array, optional
Covariance matrix
-
normalization= 'l1sum'¶
-
smooth(inimage, clean=False, is_fft=False)¶ Apply smoothing to inimage
Parameters: inimage :
ImageThe image to be smoothed. Should be 3D.
clean : bool, optional
Should we call
nan_to_numon the data before smoothing?is_fft : bool, optional
Has the data already been fft’d?
Returns: s_image : Image
New image, with smoothing applied
-
Functions¶
-
nipy.algorithms.kernel_smooth.fwhm2sigma(fwhm)¶ Convert a FWHM value to sigma in a Gaussian kernel.
Parameters: fwhm : array-like
FWHM value or values
Returns: sigma : array or float
sigma values corresponding to fwhm values
Examples
>>> sigma = fwhm2sigma(6) >>> sigmae = fwhm2sigma([6, 7, 8]) >>> sigma == sigmae[0] True
-
nipy.algorithms.kernel_smooth.sigma2fwhm(sigma)¶ Convert a sigma in a Gaussian kernel to a FWHM value
Parameters: sigma : array-like
sigma value or values
Returns: fwhm : array or float
fwhm values corresponding to sigma values
Examples
>>> fwhm = sigma2fwhm(3) >>> fwhms = sigma2fwhm([3, 4, 5]) >>> fwhm == fwhms[0] True