code: def _remove_empty_labels(labels):
      """Remove empty values label values from labels list.
  
      Returns labels mapped to np.arange(n_unique),
      where n_unique is the number of unique values in labels
      """
      vals = np.unique(labels)
      inverse_vals = -np.ones(labels.max() + 1, dtype=int)
      inverse_vals[vals] = np.arange(len(vals))
      return inverse_vals[labels]
  
file_path: nilearn/nilearn/regions/hierarchical_kmeans_clustering.py
imports: import warnings
  import numpy
  from sklearn.base import BaseEstimator, ClusterMixin, TransformerMixin
  from sklearn.cluster import MiniBatchKMeans
  from sklearn.utils import check_array
  from sklearn.utils.validation import check_is_fitted
label_desc: Use image node_id 1 for calling a global function with example usage: _remove_empty_labels(labels) and returns: inverse_vals