HistogramLUTItem#
- class pyqtgraph.HistogramLUTItem(
- image=None,
- fillHistogram=True,
- levelMode='mono',
- gradientPosition='right',
- orientation='vertical',
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’.
- Variables:
sigLookupTableChanged (
QtCore.Signal) – Emits the HistogramLUTItem itself when the gradient changessigLevelsChanged (
QtCore.Signal) – Emits the HistogramLUTItem itself while the movable region is changingsigLevelChangeFinished (
QtCore.Signal) – Emits the HistogramLUTItem itself when the movable region is finished changing
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',
- fillHistogram(
- fill=True,
- level=0.0,
- color=(100, 100, 200),
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 (
color_like, 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,
Return a lookup table from the color gradient defined by this HistogramLUTItem.
- setHistogramRange(
- mn,
- mx,
- padding=0.1,
Set the X/Y range on the histogram plot, depending on the orientation. This disables auto-scaling.
- setImageItem(
- img,
Set an ImageItem to have its levels and LUT automatically controlled by this HistogramLUTItem.