segmentation_statistics

nighres.statistics.segmentation_statistics(segmentation, intensity=None, template=None, statistics=None, output_csv=None, atlas=None, skip_first=True, ignore_zero=True, save_data=False, overwrite=False, output_dir=None, file_name=None)[source]

Segmentation Statistics

Compute various statistics of image segmentations

Parameters:
  • segmentation (niimg) – Input segmentation image
  • intensity (niimg, optional) – Input intensity image for intensity-based statistics
  • template (niimg, optional) – Input template segmentation for comparisons
  • statistics ([str]) – Statistics to compute. Available options include: “Voxels”, “Volume”, “Center_of_mass”, “Mean_intensity”, “Std_intensity”, “Sum_intensity”, “10_intensity”,”25_intensity”, “50_intensity”, “75_intensity”,”90_intensity”, “Median_intensity”, “IQR_intensity”, “SNR_intensity”,”rSNR_intensity”, “Volumes”, “Dice_overlap”, “Jaccard_overlap”, “Volume_difference”, “False_positives” “False_negatives”, “Dilated_Dice_overlap”,”Dilated_false_positive”, “Dilated_false_negative”, “Dilated_false_negative_volume”, “Dilated_false_positive_volume”, “Center_distance”, “Detected_clusters”, “False_detections”, “Cluster_numbers”, “Mean_cluster_sizes”, “Cluster_maps”, “Average_surface_distance”, “Average_surface_difference”, “Average_squared_surface_distance”, “Hausdorff_distance”
  • output_csv (str) – File name of the statistics file to generate or expand
  • atlas (str, optional) – File name of an atlas file defining the segmentation labels
  • skip_first (bool, optional) – Whether to skip the first segmentation label (usually representing the background, default is True)
  • ignore_zero (bool, optional) – Whether to ignore zero intensity values in the intensity image (default is True)
  • save_data (bool, optional) – Save output data to file (default is False)
  • overwrite (bool, optional) – 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)
Returns:

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

  • csv (str): The csv statistics file
  • map (niimg): Map of the estimated statistic, if relevant (stat-map)

Return type:

dict

Notes

Original Java module by Pierre-Louis Bazin.