Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Two Voronoi Otsu Labelings, but one results in error #48

Open
psobolewskiPhD opened this issue Feb 13, 2022 · 1 comment
Open

Two Voronoi Otsu Labelings, but one results in error #48

psobolewskiPhD opened this issue Feb 13, 2022 · 1 comment

Comments

@psobolewskiPhD
Copy link
Contributor

The drop down in the Label widget has in the Operation list two entries for voronoi otsu labeling:
image
The top one: Voronoi-Otsu-labeling results in a long spinning beachball and error on macOS 12.1, napari 0.4.14:

2022-02-13 11:10:38.267 | INFO     | napari_pyclesperanto_assistant._gui._category_widget:call_op:120 - cle.voronoi_otsu_labeling (clesperanto)(..., 2.0, 2.0)
2022-02-13 11:10:38.650 | DEBUG    | napari_pyclesperanto_assistant._gui._category_widget:_show_result:219 - creating new layer for id: 5502808128
2022-02-13 11:11:02.776 | ERROR    | napari_pyclesperanto_assistant._gui._category_widget:gui_function:324 - An error has been caught in function 'gui_function', process 'MainProcess' (27274), thread 'MainThread' (4342056320):
Traceback (most recent call last):

  File "/Users/piotrsobolewski/Dev/miniforge3/envs/napari-CL/bin/napari", line 10, in <module>
    sys.exit(main())
    │   │    └ <function main at 0x12442c790>
    │   └ <built-in function exit>
    └ <module 'sys' (built-in)>
  File "/Users/piotrsobolewski/Dev/miniforge3/envs/napari-CL/lib/python3.9/site-packages/napari/__main__.py", line 449, in main
    _run()
    └ <function _run at 0x12442c5e0>
  File "/Users/piotrsobolewski/Dev/miniforge3/envs/napari-CL/lib/python3.9/site-packages/napari/__main__.py", line 338, in _run
    run(gui_exceptions=True)
    └ <function run at 0x12480ca60>
  File "/Users/piotrsobolewski/Dev/miniforge3/envs/napari-CL/lib/python3.9/site-packages/napari/_qt/qt_event_loop.py", line 402, in run
    app.exec_()
    │   └ <built-in method exec_>
    └ <PyQt5.QtWidgets.QApplication object at 0x124fbddc0>
  File "/Users/piotrsobolewski/Dev/miniforge3/envs/napari-CL/lib/python3.9/site-packages/magicgui/backends/_qtpy/widgets.py", line 646, in _emit_data
    self._event_filter.valueChanged.emit(self._qwidget.itemData(index))
    │    │             │                 │    │        │        └ 7
    │    │             │                 │    │        └ <built-in method itemData>
    │    │             │                 │    └ <PyQt5.QtWidgets.QComboBox object at 0x13169aee0>
    │    │             │                 └ <magicgui.backends._qtpy.widgets.ComboBox object at 0x1316907f0>
    │    │             └ <unbound PYQT_SIGNAL valueChanged(PyQt_PyObject)>
    │    └ <magicgui.backends._qtpy.widgets.EventFilter object at 0x13169a280>
    └ <magicgui.backends._qtpy.widgets.ComboBox object at 0x1316907f0>
  File "/Users/piotrsobolewski/Dev/miniforge3/envs/napari-CL/lib/python3.9/site-packages/magicgui/widgets/_bases/value_widget.py", line 57, in _on_value_change
    self.changed.emit(value)
    │    │       │    └ 'Voronoi-Otsu-labeling (clesperanto)'
    │    │       └ <cyfunction SignalInstance.emit at 0x103049790>
    │    └ <SignalInstance 'changed' on ComboBox(value='Voronoi-Otsu-labeling (clesperanto)', annotation=<class 'str'>, name='op_name')>
    └ ComboBox(value='Voronoi-Otsu-labeling (clesperanto)', annotation=<class 'str'>, name='op_name')
  File "/Users/piotrsobolewski/Dev/miniforge3/envs/napari-CL/lib/python3.9/site-packages/magicgui/events.py", line 85, in _run_emit_loop
    cb(*args[:max_args])
    │   │     └ 0
    │   └ ('Voronoi-Otsu-labeling (clesperanto)',)
    └ <function ContainerWidget.insert.<locals>.<lambda> at 0x16c820e50>
  File "/Users/piotrsobolewski/Dev/miniforge3/envs/napari-CL/lib/python3.9/site-packages/magicgui/widgets/_bases/container_widget.py", line 165, in <lambda>
    widget.changed.connect(lambda: self.changed.emit(self))
                                   │    │       │    └ <FunctionGui do_label(*, input0: napari.layers.base.base.Layer = <Image layer 'Image:0' at 0x14f5089d0>, op_name: str = 'Voro...
                                   │    │       └ <cyfunction SignalInstance.emit at 0x103049790>
                                   │    └ <SignalInstance 'changed' on <FunctionGui do_label(*, input0: napari.layers.base.base.Layer = <Image layer 'Image:0' at 0x14f...
                                   └ <FunctionGui do_label(*, input0: napari.layers.base.base.Layer = <Image layer 'Image:0' at 0x14f5089d0>, op_name: str = 'Voro...
  File "/Users/piotrsobolewski/Dev/miniforge3/envs/napari-CL/lib/python3.9/site-packages/magicgui/events.py", line 85, in _run_emit_loop
    cb(*args[:max_args])
    │   │     └ 0
    │   └ (<FunctionGui do_label(*, input0: napari.layers.base.base.Layer = <Image layer 'Image:0' at 0x14f5089d0>, op_name: str = 'Vor...
    └ <bound method FunctionGui._on_change of <FunctionGui do_label(*, input0: napari.layers.base.base.Layer = <Image layer 'Image:...
  File "/Users/piotrsobolewski/Dev/miniforge3/envs/napari-CL/lib/python3.9/site-packages/magicgui/widgets/_function_gui.py", line 221, in _on_change
    self()
    └ <FunctionGui do_label(*, input0: napari.layers.base.base.Layer = <Image layer 'Image:0' at 0x14f5089d0>, op_name: str = 'Voro...
  File "/Users/piotrsobolewski/Dev/miniforge3/envs/napari-CL/lib/python3.9/site-packages/magicgui/widgets/_function_gui.py", line 303, in __call__
    value = self._function(*bound.args, **bound.kwargs)
            │    │          │     │       │     └ <property object at 0x10301e130>
            │    │          │     │       └ <BoundArguments (input0=<Image layer 'Image:0' at 0x14f5089d0>, op_name='Voronoi-Otsu-labeling (clesperanto)', x=2.0, y=2.0, ...
            │    │          │     └ <property object at 0x10301e0e0>
            │    │          └ <BoundArguments (input0=<Image layer 'Image:0' at 0x14f5089d0>, op_name='Voronoi-Otsu-labeling (clesperanto)', x=2.0, y=2.0, ...
            │    └ <function make_gui_for_category.<locals>.gui_function at 0x147fe3040>
            └ <FunctionGui do_label(*, input0: napari.layers.base.base.Layer = <Image layer 'Image:0' at 0x14f5089d0>, op_name: str = 'Voro...
> File "/Users/piotrsobolewski/Dev/miniforge3/envs/napari-CL/lib/python3.9/site-packages/napari_pyclesperanto_assistant/_gui/_category_widget.py", line 324, in gui_function
    result, used_args = call_op(op_name, inputs, t_position, viewer, **kwargs)
                        │       │        │       │           │         └ {'x': 2.0, 'y': 2.0, 'z': 0.0, 'u': 0.0, 'v': 0.0, 'w': 0.0, 'a': False, 'b': False, 'c': False, 'k': '', 'l': '', 'm': ''}
                        │       │        │       │           └ Viewer(axes=Axes(visible=False, labels=True, colored=True, dashed=False, arrows=True), camera=Camera(center=(0.0, 126.5, 127....
                        │       │        │       └ None
                        │       │        └ [<Image layer 'Image:0' at 0x14f5089d0>]
                        │       └ 'Voronoi-Otsu-labeling (clesperanto)'
                        └ <function call_op at 0x14df454c0>
  File "/Users/piotrsobolewski/Dev/miniforge3/envs/napari-CL/lib/python3.9/site-packages/napari_pyclesperanto_assistant/_gui/_category_widget.py", line 154, in call_op
    gpu_out = gpu_out.astype(int)
              │       └ <function OCLArray.astype at 0x14d91e700>
              └ cl.Array([[ 0,  0,  0, ..., 86, 86, 86],
                       [ 0,  0,  0, ..., 86, 86, 86],
                       [ 0,  0,  0, ..., 86, 86, 86],
                       ....
  File "/Users/piotrsobolewski/Dev/miniforge3/envs/napari-CL/lib/python3.9/site-packages/pyclesperanto_prototype/_tier0/_pycl.py", line 148, in astype
    return copy(self, copied)
           │    │     └ cl.Array([[0, 0, 0, ..., 0, 0, 0],
           │    │              [0, 0, 0, ..., 0, 0, 0],
           │    │              [0, 0, 0, ..., 0, 0, 0],
           │    │              ...,
           │    │              [0, 0, ...
           │    └ cl.Array([[ 0,  0,  0, ..., 86, 86, 86],
           │             [ 0,  0,  0, ..., 86, 86, 86],
           │             [ 0,  0,  0, ..., 86, 86, 86],
           │             ....
           └ <function copy at 0x14d93c280>
  File "/Users/piotrsobolewski/Dev/miniforge3/envs/napari-CL/lib/python3.9/site-packages/pyclesperanto_prototype/_tier0/_plugin_function.py", line 71, in worker_function
    return function(*bound.args, **bound.kwargs)
           │         │     │       │     └ <property object at 0x10301e130>
           │         │     │       └ <BoundArguments (source=cl.Array([[ 0,  0,  0, ..., 86, 86, 86],
           │         │     │                [ 0,  0,  0, ..., 86, 86, 86],
           │         │     │                [ 0,  0,  0, .....
           │         │     └ <property object at 0x10301e0e0>
           │         └ <BoundArguments (source=cl.Array([[ 0,  0,  0, ..., 86, 86, 86],
           │                  [ 0,  0,  0, ..., 86, 86, 86],
           │                  [ 0,  0,  0, .....
           └ <function copy at 0x14d93c1f0>
  File "/Users/piotrsobolewski/Dev/miniforge3/envs/napari-CL/lib/python3.9/site-packages/pyclesperanto_prototype/_tier1/_copy.py", line 36, in copy
    execute(__file__, '../clij-opencl-kernels/kernels/copy_' + str(len(destination.shape)) + 'd_x.cl', 'copy_' + str(len(destination.shape)) + 'd', destination.shape, parameters)
    │       │                                                          │           │                                     │           │              │           │      └ {'dst': cl.Array([[0, 0, 0, ..., 0, 0, 0],
    │       │                                                          │           │                                     │           │              │           │               [0, 0, 0, ..., 0, 0, 0],
    │       │                                                          │           │                                     │           │              │           │               [0, 0, 0, ..., 0, 0, 0],
    │       │                                                          │           │                                     │           │              │           │               ...,
    │       │                                                          │           │                                     │           │              │           │              ...
    │       │                                                          │           │                                     │           │              │           └ (254, 256)
    │       │                                                          │           │                                     │           │              └ cl.Array([[0, 0, 0, ..., 0, 0, 0],
    │       │                                                          │           │                                     │           │                       [0, 0, 0, ..., 0, 0, 0],
    │       │                                                          │           │                                     │           │                       [0, 0, 0, ..., 0, 0, 0],
    │       │                                                          │           │                                     │           │                       ...,
    │       │                                                          │           │                                     │           │                       [0, 0, ...
    │       │                                                          │           │                                     │           └ (254, 256)
    │       │                                                          │           │                                     └ cl.Array([[0, 0, 0, ..., 0, 0, 0],
    │       │                                                          │           │                                              [0, 0, 0, ..., 0, 0, 0],
    │       │                                                          │           │                                              [0, 0, 0, ..., 0, 0, 0],
    │       │                                                          │           │                                              ...,
    │       │                                                          │           │                                              [0, 0, ...
    │       │                                                          │           └ (254, 256)
    │       │                                                          └ cl.Array([[0, 0, 0, ..., 0, 0, 0],
    │       │                                                                   [0, 0, 0, ..., 0, 0, 0],
    │       │                                                                   [0, 0, 0, ..., 0, 0, 0],
    │       │                                                                   ...,
    │       │                                                                   [0, 0, ...
    │       └ '/Users/piotrsobolewski/Dev/miniforge3/envs/napari-CL/lib/python3.9/site-packages/pyclesperanto_prototype/_tier1/_copy.py'
    └ <function execute at 0x14d7d24c0>
  File "/Users/piotrsobolewski/Dev/miniforge3/envs/napari-CL/lib/python3.9/site-packages/pyclesperanto_prototype/_tier0/_execute.py", line 3, in execute
    return Backend.get_instance().get().execute(anchor, opencl_kernel_filename, kernel_name, global_size, parameters, prog, constants, image_size_independent_kernel_compilation, device)
           │       │                            │       │                       │            │            │           │     │          │                                          └ None
           │       │                            │       │                       │            │            │           │     │          └ None
           │       │                            │       │                       │            │            │           │     └ None
           │       │                            │       │                       │            │            │           └ None
           │       │                            │       │                       │            │            └ {'dst': cl.Array([[0, 0, 0, ..., 0, 0, 0],
           │       │                            │       │                       │            │                     [0, 0, 0, ..., 0, 0, 0],
           │       │                            │       │                       │            │                     [0, 0, 0, ..., 0, 0, 0],
           │       │                            │       │                       │            │                     ...,
           │       │                            │       │                       │            │                    ...
           │       │                            │       │                       │            └ (254, 256)
           │       │                            │       │                       └ 'copy_2d'
           │       │                            │       └ '../clij-opencl-kernels/kernels/copy_2d_x.cl'
           │       │                            └ '/Users/piotrsobolewski/Dev/miniforge3/envs/napari-CL/lib/python3.9/site-packages/pyclesperanto_prototype/_tier1/_copy.py'
           │       └ <classmethod object at 0x14d594ca0>
           └ <class 'pyclesperanto_prototype._tier0._backends.Backend'>
  File "/Users/piotrsobolewski/Dev/miniforge3/envs/napari-CL/lib/python3.9/site-packages/pyclesperanto_prototype/_tier0/_opencl_backend.py", line 41, in execute
    return execute(anchor, opencl_kernel_filename, kernel_name, global_size, parameters, prog, constants, image_size_independent_kernel_compilation, device)
           │       │       │                       │            │            │           │     │          │                                          └ None
           │       │       │                       │            │            │           │     │          └ None
           │       │       │                       │            │            │           │     └ None
           │       │       │                       │            │            │           └ None
           │       │       │                       │            │            └ {'dst': cl.Array([[0, 0, 0, ..., 0, 0, 0],
           │       │       │                       │            │                     [0, 0, 0, ..., 0, 0, 0],
           │       │       │                       │            │                     [0, 0, 0, ..., 0, 0, 0],
           │       │       │                       │            │                     ...,
           │       │       │                       │            │                    ...
           │       │       │                       │            └ (254, 256)
           │       │       │                       └ 'copy_2d'
           │       │       └ '../clij-opencl-kernels/kernels/copy_2d_x.cl'
           │       └ '/Users/piotrsobolewski/Dev/miniforge3/envs/napari-CL/lib/python3.9/site-packages/pyclesperanto_prototype/_tier1/_copy.py'
           └ <function execute at 0x17ea408b0>
  File "/Users/piotrsobolewski/Dev/miniforge3/envs/napari-CL/lib/python3.9/site-packages/pyclesperanto_prototype/_tier0/_opencl_execute.py", line 311, in execute
    prog = device.program_from_source("\n".join(defines))
           │      │                             └ ['#define MAX_ARRAY_SIZE 1000', '#define GET_IMAGE_WIDTH(image_key) image_size_ ## image_key ## _width', '#define GET_IMAGE_H...
           │      └ <functools._lru_cache_wrapper object at 0x14d8f5ae0>
           └ <Apple M1 on Platform: Apple (58 refs)>
  File "/Users/piotrsobolewski/Dev/miniforge3/envs/napari-CL/lib/python3.9/site-packages/pyclesperanto_prototype/_tier0/_device.py", line 26, in program_from_source
    return OCLProgram(src_str=source, dev=self)
           │                  │           └ <Apple M1 on Platform: Apple (58 refs)>
           │                  └ '#define MAX_ARRAY_SIZE 1000\n#define GET_IMAGE_WIDTH(image_key) image_size_ ## image_key ## _width\n#define GET_IMAGE_HEIGHT...
           └ <class 'pyclesperanto_prototype._tier0._program.OCLProgram'>
  File "/Users/piotrsobolewski/Dev/miniforge3/envs/napari-CL/lib/python3.9/site-packages/pyclesperanto_prototype/_tier0/_program.py", line 28, in __init__
    self.build(options=build_options)
    │    │             └ []
    │    └ <function Program.build at 0x14d8b8c10>
    └ <pyclesperanto_prototype._tier0._program.OCLProgram object at 0x131542280>
  File "/Users/piotrsobolewski/Dev/miniforge3/envs/napari-CL/lib/python3.9/site-packages/pyopencl/__init__.py", line 536, in build
    self._prg, was_cached = self._build_and_catch_errors(
    │    │                  │    └ <function Program._build_and_catch_errors at 0x14d8b8ca0>
    │    │                  └ <pyclesperanto_prototype._tier0._program.OCLProgram object at 0x131542280>
    │    └ None
    └ <pyclesperanto_prototype._tier0._program.OCLProgram object at 0x131542280>
  File "/Users/piotrsobolewski/Dev/miniforge3/envs/napari-CL/lib/python3.9/site-packages/pyopencl/__init__.py", line 584, in _build_and_catch_errors
    raise err
          └ RuntimeError(<pyopencl._cl._ErrorRecord object at 0x1315417b0>)

pyopencl._cl.RuntimeError: clBuildProgram failed: BUILD_PROGRAM_FAILURE - clBuildProgram failed: BUILD_PROGRAM_FAILURE - clBuildProgram failed: BUILD_PROGRAM_FAILURE

Build on <pyopencl.Device 'Apple M1' on 'Apple' at 0x1027f00>:

Compiler encountered an internal error
(options: -I /Users/piotrsobolewski/Dev/miniforge3/envs/napari-CL/lib/python3.9/site-packages/pyopencl/cl)
(source saved as /var/folders/sy/y3_x27j14cxg3_vhycs6cr_h0000gn/T/tmp_yz2cknb.cl)

The bottom one voronoi_otsu_labeling works fine.
Should there be two in the menu?

@haesleinhuepf
Copy link
Member

Should there be two in the menu?

Some operations from clesperanto will show up twice in a transition period: Goal is to make the assistant independent from clesperanto. Apologies for the inconvenience.

The top one: Voronoi-Otsu-labeling results in a long spinning beachball and error on macOS 12.1, napari 0.4.14:

In my case (also on Mac M1) I get an empty image as result when calling this operation, but no error. I'm wondering what's different between your system an mine. See discussion in #49

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants