algorithms.segmentation.segmentation

Module: algorithms.segmentation.segmentation

Inheritance diagram for nipy.algorithms.segmentation.segmentation:

digraph inheritance3b6d38802f { rankdir=LR; size="8.0, 12.0"; "segmentation.segmentation.Segmentation" [URL="#nipy.algorithms.segmentation.segmentation.Segmentation",fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.25,shape=box,style="setlinewidth(0.5)",target="_top"]; }

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)[source]

Bases: object

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

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

data : array-like

Input image array

mask : array-like or tuple of array

Input mask to restrict the segmentation

beta : float

Markov regularization parameter

mu : array-like

Initial class-specific means

sigma : array-like

Initial class-specific variances

set_markov_prior(beta, U=None)[source]
vm_step(freeze=())[source]
log_external_field()[source]

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

normalized_external_field()[source]
ve_step()[source]
run(niters=10, freeze=())[source]
map()[source]

Return the maximum a posterior label map

free_energy(ppm=None)[source]

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).

Functions

nipy.algorithms.segmentation.segmentation.binarize_ppm(q)[source]

Assume input ppm is masked (ndim==2)

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

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

Parameters

data: array

Image data.

mu : array

Template class-specific intensity means

sigma : array

Template class-specific intensity variances

glob_mu : float

Template global intensity mean

glob_sigma : float

Template global intensity variance

Returns

dat_mu: array

Guess of class-specific intensity means

dat_sigma: array

Guess of class-specific intensity variances