class_docstr: **Bases:** :class:`GraphicsObject <pyqtgraph.GraphicsObject>`
class_docstr_tok: ["*","*","Bases",":","*","*",":","class",":","`","GraphicsObject","<","pyqtgraph.GraphicsObject",">","`"]
docstr: Returns `x` and `y` arrays containing the histogram values for the current image.
  For an explanation of the return format, see :func:`numpy.histogram()`.
  
  The `step` argument causes pixels to be skipped when computing the histogram to save time.
  If `step` is 'auto', then a step is chosen such that the analyzed data has
  dimensions approximating `targetImageSize` for each axis.
  
  The `bins` argument and any extra keyword arguments are passed to
  :func:`numpy.histogram()`. If `bins` is `auto`, a bin number is automatically
  chosen based on the image characteristics:
  
    * Integer images will have approximately `targetHistogramSize` bins,
      with each bin having an integer width.
    * All other types will have `targetHistogramSize` bins.
  
  If `perChannel` is `True`, then a histogram is computed for each channel, 
  and the output is a list of the results.
docstr_tok: ["Returns","`","x","`","and","`","y","`","arrays","containing","the","histogram","values","for","the","current","image",".","For","an","explanation","of","the","return","format",",","see",":","func",":","`","numpy.histogram","(",")","`",".","The","`","step","`","argument","causes","pixels","to","be","skipped","when","computing","the","histogram","to","save","time",".","If","`","step","`","is","'auto","'",",","then","a","step","is","chosen","such","that","the","analyzed","data","has","dimensions","approximating","`","targetImageSize","`","for","each","axis",".","The","`","bins","`","argument","and","any","extra","keyword","arguments","are","passed","to",":","func",":","`","numpy.histogram","(",")","`",".","If","`","bins","`","is","`","auto","`",",","a","bin","number","is","automatically","chosen","based","on","the","image","characteristics",":","*","Integer","images","will","have","approximately","`","targetHistogramSize","`","bins",",","with","each","bin","having","an","integer","width",".","*","All","other","types","will","have","`","targetHistogramSize","`","bins",".","If","`","perChannel","`","is","`","True","`",",","then","a","histogram","is","computed","for","each","channel",",","and","the","output","is","a","list","of","the","results","."]
code: def getHistogram(
      self,
      bins="auto",
      step="auto",
      perChannel=False,
      targetImageSize=200,
      targetHistogramSize=500,
      **kwds,
  ):
      """
      Returns `x` and `y` arrays containing the histogram values for the current image.
      For an explanation of the return format, see :func:`numpy.histogram()`.
  
      The `step` argument causes pixels to be skipped when computing the histogram to save time.
      If `step` is 'auto', then a step is chosen such that the analyzed data has
      dimensions approximating `targetImageSize` for each axis.
  
      The `bins` argument and any extra keyword arguments are passed to
      :func:`numpy.histogram()`. If `bins` is `auto`, a bin number is automatically
      chosen based on the image characteristics:
  
        * Integer images will have approximately `targetHistogramSize` bins,
          with each bin having an integer width.
        * All other types will have `targetHistogramSize` bins.
  
      If `perChannel` is `True`, then a histogram is computed for each channel,
      and the output is a list of the results.
      """
      # This method is also used when automatically computing levels.
      if self.image is None or self.image.size == 0:
          return None, None
      if step == "auto":
          step = (
              max(
                  1,
                  int(
                      self._xp.ceil(
                          self.image.shape[0] / targetImageSize
                      )
                  ),
              ),
              max(
                  1,
                  int(
                      self._xp.ceil(
                          self.image.shape[1] / targetImageSize
                      )
                  ),
              ),
          )
      if self._xp.isscalar(step):
          step = (step, step)
      stepData = self.image[:: step[0], :: step[1]]
  
      if isinstance(bins, str) and bins == "auto":
          mn = self._xp.nanmin(stepData).item()
          mx = self._xp.nanmax(stepData).item()
          if mx == mn:
              # degenerate image, arange will fail
              mx += 1
          if self._xp.isnan(mn) or self._xp.isnan(mx):
              # the data are all-nan
              return None, None
          if stepData.dtype.kind in "ui":
              # For integer data, we select the bins carefully to avoid aliasing
              step = int(self._xp.ceil((mx - mn) / 500.0))
              bins = []
              if step > 0.0:
                  bins = self._xp.arange(
                      mn, mx + 1.01 * step, step, dtype=int
                  )
          else:
              # for float data, let numpy select the bins.
              bins = self._xp.linspace(mn, mx, 500)
  
          if len(bins) == 0:
              bins = self._xp.asarray((mn, mx))
  
      kwds["bins"] = bins
  
      cp = getCupy()
      if perChannel:
          hist = []
          for i in range(stepData.shape[-1]):
              stepChan = stepData[..., i]
              stepChan = stepChan[self._xp.isfinite(stepChan)]
              h = self._xp.histogram(stepChan, **kwds)
              if cp:
                  hist.append((cp.asnumpy(h[1][:-1]), cp.asnumpy(h[0])))
              else:
                  hist.append((h[1][:-1], h[0]))
          return hist
      else:
          stepData = stepData[self._xp.isfinite(stepData)]
          hist = self._xp.histogram(stepData, **kwds)
          if cp:
              return cp.asnumpy(hist[1][:-1]), cp.asnumpy(hist[0])
          else:
              return hist[1][:-1], hist[0]
  
imports: import warnings
  from collections.abc import Callable
  import numpy
  from ..None import colormap
  from ..None import debug
  from ..None import functions
  from ..None import getConfigOption
  from ..Point import Point
  from ..Qt import QtCore, QtGui, QtWidgets
  from ..util.cupy_helper import getCupy
  from .GraphicsObject import GraphicsObject
label_desc: Use image node_id 35 for calling the ImageItem obj's underlying member method code with example usage: obj.getHistogram(bins, step, perChannel, targetImageSize, targetHistogramSize) and returns: None,  None, hist, None,  None, cp,  cp, hist,  hist