bauerdavid / napari-nD-annotator

BSD 3-Clause "New" or "Revised" License
29 stars 2 forks source link

Error upon starting the plugin #52

Open aloboa opened 1 month ago

aloboa commented 1 month ago

Conda installation on a windows machine. Image displayed in napari. Select plugin from the menu. Right menu does not appear. Console errors: (base) C:\Users\usuario>conda activate napari-env

(napari-env) C:\Users\usuario>napari

Traceback (most recent call last):

File "C:\Users\usuario\anaconda3\envs\napari-env\lib\site-packages\napari_nd_annotator_widgets_utils\persistence\persistent_widget_state.py", line 37, in init with open(self._config_path, "w") as new_file, open(default_settings_path, "r") as def_file:

FileNotFoundError: [Errno 2] No such file or directory: 'C:/Users/usuario/AppData/Local/napari/napari\nd_annotator_config.yaml'

C:\Users\usuario\anaconda3\envs\napari-env\lib\site-packages\napari_nd_annotator_widgets_utils\persistence\persistent_widget_state.py:77: UserWarning: id 'fill_objects_checkbox' not found in config file!

Traceback (most recent call last):

File "C:\Users\usuario\anaconda3\envs\napari-env\lib\site-packages\napari_nd_annotator_widgets_utils\persistence\persistent_widget_state.py", line 37, in init with open(self._config_path, "w") as new_file, open(default_settings_path, "r") as def_file:

FileNotFoundError: [Errno 2] No such file or directory: 'C:/Users/usuario/AppData/Local/napari/napari\nd_annotator_config.yaml'

C:\Users\usuario\anaconda3\envs\napari-env\lib\site-packages\napari_nd_annotator_widgets_utils\persistence\persistent_widget_state.py:77: UserWarning: id 'method_dropdown' not found in config file!

C:\Users\usuario\anaconda3\envs\napari-env\lib\site-packages\napari_nd_annotator_widgets_utils\persistence\persistent_widget_state.py:77: UserWarning: id 'n_points' not found in config file!

C:\Users\usuario\anaconda3\envs\napari-env\lib\site-packages\napari_nd_annotator_widgets_utils\persistence\persistent_widget_state.py:77: UserWarning: id 'rpsv_iterations_spinbox' not found in config file!

Traceback (most recent call last):

File "C:\Users\usuario\anaconda3\envs\napari-env\lib\site-packages\napari_nd_annotator_widgets_utils\persistence\persistent_widget_state.py", line 37, in init with open(self._config_path, "w") as new_file, open(default_settings_path, "r") as def_file:

FileNotFoundError: [Errno 2] No such file or directory: 'C:/Users/usuario/AppData/Local/napari/napari\nd_annotator_config.yaml'

C:\Users\usuario\anaconda3\envs\napari-env\lib\site-packages\napari_nd_annotator_widgets_utils\persistence\persistent_widget_state.py:77: UserWarning: id 'feature_dropdown' not found in config file!

C:\Users\usuario\anaconda3\envs\napari-env\lib\site-packages\napari_nd_annotator_widgets_utils\persistence\persistent_widget_state.py:77: UserWarning: id 'param_spinbox' not found in config file!

C:\Users\usuario\anaconda3\envs\napari-env\lib\site-packages\napari_nd_annotator_widgets_utils\persistence\persistent_widget_state.py:77: UserWarning: id 'blur_image_checkbox' not found in config file!

C:\Users\usuario\anaconda3\envs\napari-env\lib\site-packages\napari_nd_annotator_widgets_utils\persistence\persistent_widget_state.py:77: UserWarning: id 'blur_image_slider' not found in config file!

C:\Users\usuario\anaconda3\envs\napari-env\lib\site-packages\napari_nd_annotator_widgets_utils\persistence\persistent_widget_state.py:77: UserWarning: id 'smooth_contour_checkbox' not found in config file!

C:\Users\usuario\anaconda3\envs\napari-env\lib\site-packages\napari_nd_annotator_widgets_utils\persistence\persistent_widget_state.py:77: UserWarning: id 'smooth_contour_spinbox' not found in config file!

C:\Users\usuario\anaconda3\envs\napari-env\lib\site-packages\napari_nd_annotator_widgets_utils\persistence\persistent_widget_state.py:77: UserWarning: id 'point_size_spinbox' not found in config file!

C:\Users\usuario\anaconda3\envs\napari-env\lib\site-packages\napari\utils\migrations.py:101: FutureWarning: Argument 'edge_color' is deprecated, please use 'border_color' instead. The argument 'edge_color' was deprecated in 0.5.0 and it will be removed in 0.6.0.!


AttributeError Traceback (most recent call last)

File ~\anaconda3\envs\napari-env\lib\site-packages\app_model\backends\qt_qaction.py:57, in QCommandAction._on_triggered(self=QMenuItemAction(MenuItem(when=None, group='3_plu...Annotation Toolbox)'))), alt=None), app='napari'), checked=True)

 53 def _on_triggered(self, checked: bool) -> None:

 54     # execute_command returns a Future, for the sake of eventually being

 55     # asynchronous without breaking the API.  For now, we call result()

 56     # to raise any exceptions.

---> 57 self._app.commands.execute_command(self._command_id).result()

    self._command_id = 'napari-nD-annotator:Annotation Toolbox'

    self = QMenuItemAction(MenuItem(when=None, group='3_plugin_contributions', order=None, command=CommandRule(id='napari-nD-annotator:Annotation Toolbox', title='Annotation Toolbox', category=None, tooltip=None, status_tip=None, icon=None, icon_visible_in_menu=True, enablement=None, short_title=None, toggled=ToggleRule(condition=None, get_current=functools.partial(<function _get_current_dock_status at 0x000002A67C45A280>, full_name='Annotation Toolbox (Annotation Toolbox)'))), alt=None), app='napari')

    self._app = Application('napari')

File ~\anaconda3\envs\napari-env\lib\site-packages\app_model\registries_commands_reg.py:245, in CommandsRegistry.execute_command(self=<CommandsRegistry at 0x2a67c483820 (146 commands)>, id='napari-nD-annotator:Annotation Toolbox', execute_asynchronously=False, *args=(), **kwargs={})

241 except Exception as e:

242     if self._raise_synchronous_exceptions:

243         # note, the caller of this function can also achieve this by

244         # calling `future.result()` on the returned future object.

--> 245 raise e

246     future.set_exception(e)

248 return future

File ~\anaconda3\envs\napari-env\lib\site-packages\app_model\registries_commands_reg.py:240, in CommandsRegistry.execute_command(self=<CommandsRegistry at 0x2a67c483820 (146 commands)>, id='napari-nD-annotator:Annotation Toolbox', execute_asynchronously=False, *args=(), **kwargs={})

238 future: Future = Future()

239 try:

--> 240 future.set_result(cmd(*args, **kwargs))

    future = <Future at 0x2a60b8ce940 state=pending>

    cmd = <function Store.inject.<locals>._inner.<locals>._exec at 0x000002A607C08940>

    args = ()

    kwargs = {}

241 except Exception as e:

242     if self._raise_synchronous_exceptions:

243         # note, the caller of this function can also achieve this by

244         # calling `future.result()` on the returned future object.

File ~\anaconda3\envs\napari-env\lib\site-packages\in_n_out_store.py:934, in Store.inject_processors.._deco.._exec(*args=(), **kwargs={})

932 @wraps(func)

933 def _exec(*args: P.args, **kwargs: P.kwargs) -> R:

--> 934 result = func(*args, **kwargs)

    func = <function Store.inject.<locals>._inner.<locals>._exec at 0x000002A607C08790>

    args = ()

    kwargs = {}

935     if result is not None:

