Skip to main content

Displays Polus Render dashboard in Jupyter Notebooks.

Project description

Polus Render

Enables the embedding of content from polus-render within Jupyer notebooks. Contains a local build of Polus Render which enables the use of local dataset and MICRO-JSON overlay drag and drop into Jupyter Notebook Render IFrames.

image

Requirements

  • Python 3.9+

Installation

pip install polus-render

Render: Local build vs online

polus-render is bundled with a build of Polus Render which supports additional functionality compared to the web version. Table is accurate as of 10/4/2023.

Version Zarr from URL/Path TIF from URL/Path Micro-JSON Support Zarr/TIF Drag & Drop Micro-JSON Drag & Drop
Local :heavy_check_mark: :heavy_check_mark: :heavy_check_mark: :heavy_check_mark: :heavy_check_mark:
Online :heavy_check_mark:

Drag & Drop Demo

ezgif-4-7162ca42b5

Sample usage

from polus import render
from urllib.parse import urlparse
from pathlib import Path

# Embeds an IFrame of a local build of Polus Render into Jupyter Notebooks
render()

# Embeds an IFrame of Polus Render into Jupyter Notebooks
render(use_local_render=False)

# Embeds an IFrame of a local build of Polus Render with an image file hosted at "https://viv-demo.storage.googleapis.com/LuCa-7color_Scan1/"
render(image_location=urlparse("https://viv-demo.storage.googleapis.com/LuCa-7color_Scan1/"))

# Embeds an IFrame of a local build of Polus Render with an image hosted locally at "C:\Users\JeffChen\OneDrive - Axle Informatics\Documents\zarr files\pyramid.zarr"
render(image_location=Path(r"C:\Users\JeffChen\OneDrive - Axle Informatics\Documents\zarr files\pyramid.zarr"))

# Embeds an IFrame of a local build of Polus Render with an image and overlay file that is hosted locally
render(image_location=Path(r"C:\Users\JeffChen\OneDrive - Axle Informatics\Documents\zarr files\pyramid.zarr"), \
microjson_overlay_location=Path(r"C:\Users\JeffChen\OneDrive - Axle Informatics\Documents\overlay files\x00_y01_c1_segmentations.json"))

# Embeds an IFrame of a local build of Polus Render with an image and overlay file that is hosted online
render(image_location=urlparse("https://files.scb-ncats.io/pyramids/segmentations/x00_y01_c1.ome.tif"), \
microjson_overlay_location=urlparse("https://files.scb-ncats.io/pyramids/segmentations/x00_y03_c1_segmentations.json"))

# Embeds an IFrame with a height of 1080 of a local build of Polus Render.
render(height=1080)

Functions

def render(image_location:ParseResult|PurePath = "", microjson_overlay_location:ParseResult|PurePath = "", width:int=960, height:int=500, image_port:int=0, \
           microjson_overlay_port:int=0, use_local_render:bool=True, render_url:str = "https://render.ci.ncats.io/")->None:
    """
    Displays Polus Render with args to specify display dimensions, port to serve,
    image files to use, and overlay to use.
    
    Param:
        image_location(ParseResult|Purepath): Acquired from urllib.parse.ParseResult or Path, renders url in render.
                            If not specified, renders default render url.
        microjson_overlay_location(ParseResult|Purepath): Acquired from urllib.parse.ParseResult or Path, renders url in render.
                            If not specified, renders default render url
        width (int): width of render to be displayed, default is 960
        height (int): height of render to be displayed, default is 500
        image_port (int): Port to run local zarr server on if used (default is 0 which is the 1st available port).
        microjson_overlay_port (int): Port to run local json server on if used (default is 0 which is the 1st available port).
        run_local_render (bool): True to run local build of render with 1st available port, False to use render_url (default is True)
        render_url (str): URL which refers to Polus Render. Used when run_local_render is False. (default is https://render.ci.ncats.io/)
    Pre: zarr_port and json_port selected (if used) is not in use IF path given is Purepath
        
    """

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

polus-render-0.0.3.5.1.tar.gz (891.0 kB view details)

Uploaded Source

Built Distribution

polus_render-0.0.3.5.1-py3-none-any.whl (895.8 kB view details)

Uploaded Python 3

File details

Details for the file polus-render-0.0.3.5.1.tar.gz.

File metadata

  • Download URL: polus-render-0.0.3.5.1.tar.gz
  • Upload date:
  • Size: 891.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.11.5

File hashes

Hashes for polus-render-0.0.3.5.1.tar.gz
Algorithm Hash digest
SHA256 e89f52b0a8d221858193d7e60328579db9c877050282a0ed1f05c8564b15377d
MD5 f2fbca51900754e271cbb1bc22f89045
BLAKE2b-256 443d7eba14b33b31edbcdde4b39f0728fe246047da741aa5547bc1546c94a9ad

See more details on using hashes here.

File details

Details for the file polus_render-0.0.3.5.1-py3-none-any.whl.

File metadata

File hashes

Hashes for polus_render-0.0.3.5.1-py3-none-any.whl
Algorithm Hash digest
SHA256 7e1bc4aa4be3bbc7b2a51742a09bfb70daa497fd516ee7a8e96f67bd1c2d8e8f
MD5 1f5064731f7f365e35a7e0f324f5a043
BLAKE2b-256 f9e0b83f3039fb65f9656008148e843f65cbd64d3924174810fc015c2d62f5bd

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page