AllenCell / napari-allencell-segmenter

A plugin that enables image segmentation provided by Allen Institute for Cell Science
BSD 3-Clause "New" or "Revised" License
16 stars 6 forks source link

Plugin crashes with multichannel CZI images #116

Closed yrkim98 closed 3 years ago

yrkim98 commented 3 years ago

Reported by Derek Thirstrup

Description

When loading an multichannel CZI via the napari segmenter plugin, the segmenter GUI does not even pop up and the program crashes

---------------------------------------------------------------------------
error                                     Traceback (most recent call last)
d:\users\derekt\anaconda3\envs\naparisegmenter\lib\site-packages\napari\_qt\qt_main_window.py in _add_widget(key=('napari-allencell-segmenter', 'Workflow editor'), hook_type='dock', *args=(False,))
    859                 def _add_widget(*args, key=key, hook_type=hook_type):
    860                     if hook_type == 'dock':
--> 861                         self.add_plugin_dock_widget(*key)
        global self.add_plugin_dock_widget = undefined
        key = ('napari-allencell-segmenter', 'Workflow editor')
    862                     else:
    863                         self._add_plugin_function_widget(*key)
d:\users\derekt\anaconda3\envs\naparisegmenter\lib\site-packages\napari\_qt\qt_main_window.py in add_plugin_dock_widget(self=, plugin_name='napari-allencell-segmenter', widget_name='Workflow editor')
    990 
    991         # instantiate the widget
--> 992         wdg = Widget(**kwargs)
        wdg = undefined
        Widget = 
        kwargs = {'napari_viewer': Viewer(axes=Axes(visible=False, labels=True, colored=True, dashed=False, arrows=True), camera=Camera(center=(0.0, 311.5, 461.5), zoom=1.5304777673563923, angles=(0.0, 0.0, 90.0), perspective=0.0, interactive=True), cursor=Cursor(position=(0.0, 607.1593137495445, 969.1846084511852), scaled=True, size=1, style='standard'), dims=Dims(ndim=3, ndisplay=2, last_used=2, range=((0.0, 74.0, 1.0), (0.0, 623.0, 1.0), (0.0, 923.0, 1.0)), current_step=(0, 0, 0), order=(0, 1, 2), axis_labels=('0', '1', '2')), grid=GridCanvas(enabled=False, stride=1, shape=(-1, -1)), layers=[, , , ], scale_bar=ScaleBar(visible=False, colored=False, ticks=True, position='bottom_right', font_size=10.0, unit=None), text_overlay=TextOverlay(visible=False, color=array([1., 1., 1., 1.]), font_size=10.0, position='top_left', text=''), help='', status='H3342 [  0 607 969]', tooltip=Tooltip(visible=False, text=''), theme='dark', title='napari', mouse_move_callbacks=[], mouse_drag_callbacks=[], mouse_wheel_callbacks=[], _persisted_mouse_event={}, _mouse_drag_gen={}, _mouse_wheel_gen={}, keymap={'Control-Shift-C': >})}
    993 
    994         # Add dock widget
d:\users\derekt\anaconda3\envs\naparisegmenter\lib\site-packages\napari_allencell_segmenter\_dock_widget.py in __init__(self=, napari_viewer=Viewer(axes=Axes(visible=False, labels=True, col..._viewer.QtViewer object at 0x0000007524C79670>>}))
     19         self.layout().setContentsMargins(0, 0, 0, 0)
     20         self._application = Application(napari_viewer, self.layout())
---> 21         self._application.router.workflow_selection()  # Initialize first screen
        self._application.router.workflow_selection = >
     22 
     23 
d:\users\derekt\anaconda3\envs\naparisegmenter\lib\site-packages\napari_allencell_segmenter\core\router.py in workflow_selection(self=)
     21     def workflow_selection(self):
     22         controller = WorkflowSelectController(self._application, self._layer_reader, self._workflow_engine)
---> 23         self._handle_navigation(controller)
        self._handle_navigation = >
        controller = 
     24 
     25     def workflow_steps(self):
d:\users\derekt\anaconda3\envs\naparisegmenter\lib\site-packages\napari_allencell_segmenter\core\router.py in _handle_navigation(self=, controller=)
     35             self._controller.cleanup()
     36         self._controller = controller
---> 37         self._controller.index()
        self._controller.index = >
d:\users\derekt\anaconda3\envs\naparisegmenter\lib\site-packages\napari_allencell_segmenter\controller\workflow_select_controller.py in index(self=)
     42         self.model.workflows = self._workflow_engine.workflow_definitions
     43 
---> 44         self.load_view(self._view, self.model)

Derek said that he was able to load in image and run segmentations successfully after the latest patch, but the plugin stopped working shortly thereafter.

Expected Behavior

We expect the napari to load the image to the UI and allow the user to perform segmentations via our plugin.

Reproduction

If you load a multichannel CZI (Derek used one located here) \\allen\aics\microscopy\StructureSegmentationTesting\data\terf2\batch into napari the segmenter GUI does not even pop up and napari crashes.

Brian tried to reproduce this error using the same dependencies and dataset as Derek but everything worked locally.

Environment

Could be an issue with aicsimageio==4.0.3, be sure to try that version to reproduce this issue.

schoinh commented 3 years ago

Slack message from @derekthirstrup : "I was able to run segmenter with a new environment but it kept stopping after image normalization step 1 when I added the aicsimageio plugin so I could test with multichannel czi files."

See full thread: https://allencellscience.slack.com/archives/C01L7L5M29H/p1626110941152900?thread_ts=1625862947.149100&cid=C01L7L5M29H

schoinh commented 3 years ago

I was able to reproduce what I think is the same error. Steps:

  1. Download 3500004429_100X_20210406-Scene-026-P26-E08.czi (first file in the list) from \\allen\aics\microscopy\StructureSegmentationTesting\data\terf2\batch
  2. Create a fresh conda environment conda create -y -n derek python=3.9
  3. Activate env conda activate derek
  4. Install napari pip install "napari[all]"
  5. Open napari napari
  6. Try to open the .czi file via drag-and-drop, get an error saying Napari can't open that kind of file
  7. Install napari-aicsimageio plugin according to directions on napari hub
  8. Successfullly open the .czi file by drag and drop
  9. Install segmenter plugin according to napari hub directions
  10. Try to launch the segmenter plugin's workflow editor → Error, does not even load plugin UI

Error screenshot (most recent function call): image image

schoinh commented 3 years ago

@yrkim98 and I discovered that at the end of June the aicsimageio napari plugin started to use aicsimageio v4 under the hood, but the aicsimageio version we use for this segmenter plugin is pinned to <4. This version mismatch is probably related to this bug and should be fixed regardless.