936         self.process(

937             result,

938             type_hint=type_hint,

(...)

941             _funcname=getattr(func, "__qualname__", str(func)),

942         )

File ~\anaconda3\envs\napari-env\lib\site-packages\in_n_out_store.py:804, in Store.inject.._inner.._exec(*args=(), **kwargs={})

797 logger.debug(

798     "  Calling %s with %r (injected %r)",

799     _fname,

800     bound.arguments,

801     _injected_names,

802 )

803 try:

--> 804 result = func(**bound.arguments)

    bound = <BoundArguments (plugin='napari-nD-annotator', widget_name='Annotation Toolbox', full_name='Annotation Toolbox (Annotation Toolbox)')>

    func = functools.partial(<function _toggle_or_get_widget at 0x000002A67C45A1F0>, plugin='napari-nD-annotator', widget_name='Annotation Toolbox', full_name='Annotation Toolbox (Annotation Toolbox)')

    bound.arguments = {'plugin': 'napari-nD-annotator', 'widget_name': 'Annotation Toolbox', 'full_name': 'Annotation Toolbox (Annotation Toolbox)'}

805 except TypeError as e:

806     if "missing" not in e.args[0]:

File ~\anaconda3\envs\napari-env\lib\site-packages\napari_qt_qplugins_qnpe2.py:350, in _toggle_or_get_widget(plugin='napari-nD-annotator', widget_name='Annotation Toolbox', full_name='Annotation Toolbox (Annotation Toolbox)')

348 if widget_param:

349     kwargs[widget_param] = viewer

--> 350 return widget_callable(**kwargs), full_name

    kwargs = {'viewer': Viewer(camera=Camera(center=(0.0, 959.5, 1279.5), zoom=0.23341796874999998, angles=(0.0, 0.0, 90.0), perspective=0.0, mouse_pan=True, mouse_zoom=True), cursor=Cursor(position=(0.0, -928.8596181564905, 0.0), scaled=True, style=<CursorStyle.CROSSHAIR: 'crosshair'>, size=1.0), dims=Dims(ndim=3, ndisplay=2, order=(0, 1, 2), axis_labels=('0', '1', '2'), rollable=(True, True, True), range=(RangeTuple(start=-0.5, stop=511.5, step=1.0), RangeTuple(start=0.0, stop=1919.0, step=1.0), RangeTuple(start=0.0, stop=2559.0, step=1.0)), margin_left=(0.0, 0.0, 0.0), margin_right=(0.0, 0.0, 0.0), point=(0.0, 959.0, 1279.0), last_used=0), grid=GridCanvas(stride=1, shape=(-1, -1), enabled=False), layers=[<Image layer 'DI17_2' at 0x2a60aaae4f0>, <Points layer '🔒 from E' at 0x2a60fa395e0>, <Points layer '🔒 to S' at 0x2a610f19d00>, <Points layer '🔒 temp' at 0x2a60b5c1160>, <Points layer 'Anchors [DO NOT ALTER]' at 0x2a60b5c11f0>], help='use <4> for pan/zoom, use <5> for transform, use <3> for select points', status='', tooltip=Tooltip(visible=False, text=''), theme='dark', title='napari', mouse_over_canvas=False, mouse_move_callbacks=[], mouse_drag_callbacks=[], mouse_double_click_callbacks=[], mouse_wheel_callbacks=[<function dims_scroll at 0x000002A67A8E0550>], _persisted_mouse_event={}, _mouse_drag_gen={}, _mouse_wheel_gen={}, _keymap={<KeyBinding at 0x2a60fa396d0: Ctrl+1>: <function MinimalContourWidget.__init__.<locals>.change_layer_callback.<locals>.change_layer at 0x000002A60FA3D160>, <KeyBinding at 0x2a60fa39760: Ctrl+2>: <function MinimalContourWidget.__init__.<locals>.change_layer_callback.<locals>.change_layer at 0x000002A60FA3D1F0>, <KeyBinding at 0x2a60fa397f0: Ctrl+3>: <function MinimalContourWidget.__init__.<locals>.change_layer_callback.<locals>.change_layer at 0x000002A60FA3D280>, <KeyBinding at 0x2a60fa39880: Ctrl+4>: <function MinimalContourWidget.__init__.<locals>.change_layer_callback.<locals>.change_layer at 0x000002A60FA3D310>, <KeyBinding at 0x2a60fa39910: Ctrl+5>: <function MinimalContourWidget.__init__.<locals>.change_layer_callback.<locals>.change_layer at 0x000002A60FA3D3A0>, <KeyBinding at 0x2a60fa399a0: Ctrl+6>: <function MinimalContourWidget.__init__.<locals>.change_layer_callback.<locals>.change_layer at 0x000002A60FA3D430>, <KeyBinding at 0x2a60fa39a30: Ctrl+7>: <function MinimalContourWidget.__init__.<locals>.change_layer_callback.<locals>.change_layer at 0x000002A60FA3D4C0>, <KeyBinding at 0x2a60fa39ac0: Ctrl+8>: <function MinimalContourWidget.__init__.<locals>.change_layer_callback.<locals>.change_layer at 0x000002A60FA3D550>, <KeyBinding at 0x2a60fa39b50: Ctrl+9>: <function MinimalContourWidget.__init__.<locals>.change_layer_callback.<locals>.change_layer at 0x000002A60FA3D5E0>, <KeyBinding at 0x2a611c758e0: Ctrl+Tab>: <bound method MinimalContourWidget.swap_selection of <napari_nd_annotator._widgets.minimal_contour_widget.MinimalContourWidget object at 0x000002A60F9A44C0>>})}

    widget_callable = <class 'napari_nd_annotator._widgets.annotator_module.AnnotatorWidget'>

    full_name = 'Annotation Toolbox (Annotation Toolbox)'

File ~\anaconda3\envs\napari-env\lib\site-packages\napari_nd_annotator_widgets\annotator_module.py:70, in AnnotatorWidget.init(self=, viewer=Viewer(camera=Camera(center=(0.0, 959.5, 1279.5)...malContourWidget object at 0x000002A60F9A44C0>>}))

 67 self.interpolation_widget = InterpolationWidget(viewer, self)

 68 tabs_widget.addTab(self.interpolation_widget, "Interpolation")

