ants.label.label_stats

label_stats(image, label_image)[source]

Get label statistics from an image. The labels must be representable as uint32.

ANTsR function: labelStats

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

  • label_image (ants.core.ANTsImage) – Label image

Return type:

pandas.DataFrame

Example

>>> import ants
>>> image = ants.image_read( ants.get_ants_data('r16') , 2 )
>>> image = ants.resample_image( image, (64,64), 1, 0 )
>>> mask = ants.get_mask(image)
>>> segs1 = ants.kmeans_segmentation( image, 3 )
>>> stats = ants.label_stats(image, segs1['segmentation'])