code: def segmentFromValues(values, offset=0):
      """ """
  
      seg = [offset, -1, values[0]]
      segList = []
      for i, v in enumerate(values):
          if not (v == seg[2]):
              seg[1] = i + offset - 1
              segList.append(tuple(seg))
              seg = [i + offset, -1, v]
  
      seg[1] = i + offset
      segList.append(tuple(seg))
  
      return segList
  
imports: import numpy
label_desc: Use image node_id 2 for calling a global function with example usage: segmentFromValues(values, offset) and returns: segList