7.5.5.2.3. pymodaq_gui.plotting.items.image module
- class pymodaq_gui.plotting.items.image.PymodaqImage(image=None, pen='r', **kargs)[source]
Bases:
ImageItemMethods
get_val_at(xy)- param xy:
- class pymodaq_gui.plotting.items.image.SpreadImageItem(image=None, **kargs)[source]
Bases:
PymodaqImageBases:
GraphicsObjectGraphicsObject displaying an image. Optimized for rapid update (ie video display). This item displays either a 2D numpy array (height, width) or a 3D array (height, width, RGBa). This array is optionally scaled (see
setLevels) and/or colored with a lookup table (seesetLookupTable) before being displayed.ImageItem is frequently used in conjunction with
HistogramLUTItemorHistogramLUTWidgetto provide a GUI for controlling the levels and lookup table used to display the image.Methods
boundingRect(self)Return the transform that maps from this image's input array to its local coordinate system.
getHistogram([bins, step, targetImageSize, ...])Returns x and y arrays containing the histogram values for the current image.
get_points_at([axis, val])get all triangles values whose 'x' value is val or 'y' value is val 1) compute triangle centroids 2) set one of the coordinates as val 3) check if this new point is still in the corresponding triangle 4) if yes add point :param axis: :type axis: (str) either x or y if the set coordinates is x or y :param val: :type val: (float) the value of the x or y axis
get_val_at(xy)- param xy:
paint(self, painter, option[, widget])save(fileName, *args)Save this image to file.
setImage([image, autoLevels])Update the image displayed by this item.
setLookupTable(lut[, update])Sets lookup table
lutto use for false color display of a monochrome image.compute_centroids
getPixmap
height
render
width
- dataTransform()[source]
Return the transform that maps from this image’s input array to its local coordinate system.
This transform corrects for the transposition that occurs when image data is interpreted in row-major order.
- getHistogram(bins='auto', step='auto', targetImageSize=200, targetHistogramSize=500, **kwds)[source]
Returns x and y arrays containing the histogram values for the current image. For an explanation of the return format, see numpy.histogram().
The step argument causes pixels to be skipped when computing the histogram to save time. If step is ‘auto’, then a step is chosen such that the analyzed data has dimensions roughly targetImageSize for each axis.
The bins argument and any extra keyword arguments are passed to np.histogram(). If bins is ‘auto’, then a bin number is automatically chosen based on the image characteristics:
Integer images will have approximately targetHistogramSize bins, with each bin having an integer width.
All other types will have targetHistogramSize bins.
This method is also used when automatically computing levels.
- get_points_at(axis='x', val=0)[source]
get all triangles values whose ‘x’ value is val or ‘y’ value is val 1) compute triangle centroids 2) set one of the coordinates as val 3) check if this new point is still in the corresponding triangle 4) if yes add point :param axis: :type axis: (str) either x or y if the set coordinates is x or y :param val: :type val: (float) the value of the x or y axis
- Returns:
ndarray
- Return type:
barycenter coordinates and triangles data values
- get_val_at(xy)[source]
- Parameters:
xy ((tuple) containing x and y position of the point which you want the value) –
- Returns:
flaot
- Return type:
the mean value of the three points surrounding the point
- paint(self, painter: QPainter | None, option: QStyleOptionGraphicsItem | None, widget: QWidget | None = None)[source]
- save(fileName, *args)[source]
Save this image to file. Note that this saves the visible image (after scale/color changes), not the original data.
- setImage(image=None, autoLevels=None, **kargs)[source]
Update the image displayed by this item. For more information on how the image is processed before displaying, see
makeARGBNotes:
For backward compatibility, image data is assumed to be in column-major order (column, row). However, most image data is stored in row-major order (row, column) and will need to be transposed before calling setImage():
imageitem.setImage(imagedata.T)
This requirement can be changed by calling
image.setOpts(axisOrder='row-major')or by changing theimageAxisOrderglobal configuration option.
- setLookupTable(lut, update=True)[source]
Sets lookup table
lutto use for false color display of a monochrome image. SeemakeARGBfor more information on how this is used. Optionally, lut can be a callable that accepts the current image as an argument and returns the lookup table to use.Ordinarily, this table is supplied by a
HistogramLUTItem,GradientEditorItemorColorBarItem.Setting
update = Falseavoids an immediate image update.
- class pymodaq_gui.plotting.items.image.UniformImageItem(image=None, **kargs)[source]
Bases:
PymodaqImageMethods
get_val_at(xy)- param xy: