A Jupyterlab extension for Polus Render.
Project description
Jupyterlab Polus Render
JupyterLab Polus Render makes Polus Render available as a JupyterLab extension.
Polus Render allows visualizing tiled raster datasets in Zarr and TIFF formats, as well as vector overlays in MicroJSON format. It uses lookup tables to map intensity values in these datasets to colors.
The are three ways to load the data:
- Specifying a URL to the server serving the data.
- Specifying a local path to a file from JupyterLab.
- Dragging-and-dropping the dataset.
Requirements
- JupyterLab >= 4.0
Install
You can install using pip
:
pip install jupyterlab_polus_render
Uninstall
To remove the extension, execute:
pip uninstall jupyterlab_polus_render
Troubleshoot
If you are seeing the frontend extension, but it is not working, check that the server extension is enabled:
jupyter server extension list
If the server extension is installed and enabled, but you are not seeing the frontend extension, check the frontend extension is installed:
jupyter labextension list
Sample usage
from jupyterlab_polus_render import Render
# Initiates Polus Render.
Render()
# Shows a tiff image by providing the local path.
Render(imagePath = 'images/LuCa-7color_3x3component_data.ome.tif')
# Shows a tiff image by providing the local path along with an overlay used for the image.
Render(imagePath = 'images/LuCa-7color_3x3component_data.ome.tif', overlayPath = 'images/overlay_render2.json')
# Shows a tiff image by providing a remote url.
Render(imagePath = 'https://viv-demo.storage.googleapis.com/LuCa-7color_3x3component_data.ome.tif')
# Shows a zarr dataset by providing the local path along with an overlay used for the dataset.
Render(imagePath = 'images/pyramid.zarr', overlayPath = 'images/overlay_render2.json')
Implementation Details
Frontend
- The frontend part of the extension effectively utilizes the @labshare/polus-render npm package which is used to visualize tiled TIFF images and overlays given the URL of the image/overlay.
Backend
- The backend functionality, including serving images is handled by the server extension. This extension is integrated with the Jupyterlab server environment and allows custom functionality based on the application's needs.
- In summary, the Jupyterlab Polus Render extension combines the frontend and the backend components into a single extension.
API Endpoints
/jupyterlab-polus-render/image/(.+)
: Shows tiff images and zarr datasets at a specfied path.
Contributing
Development Install
Create a dev environment:
conda create -n jupyterlab_polus_render-dev -c conda-forge nodejs python jupyterlab=4.0.11 ipywidgets
conda activate jupyterlab_polus_render-dev
# Clone the repo to your local environment
# Change directory to the jupyterlab_polus_render directory
# Install package in development mode
pip install -e .
# Link your development version of the extension with JupyterLab
jupyter labextension develop . --overwrite
# Server extension must be manually installed in develop mode
jupyter server extension enable jupyterlab_polus_render
# Rebuild extension Typescript source after making changes
jlpm run build
How to see your changes
Typescript:
If you use JupyterLab to develop then you can watch the source directory and run JupyterLab at the same time in different terminals to watch for changes in the extension's source and automatically rebuild the widget.
# Watch the source directory in one terminal, automatically rebuilding when needed
jlpm run watch
# Run JupyterLab in another terminal
jupyter lab
After a change wait for the build to finish and then refresh your browser and the changes should take effect.
Python:
If you make a change to the python code then you will need to restart the notebook kernel to have it take effect.
Development uninstall
# Server extension must be manually disabled in develop mode
jupyter server extension disable jupyterlab_polus_render
pip uninstall jupyterlab_polus_render
In development mode, you will also need to remove the symlink created by jupyter labextension develop
command. To find its location, you can run jupyter labextension list
to figure out where the labextensions
folder is located. Then you can remove the symlink named jupyterlab_polus_render
within that folder.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file jupyterlab_polus_render-1.0.1.tar.gz
.
File metadata
- Download URL: jupyterlab_polus_render-1.0.1.tar.gz
- Upload date:
- Size: 8.3 MB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.0.0 CPython/3.10.13
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 87dc961bd3b8eb14ebc4bb796c9d74e049fdc679d1d95f5e5668c9702b12a755 |
|
MD5 | 16cf49ec16325be9c97cf1dc9a2ae2a5 |
|
BLAKE2b-256 | 01bb5e11bf63b3393bbf2b28bc318f3c6650ec7e1a14d045947b70d077290786 |
File details
Details for the file jupyterlab_polus_render-1.0.1-py3-none-any.whl
.
File metadata
- Download URL: jupyterlab_polus_render-1.0.1-py3-none-any.whl
- Upload date:
- Size: 8.1 MB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.0.0 CPython/3.10.13
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 5ae0aae377b072a08a785e1962730d4debeb934dc2b871186f1fe06d0f892691 |
|
MD5 | 87caa84005757653d469af46072477f2 |
|
BLAKE2b-256 | 5e3665f4bc01ff2c72c41971ab18e27818bb6eca39975bbab115fc79b282dca4 |