Skip to main content
License PyPI Build status https://mybinder.org/badge.svg

Interactive Jupyter widgets to visualize images, point sets, and meshes.

itk-jupyter-widgets chest CT in JupyterLab

Key Features:

  • Visualize 2D and 3D images, point sets, and geometry, e.g. meshes, in Jupyter

  • Support for

    • NumPy array images

    • itk.Image

    • vtk.vtkImageData

    • pyvista.UniformGrid

    • Dask array images

    • ImageJ / Fiji / ImageJ2 images

    • Additional NumPy array-like objects

    • NumPy array point sets

    • itk.Mesh

    • vtk.vtkPolyData

    • pyvista.PolyData

  • Exquisite volume rendering

  • Tri-plane volume slicing

  • Innovative, powerful opacity transfer function / window / level widget

  • Anisotropic voxel spacing supported

  • Image line profile widget

  • Combine with other ipywidgets to quickly create graphical interfaces that interactively provide insights into data algorithms

itk-jupyter-widgets demo

These widgets are designed to support image analysis with the Insight Toolkit (ITK), but they also work with other spatial analysis tools in the scientific Python ecosystem.

These widgets are built on itk.js and vtk.js.

Examples on Binder

Data types:

Tasks:

Installation

To install the widgets for the Jupyter Notebook with pip:

pip install itkwidgets

or with conda:

conda install -c conda-forge itkwidgets

For Jupyter Lab, additionally run:

jupyter labextension install @jupyter-widgets/jupyterlab-manager itk-jupyter-widgets

Usage

In Jupyter, import the view function:

from itkwidgets import view

Then, call the view function at the end of a cell, passing in the image to examine:

view(image)

For information on additional options, see the view function docstring:

view?

Other available widgets:

  • itkwidgets.line_profile: Plot an intensity line profile.

  • itkwidgets.checkerboard: Compare two images in a checkerboard pattern.

Advanced Usage

The itk-jupyter-widgets are based on ipywidgets. As a consequence, widgets traits can be queried, assigned, or observed with the viewer object returned by the view function. itk-jupyter-widgets can be combined with other ipywidgets to quickly explore algorithm parameters, create graphical interfaces, or create data visualization dashboards.

Mouse Controls

Left click + drag

Rotate

Right click + drag or shift + left click + drag

Pan

Mouse wheel or control + left click + drag or pinch

Zoom

Alt + left click + drag left-right

Change color transfer function window

Shift + left click + drag top-bottom

Change color transfer function level

Shift + alt + left click + drag top-bottom

Change primary Gaussian volume opacity transfer function magnitude

Keyboard Shortcuts

Keyboard shortcuts take effect when the mouse is positioned inside the viewer. All shortcuts are prefixed with Alt+. Corresponding keys for the Dvorak keyboard layout have the same effect.

Alt + 1

X-plane mode

Alt + 2

Y-plane mode

Alt + 3

Z-plane mode

Alt + 4

Volume rendering mode

Alt + q

Toggle user interface

Alt + w

Toggle region of interest (ROI) selection widget

Alt + e

Reset ROI

Alt + r

Reset camera

Alt + s

Toggle slicing planes in volume rendering mode

Alt + f

Toggle fullscreen

Examples

After installation, try the following examples that demonstrate how to visualize:

or how to:

Troubleshooting

If you experience the notebook warning:

IOPub data rate exceeded.
The notebook server will temporarily stop sending output
to the client in order to avoid crashing it.
To change this limit, set the config variable
`--NotebookApp.iopub_data_rate_limit`.

Set the notebook configuration value:

jupyter notebook --NotebookApp.iopub_data_rate_limit=1e12

Hacking

Participation is welcome! For a development installation (requires Node.js):

