Skip to content

ChannelTable

ChannelTableChannelTable

Screenshot generated from the example below.

Example

examples/channel_table.py
"""Example usage of the ChannelTable class.

ChannelTable edits a list of `useq.Channel`s.  It doesn't use a CMMCorePlus, so
you tell it which channel groups and channels to offer.

Check also the 'mda_widget.py' example to see the ChannelTable
used in combination of other widgets.
"""

from qtpy.QtWidgets import QApplication

from pymmcore_widgets import ChannelTable

app = QApplication([])

ch_table_wdg = ChannelTable(rows=1)
ch_table_wdg.setChannelGroups({"Channel": ["DAPI", "FITC"]})
ch_table_wdg.valueChanged.connect(lambda: print(ch_table_wdg.value()))
ch_table_wdg.resize(500, 200)
ch_table_wdg.show()

app.exec()

API

Bases: DataTableWidget

Table to edit a list of channels (useq.Channel).

It doesn't use a core: call setChannelGroups to say which channel groups and presets to offer.

valueChanged

valueChanged = Signal()

Emitted (with no arguments) when the table changes; read it with value().

COLUMNS

COLUMNS: tuple[ColumnInfo, ...]

GROUP

GROUP = TextColumn(key='group', default=DEFAULT_GROUP, hidden=True)

CONFIG

CONFIG = TextColumn(key='config', default=None, is_row_selector=True)

EXPOSURE

EXPOSURE = FloatColumn(
    key="exposure", header="Exposure [ms]", default=100.0, minimum=0.01
)

ACQUIRE_EVERY

ACQUIRE_EVERY = IntColumn(key='acquire_every', default=1, minimum=1)

DO_STACK

DO_STACK = BoolColumn(key='do_stack', default=True)

Z_OFFSET

Z_OFFSET = FloatColumn(
    key="z_offset", default=0.0, minimum=-10000, maximum=10000
)

table

table() -> DataTable

toolBar

toolBar() -> QToolBar

setChannelGroups

setChannelGroups(groups: Mapping[str, Sequence[str]] | None) -> None

Set the channel groups that can be selected in the table.

Parameters:

Name Type Description Default
groups Mapping[str, Sequence[str]]

A mapping of group names to a sequence of config names.

required

channelGroups

channelGroups() -> Mapping[str, Sequence[str]]

Return the current channel groups that can be selected in the table.

value

value(exclude_unchecked: bool = True) -> tuple[Channel, ...]

Return the current value of the table as a tuple of useq.Channel.

Parameters:

Name Type Description Default
exclude_unchecked bool

Exclude unchecked rows, by default True

True

Returns:

Type Description
tuple[Channel, ...]

A tuple of useq.Channel.

setValue

setValue(value: Iterable[Channel]) -> None

Set the current value of the table from an Iterable of useq.Channel.

Parameters:

Name Type Description Default
value Iterable[Channel]

An Iterable of useq.Channel.

required