diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index a087f930..f4a6dabe 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -29,9 +29,9 @@ jobs: - python-version: "3.11" platform: ubuntu-latest backend: pyqt5 - - python-version: "3.10" - platform: windows-latest - backend: pyside2 + # - python-version: "3.10" + # platform: windows-latest + # backend: pyside2 steps: - uses: actions/checkout@v4 diff --git a/README.md b/README.md index 0e5be15c..cfa32050 100644 --- a/README.md +++ b/README.md @@ -17,9 +17,11 @@ You can install `napari-micromanager` via [pip]: pip install napari-micromanager -You will also need a Qt backend such as PySide2/6, or PyQt5/6. If you've previously installed napari -into this environment with `pip install napari[all]`, then you will likely already have it. If not, -you will also need to install a Qt backend of your choice: +You will also need a Qt backend such as PySide2/6, or PyQt5/6. **PyQt is +preferred and receives more testing**. If you've previously installed napari +into this environment with `pip install napari[all]`, then you will likely +already have it. If not, you will also need to install a Qt backend of your +choice: pip install pyqt5 # or any of {pyqt5, pyqt6, pyside2, pyside6} diff --git a/src/napari_micromanager/_mda_handler.py b/src/napari_micromanager/_mda_handler.py index 34f6b557..8da97d4b 100644 --- a/src/napari_micromanager/_mda_handler.py +++ b/src/napari_micromanager/_mda_handler.py @@ -94,6 +94,8 @@ def _on_mda_started(self, sequence: MDASequence) -> None: axis_labels, layers_to_create = _determine_sequence_layers(sequence) yx_shape = [self._mmc.getImageHeight(), self._mmc.getImageWidth()] + if self._mmc.getNumberOfComponents() >= 3: + yx_shape = [*yx_shape, 3] # now create a zarr array in a temporary directory for each layer for id_, shape, kwargs in layers_to_create: @@ -212,17 +214,16 @@ def _create_empty_image_layer( """ # we won't have reached this point if meta is None meta = sequence.metadata.get(NMM_METADATA_KEY, {}) + is_rgb = arr.shape[-1] == 3 + scale = [1.0] * (arr.ndim - (1 if is_rgb else 0)) # add Z to layer scale if (pix_size := self._mmc.getPixelSizeUm()) != 0: - scale = [1.0] * (arr.ndim - 2) + [pix_size] * 2 + scale[-2:] = [pix_size, pix_size] if (index := sequence.used_axes.find("z")) > -1: if meta.get("split_channels") and sequence.used_axes.find("c") < index: index -= 1 scale[index] = getattr(sequence.z_plan, "step", 1) - else: - # return to default - scale = [1.0, 1.0] layer_meta["useq_sequence"] = sequence layer_meta["uid"] = sequence.uid diff --git a/tests/test_multid_widget.py b/tests/test_multid_widget.py index f907edbc..4b19850a 100644 --- a/tests/test_multid_widget.py +++ b/tests/test_multid_widget.py @@ -16,7 +16,7 @@ from napari_micromanager.main_window import MainWindow -def test_main_window_mda(main_window: MainWindow): +def test_main_window_mda(main_window: MainWindow) -> None: assert not main_window.viewer.layers mda = MDASequence( @@ -35,6 +35,16 @@ def test_main_window_mda(main_window: MainWindow): assert all(key in layer_meta for key in keys) +def test_main_window_mda_rgb(main_window: MainWindow) -> None: + main_window._mmc.setProperty("Camera", "PixelType", "32bitRGB") + main_window._mmc.setProperty("Camera", "Mode", "Color Test Pattern") + assert not main_window.viewer.layers + + mda = MDASequence(time_plan={"loops": 4, "interval": 0.01}, channels=["DAPI"]) + main_window._mmc.mda.run(mda) + assert main_window.viewer.layers[-1].data.shape == (4, 1, 512, 512, 3) + + def test_saving_mda( qtbot: QtBot, main_window: MainWindow,