git clone https://github.com/InsightSoftwareConsortium/itk-jupyter-widgets.git
cd itk-jupyter-widgets
python -m pip install -r requirements-dev.txt -r requirements.txt
python -m pip install -e .
jupyter nbextension install --py --symlink --sys-prefix itkwidgets
jupyter nbextension enable --py --sys-prefix itkwidgets
jupyter nbextension enable --py --sys-prefix widgetsnbextension
python -m pytest

The above commands will setup your system for development with the Jupyter Notebook. To develop for Jupyter Lab, additionally run:

jupyter labextension install @jupyter-widgets/jupyterlab-manager
jupyter labextension install ./js

Release files for itkwidgets 0.17.1

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

Source distribution (sdist)

Source distribution for itkwidgets 0.17.1
File Size Uploaded
itkwidgets-0.17.1.tar.gz 1.6 MB Details

Built distribution (wheel)

Table of built distributions (wheels) for itkwidgets 0.17.1
File Interpreter ABI Platform
itkwidgets-0.17.1-py2.py3-none-any.whl Python 2, Python 3 none any Details

Total release size: 4.7 MB

Release files / itkwidgets-0.17.1.tar.gz

Download URL itkwidgets-0.17.1.tar.gz
Size 1.6 MB
Tags Source
SHA-256 checksum
How to use checksums
9e361f4f7500d2d6bf053c38220cbf7ec05ca671f2b6e08a38b752b68c527862
BLAKE2b-256 checksum
How to use checksums
32333dae9d5060e0b23bfe47bc63556ab6b9abdd9d1458cc1e71d1b064fd2ac0
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/1.13.0 pkginfo/1.4.2 requests/2.20.0 setuptools/40.4.3 requests-toolbelt/0.8.0 tqdm/4.28.1 CPython/3.6.6

Release files / itkwidgets-0.17.1-py2.py3-none-any.whl

Download URL itkwidgets-0.17.1-py2.py3-none-any.whl
Size 3.1 MB
Tags Python 2 Python 3
SHA-256 checksum
How to use checksums
6717a6c3f6841fdd23b42ca878331c011c37f884c31ba0b044ff0950b6b581a2
BLAKE2b-256 checksum
How to use checksums
9ea4500eb46d257589f541e4fcd94cccc004bbe3d1a27846be91aa2f99a7c7cc
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/1.13.0 pkginfo/1.4.2 requests/2.20.0 setuptools/40.4.3 requests-toolbelt/0.8.0 tqdm/4.28.1 CPython/3.6.6

Release history Release notifications | RSS feed

1.0a50

2 release files

0.32.5

2 release files

0.32.4

2 release files

0.32.3

2 release files

0.32.2

2 release files

0.32.1

2 release files

0.31.4

2 release files

0.31.3

2 release files

0.31.2

2 release files

0.30.1

2 release files

0.30.0

2 release files

0.29.0

2 release files

0.27.5

2 release files

0.27.4

2 release files

0.27.3

2 release files

0.27.0

2 release files

0.26.1

2 release files

0.26.0

2 release files

0.25.2

2 release files

0.25.1

2 release files

0.25.0

2 release files

0.24.1

2 release files

0.24.0

2 release files

0.23.1

2 release files

0.23.0

2 release files

0.22.0

2 release files

0.21.1

2 release files

0.20.0

2 release files

0.18.0

2 release files

This release

0.17.1 This release

2 release files

0.17.0

2 release files

0.16.3

2 release files

0.16.2

2 release files

0.16.0

2 release files

0.15.1

2 release files

0.15.0

2 release files

0.14.0

2 release files

0.13.2

2 release files

0.13.1

2 release files

0.13.0

2 release files

0.12.2

2 release files

0.11.0

2 release files

0.10.0

2 release files

0.9.0

1 release file

0.8.0

2 release files

0.7.0

2 release files

0.6.1

2 release files

0.6.0

2 release files

0.5.1

2 release files

0.5.0

2 release files

0.4.0

2 release files

0.3.0

2 release files

0.2.1

2 release files

0.2.0

2 release files

0.1.0

2 release files

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