ants.label.label_clusters

label_clusters(image, min_cluster_size=50, min_thresh=1e-06, max_thresh=1, fully_connected=False)[source]

This will give a unique ID to each connected component 1 through N of size > min_cluster_size

ANTsR function: labelClusters

Parameters:
  • image (ants.core.ANTsImage) – input image e.g. a statistical map

  • min_cluster_size (int) – throw away clusters smaller than this value

  • min_thresh (scalar) – threshold to a statistical map

  • max_thresh (scalar) – threshold to a statistical map

  • fully_connected (bool) – boolean sets neighborhood connectivity pattern

Return type:

ants.core.ANTsImage

Example

>>> import ants
>>> image = ants.image_read( ants.get_ants_data('r16') )
>>> timageFully = ants.label_clusters( image, 10, 128, 150, True )
>>> timageFace = ants.label_clusters( image, 10, 128, 150, False )