Closed bnmajor closed 9 months ago
(Moving this discussion from here to this issue since this is where it belongs)
@bnmajor I am wondering if we can push the dataset conversion / to_ngff_zarr up even further into the Viewer class?
Perhaps we can keep setup async. Maybe this could help with https://github.com/InsightSoftwareConsortium/itkwidgets/issues/564
@thewtex Digging into this a bit more I find that with a minimal plugin in a notebook:
class ImJoyPlugin1():
async def setup(self):
pass
async def run(self, ctx):
# create a viewer
viewer = await api.createWindow(src="https://bafybeicuvbx4cfp3zgo25j376bmmysh73a2ui5dbapuwqtmjcvcaipmpbi.on.fleek.co/")
# show an image
viewer.setImage(image)
class ImJoyPlugin2():
async def setup(self):
pass
async def run(self, ctx):
# create a viewer
viewer = await api.createWindow(src="https://bafybeicuvbx4cfp3zgo25j376bmmysh73a2ui5dbapuwqtmjcvcaipmpbi.on.fleek.co/")
# show an image
viewer.setImage(image)
api.export(ImJoyPlugin1())
api.export(ImJoyPlugin2())
Only the last viewer will be created and shown. ImJoyPlugin1 setup() and run() are never even reached so it seems that multiple calls to the imjoy-rpc api interrupt any previous calls, so unfortunately pushing the data conversion up to the Viewer class does not help this bug.
Fixed in #702
In a notebook (in JupyterLab, Jupyter Notebook, Colab, or SageMaker) if there are multiple cells calling
view()
only the last one is displayed. Going back and re-running the other cells works as expected. Running cells one at a time works as expected.