diff --git a/setup.cfg b/setup.cfg index bdf0b53..d9f9a32 100644 --- a/setup.cfg +++ b/setup.cfg @@ -41,7 +41,7 @@ package_dir = # add your package requirements here install_requires = - exodeepfinder + exodeepfinder==0.2.4 numpy==1.26.4 magicgui==0.8.2 QtPy==2.4.1 diff --git a/src/napari_exodeepfinder/_cluster_widget.py b/src/napari_exodeepfinder/_cluster_widget.py index 2069992..52adad9 100644 --- a/src/napari_exodeepfinder/_cluster_widget.py +++ b/src/napari_exodeepfinder/_cluster_widget.py @@ -1,3 +1,6 @@ +import napari.layers.labels +import napari.layers.labels.labels +import napari.layers.shapes from qtpy.QtWidgets import QWidget, QGridLayout, QComboBox, QPushButton, QLabel, QGroupBox, QVBoxLayout, QTextEdit, \ QSpinBox, QFileDialog, QLineEdit from qtpy import QtCore diff --git a/src/napari_exodeepfinder/_orthoview_widget.py b/src/napari_exodeepfinder/_orthoview_widget.py index ecbd4dc..95c771e 100644 --- a/src/napari_exodeepfinder/_orthoview_widget.py +++ b/src/napari_exodeepfinder/_orthoview_widget.py @@ -502,10 +502,10 @@ def sync_layer(self, event, init=False, layer: Optional[layers.Layer] = None, in layer = event.source # handle name change in a "dirty" way index = index_of_layer(self.main_view, layer) - if layer.name != self.old_layer_names[index]: + self.old_layer_names = [layer.name for layer in self.main_view.layers] + if type(index) != bool and layer.name != self.old_layer_names[index]: for view in secondary_viewers: view.layers[index].name = layer.name - self.old_layer_names[index] = layer.name # TODO: could this be done with copy? if isinstance(layer, image): for view in secondary_viewers: diff --git a/src/napari_exodeepfinder/_tests/test_widget.py b/src/napari_exodeepfinder/_tests/test_widget.py index 19d983a..4b919a0 100644 --- a/src/napari_exodeepfinder/_tests/test_widget.py +++ b/src/napari_exodeepfinder/_tests/test_widget.py @@ -63,7 +63,7 @@ def test_add_points(make_napari_viewer, qtbot): my_widget._input_layer_box.setCurrentText("test_layer") assert np.array_equal(viewer.layers["test_layer"].data, np.empty([0, 3])) qtbot.mouseClick(my_widget._add_point, QtCore.Qt.LeftButton) - assert np.array_equal(viewer.layers["test_layer"].data, np.array([[256., 256., 256.]])) + assert np.array_equal(viewer.layers["test_layer"].data, np.array([[255., 255., 255.]])) my_widget.deleteLater() qtbot.wait(10) @@ -150,11 +150,11 @@ def test_orthoslice_click(make_napari_viewer, qtbot, Event): my_widget.checkbox.setChecked(True) my_widget._on_click_checkbox(True) # test start position - assert my_widget.x == 50 - assert my_widget.y == 50 - assert my_widget.z == 10 - assert np.array_equal(viewer.layers[-1].data, np.array([[[50, 0, 10], [0, 100-1, 0]], - [[0, 50, 10], [100-1, 0, 0]]])) + assert my_widget.x == 50-1 + assert my_widget.y == 50-1 + assert my_widget.z == 10-1 + assert np.array_equal(viewer.layers[-1].data, np.array([[[50-1, 0, 10-1], [0, 100-1, 0]], + [[0, 50-1, 10-1], [100-1, 0, 0]]])) # click and test end position # Simulate click click_event = Event( @@ -166,9 +166,9 @@ def test_orthoslice_click(make_napari_viewer, qtbot, Event): my_widget.mouse_single_click(my_widget.main_view, click_event) assert my_widget.x == 75 assert my_widget.y == 75 - assert my_widget.z == 10 - assert np.array_equal(viewer.layers[-1].data, np.array([[[75, 0, 10], [0, 100-1, 0]], - [[0, 75, 10], [100-1, 0, 0]]])) + assert my_widget.z == 10-1 + assert np.array_equal(viewer.layers[-1].data, np.array([[[75, 0, 10-1], [0, 100-1, 0]], + [[0, 75, 10-1], [100-1, 0, 0]]])) # Insert a layer while in orthoslice view viewer.add_image(data=np.random.random((100, 100, 20)), name='test') assert my_widget.yz_view.layers[-2].name == 'test'