In [ ]:
# Install dependencies for this example
# Note: This does not include itk-jupyter-widgets, itself
import sys
!{sys.executable} -m pip install vtk requests
In [2]:
import vtk

import requests
import shutil
import os

from itkwidgets import view
In [3]:
# Download data
file_name = 'vase.vti'
if not os.path.exists(file_name):
    response = requests.get('https://data.kitware.com/api/v1/file/5a826bdc8d777f0685782960/download', stream=True)
    with open(file_name, 'wb') as fp:
        response.raw.decode_content = True
        shutil.copyfileobj(response.raw, fp)
In [4]:
reader = vtk.vtkXMLImageDataReader()
reader.SetFileName(file_name)
reader.Update()
vtk_image = reader.GetOutput()
In [5]:
view(vtk_image)