View multiple laters with imjoy / kaibu viewer

Hey @oeway,

I’m just trying to setup an imjoy / kaibu notebook for viewing an image processing workflow. I was wondering, is there a way to show multiple layers?

My notebook is here and it shows just one image even though I call multiple times await viewer.view_image(cle.pull(limage)). Not sure why:

Any hint is appreciated :slight_smile:

Thanks!

Cheers,
Robert

1 Like

Yes, you are doing it correctly, but you need to pass a different name when calling view_image.

from imjoy import api
from skimage.io import imread

class ImJoyPlugin():
    async def setup(self):
        pass

    async def run(self, ctx):
        image = imread('https://samples.fiji.sc/blobs.png')
        viewer = await api.createWindow(src="https://kaibu.org/#/app")
        await viewer.view_image(image, name="image-1")
        await viewer.view_image(image, name="image-2")
  
api.export(ImJoyPlugin())
1 Like

Thanks for the hint @oeway! Unfortunately, this doesn’t solve the issue:

I updated the github repo, just in case you want to give it a closer look :wink:

Thanks again for your support!

I think that’s because you have an error with this line: blurred = cle.gaussian_blur(input, sigm_x = 2, sigma_y = 2).

You will see a popup message complaining the error:

index.js?v=20201123204239:148 Traceback (most recent call last):
  File "/home/weiouyang/miniconda3/lib/python3.7/site-packages/imjoy_rpc/rpc.py", line 313, in _wait
    result = await result
  File "<ipython-input-7-f730a6f566e0>", line 25, in run
    blurred = cle.gaussian_blur(input, sigm_x = 2, sigma_y = 2)
  File "/home/weiouyang/miniconda3/lib/python3.7/site-packages/pyclesperanto_prototype/_tier0/_plugin_function.py", line 83, in worker_function
    return function(**kwargs)
TypeError: gaussian_blur() got an unexpected keyword argument 'sigm_x'

And also if you right click, choose “Inspect” in chrome, you can see the same error in the developer tool console:

1 Like

I can hack it through by removing sigma_x and sigma_y:

Note: there is also a typo with blurred.

1 Like

Awesome, yes that was it. Thanks for spotting this.

One, maybe last question: Apparently, the last layer has a different size compared to the others:

After turning invisible and then visible again, it’s ok:

Is there some kind of repaint() command which can solve this?

Thanks again! Your help is very appreciated!

That’s a bug for Kaibu then, please ignore that for now, here is the issue I just added: https://github.com/imjoy-team/kaibu/issues/33

1 Like