{"id":20399923,"url":"https://github.com/kitware/ipyvtklink","last_synced_at":"2025-04-09T16:19:43.883Z","repository":{"id":45068572,"uuid":"275927244","full_name":"Kitware/ipyvtklink","owner":"Kitware","description":"🔗  minimalist ipywidget to interface with any Python vtkRenderWindow","archived":false,"fork":false,"pushed_at":"2022-09-30T14:47:15.000Z","size":19449,"stargazers_count":98,"open_issues_count":4,"forks_count":14,"subscribers_count":9,"default_branch":"master","last_synced_at":"2025-04-09T16:19:32.270Z","etag":null,"topics":["3d","ipywidgets","jupyter","paraview","plotting","python","pyvista","vtk"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Kitware.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2020-06-29T21:12:37.000Z","updated_at":"2025-02-12T10:58:52.000Z","dependencies_parsed_at":"2022-09-16T14:02:13.402Z","dependency_job_id":null,"html_url":"https://github.com/Kitware/ipyvtklink","commit_stats":null,"previous_names":["kitware/ipyvtk-simple"],"tags_count":11,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Kitware%2Fipyvtklink","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Kitware%2Fipyvtklink/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Kitware%2Fipyvtklink/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Kitware%2Fipyvtklink/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Kitware","download_url":"https://codeload.github.com/Kitware/ipyvtklink/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248065281,"owners_count":21041872,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["3d","ipywidgets","jupyter","paraview","plotting","python","pyvista","vtk"],"created_at":"2024-11-15T04:35:09.529Z","updated_at":"2025-04-09T16:19:43.859Z","avatar_url":"https://github.com/Kitware.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# ipyvtklink\n\n[![Binder](https://mybinder.org/badge_logo.svg)](https://mybinder.org/v2/gh/Kitware/ipyvtklink/master)\n[![PyPI](https://img.shields.io/pypi/v/ipyvtklink.svg?logo=python\u0026logoColor=white)](https://pypi.org/project/ipyvtklink/)\n[![conda](https://img.shields.io/conda/vn/conda-forge/ipyvtklink.svg?logo=conda-forge\u0026logoColor=white)](https://anaconda.org/conda-forge/ipyvtklink)\n\n*An ipywidget for vtkRenderWindow* (formerly `ipyvtk-simple`)\n\nThis is an early prototype of creating a Jupyter interface to VTK. This toolkit\nis a proof of concept and a more polished tool will be available as\n[`ipyvtk`](https://github.com/Kitware/ipyvtk) in the future.\n\nThe code here was implemented from the work done by [Andras Lasso](https://github.com/lassoan)\nunder an MIT License (see [the source](https://github.com/Slicer/SlicerJupyter/blob/master/JupyterNotebooks/JupyterNotebooksLib/interactive_view_widget.py)).\n\nThe goal is to enable this widget to work with any server side\n[`vtkRenderWindow`](https://vtk.org/doc/nightly/html/classvtkRenderWindow.html)\nThis render window could be from [VTK Python](https://vtk.org/),\n[ParaView](https://www.paraview.org/), or [PyVista](https://www.pyvista.org/).\n\nPlease note that `vtk` is not listed as a requirement for this package to\nsimplify its installation in virtual environments where VTK may be built from\nsource or bundled with ParaView and we do not want to install the wheels from\nPyPI.\n\n## Installation\n\nFor use with PyVista, simply install with `pip` or `conda`:\n\n```\npip install ipyvtklink\n```\n\nor\n```\nconda install -c conda-forge ipyvtklink\n```\n\n## Run in Docker\n\nA Docker image is prebuilt and hosted in the ipyvtklink repository's packages.\n\nTo run in Docker:\n\n```\ndocker pull ghcr.io/kitware/ipyvtklink:latest\ndocker run -p 8888:8888 ghcr.io/kitware/ipyvtklink:latest\n```\n\nand open the `vtk.ipynb` notebook.\n\nAdditionally, this can be used with ParaView. An example is given in\n`paraview.ipynb` which can be run via:\n\n```\ndocker pull ghcr.io/kitware/ipyvtklink-paraview:latest\ndocker run -p 8878:8878 ghcr.io/kitware/ipyvtklink-paraview:latest\n```\n\n## Examples\n\nYou may have to build jupyter lab extensions for this to work in Lab. This is\nknown to work well in Notebook.\n\n\n### PyVista\n\nPyVista has fully implemented downstream support for `ipyvtklink`. See [PyVista's Documentation](https://docs.pyvista.org/user-guide/jupyter/ipyvtk_plotting.html)\n\nSee the `pyvista.ipynb` for an original proof of concept.\n\n![demo-1](https://raw.githubusercontent.com/Kitware/ipyvtklink/master/assets/demo-1.gif)\n\n![demo-2](https://raw.githubusercontent.com/Kitware/ipyvtklink/master/assets/demo-2.gif)\n\n\n### Python VTK\n\nThe widget here can be used with VTK. Here is a minimal example showing how\nto pass any `vtkRenderWindow` to the `ViewInteractiveWidget`:\n\n```py\nimport vtk\nfrom ipyvtklink.viewer import ViewInteractiveWidget\n\n# Create some data\ncylinder = vtk.vtkCylinderSource()\ncylinder.SetResolution(8)\nmapper = vtk.vtkPolyDataMapper()\nmapper.SetInputConnection(cylinder.GetOutputPort())\nactor = vtk.vtkActor()\nactor.SetMapper(mapper)\n\n# Set up render window\nren = vtk.vtkRenderer()\nren_win = vtk.vtkRenderWindow()\nren_win.SetOffScreenRendering(1)\nren_win.SetSize(600, 600)\nren_win.AddRenderer(ren)\niren = vtk.vtkRenderWindowInteractor()\niren.SetRenderWindow(ren_win)\nstyle = vtk.vtkInteractorStyleTrackballCamera()\niren.SetInteractorStyle(style)\n\n# Add actor to scene\nren.AddActor(actor)\nren.ResetCamera()\n\n# Display\nViewInteractiveWidget(ren_win)\n```\n\n![demo-3](https://raw.githubusercontent.com/Kitware/ipyvtklink/master/assets/demo-3.gif)\n\n\n### ParaView Python\n\nSee instructions above for running ParaView in a Docker container.\n\n```py\nimport paraview.simple as pvs\nfrom ipyvtklink.viewer import ViewInteractiveWidget\n\n# Create data on the pipeline\nwavelet = pvs.Wavelet()\ncontour = pvs.Contour(Input=wavelet)\ncontour.ContourBy = ['POINTS', 'RTData']\ncontour.Isosurfaces = [63, 143, 170, 197, 276]\n\n# Set the data as visible\npvs.Show(contour)\n\n# Fetch the view and render the scene\nview = pvs.GetActiveView()\npvs.Render(view)\n\n# Fetch the RenderWindow\nren_win = view.GetClientSideObject().GetRenderWindow()\n# Display the RenderWindow with the widget\nViewInteractiveWidget(ren_win)\n```\n\n![demo-4](https://raw.githubusercontent.com/Kitware/ipyvtklink/master/assets/demo-4.gif)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkitware%2Fipyvtklink","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fkitware%2Fipyvtklink","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkitware%2Fipyvtklink/lists"}