swtloc.utils.unique_value_counts

swtloc.utils.unique_value_counts(image: numpy.ndarray, remove_0: Optional[bool] = True) Dict[source]

Calculate unique integers in an image and their counts

Parameters
  • image (np.ndarray) – Image of which the unique values need to be calculated

  • remove_0 (Optional[bool]) – Whether to remove integer 0 from the calculated dictionary or not.

Returns

Dictionary containing key as unique integer and value as counts

of that integer in the image

Return type

(dict)