HistogramLUTItem¶
- class pyqtgraph.HistogramLUTItem(image=None, fillHistogram=True, levelMode='mono', gradientPosition='right', orientation='vertical')[source]¶
GraphicsWidgetwith controls for adjusting the display of anImageItem.Includes:
Image histogram
Movable region over the histogram to select black/white levels
Gradient editor to define color lookup table for single-channel images
- Parameters:
image (
pyqtgraph.ImageItem, optional) – If provided, control will be automatically linked to the image and changes to the control will be reflected in the image’s appearance. This may also be set viasetImageItem().fillHistogram (
bool, optional) – By default, the histogram is rendered with a fill. Performance may be improved by disabling the fill. Additional control over the fill is provided byfillHistogram().levelMode (
str, optional) –- ‘mono’ (default)
One histogram with a
LinearRegionItemis displayed to control the black/white levels of the image. This option may be used for color images, in which case the histogram and levels correspond to all channels of the image.- ’rgba’
A histogram and level control pair is provided for each image channel. The alpha channel histogram and level control are only shown if the image contains an alpha channel.
gradientPosition (
str, optional) – Position of the gradient editor relative to the histogram. Must be one of {‘right’, ‘left’, ‘top’, ‘bottom’}. ‘right’ and ‘left’ options should be used with a ‘vertical’ orientation; ‘top’ and ‘bottom’ options are for ‘horizontal’ orientation.orientation (
str, optional) – The orientation of the axis along which the histogram is displayed. Either ‘vertical’ (default) or ‘horizontal’.
- sigLookupTableChanged¶
Emits the HistogramLUTItem itself when the gradient changes
- Type:
QtCore.Signal
- sigLevelsChanged¶
Emits the HistogramLUTItem itself while the movable region is changing
- Type:
QtCore.Signal
- sigLevelChangeFinished¶
Emits the HistogramLUTItem itself when the movable region is finished changing
- Type:
QtCore.Signal
See also
ImageItemHistogramLUTItem is most useful when paired with an ImageItem.
ImageViewWidget containing a paired ImageItem and HistogramLUTItem.
HistogramLUTWidgetQWidget containing a HistogramLUTItem for widget-based layouts.
- __init__(image=None, fillHistogram=True, levelMode='mono', gradientPosition='right', orientation='vertical')[source]¶
- fillHistogram(fill=True, level=0.0, color=(100, 100, 200))[source]¶
Control fill of the histogram curve(s).
- Parameters:
fill (
bool, optional) – Set whether or not the histogram should be filled.level (
float, optional) – Set the fill level. SeePlotCurveItem.setFillLevel. Only used iffillis True.color (
pyqtgraph.mkColor(), optional) – Color to use for the fill when the histogramlevelMode == "mono". SeePlotCurveItem.setBrush.
- 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 X/Y range on the histogram plot, depending on the orientation. This disables auto-scaling.
- setImageItem(img)[source]¶
Set an ImageItem to have its levels and LUT automatically controlled by this HistogramLUTItem.