Skip to main content

ImJoy Jupyter Extension

Try the demo here: Binder

Using ImJoy with Jupyter notebooks

This extension utilizes the imjoy-rpc library to enable bidirectional RPC calls between the ImJoy core and plugins.

The library has an abstract transport interface that can support different types of transport. For now, we support Jupyter comms message which is a custom message protocol used in Jupyter notebooks (for example powers jupyter widgets).

To use it, you need to install the imjoy-jupyter-extension in javascript which will also include the imjoy-rpc as a dependency.

Install the Jupyter notebook extension

pip install -U imjoy-jupyter-extension

Use ImJoy plugins inside Jupyter notebooks

Now you can start a jupyter notebook via for example jupyter notebook command, you should be able to see an ImJoy icon in the toolbar if everything goes well.

imjoy in the notebook toolbar

Now run ImJoy plugins in a cell, see an example that uses itk-vtk-viewer to visualize images:

import imageio
import numpy as np
from imjoy_rpc import api

class ImJoyPlugin():
    def setup(self):
        api.log('plugin initialized')

    async def run(self, ctx):
        viewer = await api.showDialog(type="itk-vtk-viewer",
                                      src="https://oeway.github.io/itk-vtk-viewer/")
        # show a 3D volume
        image_array = np.random.randint(0, 255, [10,10,10], dtype='uint8')

        # show a 2D image
        # image_array = imageio.imread('imageio:chelsea.png')

        await viewer.imshow(image_array)

api.export(ImJoyPlugin())

With the above code, you created an ImJoy plugin. To run it, click the Run button with the ImJoy icon. It will then call the run function of your plugin.

Run Jupyter notebook inside ImJoy

You can also do the reverse by running a notebook inside ImJoy, to do that, please first create an empty jupyter notebook. Then copy and paste the url into the "+ PLUGINS" dialog, press enter and install the plugin. Click the newly installed plugin and you will get a notebook page open in ImJoy.

Try to copy and paste the itk-vtk-viewer example to a cell and execute it. Similarily, if you now click the run ImJoy button in the toolbar, you will get the viewer open insided ImJoy.

Metadata

Release files for imjoy-jupyter-extension 0.2.8

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for imjoy-jupyter-extension 0.2.8
File Size Uploaded Provenance Actions
imjoy-jupyter-extension-0.2.8.tar.gz 21.5 kB Without provenance Details for imjoy-jupyter-extension-0.2.8.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for imjoy-jupyter-extension 0.2.8
File Interpreter ABI Platform Actions
imjoy_jupyter_extension-0.2.8-py3-none-any.whl Python 3 none any Details for imjoy_jupyter_extension-0.2.8-py3-none-any.whl

Total release size: 59.1 kB

Release files / imjoy-jupyter-extension-0.2.8.tar.gz

Download URL imjoy-jupyter-extension-0.2.8.tar.gz
Size 21.5 kB
Tags Source
SHA-256 checksum
How to use checksums
1602383a164bf63eda5d5cf1bfb9358c7d711ad54dfb7ab10a2c276a4198ef3f
BLAKE2b-256 checksum
How to use checksums
434ffb6267a39f28e40d148ec72ab3057e79a2360fa0b0072d83a4155383cad1
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/49.6.0.post20200814 requests-toolbelt/0.9.1 tqdm/4.48.2 CPython/3.7.8

Release files / imjoy_jupyter_extension-0.2.8-py3-none-any.whl

Download URL imjoy_jupyter_extension-0.2.8-py3-none-any.whl
Size 37.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
1c6becd5763a301a1a2758b3d595220f17f0b8b5fa9abd86c23972711be0eeb6
BLAKE2b-256 checksum
How to use checksums
ad7236defea2c9cbabd7e690d94340e3420fe6fc4255977c10bd24050638a067
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/49.6.0.post20200814 requests-toolbelt/0.9.1 tqdm/4.48.2 CPython/3.7.8

Security for imjoy-jupyter-extension 0.2.8

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page