code: def loc_vector_labels(x):
      """Identify unique labels from the vector of image labels
  
      x - a vector of one label or dose per image
  
      returns labels, labnum, uniqsortvals
      labels - a vector giving an ordinal per image where that ordinal
               is an index into the vector of unique labels (uniqsortvals)
      labnum - # of unique labels in x
      uniqsortvals - a vector containing the unique labels in x
      """
      #
      # Get the index of each image's label in the sorted array
      #
      order = numpy.lexsort((x,))
      reverse_order = numpy.lexsort((order,))
      #
      # Get a sorted view of the labels
      #
      sorted_x = x[order]
      #
      # Find the elements that start a new run of labels in the sorted array
      # ex: 0,0,0,3,3,3,5,5,5
      #     1,0,0,1,0,0,1,0,0
      #
      # Then cumsum - 1 turns into:
      #     0,0,0,1,1,1,2,2,2
      #
      # and sorted_x[first_occurrence] gives the unique labels in order
      first_occurrence = numpy.ones(len(x), bool)
      first_occurrence[1:] = sorted_x[:-1] != sorted_x[1:]
      sorted_labels = numpy.cumsum(first_occurrence) - 1
      labels = sorted_labels[reverse_order]
      uniqsortvals = sorted_x[first_occurrence]
      return labels, len(uniqsortvals), uniqsortvals
  
imports: import functools
  import os
  import numpy
  import scipy.optimize
  from cellprofiler_core.constants.measurement import EXPERIMENT
  from cellprofiler_core.constants.measurement import IMAGE
  from cellprofiler_core.constants.measurement import NEIGHBORS
  from cellprofiler_core.constants.module import IO_FOLDER_CHOICE_HELP_TEXT, IO_WITH_METADATA_HELP_TEXT
  from cellprofiler_core.measurement import Measurements
  from cellprofiler_core.module import Module
  from cellprofiler_core.preferences import ABSOLUTE_FOLDER_NAME
  from cellprofiler_core.preferences import DEFAULT_INPUT_FOLDER_NAME
  from cellprofiler_core.preferences import DEFAULT_INPUT_SUBFOLDER_NAME
  from cellprofiler_core.preferences import DEFAULT_OUTPUT_FOLDER_NAME
  from cellprofiler_core.preferences import DEFAULT_OUTPUT_SUBFOLDER_NAME
  from cellprofiler_core.setting import Binary
  from cellprofiler_core.setting import Divider
  from cellprofiler_core.setting import Measurement
  from cellprofiler_core.setting import SettingsGroup
  from cellprofiler_core.setting import ValidationError
  from cellprofiler_core.setting.do_something import DoSomething
  from cellprofiler_core.setting.do_something import RemoveSettingButton
  from cellprofiler_core.setting.text import Directory
  from cellprofiler_core.setting.text import Text
label_desc: Use image node_id 4 for calling a global function with example usage: loc_vector_labels(x) and returns: labels,  len,  uniqsortvals