Skip to content

Napari crashes when taking an OCLArray as input #1

@haesleinhuepf

Description

@haesleinhuepf

Hey Folks,

I'm adding this issue here because I'm not sure if this is an issue on pyopencl side, on our side or a napari issue.

When replacing fly in this line with background_subtracted_fly, the te_oki.py script crashes. Napari cannot show OCLArrays even though the OCLArray should be accessible as a numpy array. I think we need to introduce a cle.pull method but couldn't figure out how to convert an OCLArray into a numpy array.

If someone has an idea how to fix this, feel freel to push to master :-)

Thanks!

Cheers,
Robert

P.S.: The error message reads like this:

>python te_oki.py
no scikit-tensor detected, so separable functions wont work
This is a python3 issue and can be resolved by:

git clone https://github.com/mnick/scikit-tensor.git
pip3 install scikit-tensor
(121, 1024, 512)
C:\Users\rober\Anaconda3\envs\te_oki\lib\site-packages\pyopencl\cffi_cl.py:1502: CompilerWarning: Non-empty compiler output encountered. Set the environment variable PYOPENCL_COMPILER_OU
TPUT=1 to see more.
  "to see more.", CompilerWarning)
Traceback (most recent call last):
  File "te_oki.py", line 21, in <module>
    viewer.add_image(background_subtracted_fly);
  File "C:\Users\rober\Anaconda3\envs\te_oki\lib\site-packages\napari\components\add_layers_mixin.py", line 228, in add_image
    return self.add_layer(layers.Image(data, **kwargs))
  File "C:\Users\rober\Anaconda3\envs\te_oki\lib\site-packages\napari\layers\image\image.py", line 232, in __init__
    self.contrast_limits_range = self._calc_data_range()
  File "C:\Users\rober\Anaconda3\envs\te_oki\lib\site-packages\napari\layers\image\image.py", line 257, in _calc_data_range
    return calc_data_range(input_data)
  File "C:\Users\rober\Anaconda3\envs\te_oki\lib\site-packages\napari\layers\utils\layer_utils.py", line 35, in calc_data_range
    [np.max(data[idx]) for idx in idxs],
  File "C:\Users\rober\Anaconda3\envs\te_oki\lib\site-packages\napari\layers\utils\layer_utils.py", line 35, in <listcomp>
    [np.max(data[idx]) for idx in idxs],
  File "<__array_function__ internals>", line 6, in amax
  File "C:\Users\rober\Anaconda3\envs\te_oki\lib\site-packages\numpy\core\fromnumeric.py", line 2668, in amax
    keepdims=keepdims, initial=initial, where=where)
  File "C:\Users\rober\Anaconda3\envs\te_oki\lib\site-packages\numpy\core\fromnumeric.py", line 88, in _wrapreduction
    return reduction(axis=axis, out=out, **passkwargs)
  File "C:\Users\rober\Anaconda3\envs\te_oki\lib\site-packages\gputools\core\ocltypes.py", line 123, in func
    return getattr(mod, f)(self, *args, **kwargs)
TypeError: f() got an unexpected keyword argument 'axis'

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions