Table Of Contents

Previous topic

API

Next topic

algorithms.interpolation

This Page

algorithms.fwhm

Module: algorithms.fwhm

Inheritance diagram for nipy.algorithms.fwhm:

This module provides classes and definitions for using full width at half maximum (FWHM) to be used in conjunction with Gaussian Random Field Theory to determine resolution elements (resels).

A resolution element (resel) is defined as a block of pixels of the same size as the FWHM of the smoothed image.

There are two methods implemented to estimate (3d, or volumewise) FWHM based on a 4d Image:

fastFHWM: used if the entire 4d Image is available iterFWHM: used when 4d Image is being filled in by slices of residuals

Classes

ReselImage

class nipy.algorithms.fwhm.ReselImage(resels=None, fwhm=None, **keywords)

Bases: nipy.algorithms.fwhm.Resels

__init__(resels=None, fwhm=None, **keywords)
Parameters:
resels : core.api.Image

Image of resel per voxel values.

fwhm : core.api.Image

Image of FWHM values.

keywords : dict

Passed as keywords arguments to core.api.Image

Resels

class nipy.algorithms.fwhm.Resels(coordmap, normalized=False, fwhm=None, resels=None, mask=None, clobber=False, D=3)

Bases: object

The Resels class.

__init__(coordmap, normalized=False, fwhm=None, resels=None, mask=None, clobber=False, D=3)
Parameters:
coordmap : CoordinateMap

CoordinateMap over which fwhm and resels are to be estimated. Used in fwhm/resel conversion.

fwhm : Image

Optional Image of FWHM. Used to convert FWHM Image to resels if FWHM is not being estimated.

resels : Image

Optional Image of resels. Used to compute resels within a mask, for instance, if FWHM has already been estimated.

mask : Image

Mask over which to integrate resels.

clobber : bool

Clobber output FWHM and resel images?

D : int

Can be 2 or 3, the dimension of the final volume.

fwhm2resel(fwhm)
Parameters:
fwhm : float

Convert an FWHM value to an equivalent resels per voxel based on step sizes in self.coordmap.

Returns:

resels

integrate(mask=None)
Parameters:
mask : Image

Optional mask over which to integrate (add) resels.

Returns:

(total_resels, FWHM, nvoxel)

total_resels: the resels contained in the mask FWHM: an estimate of FWHM based on the average resel per voxel nvoxel: the number of voxels in the mask

resel2fwhm(resels)
Parameters:
resels : float

Convert a resel value to an equivalent isotropic FWHM based on step sizes in self.coordmap.

Returns:

FWHM

fastFWHM

class nipy.algorithms.fwhm.fastFWHM(resid, **keywords)

Bases: nipy.algorithms.fwhm.Resels

__init__(resid, **keywords)

Given a 4d image of residuals, i.e. not one filled in step by step by an iterator, estimate FWHM and resels.

Parameters:
resid : array

Image of residuals used to estimate FWHM and resels per voxel.

Returns:

None

iterFWHM

class nipy.algorithms.fwhm.iterFWHM(coordmap, normalized=False, df_resid=5.0, mask=None, **keywords)

Bases: nipy.algorithms.fwhm.Resels

Estimate FWHM on an image of residuals sequentially. This is handy when, say, residuals from a linear model are written out slice-by-slice.

Resulting FWHM is clipped at self.FWHMmax, which defaults to 50.

__init__(coordmap, normalized=False, df_resid=5.0, mask=None, **keywords)

Setup a FWHM estimator.

Parameters:
coordmap : CoordinateMap

CoordinateMap over which fwhm and resels are to be estimated. Used in fwhm/resel conversion.

normalized : bool

Are residuals normalized to have length 1? If False, residuals are normalized before estimating FWHM.

df_resid : float

How many degrees of freedom are there in the residuals? Must be greater than self.D + 1.

mask : Image

Optional mask over which to integrate (add) resels.

keywords : dict

Passed as keyword parameters to Resels.__init__

normalize(resid)

Normalize residuals subtracting mean, and fixing length to 1.

Parameters:resid : Array of residuals.
Returns:Normalized residuals.
output()
Returns:None
set_next(resid)

Pass a slice of residuals into slicewise estimate of FWHM.

Parameters:
resid : array

slice of residuals

Returns:

None