diff options
-rw-r--r-- | .gitignore | 1 | ||||
-rw-r--r-- | python-ipyvtklink.spec | 504 | ||||
-rw-r--r-- | sources | 1 |
3 files changed, 506 insertions, 0 deletions
@@ -0,0 +1 @@ +/ipyvtklink-0.2.3.tar.gz diff --git a/python-ipyvtklink.spec b/python-ipyvtklink.spec new file mode 100644 index 0000000..8c56c35 --- /dev/null +++ b/python-ipyvtklink.spec @@ -0,0 +1,504 @@ +%global _empty_manifest_terminate_build 0 +Name: python-ipyvtklink +Version: 0.2.3 +Release: 1 +Summary: ipywidget for vtkRenderWindow +License: BSD 3-Clause +URL: https://github.com/Kitware/ipyvtklink +Source0: https://mirrors.nju.edu.cn/pypi/web/packages/d6/e6/4771ca4dd69e933af9ab1308efafaf797ebc0ef0626ee5615ea9e8e2665b/ipyvtklink-0.2.3.tar.gz +BuildArch: noarch + +Requires: python3-ipycanvas +Requires: python3-ipyevents +Requires: python3-ipywidgets + +%description +# ipyvtklink + +[](https://mybinder.org/v2/gh/Kitware/ipyvtklink/master) +[](https://pypi.org/project/ipyvtklink/) +[](https://anaconda.org/conda-forge/ipyvtklink) + +*An ipywidget for vtkRenderWindow* (formerly `ipyvtk-simple`) + +This is an early prototype of creating a Jupyter interface to VTK. This toolkit +is a proof of concept and a more polished tool will be available as +[`ipyvtk`](https://github.com/Kitware/ipyvtk) in the future. + +The code here was implemented from the work done by [Andras Lasso](https://github.com/lassoan) +under an MIT License (see [the source](https://github.com/Slicer/SlicerJupyter/blob/master/JupyterNotebooks/JupyterNotebooksLib/interactive_view_widget.py)). + +The goal is to enable this widget to work with any server side +[`vtkRenderWindow`](https://vtk.org/doc/nightly/html/classvtkRenderWindow.html) +This render window could be from [VTK Python](https://vtk.org/), +[ParaView](https://www.paraview.org/), or [PyVista](https://www.pyvista.org/). + +Please note that `vtk` is not listed as a requirement for this package to +simplify its installation in virtual environments where VTK may be built from +source or bundled with ParaView and we do not want to install the wheels from +PyPI. + +## Installation + +For use with PyVista, simply install with `pip` or `conda`: + +``` +pip install ipyvtklink +``` + +or +``` +conda install -c conda-forge ipyvtklink +``` + +## Run in Docker + +A Docker image is prebuilt and hosted in the ipyvtklink repository's packages. + +To run in Docker: + +``` +docker pull ghcr.io/kitware/ipyvtklink:latest +docker run -p 8888:8888 ghcr.io/kitware/ipyvtklink:latest +``` + +and open the `vtk.ipynb` notebook. + +Additionally, this can be used with ParaView. An example is given in +`paraview.ipynb` which can be run via: + +``` +docker pull ghcr.io/kitware/ipyvtklink-paraview:latest +docker run -p 8878:8878 ghcr.io/kitware/ipyvtklink-paraview:latest +``` + +## Examples + +You may have to build jupyter lab extensions for this to work in Lab. This is +known to work well in Notebook. + + +### PyVista + +PyVista has fully implemented downstream support for `ipyvtklink`. See [PyVista's Documentation](https://docs.pyvista.org/user-guide/jupyter/ipyvtk_plotting.html) + +See the `pyvista.ipynb` for an original proof of concept. + + + + + + +### Python VTK + +The widget here can be used with VTK. Here is a minimal example showing how +to pass any `vtkRenderWindow` to the `ViewInteractiveWidget`: + +```py +import vtk +from ipyvtklink.viewer import ViewInteractiveWidget + +# Create some data +cylinder = vtk.vtkCylinderSource() +cylinder.SetResolution(8) +mapper = vtk.vtkPolyDataMapper() +mapper.SetInputConnection(cylinder.GetOutputPort()) +actor = vtk.vtkActor() +actor.SetMapper(mapper) + +# Set up render window +ren = vtk.vtkRenderer() +ren_win = vtk.vtkRenderWindow() +ren_win.SetOffScreenRendering(1) +ren_win.SetSize(600, 600) +ren_win.AddRenderer(ren) +iren = vtk.vtkRenderWindowInteractor() +iren.SetRenderWindow(ren_win) +style = vtk.vtkInteractorStyleTrackballCamera() +iren.SetInteractorStyle(style) + +# Add actor to scene +ren.AddActor(actor) +ren.ResetCamera() + +# Display +ViewInteractiveWidget(ren_win) +``` + + + + +### ParaView Python + +See instructions above for running ParaView in a Docker container. + +```py +import paraview.simple as pvs +from ipyvtklink.viewer import ViewInteractiveWidget + +# Create data on the pipeline +wavelet = pvs.Wavelet() +contour = pvs.Contour(Input=wavelet) +contour.ContourBy = ['POINTS', 'RTData'] +contour.Isosurfaces = [63, 143, 170, 197, 276] + +# Set the data as visible +pvs.Show(contour) + +# Fetch the view and render the scene +view = pvs.GetActiveView() +pvs.Render(view) + +# Fetch the RenderWindow +ren_win = view.GetClientSideObject().GetRenderWindow() +# Display the RenderWindow with the widget +ViewInteractiveWidget(ren_win) +``` + + + + +%package -n python3-ipyvtklink +Summary: ipywidget for vtkRenderWindow +Provides: python-ipyvtklink +BuildRequires: python3-devel +BuildRequires: python3-setuptools +BuildRequires: python3-pip +%description -n python3-ipyvtklink +# ipyvtklink + +[](https://mybinder.org/v2/gh/Kitware/ipyvtklink/master) +[](https://pypi.org/project/ipyvtklink/) +[](https://anaconda.org/conda-forge/ipyvtklink) + +*An ipywidget for vtkRenderWindow* (formerly `ipyvtk-simple`) + +This is an early prototype of creating a Jupyter interface to VTK. This toolkit +is a proof of concept and a more polished tool will be available as +[`ipyvtk`](https://github.com/Kitware/ipyvtk) in the future. + +The code here was implemented from the work done by [Andras Lasso](https://github.com/lassoan) +under an MIT License (see [the source](https://github.com/Slicer/SlicerJupyter/blob/master/JupyterNotebooks/JupyterNotebooksLib/interactive_view_widget.py)). + +The goal is to enable this widget to work with any server side +[`vtkRenderWindow`](https://vtk.org/doc/nightly/html/classvtkRenderWindow.html) +This render window could be from [VTK Python](https://vtk.org/), +[ParaView](https://www.paraview.org/), or [PyVista](https://www.pyvista.org/). + +Please note that `vtk` is not listed as a requirement for this package to +simplify its installation in virtual environments where VTK may be built from +source or bundled with ParaView and we do not want to install the wheels from +PyPI. + +## Installation + +For use with PyVista, simply install with `pip` or `conda`: + +``` +pip install ipyvtklink +``` + +or +``` +conda install -c conda-forge ipyvtklink +``` + +## Run in Docker + +A Docker image is prebuilt and hosted in the ipyvtklink repository's packages. + +To run in Docker: + +``` +docker pull ghcr.io/kitware/ipyvtklink:latest +docker run -p 8888:8888 ghcr.io/kitware/ipyvtklink:latest +``` + +and open the `vtk.ipynb` notebook. + +Additionally, this can be used with ParaView. An example is given in +`paraview.ipynb` which can be run via: + +``` +docker pull ghcr.io/kitware/ipyvtklink-paraview:latest +docker run -p 8878:8878 ghcr.io/kitware/ipyvtklink-paraview:latest +``` + +## Examples + +You may have to build jupyter lab extensions for this to work in Lab. This is +known to work well in Notebook. + + +### PyVista + +PyVista has fully implemented downstream support for `ipyvtklink`. See [PyVista's Documentation](https://docs.pyvista.org/user-guide/jupyter/ipyvtk_plotting.html) + +See the `pyvista.ipynb` for an original proof of concept. + + + + + + +### Python VTK + +The widget here can be used with VTK. Here is a minimal example showing how +to pass any `vtkRenderWindow` to the `ViewInteractiveWidget`: + +```py +import vtk +from ipyvtklink.viewer import ViewInteractiveWidget + +# Create some data +cylinder = vtk.vtkCylinderSource() +cylinder.SetResolution(8) +mapper = vtk.vtkPolyDataMapper() +mapper.SetInputConnection(cylinder.GetOutputPort()) +actor = vtk.vtkActor() +actor.SetMapper(mapper) + +# Set up render window +ren = vtk.vtkRenderer() +ren_win = vtk.vtkRenderWindow() +ren_win.SetOffScreenRendering(1) +ren_win.SetSize(600, 600) +ren_win.AddRenderer(ren) +iren = vtk.vtkRenderWindowInteractor() +iren.SetRenderWindow(ren_win) +style = vtk.vtkInteractorStyleTrackballCamera() +iren.SetInteractorStyle(style) + +# Add actor to scene +ren.AddActor(actor) +ren.ResetCamera() + +# Display +ViewInteractiveWidget(ren_win) +``` + + + + +### ParaView Python + +See instructions above for running ParaView in a Docker container. + +```py +import paraview.simple as pvs +from ipyvtklink.viewer import ViewInteractiveWidget + +# Create data on the pipeline +wavelet = pvs.Wavelet() +contour = pvs.Contour(Input=wavelet) +contour.ContourBy = ['POINTS', 'RTData'] +contour.Isosurfaces = [63, 143, 170, 197, 276] + +# Set the data as visible +pvs.Show(contour) + +# Fetch the view and render the scene +view = pvs.GetActiveView() +pvs.Render(view) + +# Fetch the RenderWindow +ren_win = view.GetClientSideObject().GetRenderWindow() +# Display the RenderWindow with the widget +ViewInteractiveWidget(ren_win) +``` + + + + +%package help +Summary: Development documents and examples for ipyvtklink +Provides: python3-ipyvtklink-doc +%description help +# ipyvtklink + +[](https://mybinder.org/v2/gh/Kitware/ipyvtklink/master) +[](https://pypi.org/project/ipyvtklink/) +[](https://anaconda.org/conda-forge/ipyvtklink) + +*An ipywidget for vtkRenderWindow* (formerly `ipyvtk-simple`) + +This is an early prototype of creating a Jupyter interface to VTK. This toolkit +is a proof of concept and a more polished tool will be available as +[`ipyvtk`](https://github.com/Kitware/ipyvtk) in the future. + +The code here was implemented from the work done by [Andras Lasso](https://github.com/lassoan) +under an MIT License (see [the source](https://github.com/Slicer/SlicerJupyter/blob/master/JupyterNotebooks/JupyterNotebooksLib/interactive_view_widget.py)). + +The goal is to enable this widget to work with any server side +[`vtkRenderWindow`](https://vtk.org/doc/nightly/html/classvtkRenderWindow.html) +This render window could be from [VTK Python](https://vtk.org/), +[ParaView](https://www.paraview.org/), or [PyVista](https://www.pyvista.org/). + +Please note that `vtk` is not listed as a requirement for this package to +simplify its installation in virtual environments where VTK may be built from +source or bundled with ParaView and we do not want to install the wheels from +PyPI. + +## Installation + +For use with PyVista, simply install with `pip` or `conda`: + +``` +pip install ipyvtklink +``` + +or +``` +conda install -c conda-forge ipyvtklink +``` + +## Run in Docker + +A Docker image is prebuilt and hosted in the ipyvtklink repository's packages. + +To run in Docker: + +``` +docker pull ghcr.io/kitware/ipyvtklink:latest +docker run -p 8888:8888 ghcr.io/kitware/ipyvtklink:latest +``` + +and open the `vtk.ipynb` notebook. + +Additionally, this can be used with ParaView. An example is given in +`paraview.ipynb` which can be run via: + +``` +docker pull ghcr.io/kitware/ipyvtklink-paraview:latest +docker run -p 8878:8878 ghcr.io/kitware/ipyvtklink-paraview:latest +``` + +## Examples + +You may have to build jupyter lab extensions for this to work in Lab. This is +known to work well in Notebook. + + +### PyVista + +PyVista has fully implemented downstream support for `ipyvtklink`. See [PyVista's Documentation](https://docs.pyvista.org/user-guide/jupyter/ipyvtk_plotting.html) + +See the `pyvista.ipynb` for an original proof of concept. + + + + + + +### Python VTK + +The widget here can be used with VTK. Here is a minimal example showing how +to pass any `vtkRenderWindow` to the `ViewInteractiveWidget`: + +```py +import vtk +from ipyvtklink.viewer import ViewInteractiveWidget + +# Create some data +cylinder = vtk.vtkCylinderSource() +cylinder.SetResolution(8) +mapper = vtk.vtkPolyDataMapper() +mapper.SetInputConnection(cylinder.GetOutputPort()) +actor = vtk.vtkActor() +actor.SetMapper(mapper) + +# Set up render window +ren = vtk.vtkRenderer() +ren_win = vtk.vtkRenderWindow() +ren_win.SetOffScreenRendering(1) +ren_win.SetSize(600, 600) +ren_win.AddRenderer(ren) +iren = vtk.vtkRenderWindowInteractor() +iren.SetRenderWindow(ren_win) +style = vtk.vtkInteractorStyleTrackballCamera() +iren.SetInteractorStyle(style) + +# Add actor to scene +ren.AddActor(actor) +ren.ResetCamera() + +# Display +ViewInteractiveWidget(ren_win) +``` + + + + +### ParaView Python + +See instructions above for running ParaView in a Docker container. + +```py +import paraview.simple as pvs +from ipyvtklink.viewer import ViewInteractiveWidget + +# Create data on the pipeline +wavelet = pvs.Wavelet() +contour = pvs.Contour(Input=wavelet) +contour.ContourBy = ['POINTS', 'RTData'] +contour.Isosurfaces = [63, 143, 170, 197, 276] + +# Set the data as visible +pvs.Show(contour) + +# Fetch the view and render the scene +view = pvs.GetActiveView() +pvs.Render(view) + +# Fetch the RenderWindow +ren_win = view.GetClientSideObject().GetRenderWindow() +# Display the RenderWindow with the widget +ViewInteractiveWidget(ren_win) +``` + + + + +%prep +%autosetup -n ipyvtklink-0.2.3 + +%build +%py3_build + +%install +%py3_install +install -d -m755 %{buildroot}/%{_pkgdocdir} +if [ -d doc ]; then cp -arf doc %{buildroot}/%{_pkgdocdir}; fi +if [ -d docs ]; then cp -arf docs %{buildroot}/%{_pkgdocdir}; fi +if [ -d example ]; then cp -arf example %{buildroot}/%{_pkgdocdir}; fi +if [ -d examples ]; then cp -arf examples %{buildroot}/%{_pkgdocdir}; fi +pushd %{buildroot} +if [ -d usr/lib ]; then + find usr/lib -type f -printf "/%h/%f\n" >> filelist.lst +fi +if [ -d usr/lib64 ]; then + find usr/lib64 -type f -printf "/%h/%f\n" >> filelist.lst +fi +if [ -d usr/bin ]; then + find usr/bin -type f -printf "/%h/%f\n" >> filelist.lst +fi +if [ -d usr/sbin ]; then + find usr/sbin -type f -printf "/%h/%f\n" >> filelist.lst +fi +touch doclist.lst +if [ -d usr/share/man ]; then + find usr/share/man -type f -printf "/%h/%f.gz\n" >> doclist.lst +fi +popd +mv %{buildroot}/filelist.lst . +mv %{buildroot}/doclist.lst . + +%files -n python3-ipyvtklink -f filelist.lst +%dir %{python3_sitelib}/* + +%files help -f doclist.lst +%{_docdir}/* + +%changelog +* Fri May 05 2023 Python_Bot <Python_Bot@openeuler.org> - 0.2.3-1 +- Package Spec generated @@ -0,0 +1 @@ +85b060fc9cdccab75f6aa6e8f09574b3 ipyvtklink-0.2.3.tar.gz |