We are happy to announce the release of a ParaView kernel for Jupyter notebooks  !
Basically, creating a ParaView Notebook launches the ParaView GUI in background. Then, the whole API of ParaView is available from the Notebook. At this point, it is very similar to the standard Python shell. Below is a demonstration video.
Demonstration of our ParaView kernel for Jupyter Notebooks.
API to ease data manipulation
In addition, we created a simple Python API so numpy data can easily be added to the pipeline. The API includes:
- create an empty grid;
- create a grid from data;
- add/remove data to a grid;
- remove a grid;
- get the current selection;
- display screenshots (current View states) in the notebook.
For instance, the following notebook generate data with numpy and initialize a regular grid – see Fig. 1.
Figure 1 – A new source can be created and initialized from numpy array.
The dimensions of the resulting grid are set accordingly to the numpy array shape, and a PointData array is created with the
data values – see Fig. 2.
Figure 2 – Resulting information panel
Then the ParaView API can be used to create visualization. Note the
Display method to bring back screenshots in the cell output – see Fig. 3.
Figure 3 – Screenshots can be displayed inside the notebook.
Generating Notebooks from the GUI
In ParaView’s GUI, the Python Trace utility can be used to generate a python script. This feature records action from the GUI and creates a Python version of those actions. To ease creation of notebooks, we added a button in the toolbar to create a trace and transfer it to the current notebook – see Fig. 4.
Figure 4 – This last Notebook cell is the ParaView trace for creating a clip retrieved by clicking a button in the UI.
This ParaView plugin implements Jupyter kernel based on the Xeus project . It provides a kernel configuration file for Jupyter. In this configuration, the executable to be launch is ParaView, configured to load the plugin at startup. It uses environment environment variables to specify the plugin location and to initialize the Jupyter communication.
Also please note that current version does not work on Windows.
Some features from notebook, such as widgets and magics could be useful but are not implemented yet. They may come in the future, stay tuned!
This work was supported by Total SA
Developments were done by Kitware SAS, France.
We wanted to thank the 3DSlicer team who worked on a similar project a few months ago , and helped us a lot to start the work.
 Kernel repository https://gitlab.kitware.com/paraview/paraviewjupyterkernel
 Jupyter main page https://jupyter.org/
 Slicer kernel announcement https://discourse.slicer.org/t/jupyter-notebooks-are-now-usable-in-3d-slicer/3438
 xeus https://xeus.readthedocs.io/en/latest/