---> 70 self.minimal_contour_widget = MinimalContourWidget(viewer, self)

    viewer = Viewer(camera=Camera(center=(0.0, 959.5, 1279.5), zoom=0.23341796874999998, angles=(0.0, 0.0, 90.0), perspective=0.0, mouse_pan=True, mouse_zoom=True), cursor=Cursor(position=(0.0, -928.8596181564905, 0.0), scaled=True, style=<CursorStyle.CROSSHAIR: 'crosshair'>, size=1.0), dims=Dims(ndim=3, ndisplay=2, order=(0, 1, 2), axis_labels=('0', '1', '2'), rollable=(True, True, True), range=(RangeTuple(start=-0.5, stop=511.5, step=1.0), RangeTuple(start=0.0, stop=1919.0, step=1.0), RangeTuple(start=0.0, stop=2559.0, step=1.0)), margin_left=(0.0, 0.0, 0.0), margin_right=(0.0, 0.0, 0.0), point=(0.0, 959.0, 1279.0), last_used=0), grid=GridCanvas(stride=1, shape=(-1, -1), enabled=False), layers=[<Image layer 'DI17_2' at 0x2a60aaae4f0>, <Points layer '🔒 from E' at 0x2a60fa395e0>, <Points layer '🔒 to S' at 0x2a610f19d00>, <Points layer '🔒 temp' at 0x2a60b5c1160>, <Points layer 'Anchors [DO NOT ALTER]' at 0x2a60b5c11f0>], help='use <4> for pan/zoom, use <5> for transform, use <3> for select points', status='', tooltip=Tooltip(visible=False, text=''), theme='dark', title='napari', mouse_over_canvas=False, mouse_move_callbacks=[], mouse_drag_callbacks=[], mouse_double_click_callbacks=[], mouse_wheel_callbacks=[<function dims_scroll at 0x000002A67A8E0550>], _persisted_mouse_event={}, _mouse_drag_gen={}, _mouse_wheel_gen={}, _keymap={<KeyBinding at 0x2a60fa396d0: Ctrl+1>: <function MinimalContourWidget.__init__.<locals>.change_layer_callback.<locals>.change_layer at 0x000002A60FA3D160>, <KeyBinding at 0x2a60fa39760: Ctrl+2>: <function MinimalContourWidget.__init__.<locals>.change_layer_callback.<locals>.change_layer at 0x000002A60FA3D1F0>, <KeyBinding at 0x2a60fa397f0: Ctrl+3>: <function MinimalContourWidget.__init__.<locals>.change_layer_callback.<locals>.change_layer at 0x000002A60FA3D280>, <KeyBinding at 0x2a60fa39880: Ctrl+4>: <function MinimalContourWidget.__init__.<locals>.change_layer_callback.<locals>.change_layer at 0x000002A60FA3D310>, <KeyBinding at 0x2a60fa39910: Ctrl+5>: <function MinimalContourWidget.__init__.<locals>.change_layer_callback.<locals>.change_layer at 0x000002A60FA3D3A0>, <KeyBinding at 0x2a60fa399a0: Ctrl+6>: <function MinimalContourWidget.__init__.<locals>.change_layer_callback.<locals>.change_layer at 0x000002A60FA3D430>, <KeyBinding at 0x2a60fa39a30: Ctrl+7>: <function MinimalContourWidget.__init__.<locals>.change_layer_callback.<locals>.change_layer at 0x000002A60FA3D4C0>, <KeyBinding at 0x2a60fa39ac0: Ctrl+8>: <function MinimalContourWidget.__init__.<locals>.change_layer_callback.<locals>.change_layer at 0x000002A60FA3D550>, <KeyBinding at 0x2a60fa39b50: Ctrl+9>: <function MinimalContourWidget.__init__.<locals>.change_layer_callback.<locals>.change_layer at 0x000002A60FA3D5E0>, <KeyBinding at 0x2a611c758e0: Ctrl+Tab>: <bound method MinimalContourWidget.swap_selection of <napari_nd_annotator._widgets.minimal_contour_widget.MinimalContourWidget object at 0x000002A60F9A44C0>>})

    self = <napari_nd_annotator._widgets.annotator_module.AnnotatorWidget object at 0x000002A607C08280>

    MinimalContourWidget = <class 'napari_nd_annotator._widgets.minimal_contour_widget.MinimalContourWidget'>

 71 tabs_widget.addTab(self.minimal_contour_widget, "Minimal Contour")

 73 if MinimalSurfaceWidget is not None:

File ~\anaconda3\envs\napari-env\lib\site-packages\napari_nd_annotator_widgets\minimal_contour_widget.py:322, in MinimalContourWidget.init(self=, viewer=Viewer(camera=Camera(center=(0.0, 959.5, 1279.5)...malContourWidget object at 0x000002A60F9A44C0>>}), parent=)

320 self.change_point_size(self.point_size_spinbox.value())

321 self.store_orig_image()

--> 322 self.set_use_smoothing(self.blur_image_checkbox.isChecked())

    self.blur_image_checkbox = <PyQt5.QtWidgets.QCheckBox object at 0x000002A60F9FC670>

    self = <napari_nd_annotator._widgets.minimal_contour_widget.MinimalContourWidget object at 0x000002A60F9A44C0>

323 self.smooth_contour_spinbox.setVisible(self.smooth_contour_checkbox.isChecked())

324 self.apply_blurring()

File ~\anaconda3\envs\napari-env\lib\site-packages\napari_nd_annotator_widgets\minimal_contour_widget.py:337, in MinimalContourWidget.set_use_smoothing(self=, use_smoothing=False)

335 self.apply_blurring_button.setEnabled(use_smoothing)

336 self.apply_blurring()

--> 337 self.set_image()

    self = <napari_nd_annotator._widgets.minimal_contour_widget.MinimalContourWidget object at 0x000002A60F9A44C0>

File ~\anaconda3\envs\napari-env\lib\site-packages\napari_nd_annotator_widgets\minimal_contour_widget.py:674, in MinimalContourWidget.set_image(self=, *args=())

672     self.feature_editor.execute()

673 else:

--> 674 grad_x, grad_y = self.feature_manager.get_features(self.image.layer)

    self = <napari_nd_annotator._widgets.minimal_contour_widget.MinimalContourWidget object at 0x000002A60F9A44C0>

    self.feature_manager = <napari_nd_annotator.minimal_contour.feature_manager.FeatureManager object at 0x000002A60F992160>

675     if grad_x is not None:

676         with warnings.catch_warnings():

File ~\anaconda3\envs\napari-env\lib\site-packages\napari_nd_annotator\minimal_contour\feature_manager.py:40, in FeatureManager.get_features(self=, layer=<Image layer 'DI17_2'>, block=True)

 38     dims_not_displayed = tuple(layer_dims_not_displayed(layer))

 39 if layer != self.layer or dims_displayed != self.dims_displayed:

---> 40 self.init_file(layer, dims_displayed)

    dims_displayed = (0, 1)

    layer = <Image layer 'DI17_2' at 0x2a60aaae4f0>

    self = <napari_nd_annotator.minimal_contour.feature_manager.FeatureManager object at 0x000002A60F992160>

 41 with warnings.catch_warnings():

 42     warnings.simplefilter("ignore")

File ~\anaconda3\envs\napari-env\lib\site-packages\napari_nd_annotator\minimal_contour\feature_manager.py:98, in FeatureManager.init_file(self=, layer=<Image layer 'DI17_2'>, dims_displayed=(0, 1))

 96     self.memmaps.append(np.memmap(path_v, shape=shape, dtype=float, mode="w+"))

 97     self.memmaps.append(np.memmap(path_h, shape=shape, dtype=float, mode="w+"))

---> 98 self.start_feature_calculation(layer)

    layer = <Image layer 'DI17_2' at 0x2a60aaae4f0>

    self = <napari_nd_annotator.minimal_contour.feature_manager.FeatureManager object at 0x000002A60F992160>

 99 else:

100     self.memmaps.append(np.memmap(path_v, shape=shape, dtype=float))

File ~\anaconda3\envs\napari-env\lib\site-packages\napari_nd_annotator\minimal_contour\feature_manager.py:112, in FeatureManager.start_feature_calculation(self=, layer=<Image layer 'DI17_2'>)

110 with warnings.catch_warnings():

111     warnings.simplefilter("ignore")

--> 112 slice_indices = layer._slice_indices

    layer = <Image layer 'DI17_2' at 0x2a60aaae4f0>

113     dims_not_displayed = layer_dims_not_displayed(layer)

114 self.feature_extractor.start_jobs(layer.data, self.memmaps, slice_indices, dims_not_displayed, layer.rgb)

AttributeError: 'Image' object has no attribute '_slice_indices'

aloboa commented 1 month ago

I think this is the same than or very related to https://github.com/bauerdavid/napari-nD-annotator/issues/51 I actually get the same problem on a linux machine. What is surprising is that today's installation with napari 0.5.4 reports napari-2D-annotator 0.1.1, while I have an older environment with napari 0.4.19 reporting napari-2D-annotator 0.2.3 (which works). How can today's version of napari-2D-annotator be older?

aloboa commented 1 month ago

See https://forum.image.sc/t/version-of-newly-installed-napari-nd-annotation-is-older-than-that-of-older-installation/103376/4

