# Note: This example currently does not work in MyBinder.
# Install dependencies for this example
# Note: This does not include itkwidgets, itself
import sys
!{sys.executable} -m pip install -U vedo
Collecting vedo Downloading vedo-2021.0.3.tar.gz (9.3 MB) |████████████████████████████████| 9.3 MB 7.0 MB/s eta 0:00:01 Requirement already satisfied: vtk in /home/matt/bin/miniconda/envs/itkwidgets/lib/python3.8/site-packages (from vedo) (9.0.1) Requirement already satisfied: numpy in /home/matt/bin/miniconda/envs/itkwidgets/lib/python3.8/site-packages (from vedo) (1.20.2) Building wheels for collected packages: vedo Building wheel for vedo (setup.py) ... done Created wheel for vedo: filename=vedo-2021.0.3-py3-none-any.whl size=9384218 sha256=a1d8ecc77dc48f4c4584c09d436170d04fd291ce4f864bb60ed6a9514b6ace30 Stored in directory: /home/matt/.cache/pip/wheels/9c/6f/7c/c8f69d87d6f20bfd65e4af01498ac78836e12308ee46cbad58 Successfully built vedo Installing collected packages: vedo Successfully installed vedo-2021.0.3
from vedo import load, datadir, Sphere
from itkwidgets import view
embryo = load(datadir+'embryo.slc')
sph = Sphere(r=50).pos(10,20,30)
scals = sph.points()[:,2] # scalars are z coords
sph.pointColors(scals)
embedWindow(verbose=True): could not load ipyvtk_simple try: > pip install -U git+https://github.com/Kitware/ipyvtk-simple.git
(Sphere)0x7f185a66fc40
embryo.printInfo()
_________________________________________________________________ Volume position: (0.0, 0.0, 0.0) dimensions: (256, 256, 256) spacing: (1.0, 1.0, 1.0) data dimension: 3 memory size: 16 MB scalar #bytes: 1 bounds: x=(0, 255) y=(0, 255) z=(0, 255) scalar range: (0.0, 197.0) (logscale) Histogram (entries=100000) 4.97 0.00 | ▆▆▆▆▆▆▆▆▆▆▆▆▆▆▆▆▆▆▆▆▆▆▆▆▆▆▆▆▆▆ 23.12 | ▆▆▆▆▆▆▆▆▆▆▆▆▆▆▆▆▆▆▆ 46.25 | ▆▆▆▆▆▆▆▆▆▆▆▆▆▆▆▆▆▆▆ 69.38 | ▆▆▆▆▆▆▆▆▆▆▆▆▆▆▆▆▆▆ 92.50 | ▆▆▆▆▆▆▆▆▆▆▆▆▆▆▆▆ 115.62| ▆▆▆▆▆▆▆▆▆▆▆▆ 138.75| ▆▆▆▆▆▆▆ 161.88| ▆▆
(Volume)0x7f185a66f9a0
view(actors=[embryo, sph])
Viewer(geometries=[{'vtkClass': 'vtkPolyData', 'points': {'vtkClass': 'vtkPoints', 'name': '_points', 'numberO…