Skip to content

MDASequenceWidget

MDASequenceWidget widget

This image generated from example code below.

MDASequenceWidget #

Bases: QWidget

A widget that provides a GUI to construct and edit a useq.MDASequence.

This widget requires no connection to a microscope or core instance. It strictly deals with loading and creating useq-schema useq.MDASequence objects.

_enable_af(state: bool) -> None #

Enable or disable autofocus settings.

_on_tab_checked(tab_idx: int) -> None #

Before updating autofocus axes, check if the autofocus plan can be used.

_settings_extensions() -> str #

Returns the available extensions for MDA settings save/load.

_simplify_af_offsets(seq: useq.MDASequence) -> dict #

If all positions have the same af offset, remove it from each position.

Instead, add a global autofocus plan to the sequence. This function returns a dict of fields to update in the sequence.

_update_af_axes(positions: Sequence[useq.Position]) -> Sequence[useq.Position] #

Add the autofocus axes to each subsequence.

_update_available_axis_orders() -> None #

Handle tabChecked signal.

Hide columns in the channels tab accordingly.

_update_time_estimate() -> None #

Update the time estimate label.

_use_af_per_position() -> bool #

Return True if autofocus per position is checked and enabled.

_validate_af_with_z_plan() -> None #

Check if the autofocus plan can be used with the current Z Plan.

If the Z Plan is set to TOP_BOTTOM, the autofocus plan cannot be used.

load(file: str | Path | None = None) -> None #

Load a useq.MDASequence from a file.

save(file: str | Path | None = None) -> None #

Save the current useq.MDASequence to a file.

setValue(value: useq.MDASequence) -> None #

Set the current value of the widget from a useq.MDASequence.

Parameters:

Name Type Description Default
value MDASequence

The useq.MDASequence to set.

required

value() -> useq.MDASequence #

Return the current value of the widget as a useq.MDASequence.

Returns:

Type Description
MDASequence

The current useq.MDASequence value of the widget.

Example#

mda_sequence_widget.py
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
"""MDASequenceWidget is a widget for creating a useq.MDASequence object.

It has no awareness of the CMMCorePlus object, and does not have a "run" button.
"""

import useq
from qtpy.QtWidgets import QApplication

from pymmcore_widgets import MDASequenceWidget

app = QApplication([])

wdg = MDASequenceWidget()
wdg.channels.setChannelGroups({"Channel": ["DAPI", "FITC"]})
wdg.time_plan.setValue(useq.TIntervalLoops(interval=0.5, loops=11))
wdg.valueChanged.connect(lambda: print(wdg.value()))
wdg.show()
app.exec()