forked from pyvista/pyvista
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add PlotterITK examples and documentation (pyvista#580)
* no longer duplicating the mesh when scalars are added * cleaned up docs * added docs in earnest * added tests and itk plotting * added itkwidgets to requirements * various code style and spelling fixes * Update pyvista/plotting/itkplotter.py Co-Authored-By: Bane Sullivan <[email protected]> * checking version without using packaging * fixed doc on meets_version * removed unnecessary print * using scooby.meets_version * updated scooby min version Co-authored-by: Bane Sullivan <[email protected]>
- Loading branch information
1 parent
f0c1dbb
commit d07b43f
Showing
13 changed files
with
320 additions
and
41 deletions.
There are no files selected for viewing
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -10,4 +10,5 @@ Plotting | |
|
||
plotting | ||
qt_plotting | ||
itk_plotting | ||
widgets |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,83 @@ | ||
.. _jupyter_ref: | ||
|
||
PyVista Jupyter Notebook Integration | ||
------------------------------------ | ||
|
||
PyVista has an interface for visualizing plots in Jupyter. The | ||
``pyvista.PlotterITK`` class allows you interactively visualize a mesh | ||
within a jupyter notebook. For those who prefer plotting within | ||
jupyter, this is an great way of visualizing using ``VTK`` and | ||
``pyvista``. | ||
|
||
Special thanks to thewtex | ||
.. _itkwidgets: https://github.com/InsightSoftwareConsortium/itkwidgets | ||
|
||
|
||
Installation | ||
~~~~~~~~~~~~ | ||
To use `PlotterITK` you'll need to install ``itkwidgets>=0.25.2``. | ||
Follow the installation steps here: | ||
.. _itkwidgets: https://github.com/InsightSoftwareConsortium/itkwidgets#installation | ||
|
||
You can install everything with `pip` if you prefer not using conda, | ||
but be sure your juptyerlab is up-to-date. If you encounter problems, | ||
uninstall and reinstall jupyterlab using pip. | ||
|
||
|
||
Example Plotting with ITKwidgets | ||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | ||
The following example shows how to create a simple plot that shows a | ||
simple sphere. | ||
|
||
.. code:: python | ||
import pyvista as pv | ||
# create a mesh and identify some scalars you wish to plot | ||
mesh = pv.Sphere() | ||
z = mesh.points[:, 2] | ||
# Plot using the ITKplotter | ||
pl = pv.PlotterITK() | ||
pl.add_mesh(mesh, scalars=z, smooth_shading=True) | ||
pl.show(True) | ||
.. figure:: ../images/user-generated/itk_plotting_sphere.png | ||
:width: 600pt | ||
|
||
ITKwidgets with pyvista | ||
|
||
|
||
For convenience, figures can also be plotted using the ``plot_itk`` function: | ||
|
||
.. code:: python | ||
import pyvista as pv | ||
# create a mesh and identify some scalars you wish to plot | ||
mesh = pv.Sphere() | ||
z = mesh.points[:, 2] | ||
# Plot using the ITKplotter | ||
pv.plot_itk(mesh, scalars=z) | ||
Additional binder examples can be found at: | ||
|
||
.. _itkwidgets_binder: https://hub.gke.mybinder.org/user/insightsoftware-tium-itkwidgets-p2yw6xvh/lab | ||
|
||
.. rubric:: Attributes | ||
|
||
.. autoautosummary:: pyvista.PlotterITK | ||
:attributes: | ||
|
||
.. rubric:: Methods | ||
|
||
.. autoautosummary:: pyvista.PlotterITK | ||
:methods: | ||
|
||
.. autoclass:: pyvista.PlotterITK | ||
:members: | ||
:undoc-members: | ||
:show-inheritance: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -12,5 +12,6 @@ imageio>=2.5.0 | |
imageio-ffmpeg | ||
colorcet | ||
cmocean | ||
scooby>=0.5.0 | ||
scooby>=0.5.1 | ||
meshio>=3.3.0 | ||
itkwidgets>=0.25.2 |
Oops, something went wrong.