ants.segmentation.otsu

Functions

otsu_segmentation(image, k[, mask])

Otsu image segmentation

otsu_segmentation(image, k, mask=None)[source]

Otsu image segmentation

This is a very fast segmentation algorithm good for quick explortation, but does not return probability maps.

ANTsR function: thresholdImage(image, ‘Otsu’, k)

Parameters:
  • image (ants.core.ANTsImage) – input image

  • k (int) – integer number of classes. Note that a background class will be added to this, so the resulting segmentation will have k+1 unique values.

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

Return type:

ants.core.ANTsImage

Example

>>> import ants
>>> mni = ants.image_read(ants.get_data('mni'))
>>> seg = mni.otsu_segmentation(k=3) #0=bg,1=csf,2=gm,3=wm