Jupyter widgets to visualize images in 2D and 3D
Project description
Interactive Jupyter widgets to visualize images in 2D and 3D.
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:
pip install 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?
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:
ImageJ ImgLib2 images (requires conda and a local Fiji installation)
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
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 itkwidgets-0.13.1.tar.gz
.
File metadata
- Download URL: itkwidgets-0.13.1.tar.gz
- Upload date:
- Size: 2.5 MB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/1.11.0 pkginfo/1.4.2 requests/2.19.1 setuptools/39.0.1 requests-toolbelt/0.8.0 tqdm/4.23.4 CPython/2.7.13
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | a4c8c15d550cbda2d0aaf62bd0897040b590f3a0203a753ab3380014d9f7f3ab |
|
MD5 | e0054fd28f942cb88e560dbd4d7ad972 |
|
BLAKE2b-256 | 006d2deacdb58c1366a361190284030a4335c8d2ecf7aa9cd1f6a48dd3c81e79 |
File details
Details for the file itkwidgets-0.13.1-py2.py3-none-any.whl
.
File metadata
- Download URL: itkwidgets-0.13.1-py2.py3-none-any.whl
- Upload date:
- Size: 4.2 MB
- Tags: Python 2, Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/1.11.0 pkginfo/1.4.2 requests/2.19.1 setuptools/39.0.1 requests-toolbelt/0.8.0 tqdm/4.23.4 CPython/2.7.13
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | a754caef88e5e54d8d88357072e8f55663354d26091470b9473ee24e394b5850 |
|
MD5 | 59eab4c3c7e5a7a40e2d714c5f61740f |
|
BLAKE2b-256 | c1c0d6e6942f80adf8570d37d21e854b3cda1909216aa229af28ea19aa9336b2 |