ImageView

class pyqtgraph.ImageView(parent=None, name='ImageView', view=None, imageItem=None, *args)

Widget used for display and analysis of image data. Implements many features:

  • Displays 2D and 3D image data. For 3D data, a z-axis slider is displayed allowing the user to select which frame is displayed.

  • Displays histogram of image data with movable region defining the dark/light levels

  • Editable gradient provides a color lookup table

  • Frame slider may also be moved using left/right arrow keys as well as pgup, pgdn, home, and end.

  • Basic analysis features including:

    • ROI and embedded plot for measuring image values across frames
    • Image normalization / background subtraction

Basic Usage:

imv = pg.ImageView()
imv.show()
imv.setImage(data)
__init__(parent=None, name='ImageView', view=None, imageItem=None, *args)

By default, this class creates an ImageItem to display image data and a ViewBox to contain the ImageItem. Custom items may be given instead by specifying the view and/or imageItem arguments.

autoLevels()

Set the min/max levels automatically to match the image data.

autoRange()

Auto scale and pan the view around the image.

close()

Closes the widget nicely, making sure to clear the graphics scene and release memory.

getHistogramWidget()

Return the HistogramLUTWidget for this ImageView

getImageItem()

Return the ImageItem for this ImageView.

getProcessedImage()

Returns the image data after it has been processed by any normalization options in use.

getRoiPlot()

Return the ROI PlotWidget for this ImageView

getView()

Return the ViewBox (or other compatible object) which displays the ImageItem

jumpFrames(n)

Move video frame ahead n frames (may be negative)

play(rate)

Begin automatically stepping frames forward at the given rate (in fps). This can also be accessed by pressing the spacebar.

setCurrentIndex(ind)

Set the currently displayed frame index.

setImage(img, autoRange=True, autoLevels=True, levels=None, axes=None, xvals=None, pos=None, scale=None, transform=None)

Set the image to be displayed in the widget.

Arguments:  
img (numpy array) the image to be displayed.
xvals (numpy array) 1D array of z-axis values corresponding to the third axis in a 3D image. For video, this array should contain the time of each frame.
autoRange (bool) whether to scale/pan the view to fit the image.
autoLevels (bool) whether to update the white/black levels to fit the image.
levels (min, max); the white and black level values to use.
axes

Dictionary indicating the interpretation for each axis. This is only needed to override the default guess. Format is:

{'t':0, 'x':1, 'y':2, 'c':3};
pos Change the position of the displayed image
scale Change the scale of the displayed image
transform Set the transform of the dispalyed image. This option overrides pos and scale.
setLevels(min, max)

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

Previous topic

PlotWidget

Next topic

dockarea module

This Page