ants.math.get_centroids

get_centroids(image, clustparam=0)[source]

Reduces a variate/statistical/network image to a set of centroids describing the center of each stand-alone non-zero component in the image

ANTsR function: getCentroids

Parameters:
  • image (ants.core.ANTsImage) – image from which centroids will be calculated

  • clustparam (int) – look at regions greater than or equal to this size

Return type:

numpy.ndarray

Example

>>> import ants
>>> image = ants.image_read( ants.get_ants_data( "r16" ) )
>>> image = ants.threshold_image( image, 90, 120 )
>>> image = ants.label_clusters( image, 10 )
>>> cents = ants.get_centroids( image )