widgets module

Special widgets

General widgets

class lys.widgets.general.AxesSelectionDialog(dim=2)[source]

Bases: QDialog

A dialog to select two axes.

Parameters

dim (int) – The dimension of the data.

getAxes()[source]

Get axes selected.

Returns

The selected axes

Return type

tuple of length 2

setDimension(n)[source]

Change the dimension.

Parameters

d (int) – The new dimension

class lys.widgets.general.AxisCheckLayout(dim)[source]

Bases: QHBoxLayout

A layout that specifies axes.

Parameters

dim (int) – The dimension of data.

GetChecked()[source]

Return checked axes as array.

Returns

The selected axes

Return type

list of integers

SetChecked(axes)[source]

Set the state of the layout.

Parameters

axes (list of integers) – The list of axes to be checked.

stateChanged

Emitted when the state of the layout is changed.

class lys.widgets.general.AxisSelectionLayout(label, dim=2, init=0)[source]

Bases: QHBoxLayout

A layout to specify an axis.

Parameters
  • label (str) – The label of the layout.

  • dim (int) – The dimension of data.

  • init (int) – The axis initially selected.

axisChanged

Emitted when the selected axis is changed.

getAxis()[source]

Get the selected axis.

Returns

The selected axis.

Return type

int

setAxis(axis)[source]

Set the selected axis.

Parameters

axis (int) – The axis to select.

setDimension(d)[source]

Change the dimension of the layout.

Parameters

d (int) – The new dimension

setEnabled(enabled)[source]

Enable the widgets in this layout.

Parameters

enabled (bool) – Whether the widgets are enabled.

class lys.widgets.general.ColorSelection[source]

Bases: QPushButton

A widget to select color.

colorChanged

Emitted when the selected color is changed

getColor()[source]

Get the color.

Returns

The color string such as ‘#112233’

Return type

str

getColorAsArray()[source]

Get the color as QtGui.QColor.

Returns

The color selected by user.

Return type

QColor

setColor(color)[source]

Set the color.

Parameters

color (str) – The color string such as ‘#112233’.

class lys.widgets.general.ColormapSelection(opacity=True, log=True, reverse=True, gamma=True)[source]

Bases: QWidget

A widget to select colormap.

Parameters
  • opacity (bool) – If True, the opacity setting is enabled.

  • log (bool) – If True, ‘log’ checkbox is enabled.

  • reverse (bool) – If True, ‘reverse’ checkbox is enabled.

  • gamma (bool) – If True, gamma value can be set.

colorChanged

Emitted when the color map is changed

currentColor()[source]

Get the name of the selected colormap.

Returns

The name of the selected colormap.

Return type

str

currentColorMaps()[source]

Get the QtGui.QPixmap of the selected colormap.

Returns

The selected colormap.

Return type

QPixmap

gamma()[source]

Get the gamma.

Returns

The value of gamma.

Return type

float

isLog()[source]

Check if the ‘log’ checkbox is checked.

Returns

Whether the ‘log’ checkbox is checked.

Return type

bool

opacity()[source]

Get the opacity.

Returns

The value of opacity.

Return type

float

setColormap(cmap)[source]

Set the colormap.

Parameters

cmap (str) – The name of matplotlib colormaps. Use matplotlib.pyplot.colormaps to view all colormap names.

setEnabled(enable)[source]

Enable the widget.

Parameters

enable (bool) – The boolean to specify whether enabling or disabling the widget

setGamma(value)[source]

Set the gamma of the colormap.

Parameters

value (float) – The gamma value.

setLog(value)[source]

Set the state of the ‘log’ checkbox.

Parameters

value (bool) – True to check ‘log’ checkbox.

setOpacity(value)[source]

Set the opacity of the colormap.

Parameters

value (float) – The opacity between 0 to 1.

class lys.widgets.general.IndiceSelectionLayout(shape=None)[source]

Bases: QGridLayout

A layout to specify indice.

Parameters

shape (tuple) – The shape of data.

getIndices()[source]

Get the indices.

Returns

The indices.

Return type

sequence of int

setEnabled(enabled)[source]

Enable the respective spin box.

Parameters

enabled (sequence of boolean) – Whether the spin box is enabled.

setShape(shape)[source]

Change the shape of the layout.

Parameters

shape (tuple) – The new shape

setValues(indices)[source]

Set the indices.

Parameters

indices (sequence of int) – The indices.

valueChanged

Emitted when the value is changed.

class lys.widgets.general.RegionSelectWidget(parent, dim, check=False)[source]

Bases: QGridLayout

A widget to select region of multi-dimensional data. :param parent: The parent widget. :param dim: The dimension of the data. :param check: If True, user can select the axes.

getChecked()[source]

Get the state of the checkboxes.

Reutrns:

list of boolean: The state of the checkboxes.

getRegion()[source]

Get the specified region.

Returns

The specified region.

Return type

list of length 2 sequence

setChecked(checked)[source]

Set the state of the checkboxes.

Parameters

checked (list of boolean) – The state to be set.

setRegion(axis, range)[source]

Set the region.

Parameters
  • axis (int) – The axis to be changed.

  • range (length 2 sequency) – The range to be set.

stateChanged

Emitted when the state of the checkbox is changed.

class lys.widgets.general.ScientificSpinBox(*args, valueChanged=None, **kwargs)[source]

Bases: QDoubleSpinBox

Spin box that displays values in sdientific notation, which is frequently used in lys.

stepBy(steps)[source]

Reimplementation of stepBy

textFromValue(value)[source]

Reimplementation of textFromValue

validate(text, pos)[source]

Reimplementation of validate

valueFromText(text)[source]

Reimplementation of valueFromText

class lys.widgets.general.kernelSigmaLayout(dimension=2)[source]

Bases: QGridLayout

A layout that specifies the kernel of gaussian convolution filter.

Parameters

dimension (int) – The dimension of the kernel.

getKernelSigma()[source]

Get kernel sigma as array.

Returns

The kernel sigma.

Return type

list

setKernelSigma(val)[source]

Set kernel sigma.

Parameters

val (list of float) – The kernel sigma.

class lys.widgets.general.kernelSizeLayout(dimension=2, odd=True)[source]

Bases: QGridLayout

A layout that specifies the kernel size of convolution filter (such as median filter).

Parameters
  • dimension (int) – The dimension of the kernel.

  • odd (bool) – If True, only odd values can be set.

getKernelSize()[source]

Get kernel size as array.

Returns

The kernel size.

Return type

list

setKernelSize(val)[source]

Set kernel size.

Parameters

val (list of integers) – The kernel size.