class_docstr: **Bases:** :class:`GraphicsObject <pyqtgraph.GraphicsObject>`
  
  GraphicsObject displaying an image with non-uniform sample points. It's
  commonly used to display 2-d or slices of higher dimensional data that
  have a regular but non-uniform grid e.g. measurements or simulation results.
class_docstr_tok: ["*","*","Bases",":","*","*",":","class",":","`","GraphicsObject","<","pyqtgraph.GraphicsObject",">","`","GraphicsObject","displaying","an","image","with","non-uniform","sample","points",".","It's","commonly","used","to","display","2-d","or","slices","of","higher","dimensional","data","that","have","a","regular","but","non-uniform","grid","e.g",".","measurements","or","simulation","results","."]
code: def generatePicture(self):
      x, y, z = self.data
  
      # pad x and y so that we don't need to special-case the edges
      x = np.pad(x, 1, mode="edge")
      y = np.pad(y, 1, mode="edge")
  
      x = (x[:-1] + x[1:]) / 2
      y = (y[:-1] + y[1:]) / 2
  
      X, Y = np.meshgrid(x[:-1], y[:-1], indexing="ij")
      W, H = np.meshgrid(np.diff(x), np.diff(y), indexing="ij")
      Z = z
  
      # get colormap
      if callable(self.lut):
          lut = self.lut(z)
      else:
          lut = self.lut
  
      if lut is None:
          # lut can be None for a few reasons:
          # 1) self.lut(z) can also return None on error
          # 2) if a trivial gradient is being used, HistogramLUTItem calls
          #    setLookupTable(None) as an optimization for ImageItem
          cmap = ColorMap(None, [0.0, 1.0])
          lut = cmap.getLookupTable(nPts=256)
  
      # normalize and quantize
      mn, mx = self.getLevels()
      rng = mx - mn
      if rng == 0:
          rng = 1
      scale = len(lut) / rng
      Z = fn.rescaleData(
          Z, scale, mn, dtype=int, clip=(0, len(lut) - 1)
      )
  
      # replace nans positions with invalid lut index
      invalid_coloridx = len(lut)
      Z[np.isnan(z)] = invalid_coloridx
  
      # pre-allocate to the largest array needed
      color_indices, counts = np.unique(Z, return_counts=True)
      rectarray = Qt.internals.PrimitiveArray(QtCore.QRectF, 4)
      rectarray.resize(counts.max())
  
      # sorted_indices effectively groups together the
      # (flattened) indices of the same coloridx together.
      sorted_indices = np.argsort(Z, axis=None)
      for arr in X, Y, W, H:
          arr.shape = -1  # in-place unravel
  
      self.picture = QtGui.QPicture()
      painter = QtGui.QPainter(self.picture)
      painter.setPen(fn.mkPen(None))
  
      # draw the tiles grouped by coloridx
      offset = 0
      for coloridx, cnt in zip(color_indices, counts):
          if coloridx == invalid_coloridx:
              continue
          indices = sorted_indices[offset : offset + cnt]
          offset += cnt
          rectarray.resize(cnt)
          memory = rectarray.ndarray()
          memory[:, 0] = X[indices]
          memory[:, 1] = Y[indices]
          memory[:, 2] = W[indices]
          memory[:, 3] = H[indices]
  
          brush = fn.mkBrush(lut[coloridx])
          painter.setBrush(brush)
          painter.drawRects(*rectarray.drawargs())
  
      if self.border is not None:
          painter.setPen(self.border)
          painter.setBrush(fn.mkBrush(None))
          painter.drawRect(self.boundingRect())
  
      painter.end()
  
file_path: pyqtgraph/pyqtgraph/graphicsItems/NonUniformImage.py
imports: import warnings
  import numpy
  from ..None import functions
  from ..colormap import ColorMap
  from ..None import Qt
  from ..Qt import QtCore, QtGui
  from .GraphicsObject import GraphicsObject
  from .HistogramLUTItem import HistogramLUTItem
label_desc: Use image node_id 7 for calling the NonUniformImage obj's underlying member method code with example usage: obj.generatePicture() without return types