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
- imageImageItem 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.
- fillHistogrambool
By default, the histogram is rendered with a fill. For performance, set fillHistogram = False.
- rgbHistogrambool
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]¶ Bases:
GraphicsItem,QtGui.QGraphicsWidgetExtends QGraphicsWidget with several helpful methods and workarounds for PyQt bugs. Most of the extra functionality is inherited from
GraphicsItem.
-
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.
-
paint(self, painter: PySide2.QtGui.QPainter, option: PySide2.QtWidgets.QStyleOptionGraphicsItem, widget: typing.Union[PySide2.QtWidgets.QWidget, NoneType] = None)[source]¶
-
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’.