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.ANTsImageorlist/tupleofANTsImage types) – input image or image list for multivariate segmentationpriors (
list/tupleofANTsImage types) – list of priors that cover the number of classesmask (
ants.core.ANTsImage) – segment inside this maskprior_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.2iterations (
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)