algorithms.kernel_smooth

Module: algorithms.kernel_smooth

Inheritance diagram for nipy.algorithms.kernel_smooth:

Inheritance diagram of 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: object

A 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:
coordmapCoordinateMap
shapesequence
fwhmfloat, optional

fwhm for Gaussian kernel, default is 6.0

scalefloat, optional

scaling to apply to data after smooth, default 1.0

locationfloat

offset to apply to data after smooth and scaling, default 0

covNone or array, optional

Covariance matrix

normalization = 'l1sum'
smooth(inimage, clean=False, is_fft=False)

Apply smoothing to inimage

Parameters:
inimageImage

The image to be smoothed. Should be 3D.

cleanbool, optional

Should we call nan_to_num on the data before smoothing?

is_fftbool, optional

Has the data already been fft’d?

Returns:
s_imageImage

New image, with smoothing applied

Functions

nipy.algorithms.kernel_smooth.fwhm2sigma(fwhm)

Convert a FWHM value to sigma in a Gaussian kernel.

Parameters:
fwhmarray-like

FWHM value or values

Returns:
sigmaarray 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:
sigmaarray-like

sigma value or values

Returns:
fwhmarray or float

fwhm values corresponding to sigma values

Examples

>>> fwhm = sigma2fwhm(3)
>>> fwhms = sigma2fwhm([3, 4, 5])
>>> fwhm == fwhms[0]
True