8.5.5.2.3. pymodaq_gui.plotting.items.image module

class pymodaq_gui.plotting.items.image.PymodaqImage(image=None, pen='r', **kargs)[source]

Bases: ImageItem

Methods

get_val_at(xy)

get_val_at(xy)[source]
Parameters:

xy ((tuple) containing x and y position of the point which you want the value)

Returns:

float

Return type:

the value at the given position in the image

class pymodaq_gui.plotting.items.image.SpreadImageItem(image=None, **kargs)[source]

Bases: PymodaqImage

Bases: GraphicsObject

GraphicsObject 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 (see setLookupTable) before being displayed.

ImageItem is frequently used in conjunction with HistogramLUTItem or HistogramLUTWidget to provide a GUI for controlling the levels and lookup table used to display the image.

Methods

boundingRect()

dataTransform()

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 :type axis: (str) either x or y if the set coordinates is x or y :param axis: :type axis: (str) either x or y if the set coordinates is x or y :type val: (float) the value of the x or y axis :param val: :type val: (float) the value of the x or y axis

get_val_at(xy)

paint(self, painter, option[, widget])

save(fileName, *args)

Save this image to file.

setImage([image, autoLevels, levels_sym])

Update the image displayed by this item.

setLookupTable(lut[, update])

compute_centroids

getPixmap

height

render

width

boundingRect()[source]
compute_centroids()[source]
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.

getPixmap()[source]
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 :type axis: (str) either x or y if the set coordinates is x or y :param axis: :type axis: (str) either x or y if the set coordinates is x or y :type val: (float) the value of the x or y axis :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

height()[source]
paint(self, painter: QPainter | None, option: QStyleOptionGraphicsItem | None, widget: QWidget | None = None)[source]
render()[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, levels_sym=False, **kargs)[source]

Update the image displayed by this item. For more information on how the image is processed before displaying, see makeARGB

Notes:

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 the imageAxisOrder global configuration option.

setLookupTable(lut, update=True)[source]
width()[source]
class pymodaq_gui.plotting.items.image.UniformImageItem(image=None, **kargs)[source]

Bases: PymodaqImage

Methods

get_val_at(xy)

setImage([image, autoLevels, levels_sym])

Updates the image displayed by this ImageItem.

get_val_at(xy)[source]
Parameters:

xy ((tuple) containing x and y position of the point which you want the value)

Returns:

float

Return type:

the value at the given position in the image

setImage(image=None, autoLevels=None, levels_sym=False, **kargs)[source]

Updates the image displayed by this ImageItem. For more information on how the image is processed before displaying, see makeARGB().

For backward compatibility, image data is assumed to be in column-major order (column, row) by default. However, most data is stored in row-major order (row, column). It can either be transposed before assignment:

imageitem.setImage(imagedata.T)

or the interpretation of the data can be changed locally through the axisOrder keyword or by changing the imageAxisOrder global configuration option

All keywords supported by setOpts() are also allowed here.

Parameters:
  • image (numpy.ndarray, optional) – Image data given as NumPy array with an integer or floating point dtype of any bit depth. A 2-dimensional array describes single-valued (monochromatic) data. A 3-dimensional array is used to give individual color components. The third dimension must be of length 3 (RGB) or 4 (RGBA).

  • rect (QRectF or QRect or array_like, optional) – If given, sets translation and scaling to display the image within the specified rectangle. If array_like should be the form of floats [x, y, w, h] See setRect()

  • autoLevels (bool, optional) –

    If True, ImageItem will automatically select levels based on the maximum and minimum values encountered in the data. For performance reasons, this search subsamples the images and may miss individual bright or or dark points in the data set.

    If False, the search will be omitted.

    The default is False if a levels keyword argument is given, and True otherwise.

  • levelSamples (int, default 65536) – When determining minimum and maximum values, ImageItem only inspects a subset of pixels no larger than this number. Setting this larger than the total number of pixels considers all values.

  • levels_sym (bool, optional) – if true and autolevels is True, will symetrize the levels from -abs(max(min_data, max_data) to abs(max(min_data, max_data)