NIPY logo

Site Navigation

NIPY Community

Table Of Contents

Previous topic

algorithms.routines.fast_distance

Next topic

algorithms.segmentation.vem

This Page

algorithms.segmentation.brain_segmentation

Module: algorithms.segmentation.brain_segmentation

Functions

nipy.algorithms.segmentation.brain_segmentation.brain_segmentation(img, mask_img=None, hard=False, niters=25, labels=('CSF', 'GM', 'WM'), mixmat=None, noise='gauss', beta=0.20000000000000001, freeze_prop=True, scheme='mf', synchronous=False)

Perform tissue classification of a brain MR image into gray matter, white matter and CSF. The image needs be skull-stripped beforehand for the method to work. Currently, it is implicitly assumed that the input image is T1-weighted, but it will be easy to relax this restriction in the future.

For details regarding the underlying method, see:

Roche et al, 2011. On the convergence of EM-like algorithms for image segmentation using Markov random fields. Medical Image Analysis (DOI: 10.1016/j.media.2011.05.002).

Parameters :

img : nipy-like image

MR-T1 image to segment.

mask_img : nipy-like image

Brain mask. If None, the mask will be defined by thresholding the input image above zero (strictly).

beta: float

Markov random field damping parameter.

noise: string

One of ‘gauss’: Gaussian noise assumption or ‘laplace’: Laplace noise assumption.

freeze_prop: boolean

If False, consider relative tissue volume proportions as free parameters. Otherwise, use equal proportions.

hard: boolean

If True, use FSL-FAST hard classification scheme rather than the standard mean-field iteration (not advised).

synchronous: boolean :

Determines whether voxel are updated sequentially or all at once.

scheme: string

One of ‘mf’: mean-field or ‘bp’: (cheap) belief propagation.

labels: sequence of strings

Label names.

Returns :

ppm_img: nipy-like image :

A 4D image representing the posterior probability map of each tissue.

label_img: nipy-like image

Hard tissue classification image similar to a MAP.

nipy.algorithms.segmentation.brain_segmentation.initialize_parameters(data, klasses)

Rough parameter initialization by moment matching with a brainweb image for which accurate parameters are known.

Parameters :

data: array :

Image data.

klasses: int :

Number of desired classes.

Returns :

means: array :

Initial class-specific intensity means

stdevs: array :

Initial class-specific intensity standard deviations

props: array :

Initial class-specific volume proportions