HistogramLUTItem

class pyqtgraph.HistogramLUTItem(image=None, fillHistogram=True, rgbHistogram=False, levelMode='mono')[source]

This is a graphicsWidget which provides controls for adjusting the display of an image.

Includes:

  • Image histogram
  • Movable region over histogram to select black/white levels
  • Gradient editor to define color lookup table for single-channel images
image
: ImageItem or None
If image is provided, then the control will be automatically linked to the image and changes to the control will be immediately reflected in the image’s appearance.
fillHistogram
: bool
By default, the histogram is rendered with a fill. For performance, set fillHistogram = False.
rgbHistogram
: bool
Sets whether the histogram is computed once over all channels of the image, or once per channel.
levelMode
: ‘mono’ or ‘rgba’
If ‘mono’, then only a single set of black/whilte level lines is drawn, and the levels apply to all channels in the image. If ‘rgba’, then one set of levels is drawn for each channel.
__init__(image=None, fillHistogram=True, rgbHistogram=False, levelMode='mono')[source]
autoHistogramRange()[source]

Enable auto-scaling on the histogram plot.

getLevels()[source]

Return the min and max levels.

For rgba mode, this returns a list of the levels for each channel.

getLookupTable(img=None, n=None, alpha=None)[source]

Return a lookup table from the color gradient defined by this HistogramLUTItem.

setHistogramRange(mn, mx, padding=0.1)[source]

Set the Y range on the histogram plot. This disables auto-scaling.

setImageItem(img)[source]

Set an ImageItem to have its levels and LUT automatically controlled by this HistogramLUTItem.

setLevelMode(mode)[source]

Set the method of controlling the image levels offered to the user. Options are ‘mono’ or ‘rgba’.

setLevels(min=None, max=None, rgba=None)[source]

Set the min/max (bright and dark) levels.

Arguments may be min and max for single-channel data, or rgba = [(rmin, rmax), ...] for multi-channel data.