nighres.segmentation.fuzzy_cmeans(image, clusters=3, max_iterations=50, max_difference=0.01, smoothing=0.1, fuzziness=2.0, mask_zero=True, save_data=False, overwrite=False, output_dir=None, file_name=None)[source]

Fuzzy C-means image segmentation

Estimates intensity clusters with spatial smoothness and partial voluming. Based on the RFCM algorithm of (Pham, 2001).

  • image (niimg) – Input image to segment
  • clusters (int) – Number of clusters to estimate (default is 3)
  • max_iterations (int) – Maximum number of iterations to perform (default is 50)
  • max_difference (float) – Maximum difference between steps for stopping (default is 0.01)
  • smoothing (float) – Ratio of spatial smoothness to impose on the clusters (default is 0.1)
  • fuzziness (float) – Scaling of the C-means measure, in [1.0 - 3.0] (default is 2.0)
  • mask_zero (bool) – Whether to ignore zero values (default is true)
  • save_data (bool) – Save output data to file (default is False)
  • overwrite (bool) – Overwrite existing results (default is False)
  • output_dir (str, optional) – Path to desired output directory, will be created if it doesn’t exist
  • file_name (str, optional) – Desired base name for output files with file extension (suffixes will be added)

Dictionary collecting outputs under the following keys (suffix of output files in brackets)

  • memberships [niimg]: List of membership functions for each cluster in [0,1] (_rfcm-mem#cluster)
  • classification (niimg): Hard classification of most likely cluster per voxel (_rfcm-class)

Return type:



Original Java module by Pierre-Louis Bazin.