algorithms.segmentation.segmentation

Module: algorithms.segmentation.segmentation

Inheritance diagram for nipy.algorithms.segmentation.segmentation:

Inheritance diagram of nipy.algorithms.segmentation.segmentation

Class

Segmentation

class nipy.algorithms.segmentation.segmentation.Segmentation(data, mask=None, mu=None, sigma=None, ppm=None, prior=None, U=None, ngb_size=26, beta=0.1)

Bases: object

__init__(data, mask=None, mu=None, sigma=None, ppm=None, prior=None, U=None, ngb_size=26, beta=0.1)

Class for multichannel Markov random field image segmentation using the variational EM algorithm. For details regarding the underlying algorithm, 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:
dataarray-like

Input image array

maskarray-like or tuple of array

Input mask to restrict the segmentation

betafloat

Markov regularization parameter

muarray-like

Initial class-specific means

sigmaarray-like

Initial class-specific variances

free_energy(ppm=None)

Compute the free energy defined as:

F(q, theta) = int q(x) log q(x)/p(x,y/theta) dx

associated with input parameters mu, sigma and beta (up to an ignored constant).

log_external_field()

Compute the logarithm of the external field, where the external field is defined as the likelihood times the first-order component of the prior.

map()

Return the maximum a posterior label map

normalized_external_field()
run(niters=10, freeze=())
set_markov_prior(beta, U=None)
ve_step()
vm_step(freeze=())

Functions

nipy.algorithms.segmentation.segmentation.binarize_ppm(q)

Assume input ppm is masked (ndim==2)

nipy.algorithms.segmentation.segmentation.map_from_ppm(ppm, mask=None)
nipy.algorithms.segmentation.segmentation.moment_matching(dat, mu, sigma, glob_mu, glob_sigma)

Moment matching strategy for parameter initialization to feed a segmentation algorithm.

Parameters:
data: array

Image data.

muarray

Template class-specific intensity means

sigmaarray

Template class-specific intensity variances

glob_mufloat

Template global intensity mean

glob_sigmafloat

Template global intensity variance

Returns:
dat_mu: array

Guess of class-specific intensity means

dat_sigma: array

Guess of class-specific intensity variances