bauerdavid commented 1 month ago

Hey @aloboa, I don't think that it is the same as #51, there using the newest numpy version caused the error, but here there are multiple things:

  1. The location of a configuration file is not found
  2. There were some changes made to the core of napari, and here the plugin tries to access some attributes which are not accessible in the new napari version (The same as #50, was fixed in 1e1d4f0551e5a590ca5e8e60ee4b20726dde6c3f)

It would be a huge help if you could try installing the plugin from git. It requires building some C/C++ code, so this might not be trivial. If you need any help with this, please let me know. Also, could you check the path the plugin's looking for? It's C:/Users/usuario/AppData/Local/napari/napari\nd_annotator_config.yaml

aloboa commented 1 month ago

C:/Users/usuario/AppData/Local/napari/napari\ exists, but nd_annotator_config.yaml does not.

aloboa commented 1 month ago

It would be a huge help if you could try installing the plugin from git. It requires building some C/C++ code, so this might not be trivial. If you need any help with this, please let me know.

I would be happy to help on a linux machine. Cannot help on Windows (I was just trying to help out an student). I can invest some time this week, next week will be more difficult, but should be able to help again afterwards. Would need your guide, though. Perhaps will make you waste more time than actually helping out.

aloboa commented 1 month ago

I post here the report of my try on a ubuntu 22.04 machine:

conda create -y -n nDannot-env -c conda-forge python=3.10
conda activate nDannot-env
python -m pip install "napari[all]"
Installing collected packages: pytz, PyQt5-Qt5, ptyprocess, appdirs, urllib3, six, rpds-py, PyYAML, PyQt5-sip, pexpect, kiwisolver, idna, fasteners, decorator, certifi, attrs, referencing, PyQt5, pydantic, jsonschema-specifications, jsonschema, app-model, napari
ERROR: pip's dependency resolver does not currently take into account all the packages that are installed. This behaviour is the source of the following dependency conflicts.
catboost 1.2.7 requires matplotlib, which is not installed.
catboost 1.2.7 requires plotly, which is not installed.
Successfully installed PyQt5-5.15.11 PyQt5-Qt5-5.15.15 PyQt5-sip-12.15.0 PyYAML-6.0.2 app-model-0.3.0 appdirs-1.4.4 attrs-24.2.0 certifi-2024.8.30 decorator-5.1.1 fasteners-0.19 idna-3.10 jsonschema-4.23.0 jsonschema-specifications-2023.12.1 kiwisolver-1.4.7 napari-0.5.4 pexpect-4.9.0 ptyprocess-0.7.0 pydantic-2.9.2 pytz-2024.2 referencing-0.35.1 rpds-py-0.20.0 six-1.16.0 urllib3-2.2.3
python -m pip install "napari[all]" --upgrade
pip install napari-nD-annotator[all]
Installing collected packages: pyparsing, fonttools, cycler, contourpy, matplotlib, napari-nD-annotator, napari-bbox
ERROR: pip's dependency resolver does not currently take into account all the packages that are installed. This behaviour is the source of the following dependency conflicts.
catboost 1.2.7 requires plotly, which is not installed.
Successfully installed contourpy-1.3.0 cycler-0.12.1 fonttools-4.54.1 matplotlib-3.9.2 napari-bbox-0.0.8 napari-nD-annotator-0.1.0 pyparsing-3.1.4

napari I get napari 0.5.4 and napari-nd-annotatro 0.1.0 which can be updates to v0.2.3 (which I do and quit)

napari and start the plugin: $ napari /home/alobo2/miniforge3/envs/nDannot-env/lib/python3.10/site-packages/napari/utils/migrations.py:101: FutureWarning: Argument 'edge_color' is deprecated, please use 'border_color' instead. The argument 'edge_color' was deprecated in 0.5.0 and it will be removed in 0.6.0.! Then add an image and start the plugin. Many error messages to the console, and the right part of the plugin GUI does not appear:


AttributeError Traceback (most recent call last) File ~/miniforge3/envs/nDannot-env/lib/python3.10/site-packages/napari_nd_annotator/_widgets/minimal_contour_widget.py:674, in MinimalContourWidget.set_image(self=, *args=(1,)) 672 self.feature_editor.execute() 673 else: --> 674 grad_x, grad_y = self.feature_manager.get_features(self.image.layer) self = <napari_nd_annotator._widgets.minimal_contour_widget.MinimalContourWidget object at 0x763ad814ee60> self.feature_manager = <napari_nd_annotator.minimal_contour.feature_manager.FeatureManager object at 0x763ad8155f60> 675 if grad_x is not None: 676 with warnings.catch_warnings():

File ~/miniforge3/envs/nDannot-env/lib/python3.10/site-packages/napari_nd_annotator/minimal_contour/feature_manager.py:40, in FeatureManager.get_features(self=, layer=<Image layer 'DI17_2'>, block=True) 38 dims_not_displayed = tuple(layer_dims_not_displayed(layer)) 39 if layer != self.layer or dims_displayed != self.dims_displayed: ---> 40 self.init_file(layer, dims_displayed) dims_displayed = (0, 1) layer = <Image layer 'DI17_2' at 0x763a95bd36a0> self = <napari_nd_annotator.minimal_contour.feature_manager.FeatureManager object at 0x763ad8155f60> 41 with warnings.catch_warnings(): 42 warnings.simplefilter("ignore")

File ~/miniforge3/envs/nDannot-env/lib/python3.10/site-packages/napari_nd_annotator/minimal_contour/feature_manager.py:98, in FeatureManager.init_file(self=, layer=<Image layer 'DI17_2'>, dims_displayed=(0, 1)) 96 self.memmaps.append(np.memmap(path_v, shape=shape, dtype=float, mode="w+")) 97 self.memmaps.append(np.memmap(path_h, shape=shape, dtype=float, mode="w+")) ---> 98 self.start_feature_calculation(layer) layer = <Image layer 'DI17_2' at 0x763a95bd36a0> self = <napari_nd_annotator.minimal_contour.feature_manager.FeatureManager object at 0x763ad8155f60> 99 else: 100 self.memmaps.append(np.memmap(path_v, shape=shape, dtype=float))

File ~/miniforge3/envs/nDannot-env/lib/python3.10/site-packages/napari_nd_annotator/minimal_contour/feature_manager.py:112, in FeatureManager.start_feature_calculation(self=, layer=<Image layer 'DI17_2'>) 110 with warnings.catch_warnings(): 111 warnings.simplefilter("ignore") --> 112 slice_indices = layer._slice_indices layer = <Image layer 'DI17_2' at 0x763a95bd36a0> 113 dims_not_displayed = layer_dims_not_displayed(layer) 114 self.feature_extractor.start_jobs(layer.data, self.memmaps, slice_indices, dims_not_displayed, layer.rgb)

AttributeError: 'Image' object has no attribute '_slice_indices' Segmentation fault (core dumped) (nDannot-env) alobo2@alobo-ws:~$ napari /home/alobo2/miniforge3/envs/nDannot-env/lib/python3.10/site-packages/napari/utils/migrations.py:101: FutureWarning: Argument 'edge_color' is deprecated, please use 'border_color' instead. The argument 'edge_color' was deprecated in 0.5.0 and it will be removed in 0.6.0.!

AttributeError Traceback (most recent call last) File ~/miniforge3/envs/nDannot-env/lib/python3.10/site-packages/app_model/backends/qt/_qaction.py:57, in QCommandAction._on_triggered(self=QMenuItemAction(MenuItem(when=None, group='3_plu...Annotation Toolbox)'))), alt=None), app='napari'), checked=True) 53 def _on_triggered(self, checked: bool) -> None: 54 # execute_command returns a Future, for the sake of eventually being 55 # asynchronous without breaking the API. For now, we call result() 56 # to raise any exceptions. ---> 57 self._app.commands.execute_command(self._command_id).result() self._command_id = 'napari-nD-annotator:Annotation Toolbox' self = QMenuItemAction(MenuItem(when=None, group='3_plugin_contributions', order=None, command=CommandRule(id='napari-nD-annotator:Annotation Toolbox', title='Annotation Toolbox', category=None, tooltip=None, status_tip=None, icon=None, icon_visible_in_menu=True, enablement=None, short_title=None, toggled=ToggleRule(condition=None, get_current=functools.partial(<function _get_current_dock_status at 0x7e704cbe0d30>, full_name='Annotation Toolbox (Annotation Toolbox)'))), alt=None), app='napari') self._app = Application('napari')

