PartSegCore_compiled_backend.fast_unique

Module with fast unique calculation. This implementation is faster than numpy.unique and comparable to pandas.unique(data.ravel())` for data with continuous memory. If data are not continuous memory this function is faster than pandas.unique.

For benchmark please see https://github.com/4DNucleome/PartSegCore-compiled-backend/blob/master/notebooks/performance_label_unique.ipynb

PartSegCore_compiled_backend.fast_unique.label_unique(array, numpy_fallback=False) ndarray

Calculate unique values in array.

Parameters:
  • array (np.ndarray) – array to calculate unique values

  • numpy_fallback (bool) – if True allow using numpy.unique if cython version is not available otherwise raise RuntimeError

Returns:

array of unique values

Return type:

np.ndarray