ants.segmentation.prior_based_segmentation

prior_based_segmentation(image, priors, mask, priorweight=0.25, mrf=0.1, iterations=25)[source]

Spatial prior-based image segmentation.

Markov random field regularized, prior-based image segmentation that is a wrapper around atropos (see ANTs and related publications).

ANTsR function: priorBasedSegmentation

Parameters:
  • image (ants.core.ANTsImage or list/tuple of ANTsImage types) – input image or image list for multivariate segmentation

  • priors (list/tuple of ANTsImage types) – list of priors that cover the number of classes

  • mask (ants.core.ANTsImage) – segment inside this mask

  • prior_weight (scalar) – usually 0 (priors used for initialization only), 0.25 or 0.5.

  • mrf (scalar) – regularization, higher is smoother, a numerical value in range 0.0 to 0.2

  • iterations (int) – maximum number of iterations. could be a large value eg 25.

Returns:

segmentation: ANTsImage

actually segmented image

probabilityimageslist of ANTsImage types

one image for each segmentation class

Return type:

dictionary with the following key/value pairs

Example

>>> import ants
>>> fi = ants.image_read(ants.get_ants_data('r16'))
>>> seg = ants.kmeans_segmentation(fi,3)
>>> mask = ants.threshold_image(seg['segmentation'], 1, 1e15)
>>> priorseg = ants.prior_based_segmentation(fi, seg['probabilityimages'], mask, 0.25, 0.1, 3)