PyDMImageView¶
-
class
pydm.widgets.image.
PyDMImageView
(parent=None, image_channel=None, width_channel=None)[source]¶ A PyQtGraph ImageView with support for Channels and more from PyDM.
If there is no
channelWidth
it is possible to define the width of the image with thewidth
property.The
normalizeData
property defines if the colors of the images are relative to thecolorMapMin
andcolorMapMax
property or to the minimum and maximum values of the image.Use the
newImageSignal
to hook up to a signal that is emitted when a new image is rendered in the widget.- Parameters
parent (QWidget) – The parent widget for the Label
image_channel (str, optional) – The channel to be used by the widget for the image data.
width_channel (str, optional) – The channel to be used by the widget to receive the image width information
-
class
ReadingOrder
¶ Class to build ReadingOrder ENUM property.
-
autoDownsample
¶ Return if we should or not apply the autoDownsample option to PyQtGraph.
- Returns
- Return type
bool
-
channels
()[source]¶ Return the channels being used for this Widget.
- Returns
channels – List of PyDMChannel objects
- Return type
list
-
colorMap
¶ Return the color map used by the ImageView.
- Returns
- Return type
PyDMColorMap
-
colorMapMax
¶ Maximum value for the colormap.
- Returns
- Return type
float
-
colorMapMin
¶ Minimum value for the colormap.
- Returns
- Return type
float
-
imageChannel
¶ The channel address in use for the image data .
- Returns
Channel address
- Return type
str
-
imageWidth
¶ Return the width of the image.
- Returns
- Return type
int
-
image_connection_state_changed
(conn)[source]¶ Callback invoked when the Image Channel connection state is changed.
- Parameters
conn (bool) – The new connection state.
-
image_value_changed
(new_image)[source]¶ Callback invoked when the Image Channel value is changed.
We try to do as little as possible in this method, because it gets called every time the image channel updates, which might be extremely often. Basically just store the data, and set a flag requesting that the image be redrawn.
- Parameters
new_image (np.ndarray) – The new image data. This can be a flat 1D array, or a 2D array.
-
image_width_changed
(new_width)[source]¶ Callback invoked when the Image Width Channel value is changed.
- Parameters
new_width (int) – The new image width
-
maxRedrawRate
¶ The maximum rate (in Hz) at which the plot will be redrawn.
The plot will not be redrawn if there is not new data to draw.
- Returns
- Return type
int
-
normalizeData
¶ Return True if the colors are relative to data maximum and minimum.
- Returns
- Return type
bool
-
process_image
(image)[source]¶ Boilerplate method to be used by applications in order to add calculations and also modify the image before it is displayed at the widget.
Warning
This code runs in a separated QThread so it MUST not try to write to QWidgets.
- Parameters
image (np.ndarray) – The Image Data as a 2D numpy array
- Returns
The Image Data as a 2D numpy array after processing.
- Return type
np.ndarray
-
readingOrder
¶ Return the reading order of the
imageChannel
array.- Returns
- Return type
-
redrawImage
()[source]¶ Set the image data into the ImageItem, if needed.
If necessary, reshape the image to 2D first.
-
scaleXAxis
¶ Sets the scale for the X Axis.
For example, if your image has 100 pixels per millimeter, you can set xAxisScale to 1/100 = 0.01 to make the X Axis report in millimeter units.
-
scaleYAxis
¶ Sets the scale for the Y Axis.
For example, if your image has 100 pixels per millimeter, you can set yAxisScale to 1/100 = 0.01 to make the Y Axis report in millimeter units.
-
setColorMapLimits
(mn, mx)[source]¶ Set the limit values for the colormap.
- Parameters
mn (int) – The lower limit
mx (int) – The upper limit
-
showAxes
¶ Whether or not axes should be shown on the widget.
Fetch the Widget specific context menu.
It will be populated with additional tools by assemble_tools_menu.
- Returns
If the return of this method is None a new QMenu will be created by assemble_tools_menu.
- Return type
QMenu or None
-
widthChannel
¶ The channel address in use for the image width .
- Returns
Channel address
- Return type
str