File ~/miniforge3/envs/nDannot-env/lib/python3.10/site-packages/app_model/registries/_commands_reg.py:245, in CommandsRegistry.execute_command(self=<CommandsRegistry at 0x7e704cbf3340 (152 commands)>, id='napari-nD-annotator:Annotation Toolbox', execute_asynchronously=False, *args=(), **kwargs={}) 241 except Exception as e: 242 if self._raise_synchronous_exceptions: 243 # note, the caller of this function can also achieve this by 244 # calling future.result() on the returned future object. --> 245 raise e 246 future.set_exception(e) 248 return future

File ~/miniforge3/envs/nDannot-env/lib/python3.10/site-packages/app_model/registries/_commands_reg.py:240, in CommandsRegistry.execute_command(self=<CommandsRegistry at 0x7e704cbf3340 (152 commands)>, id='napari-nD-annotator:Annotation Toolbox', execute_asynchronously=False, *args=(), *kwargs={}) 238 future: Future = Future() 239 try: --> 240 future.set_result(cmd(args, **kwargs)) future = <Future at 0x7e701878efe0 state=pending> cmd = <function Store.inject.._inner.._exec at 0x7e70187737f0> args = () kwargs = {} 241 except Exception as e: 242 if self._raise_synchronous_exceptions: 243 # note, the caller of this function can also achieve this by 244 # calling future.result() on the returned future object.

File ~/.local/lib/python3.10/site-packages/in_n_out/_store.py:934, in Store.inject_processors.._deco.._exec(*args=(), kwargs={}) 932 @wraps(func) 933 def _exec(*args: P.args, *kwargs: P.kwargs) -> R: --> 934 result = func(args, kwargs) func = <function Store.inject.._inner.._exec at 0x7e7018773520> args = () kwargs = {} 935 if result is not None: 936 self.process( 937 result, 938 type_hint=type_hint, (...) 941 _funcname=getattr(func, "qualname", str(func)), 942 )

File ~/.local/lib/python3.10/site-packages/in_n_out/_store.py:804, in Store.inject.._inner.._exec(*args=(), kwargs={}) 797 logger.debug( 798 " Calling %s with %r (injected %r)", 799 _fname, 800 bound.arguments, 801 _injected_names, 802 ) 803 try: --> 804 result = func(bound.arguments) bound = <BoundArguments (plugin='napari-nD-annotator', widget_name='Annotation Toolbox', full_name='Annotation Toolbox (Annotation Toolbox)')> func = functools.partial(<function _toggle_or_get_widget at 0x7e704cbe0ca0>, plugin='napari-nD-annotator', widget_name='Annotation Toolbox', full_name='Annotation Toolbox (Annotation Toolbox)') bound.arguments = {'plugin': 'napari-nD-annotator', 'widget_name': 'Annotation Toolbox', 'full_name': 'Annotation Toolbox (Annotation Toolbox)'} 805 except TypeError as e: 806 if "missing" not in e.args[0]:

File ~/miniforge3/envs/nDannot-env/lib/python3.10/site-packages/napari/_qt/_qplugins/_qnpe2.py:350, in _toggle_or_get_widget(plugin='napari-nD-annotator', widget_name='Annotation Toolbox', full_name='Annotation Toolbox (Annotation Toolbox)') 348 if widget_param: 349 kwargs[widget_param] = viewer --> 350 return widget_callable(**kwargs), full_name kwargs = {'viewer': Viewer(camera=Camera(center=(0.0, 959.5, 1279.5), zoom=0.2070703125, angles=(0.0, 0.0, 90.0), perspective=0.0, mouse_pan=True, mouse_zoom=True), cursor=Cursor(position=(0.0, -509.2477596787735, 0.0), scaled=True, style=<CursorStyle.CROSSHAIR: 'crosshair'>, size=1.0), dims=Dims(ndim=3, ndisplay=2, order=(0, 1, 2), axis_labels=('0', '1', '2'), rollable=(True, True, True), range=(RangeTuple(start=-0.5, stop=511.5, step=1.0), RangeTuple(start=0.0, stop=1919.0, step=1.0), RangeTuple(start=0.0, stop=2559.0, step=1.0)), margin_left=(0.0, 0.0, 0.0), margin_right=(0.0, 0.0, 0.0), point=(0.0, 959.0, 1279.0), last_used=0), grid=GridCanvas(stride=1, shape=(-1, -1), enabled=False), layers=[<Image layer 'DI17_2' at 0x7e701831c790>, <Points layer '🔒 from E' at 0x7e6fac14e2c0>, <Points layer '🔒 to S' at 0x7e6fac1eaa40>, <Points layer '🔒 temp' at 0x7e7040963760>, <Points layer 'Anchors [DO NOT ALTER]' at 0x7e7040963430>], help='use <4> for pan/zoom, use <5> for transform, use <3> for select points', status='', tooltip=Tooltip(visible=False, text=''), theme='dark', title='napari', mouse_over_canvas=False, mouse_move_callbacks=[], mouse_drag_callbacks=[], mouse_double_click_callbacks=[], mouse_wheel_callbacks=[<function dims_scroll at 0x7e704dc965f0>], _persisted_mouse_event={}, _mouse_drag_gen={}, _mouse_wheel_gen={}, _keymap={<KeyBinding at 0x7e6fac14e3b0: Ctrl+1>: <function MinimalContourWidget.init..change_layer_callback..change_layer at 0x7e6fac16d870>, <KeyBinding at 0x7e6fac14e440: Ctrl+2>: <function MinimalContourWidget.init..change_layer_callback..change_layer at 0x7e6fac16d900>, <KeyBinding at 0x7e6fac14e4d0: Ctrl+3>: <function MinimalContourWidget.init..change_layer_callback..change_layer at 0x7e6fac16d990>, <KeyBinding at 0x7e6fac14e560: Ctrl+4>: <function MinimalContourWidget.init..change_layer_callback..change_layer at 0x7e6fac16da20>, <KeyBinding at 0x7e6fac14e5f0: Ctrl+5>: <function MinimalContourWidget.init..change_layer_callback..change_layer at 0x7e6fac16dab0>, <KeyBinding at 0x7e6fac14e680: Ctrl+6>: <function MinimalContourWidget.init..change_layer_callback..change_layer at 0x7e6fac16db40>, <KeyBinding at 0x7e6fac14e710: Ctrl+7>: <function MinimalContourWidget.init..change_layer_callback..change_layer at 0x7e6fac16dbd0>, <KeyBinding at 0x7e6fac14e7a0: Ctrl+8>: <function MinimalContourWidget.init..change_layer_callback..change_layer at 0x7e6fac16dc60>, <KeyBinding at 0x7e6fac14e830: Ctrl+9>: <function MinimalContourWidget.init..change_layer_callback..change_layer at 0x7e6fac16dcf0>, <KeyBinding at 0x7e6f9c1a8cd0: Ctrl+Tab>: <bound method MinimalContourWidget.swap_selection of <napari_nd_annotator._widgets.minimal_contour_widget.MinimalContourWidget object at 0x7e6fac135870>>})} widget_callable = <class 'napari_nd_annotator._widgets.annotator_module.AnnotatorWidget'> full_name = 'Annotation Toolbox (Annotation Toolbox)'

