ants.segmentation.kmeans
Functions
|
K-means image segmentation that is a wrapper around ants.atropos |
- kmeans_segmentation(image, k, kmask=None, mrf=0.1)[source]
K-means image segmentation that is a wrapper around ants.atropos
ANTsR function: kmeansSegmentation
- Parameters:
image (
ants.core.ANTsImage) – input imagek (
int) – integer number of classeskmask (
ANTsImage (optional)) – segment inside this maskmrf (
scalar) – smoothness, higher is smoother
- Return type:
ants.core.ANTsImage
Example
>>> import ants >>> fi = ants.image_read(ants.get_ants_data('r16'), 'float') >>> fi = ants.n3_bias_field_correction(fi, 2) >>> seg = ants.kmeans_segmentation(fi, 3)