clEsperanto / napari_pyclesperanto_assistant

GPU-accelerated general purpose image processing and image analysis in napari
http://clesperanto.net
BSD 3-Clause "New" or "Revised" License
32 stars 9 forks source link

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

Open psobolewskiPhD opened 2 years ago

psobolewskiPhD commented 2 years ago

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 sys.exit(main()) │ │ └ │ └ File "/Users/piotrsobolewski/Dev/miniforge3/envs/napari-CL/lib/python3.9/site-packages/napari/__main__.py", line 449, in main _run() └ File "/Users/piotrsobolewski/Dev/miniforge3/envs/napari-CL/lib/python3.9/site-packages/napari/__main__.py", line 338, in _run run(gui_exceptions=True) └ 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_() │ └ 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 │ │ │ │ │ └ │ │ │ │ └ │ │ │ └ │ │ └ │ └ 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)' │ │ └ │ └ , name='op_name')> └ ComboBox(value='Voronoi-Otsu-labeling (clesperanto)', annotation=, 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)',) └ . at 0x16c820e50> File "/Users/piotrsobolewski/Dev/miniforge3/envs/napari-CL/lib/python3.9/site-packages/magicgui/widgets/_bases/container_widget.py", line 165, in widget.changed.connect(lambda: self.changed.emit(self)) │ │ │ └ , op_name: str = 'Voro... │ │ └ │ └ , 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 │ └ (, op_name: str = 'Vor... └ , 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) │ │ │ │ │ └ │ │ │ │ └ , op_name='Voronoi-Otsu-labeling (clesperanto)', x=2.0, y=2.0, ... │ │ │ └ │ │ └ , op_name='Voronoi-Otsu-labeling (clesperanto)', x=2.0, y=2.0, ... │ └ .gui_function at 0x147fe3040> └ , 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 │ │ └ [] │ └ 'Voronoi-Otsu-labeling (clesperanto)' └ 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) │ └ └ 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], │ .... └ 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) │ │ │ │ └ │ │ │ └ │ └ 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' └ 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' │ └ 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' └ 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... │ └ 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) │ │ └ │ └ '#define MAX_ARRAY_SIZE 1000\n#define GET_IMAGE_WIDTH(image_key) image_size_ ## image_key ## _width\n#define GET_IMAGE_HEIGHT... └ 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) │ │ └ [] │ └ 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( │ │ │ └ │ │ └ │ └ None └ 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.RuntimeError: clBuildProgram failed: BUILD_PROGRAM_FAILURE - clBuildProgram failed: BUILD_PROGRAM_FAILURE - clBuildProgram failed: BUILD_PROGRAM_FAILURE Build on : 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 commented 2 years ago

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