File ~/miniforge3/envs/nDannot-env/lib/python3.10/site-packages/napari_nd_annotator/_widgets/annotator_module.py:70, in AnnotatorWidget.init(self=, viewer=Viewer(camera=Camera(center=(0.0, 959.5, 1279.5)...MinimalContourWidget object at 0x7e6fac135870>>})) 67 self.interpolation_widget = InterpolationWidget(viewer, self) 68 tabs_widget.addTab(self.interpolation_widget, "Interpolation") ---> 70 self.minimal_contour_widget = MinimalContourWidget(viewer, self) viewer = Viewer(camera=Camera(center=(0.0, 959.5, 1279.5), zoom=0.2070703125, angles=(0.0, 0.0, 90.0), perspective=0.0, mouse_pan=True, mouse_zoom=True), cursor=Cursor(position=(0.0, -509.2477596787735, 0.0), scaled=True, style=<CursorStyle.CROSSHAIR: 'crosshair'>, size=1.0), dims=Dims(ndim=3, ndisplay=2, order=(0, 1, 2), axis_labels=('0', '1', '2'), rollable=(True, True, True), range=(RangeTuple(start=-0.5, stop=511.5, step=1.0), RangeTuple(start=0.0, stop=1919.0, step=1.0), RangeTuple(start=0.0, stop=2559.0, step=1.0)), margin_left=(0.0, 0.0, 0.0), margin_right=(0.0, 0.0, 0.0), point=(0.0, 959.0, 1279.0), last_used=0), grid=GridCanvas(stride=1, shape=(-1, -1), enabled=False), layers=[<Image layer 'DI17_2' at 0x7e701831c790>, <Points layer '🔒 from E' at 0x7e6fac14e2c0>, <Points layer '🔒 to S' at 0x7e6fac1eaa40>, <Points layer '🔒 temp' at 0x7e7040963760>, <Points layer 'Anchors [DO NOT ALTER]' at 0x7e7040963430>], help='use <4> for pan/zoom, use <5> for transform, use <3> for select points', status='', tooltip=Tooltip(visible=False, text=''), theme='dark', title='napari', mouse_over_canvas=False, mouse_move_callbacks=[], mouse_drag_callbacks=[], mouse_double_click_callbacks=[], mouse_wheel_callbacks=[<function dims_scroll at 0x7e704dc965f0>], _persisted_mouse_event={}, _mouse_drag_gen={}, _mouse_wheel_gen={}, _keymap={<KeyBinding at 0x7e6fac14e3b0: Ctrl+1>: <function MinimalContourWidget.init..change_layer_callback..change_layer at 0x7e6fac16d870>, <KeyBinding at 0x7e6fac14e440: Ctrl+2>: <function MinimalContourWidget.init..change_layer_callback..change_layer at 0x7e6fac16d900>, <KeyBinding at 0x7e6fac14e4d0: Ctrl+3>: <function MinimalContourWidget.init..change_layer_callback..change_layer at 0x7e6fac16d990>, <KeyBinding at 0x7e6fac14e560: Ctrl+4>: <function MinimalContourWidget.init..change_layer_callback..change_layer at 0x7e6fac16da20>, <KeyBinding at 0x7e6fac14e5f0: Ctrl+5>: <function MinimalContourWidget.init..change_layer_callback..change_layer at 0x7e6fac16dab0>, <KeyBinding at 0x7e6fac14e680: Ctrl+6>: <function MinimalContourWidget.init..change_layer_callback..change_layer at 0x7e6fac16db40>, <KeyBinding at 0x7e6fac14e710: Ctrl+7>: <function MinimalContourWidget.init..change_layer_callback..change_layer at 0x7e6fac16dbd0>, <KeyBinding at 0x7e6fac14e7a0: Ctrl+8>: <function MinimalContourWidget.init..change_layer_callback..change_layer at 0x7e6fac16dc60>, <KeyBinding at 0x7e6fac14e830: Ctrl+9>: <function MinimalContourWidget.init..change_layer_callback..change_layer at 0x7e6fac16dcf0>, <KeyBinding at 0x7e6f9c1a8cd0: Ctrl+Tab>: <bound method MinimalContourWidget.swap_selection of <napari_nd_annotator._widgets.minimal_contour_widget.MinimalContourWidget object at 0x7e6fac135870>>}) self = <napari_nd_annotator._widgets.annotator_module.AnnotatorWidget object at 0x7e7018773760> MinimalContourWidget = <class 'napari_nd_annotator._widgets.minimal_contour_widget.MinimalContourWidget'> 71 tabs_widget.addTab(self.minimal_contour_widget, "Minimal Contour") 73 if MinimalSurfaceWidget is not None:

File ~/miniforge3/envs/nDannot-env/lib/python3.10/site-packages/napari_nd_annotator/_widgets/minimal_contour_widget.py:322, in MinimalContourWidget.init(self=, viewer=Viewer(camera=Camera(center=(0.0, 959.5, 1279.5)...MinimalContourWidget object at 0x7e6fac135870>>}), parent=) 320 self.change_point_size(self.point_size_spinbox.value()) 321 self.store_orig_image() --> 322 self.set_use_smoothing(self.blur_image_checkbox.isChecked()) self.blur_image_checkbox = <PyQt5.QtWidgets.QCheckBox object at 0x7e6fac137880> self = <napari_nd_annotator._widgets.minimal_contour_widget.MinimalContourWidget object at 0x7e6fac135870> 323 self.smooth_contour_spinbox.setVisible(self.smooth_contour_checkbox.isChecked()) 324 self.apply_blurring()

File ~/miniforge3/envs/nDannot-env/lib/python3.10/site-packages/napari_nd_annotator/_widgets/minimal_contour_widget.py:337, in MinimalContourWidget.set_use_smoothing(self=, use_smoothing=False) 335 self.apply_blurring_button.setEnabled(use_smoothing) 336 self.apply_blurring() --> 337 self.set_image() self = <napari_nd_annotator._widgets.minimal_contour_widget.MinimalContourWidget object at 0x7e6fac135870>

File ~/miniforge3/envs/nDannot-env/lib/python3.10/site-packages/napari_nd_annotator/_widgets/minimal_contour_widget.py:674, in MinimalContourWidget.set_image(self=, *args=()) 672 self.feature_editor.execute() 673 else: --> 674 grad_x, grad_y = self.feature_manager.get_features(self.image.layer) self = <napari_nd_annotator._widgets.minimal_contour_widget.MinimalContourWidget object at 0x7e6fac135870> self.feature_manager = <napari_nd_annotator.minimal_contour.feature_manager.FeatureManager object at 0x7e6fac138bb0> 675 if grad_x is not None: 676 with warnings.catch_warnings():

File ~/miniforge3/envs/nDannot-env/lib/python3.10/site-packages/napari_nd_annotator/minimal_contour/feature_manager.py:40, in FeatureManager.get_features(self=, layer=<Image layer 'DI17_2'>, block=True) 38 dims_not_displayed = tuple(layer_dims_not_displayed(layer)) 39 if layer != self.layer or dims_displayed != self.dims_displayed: ---> 40 self.init_file(layer, dims_displayed) dims_displayed = (0, 1) layer = <Image layer 'DI17_2' at 0x7e701831c790> self = <napari_nd_annotator.minimal_contour.feature_manager.FeatureManager object at 0x7e6fac138bb0> 41 with warnings.catch_warnings(): 42 warnings.simplefilter("ignore")

