code: def wrap(self, value):
          
          attrib = getattr(value, 'attrib', {})
  
          S, NS = divmod(time.time(), 1.0)
          value = numpy.asarray(value) # loses any special/augmented attributes
          dims = list(value.shape)
          dims.reverse() # inner-most sent as left
  
          if 'ColorMode' not in attrib:
              # attempt to infer color mode from shape
              if value.ndim==2:
                  attrib['ColorMode'] = 0 # gray
  
              elif value.ndim==3:
                  for idx,dim in enumerate(dims):
                      if dim==3: # assume it's a color
                          attrib['ColorMode'] = 2 + idx  # 2 - RGB1, 3 - RGB2, 4 - RGB3
                          break # assume that the first is color, and any subsequent dim=3 is a thin ROI
  
          dataSize = value.nbytes
  
          return Value(self.type, {
              'value': (self._code2u[value.dtype.char], value.flatten()),
              'compressedSize': dataSize,
              'uncompressedSize': dataSize,
              'uniqueId': 0,
              'timeStamp': {
                  'secondsPastEpoch': S,
                  'nanoseconds': NS * 1e9,
              },
              'attribute': [{'name': K, 'value': V} for K, V in attrib.items()],
              'dimension': [{'size': N,
                             'offset': 0,
                             'fullSize': N,
                             'binning': 1,
                             'reverse': False} for N in dims],
          })
docs: Wrap numpy.ndarray as Value