code: def convert_dense_to_label_set(dense, indices=None, validate=True):
      """
      Convert a 'dense' matrix into a list of 2-tuples,
      where the number of tuples corresponds to the 'label_idx' dim of the
      'dense' matrix (see '_validate_dense' for details),
      the tuple's first element is a 'labels' matrix
      (see '_validate_labels' for details),
      and the tuple's second element is the 1-d ndarray of labels in the matrix
      (see 'indices_from_dense' for details)
      """
      if validate:
          _validate_dense(dense)
          assert (
              dense.shape[DENSE_AXIS.c.value] == 1
              and dense.shape[DENSE_AXIS.t.value] == 1
          ), f"dense must have shape where f{DENSE_AXIS.c.name} = 1 and f{DENSE_AXIS.t.name} = 1"
  
      if indices is None:
          indices = indices_from_dense(dense, validate=False)
  
      label_set_len = dense.shape[DENSE_AXIS.label_idx.value]
      squeezed_dense = dense.squeeze()
  
      if label_set_len == 1:
          return [(squeezed_dense, indices[0])]
  
      return [
          (squeezed_dense[i], indices[i]) for i in range(label_set_len)
      ]
  
imports: from enum import Enum
  import numpy
  from numpy.random.mtrand import RandomState
  import scipy.sparse
  import centrosome.index
label_desc: Use image node_id 12 for calling a global function with example usage: convert_dense_to_label_set(dense, indices, validate) and returns: unknown, list