File ~/miniforge3/envs/nDannot-env/lib/python3.10/site-packages/napari_nd_annotator/minimal_contour/feature_manager.py:98, in FeatureManager.init_file(self=, layer=<Image layer 'DI17_2'>, dims_displayed=(0, 1)) 96 self.memmaps.append(np.memmap(path_v, shape=shape, dtype=float, mode="w+")) 97 self.memmaps.append(np.memmap(path_h, shape=shape, dtype=float, mode="w+")) ---> 98 self.start_feature_calculation(layer) layer = <Image layer 'DI17_2' at 0x7e701831c790> self = <napari_nd_annotator.minimal_contour.feature_manager.FeatureManager object at 0x7e6fac138bb0> 99 else: 100 self.memmaps.append(np.memmap(path_v, shape=shape, dtype=float))

File ~/miniforge3/envs/nDannot-env/lib/python3.10/site-packages/napari_nd_annotator/minimal_contour/feature_manager.py:112, in FeatureManager.start_feature_calculation(self=, layer=<Image layer 'DI17_2'>) 110 with warnings.catch_warnings(): 111 warnings.simplefilter("ignore") --> 112 slice_indices = layer._slice_indices layer = <Image layer 'DI17_2' at 0x7e701831c790> 113 dims_not_displayed = layer_dims_not_displayed(layer) 114 self.feature_extractor.start_jobs(layer.data, self.memmaps, slice_indices, dims_not_displayed, layer.rgb)

AttributeError: 'Image' object has no attribute '_slice_indices'

bauerdavid commented 1 month ago

For starters trying on Linux is also super helpful! Try to install the plugin as: python -m pip install git+https://github.com/bauerdavid/napari-nD-annotator. This will install the newest unpublished version of the plugin from source.

aloboa commented 1 month ago

It works very nicely on napari 0.5.4 (linux), thanks! I will try to install on windows tomorrow, I would like to get a few people digitizing for a project next week and they all use windows.

bauerdavid commented 1 month ago

Great, thanks! I'll try to release asap, just need to fix some things before that.

aloboa commented 1 month ago

Tried on Windows too. I installed miniconda and then last version of napari:

conda create -y -n napari-env -c conda-forge python=3.10
conda activate napari-env
conda install -c conda-forge napari pyqt
conda update napari
python -m pip install git+https://github.com/bauerdavid/napari-nD-annotator

failed because git was not installed in this machine. I installed https://github.com/git-for-windows/git/releases/download/v2.46.2.windows.1/Git-2.46.2-64-bit.exe and had to reboot python -m pip install git+https://github.com/bauerdavid/napari-nD-annotator the git download worked but installation failed again because Visual Studio Build Tools 2022 was required and had not been installed in this machine:

  running build_ext
      building 'napari_nd_annotator.minimal_contour._eikonal_wrapper' extension
      error: Microsoft Visual C++ 14.0 or greater is required. Get it with "Microsoft C++ Build Tools": https://visualstudio.microsoft.com/visual-cpp-build-tools/
      [end of output]

  note: This error originates from a subprocess, and is likely not a problem with pip.
  ERROR: Failed building wheel for napari-nD-annotator
Failed to build napari-nD-annotator
ERROR: ERROR: Failed to build installable wheels for some pyproject.toml based projects (napari-nD-annotator)

I installed Visual Studio Build Tools 2022 from https://aka.ms/vs/17/release/vs_BuildTools.exe (which is a pain, could this be avoided in the future?) and this time python -m pip install git+https://github.com/bauerdavid/napari-nD-annotator worked. The plugin is being used in that machine now.

aloboa commented 1 month ago

At least with the windows installation, the plugin does not work with color images. Once I start the plugin and dro the image, I get:

napari-env) C:\Users\Nuria>napari
Traceback (most recent call last):
  File "C:\Users\Nuria\miniconda3\envs\napari-env\lib\site-packages\napari_nd_annotator\_widgets\_utils\persistence\persistent_widget_state.py", line 37, in __init__
    with open(self._config_path, "w") as new_file, open(default_settings_path, "r") as def_file:
FileNotFoundError: [Errno 2] No such file or directory: 'C:/Users/Nuria/AppData/Local/napari/napari\\nd_annotator_config.yaml'
C:\Users\Nuria\miniconda3\envs\napari-env\lib\site-packages\napari_nd_annotator\_widgets\_utils\persistence\persistent_widget_state.py:77: UserWarning: id 'fill_objects_checkbox' not found in config file!
Traceback (most recent call last):
  File "C:\Users\Nuria\miniconda3\envs\napari-env\lib\site-packages\napari_nd_annotator\_widgets\_utils\persistence\persistent_widget_state.py", line 37, in __init__
    with open(self._config_path, "w") as new_file, open(default_settings_path, "r") as def_file:
FileNotFoundError: [Errno 2] No such file or directory: 'C:/Users/Nuria/AppData/Local/napari/napari\\nd_annotator_config.yaml'
C:\Users\Nuria\miniconda3\envs\napari-env\lib\site-packages\napari_nd_annotator\_widgets\_utils\persistence\persistent_widget_state.py:77: UserWarning: id 'method_dropdown' not found in config file!
C:\Users\Nuria\miniconda3\envs\napari-env\lib\site-packages\napari_nd_annotator\_widgets\_utils\persistence\persistent_widget_state.py:77: UserWarning: id 'n_points' not found in config file!
C:\Users\Nuria\miniconda3\envs\napari-env\lib\site-packages\napari_nd_annotator\_widgets\_utils\persistence\persistent_widget_state.py:77: UserWarning: id 'rpsv_iterations_spinbox' not found in config file!
Traceback (most recent call last):
  File "C:\Users\Nuria\miniconda3\envs\napari-env\lib\site-packages\napari_nd_annotator\_widgets\_utils\persistence\persistent_widget_state.py", line 37, in __init__
    with open(self._config_path, "w") as new_file, open(default_settings_path, "r") as def_file:
FileNotFoundError: [Errno 2] No such file or directory: 'C:/Users/Nuria/AppData/Local/napari/napari\\nd_annotator_config.yaml'
C:\Users\Nuria\miniconda3\envs\napari-env\lib\site-packages\napari_nd_annotator\_widgets\_utils\persistence\persistent_widget_state.py:77: UserWarning: id 'feature_dropdown' not found in config file!
C:\Users\Nuria\miniconda3\envs\napari-env\lib\site-packages\napari_nd_annotator\_widgets\_utils\persistence\persistent_widget_state.py:77: UserWarning: id 'param_spinbox' not found in config file!
C:\Users\Nuria\miniconda3\envs\napari-env\lib\site-packages\napari_nd_annotator\_widgets\_utils\persistence\persistent_widget_state.py:77: UserWarning: id 'blur_image_checkbox' not found in config file!
C:\Users\Nuria\miniconda3\envs\napari-env\lib\site-packages\napari_nd_annotator\_widgets\_utils\persistence\persistent_widget_state.py:77: UserWarning: id 'blur_image_slider' not found in config file!
C:\Users\Nuria\miniconda3\envs\napari-env\lib\site-packages\napari_nd_annotator\_widgets\_utils\persistence\persistent_widget_state.py:77: UserWarning: id 'smooth_contour_checkbox' not found in config file!
C:\Users\Nuria\miniconda3\envs\napari-env\lib\site-packages\napari_nd_annotator\_widgets\_utils\persistence\persistent_widget_state.py:77: UserWarning: id 'smooth_contour_spinbox' not found in config file!
C:\Users\Nuria\miniconda3\envs\napari-env\lib\site-packages\napari_nd_annotator\_widgets\_utils\persistence\persistent_widget_state.py:77: UserWarning: id 'point_size_spinbox' not found in config file!
C:\Users\Nuria\miniconda3\envs\napari-env\lib\site-packages\napari\utils\migrations.py:101: FutureWarning: Argument 'edge_color' is deprecated, please use 'border_color' instead. The argument 'edge_color' was deprecated in 0.5.0 and it will be removed in 0.6.0.!
image should have 3 channels

