Image module

class lys.widgets.canvas.interface.Image.ImageData(canvas, wave, axis)[source]

Bases: WaveData

Interface to access image data in the canvas.

Instance of ImageData is automatically generated by display or append methods.

Example:

from lys import display
g = display([[1,2,3],[4,5,6]])
g.getImages()[0].setColormap('gray')
getAutoColorRange()[source]

Get the automarically-calculated color range of the image, which is used by setColorRange() method.

Returns

minimum and maximum value of the range.

Return type

tuple of length 2

getColorRange()[source]

Get the color range of the image.

Returns

minimum and maximum value of the range.

Return type

tuple of length 2

getColorbarDirection()[source]

Get the direction of the colorbar.

Returns

The direction of the colorbar.

Return type

str

getColorbarPosition()[source]

Get the position of the colorbar.

Returns

The position of the colorbar.

Return type

length 2 float

getColorbarSize()[source]

Get the size of the colorbar.

Returns

The size of the colorbar.

Return type

length 2 float

getColorbarVisible()[source]

Get the visibility of the colorbar.

Returns

The visibility.

Return type

bool

getColormap()[source]

Get colormap of the image.

Returns

colormap string such as ‘gray’

Return type

str

getGamma()[source]

Get the gamma value of the image.

Returns

The gamma value.

Return type

float

getOpacity()[source]

Get the opacity of the image.

Returns

The opacity.

Return type

float

isLog()[source]

Return true if the color scale is logarithmic.

Returns

If True, logarithmic scale is enabled.

Return type

bool

setColorRange(min='auto', max='auto')[source]

Set the color range of the image.

Parameters
  • min (float or 'auto') – The minimum value of the range.

  • max (float or 'auto') – The maximum value of the range.

setColorbarDirection(direction)[source]

Set the direction of the colorbar.

Parameters

direction ('vretical' or 'horizontal') – The direction of the colorbar.

setColorbarPosition(pos)[source]

Set the position of the colorbar.

Parameters

pos (length 2 float) – The position of the colorbar in the form of (x,y).

setColorbarSize(size)[source]

Set the size of the colorbar.

Parameters

size (length 2 float) – The size of the colorbar in the form of (width, height).

setColorbarVisible(visible)[source]

Set the visibility of the colorbar.

Parameters

visible (bool) – The visibility.

setColormap(cmap)[source]

Set colormap of the image.

Parameters

colormap (str) – colormap string such as ‘gray’.

setGamma(gamma)[source]

Set gamma value of the image.

Parameters

gamma (float) – The gamma value.

setLog(log)[source]

Set the color scale to be logarithmic.

Parameters

log (bool) – If log is True, logarithmic scale is enabled.

setOpacity(opacity)[source]

Set the opacity of the image.

Parameters

opacity (float) – The opacity.