Only the 1st point is set, if I go on clicking, napari crashes:

WARNING: QObject::killTimer: Timers cannot be stopped from another thread
11:39:13 : WARNING : Dummy-1 : QObject::killTimer: Timers cannot be stopped from another thread
WARNING: QObject::~QObject: Timers cannot be stopped from another thread
11:39:13 : WARNING : Dummy-1 : QObject::~QObject: Timers cannot be stopped from another thread
aloboa commented 1 month ago

Instead, the plugin works fine on linux, including color images. The only output to the console is:

$ napari
/home/alobo2/miniforge3/envs/nDannot-env/lib/python3.10/site-packages/napari/utils/migrations.py:101: FutureWarning: Argument 'edge_color' is deprecated, please use 'border_color' instead. The argument 'edge_color' was deprecated in 0.5.0 and it will be removed in 0.6.0.!
bauerdavid commented 1 month ago

That's strange... Could you send the image you want to annotate? I'm working on a Windows machine, and works fine for me with rgb images.

aloboa commented 1 month ago
  1. Note that, before adding any image, the windows installation writes error messages to the console as soon as the plugin is activated
Traceback (most recent call last):
  File "C:\Users\avill\miniconda3\envs\napari-env\lib\site-packages\napari_nd_annotator\_widgets\_utils\persistence\persistent_widget_state.py", line 37, in __init__
    with open(self._config_path, "w") as new_file, open(default_settings_path, "r") as def_file:
FileNotFoundError: [Errno 2] No such file or directory: 'C:/Users/avill/AppData/Local/napari/napari\\nd_annotator_config.yaml'
C:\Users\avill\miniconda3\envs\napari-env\lib\site-packages\napari_nd_annotator\_widgets\_utils\persistence\persistent_widget_state.py:77: UserWarning: id 'fill_objects_checkbox' not found in config file!
Traceback (most recent call last):
  File "C:\Users\avill\miniconda3\envs\napari-env\lib\site-packages\napari_nd_annotator\_widgets\_utils\persistence\persistent_widget_state.py", line 37, in __init__
    with open(self._config_path, "w") as new_file, open(default_settings_path, "r") as def_file:
FileNotFoundError: [Errno 2] No such file or directory: 'C:/Users/avill/AppData/Local/napari/napari\\nd_annotator_config.yaml'
C:\Users\avill\miniconda3\envs\napari-env\lib\site-packages\napari_nd_annotator\_widgets\_utils\persistence\persistent_widget_state.py:77: UserWarning: id 'method_dropdown' not found in config file!
C:\Users\avill\miniconda3\envs\napari-env\lib\site-packages\napari_nd_annotator\_widgets\_utils\persistence\persistent_widget_state.py:77: UserWarning: id 'n_points' not found in config file!
C:\Users\avill\miniconda3\envs\napari-env\lib\site-packages\napari_nd_annotator\_widgets\_utils\persistence\persistent_widget_state.py:77: UserWarning: id 'rpsv_iterations_spinbox' not found in config file!
Traceback (most recent call last):
  File "C:\Users\avill\miniconda3\envs\napari-env\lib\site-packages\napari_nd_annotator\_widgets\_utils\persistence\persistent_widget_state.py", line 37, in __init__
    with open(self._config_path, "w") as new_file, open(default_settings_path, "r") as def_file:
FileNotFoundError: [Errno 2] No such file or directory: 'C:/Users/avill/AppData/Local/napari/napari\\nd_annotator_config.yaml'
C:\Users\avill\miniconda3\envs\napari-env\lib\site-packages\napari_nd_annotator\_widgets\_utils\persistence\persistent_widget_state.py:77: UserWarning: id 'feature_dropdown' not found in config file!
C:\Users\avill\miniconda3\envs\napari-env\lib\site-packages\napari_nd_annotator\_widgets\_utils\persistence\persistent_widget_state.py:77: UserWarning: id 'param_spinbox' not found in config file!
C:\Users\avill\miniconda3\envs\napari-env\lib\site-packages\napari_nd_annotator\_widgets\_utils\persistence\persistent_widget_state.py:77: UserWarning: id 'blur_image_checkbox' not found in config file!
C:\Users\avill\miniconda3\envs\napari-env\lib\site-packages\napari_nd_annotator\_widgets\_utils\persistence\persistent_widget_state.py:77: UserWarning: id 'blur_image_slider' not found in config file!
C:\Users\avill\miniconda3\envs\napari-env\lib\site-packages\napari_nd_annotator\_widgets\_utils\persistence\persistent_widget_state.py:77: UserWarning: id 'smooth_contour_checkbox' not found in config file!
C:\Users\avill\miniconda3\envs\napari-env\lib\site-packages\napari_nd_annotator\_widgets\_utils\persistence\persistent_widget_state.py:77: UserWarning: id 'smooth_contour_spinbox' not found in config file!
C:\Users\avill\miniconda3\envs\napari-env\lib\site-packages\napari_nd_annotator\_widgets\_utils\persistence\persistent_widget_state.py:77: UserWarning: id 'point_size_spinbox' not found in config file!
C:\Users\avill\miniconda3\envs\napari-env\lib\site-packages\napari\utils\migrations.py:101: FutureWarning: Argument 'edge_color' is deprecated, please use 'border_color' instead. The argument 'edge_color' was deprecated in 0.5.0 and it will be removed in 0.6.0.!
  1. Some color images add these messages to the console as we mark points https://www.dropbox.com/scl/fi/5asthht2y8m70t2mgyefq/pantano1_mini.tif?rlkey=dh8skoe8kbahxpfuosd45bo9g&dl=0 (not a microscopy image, just part of a lager image)
C:\Users\avill\miniconda3\envs\napari-env\lib\site-packages\napari_nd_annotator\_widgets\minimal_contour_widget.py:709: UserWarning: Cannot delete a single point. Cleared all anchor points!
C:\Users\avill\miniconda3\envs\napari-env\lib\site-packages\napari_nd_annotator\_widgets\minimal_contour_widget.py:414: UserWarning: There's nothing to revert.!
image should have 3 channels
image should have 3 channels
image should have 3 channels
image should have 3 channels
  1. The actual crash was related to the image size, not to the color. Large color image (just one I happen to have, not microscopy) (crashing): https://www.dropbox.com/scl/fi/05addu428ytwnp55j7050/pantano1_200.tif?rlkey=a9ywy3pg0miwoagthe0xk4ocd&dl=0

  2. This microscopy color image behaves as the grey scale one: https://www.dropbox.com/scl/fi/5nyxye9n1br6lbr0bzhh3/DI_17_2.tif?rlkey=z47tmleq888wg06rdhc3cc6iz&dl=0

bauerdavid commented 1 month ago
  1. This comes from a bug when writing the current settings to disk. This will be done by another Python module, hopefully that will solve the issue.
  2. Wow, as it turns out the plugin couldn't handle RGBA images. I managed to fix it, I'll post the updated code soon.
  3. The problem is that the plugin can't handle too big images, as image features are calculated for the whole image (in 3D images the current slice). In the future I want to change this and compute only for the currently visible part, also considering the displayed resolution (that is if we are looking at a whole slide image, we won't need the original resolution).
  4. It works because it doesn't have a 4th channel (see point 2.)
aloboa commented 1 month ago

Regarding RGBA images, not a big problem once we know it. The A channel is always constant in our images (and not all programs actually write it), so we will just eliminate it.