Basic Usage of ParaView

Loading a spatial dataset

Explore how to import and visualize spatial datasets in ParaView. The materials in this section will introduce you to the process of loading common file formats. You will learn how to efficiently manage and explore complex geometries and scalar fields using ParaView’s built-in tools and visualization techniques.

Exercise

Read a spatial dataset representing a medical dataset, perform contouring to extract the head surface, clip the surface to see the internal portion, and then try to assign different colors for difference anatomical structures.

spatial-dataset.png

Dataset Files

You can download the dataset for this exercise from this link.

Loading a temporal dataset

Learn to load and analyze temporal datasets in ParaView, where data evolves over time. This section covers techniques for importing time-dependent datasets, navigating through time steps, and visualizing changes in variables and fields over a series of time intervals, enabling dynamic analysis of simulations.

Exercise

Load a temporal dataset generated from a simulation. Explore the various blocks and scalar arrays within the dataset. Define a region of interest and plot its evolution over time. Optionally, experiment with additional ParaView features that may be relevant to the dataset for further analysis.

temporal.png

Dataset Files

You can download the dataset for this exercise from this link.

Extracting streamlines and glyph based visualization

This section focuses on two important techniques: streamlines and glyph-based visualization. You will learn how to extract and render streamlines to represent vector fields and apply glyphs for visualizing vector magnitudes, directions, and other data attributes, aiding in the interpretation of flow fields and other directional data.

Exercise

Load a suitable dataset to explore the creation of streamlines, streamtubes, and glyphs. Use the Stream Tracer filter in ParaView to extract streamlines, experimenting with various parameters to observe their effects. Investigate how changing the seed type influences the results. From the computed streamlines, generate streamtubes, and enhance the visualization by overlaying glyphs.

streamline-glyph.png

Dataset Files

You can download the dataset for this exercise from this link.

Flow visualization

In this section, you will dive deeper into advanced flow visualization techniques using ParaView.

Exercise

Load a suitable dataset to explore flow visualization.

flow.gif

Dataset Files

You can download the dataset for this exercise from https://cgl.ethz.ch/research/visualization/data.php.

Python Scripting in ParaView

Python scripting in ParaView plays a crucial role in automating tasks, making it easier to handle large datasets and perform repetitive actions without manual intervention. It allows users to customize the visualization process, apply filters, and manage data in a more flexible way. By using scripts, you can also run ParaView in a non-GUI mode, which is particularly useful for processing large-scale data on high-performance computing clusters. Beyond that, scripting ensures that workflows are reproducible and can be easily shared or integrated with other tools and libraries commonly used in scientific research.

Loading your custom datasets

Learn how to load and manipulate custom datasets using Python in ParaView. This exercise will help you understand the process of loading non-standard datasets in ParaView using Python scripts.

Exercise

Load the provided custom dataset. Use a ProgrammableSource in ParaView to import the raw data files. Each file (Scan_i_points.dat) represents an individual scan and contains 3D points measured in the robot’s coordinate system, along with the sensor’s position from which the points were captured. The data format follows the order: sensorPosX, sensorPosY, sensorPosZ, pointX, pointY, pointZ. You can skip the sensor position values and focus on plotting the 3D points (pointX, pointY, pointZ), ignoring the first three values in each row. Once the points are loaded, render them using an appropriate visualization technique in ParaView.

custom-dataset.png

Dataset Files

You can download the dataset for this exercise from this link.

Note that the dataset provided here is a subset of the original data recorded by B. Steder at the University of Freiburg. To access the complete dataset, please refer to http://ais.informatik.uni-freiburg.de/projects/datasets/fr360/.

Writing XML Plugins

This exercise covers a simple example of XML-based plugins for ParaView. You’ll learn how to write plugins that extend ParaView’s capabilities, adding custom sources, filters, or readers by defining them through XML, without needing to compile code.

Exercise

In this exercise, you will create an XML-based plugin to customize the default behavior of the cone source in ParaView. The plugin will modify specific properties of the cone and update the Properties user interface in ParaView by removing unnecessary properties.

Objectives:

  • Change the default resolution of the cone.

  • Change the default orientation of the cone.

  • Remove unnecessary properties from the cone’s property panel.

cone-plugin.png

Dataset Files

You can start your exercise from a basic template. Please download the template from this link.

You can also refer to the ParaView source file Remoting/Application/Resources/sources_filterssources.xml. The file represents an XML configuration file that defines the properties, parameters, and metadata for various sources and filters available in ParaView.

Writing Python Plugins

Python plugins allow for greater customization within ParaView. In the following exercise, you will learn how to create Python plugins to add new functionality in ParaView.

Exercise

In this exercise, you will create a custom Python plugin in ParaView to apply random distortion (RandomWarp) to a sphere. By writing a Python script, you will control the random displacement of the sphere’s surface and understand how to extend ParaView’s functionality using Python.

Objective:

  • Download the exercise script file, which is a basic, incomplete plugin script that you will build upon.

  • Implement the RandomWarp functionality in the plugin script.

  • Apply the plugin to a sphere and visualize the random distortion.

sphere-random-distortion.png

Dataset Files

Please download the incomplete script from this link.

You can also refer to more examples available at https://gitlab.kitware.com/paraview/paraview/-/blob/master/Examples/Plugins/PythonAlgorithm/PythonAlgorithmExamples.py

Writing C++ Plugins

For performance-critical tasks, C++ plugins provide greater control and efficiency. While this workshop focuses primarily on Python, we encourage C++ developers interested in creating ParaView plugins to reach out for assistance. For an inspiration, we provide a demonstration of C++ plugins as part of the workshop. Support for C++ plugin development is available through our User Support Portal at support@naic.no

A detailed documentation about writing plugins is available at https://www.paraview.org/Wiki/ParaView/Plugin_HowTo

Using virtual environments inside ParaView

Learn how to set up and use Python virtual environments within ParaView for isolated and reproducible scripting environments. If you’re using a recent version of ParaView (>= v5.13), you can follow the following instructions:

Create a project folder and cd into it.

$ mkdir my_project
$ cd my_project

Create a virtual environment and install some packages in it.

$ python -m venv my_env  # this will create a virtual environment.
$ source my_env/bin/activate # activate the virtual environment.
$ pip install nibabel # install custom package.
$ deactivate # deactivate the environment.

Now you can run paraview by activating the environment.

$ ./paraview --venv=/home/sherin/workspace/8_MyCustomEnvs/my_env

If you’re using an old version of ParaView and virtualenv as a tool to create isolated Python environments, you can use the following commands:

$ python -m virtualenv venv  # this will create a virtual environment.
$ venv\Scripts\activate # activate the virtual environment.
$ pip install numpy # install custom package.
$ deactivate # deactivate the environment.
$ activate_this = "C:/pv/workshop_2024/custom_envs/myvenv/Scripts/activate_this.py"
$ exec(open(activate_this).read(), {'__file__': activate_this})
$ import numpy as np

ParaView in HPC Environments

This section provides an overview of the recommended workflow for using ParaView in high-performance computing (HPC) environments, particularly within the NAIC infrastructure. While there are several ways to utilize ParaView in a client-server setup, we recommend using EduCloud OnDemand for optimal performance and ease of access when working with ParaView under NAIC.

Using ParaView on EduCloud OnDemand

Educloud OnDemand is a web portal (provided by the University of Oslo (UiO)) that enables interactive access to the Fox HPC cluster, utilizing Open OnDemand technology to provide a user-friendly interface for running applications directly through a web browser. This is the easiest method to make use of ParaView with HPC support because it involves no command-line interactions or writing job scripts by an end-user.

diagram-ondemand.png

Detailed documentation on Educloud OnDemand can be read at https://www.uio.no/english/services/it/research/hpc/open-on-demand/index.html

Summary of user workflow in EduCloud OnDemand

NAIC-Paraview-Workflow.svg

Summary of the NAIC user workflow for using ParaView

Caution

Please note that not all features shown in the figure are currently implemented. For example, the SMS/email notification functionality is not yet available. USIT is currently working on implementing this feature.

Establishing Connection: using EduCloud OnDemand

  1. Go to https://ondemand.educloud.no/ and login with your UiO credentials.

ed1.png

EduCloud OnDemand login page.

  1. After a successful login, you will see several applications to choose from.

ed2.png

EduCloud OnDemand application selection page.

  1. Selecting ParaView in the applications page takes you to the configuration page where you can set specific run settings for running ParaView.

ed3.png

ParaView application configuration request page.

  1. After pressing Launch button in the configuraion page, your request will be queued.

ed4.png

User’s application request status changed to queued.

  1. Once the request is processed, a remote ParaView instance will start running.

ed5.png

User’s application request status changed to running.

  1. After setting the compression and image quality settings, you can launch ParaView in a browser by hitting the Launch ParaView button.

ed6.png

ParaView application running under EduCloud OnDemand

Using ParaView on ML-nodes

This section outlines the procedure for running ParaView under ML Nodes.

Note

Please be aware that the ML nodes lack a batch scheduling system, meaning you cannot execute jobs across multiple machines as you would on a typical HPC system. Consequently, there is no job queuing mechanism in place. We kindly ask all users to utilize the available resources considerately to ensure fair access for everyone. Read more at https://www.uio.no/tjenester/it/forskning/kompetansehuber/uio-ai-hub-node-project/it-resources/ml-nodes/

diagram-mlnodes.png

Detailed documentation on ML Nodes can be read at https://www.uio.no/tjenester/it/forskning/kompetansehuber/uio-ai-hub-node-project/it-resources/ml-nodes/

Establishing Connections - ML Nodes

This section explains how to connect to pvserver instances running on machine learning (ML) nodes.

  1. If you have any data, you may use the following command (in a separate local terminal) to move your data to a suitable storage location to an ML node.

# copy a single file to home folder on your ML-node (for example ml3)
$ scp -J <USERNAME>@login.uio.no afile.txt <USERNAME>@ml3.hpc.uio.no:
  1. Use a local terminal and login to one of the available ML nodes.

$ ssh -J UIO-USER-NAME@login.uio.no  UIO-USER-NAME@ml3.hpc.uio.no
  1. Ensure that your local ParaView version matches the version available on the ML-node. To check available versions on the ML-node, execute module avail ParaView. If a matching version isn’t listed, consider using a prebuilt version of ParaView on the ML-node.

# Download ParaView version 5.13.1 from a download link (Please note that the provided link will expire in the future.)
$ wget --content-disposition "https://filesender.uio.no/download.php?token=d93cef6d-2154-4ac8-a06d-c412836bcca6&files_ids=439887"
# Extract ParaView binaries
$ tar -xvzf ParaView-5.13.1-egl-MPI-Linux-Python3.10-x86_64.tar.gz
# cd into the bin folder
$ cd ParaView-5.13.1-egl-MPI-Linux-Python3.10-x86_64/bin
  1. Run pvserver instances in parallel.

# For this workshop, please use 2 as the number of processor cores.
$ ./mpiexec -n 2 ./pvserver --server-port=11111

Note

Please read the guidelines at https://www.uio.no/tjenester/it/forskning/kompetansehuber/uio-ai-hub-node-project/it-resources/ml-nodes/#toc9 before using the ML system for your research projects.

  1. Open a local terminal in your computer and setup the following SSH tunnel.

$ ssh -J sherinsu@gothmog.uio.no -L 5556:localhost:11111 sherinsu@ml3.hpc.uio.no
  1. Make a connection using the following steps:

  • Launch ParaView, and click the Connect button on the toolbar.

  • Click the Add Server button.

  • In the Edit Server Configuration window, input:

MyServer  (#or any name you like)
Client/Server
localhost
5556
  • Click Configure, then Save

  • Back in the main connection window, click Connect

  • A popup saying “Establishing Connection” will appear.

  • If connection is successful, MyServer will be listed in the Pipeline Browser

Example screenshots depicting the above steps are given below:

remote_connection_steps1.png

Steps to connect to a remote server.

remote_connection_steps2.png

Steps to connect to a remote server.

Using ParaView on Fox HPC

This section outlines the procedure for leveraging the Fox HPC system’s remote rendering capabilities with your locally running ParaView instance. Unlike the EduCloud OnDemand method, this approach requires command-line interactions and the use of job scripts, making it particularly beneficial in scenarios such as automated job script execution.

diagram-fox.png

Detailed documentation on Fox HPC can be read at https://www.uio.no/english/services/it/research/hpc/fox/

Establishing Connections - Fox HPC

Use the following instructions to use pvserver instances running in Fox HPC. To learn more on using Fox, please visit https://www.uio.no/english/services/it/research/platforms/edu-research/help/fox/index.md

  1. Connect to Fox.

$ ssh <educloud-username>@fox.educloud.no 
  1. You can move your data using the following commands

$ scp my_file.tar.gz <username>@fox.educloud.no:

OR

# the -r option is used to copy an entire directory:
$ scp -r my_dir/ <username>@fox.educloud.no:/cluster/work/users/<username>/
  1. Ensure that your local ParaView version matches the version available on the Fox HPC system. To check available versions on Fox, execute module avail ParaView. If a matching version isn’t listed, consider using a prebuilt version of ParaView on Fox.

# Download ParaView version 5.13.1 from a download link (the following link will expire later)
$ wget --content-disposition "https://filesender.uio.no/download.php?token=d93cef6d-2154-4ac8-a06d-c412836bcca6&files_ids=439887"
# Extract ParaView binaries
$ tar -xvzf ParaView-5.13.1-egl-MPI-Linux-Python3.10-x86_64.tar.gz
# cd into the bin folder
$ cd ParaView-5.13.1-egl-MPI-Linux-Python3.10-x86_64/bin

Note

For additional methods of transferring files, please refer to https://www.uio.no/english/services/it/research/platforms/edu-research/help/fox/transferring-files.md

  1. Submit a job using the run_pvserver.sh slurm script.

Download

Download the run_pvserver.sh script from this link. Please modify the paths as needed.

$ sbatch run_pvserver.sh
  1. Wait until the job starts running…

$ sacct
JobID           JobName  Partition    Account  AllocCPUS      State ExitCode 
------------ ---------- ---------- ---------- ---------- ---------- -------- 
1108197       mpvserver      accel      ec232          5    RUNNING      0:0 
1108197.bat+      batch                 ec232          5    RUNNING      0:0 
1108197.ext+     extern                 ec232          5    RUNNING      0:0 
1108197.0    hydra_pmi+                 ec232          5    RUNNING      0:0 
  1. Take a note of the nodes associated with your job.

$ squeue -j 1108197
(base) [ec-sherinsu@login-3 workshop2025]$ squeue -j 1108197
             JOBID PARTITION     NAME     USER ST       TIME  NODES NODELIST(REASON)
           1108197     accel mpvserve ec-sheri  R       2:56      1 gpu-2
  1. Open a local terminal in your computer and setup the following SSH tunnel.

$ ssh -J sherinsu@gothmog.uio.no -L 5556:gpu-2:11111 ec-sherinsu@fox.educloud.no
  1. Start your local ParaView instance and make a connection using the following settings.

Server Type: Client/Server     Host: localhost     Port:5556

Using ParaView on NAIC Orchestrator (Still POC and under development)

The NAIC Orchestrator portal allows users to easily create and use VMs offered by multiple vendors.

Caution

The orchestrator project is still in the proof-of-concept stage and under active development.

diagram-orchestrator.png

Detailed documentation on NAIC Orchestrator can be read at https://orchestrator.naic.no/

Establishing Connections - NAIC Orchestrator

  1. Login to https://orchestrator.naic.no/ with your EduCloud account.

  2. After successful login, click Create to set up a new virtual machine (VM).

orchestrator_step1.png

Create Virtual Machine page in the NAIC Orchestrator portal.

  1. Enter a name for the VM and create a new SSH key pair by clicking Create New +. In the example below, the SSH key is named pv-key. Click Create key pair.

orchestrator_step2.png

Create a new SSH key pair.

  1. You will be prompted to download the private key. Ensure you download and save it securely. Press Okay

orchestrator_step3.png

Download your private key.

  1. The SSH key creation step will be confirmed as successful. Next, provide additional details, including the locations from which you need access to the VM.

orchestrator_step4.png

SSH key pair creation successful.

  1. Enable the Advanced View and choose the required VM configuration from available vendors. Press Create Virtual Machine

orchestrator_step5.png

Choose your VM.

  1. Wait for the VM to get initialized and started running.

status.png

VM Creation Status: Waiting in Queue, Creating, and Running

  1. When the status changes to ‘Running’, click Help to access the login instructions. A detailed instructions page will appear, outlining steps to secure your private key and log in to your virtual machine using the provided SSH login string.

  2. Follow below instructions to download a prebuilt ParaView binary and start the pvserver instance(s). Be sure to adjust the download link to match your local ParaView version and align with the VM capabilities (GPU(egl) or no-GPU(osmesa)).

$ wget --content-disposition "https://filesender.uio.no/download.php?token=d93cef6d-2154-4ac8-a06d-c412836bcca6&files_ids=439887"
$ tar -xvzf ParaView-5.13.1-egl-MPI-Linux-Python3.10-x86_64.tar.gz
$ ./mpiexec -n 6 ./pvserver --server-port=11111
  1. If the pvserver is successfully started, you will see a similar output as shown below:

Waiting for client...
Connection URL: cs://naic-vm-99fc1828-1bad-485b-b09f-692e94a490fe:11111
Accepting connection(s): naic-vm-99fc1828-1bad-485b-b09f-692e94a490fe:11111
  1. Open a local terminal in your computer and setup the following SSH tunnel.

$ ssh -L 5556:naic-vm-99fc1828-1bad-485b-b09f-692e94a490fe:11111 naic-user@35.228.25.244 -i pv-key.pem
  1. Start your local ParaView instance and make a connection using the following settings.

Server Type: Client/Server     Host: localhost     Port:5556

ParaView Visualizations to Web

Kitware has developed trame, a user-friendly Python and web-based framework designed for visual analytics, seamlessly integrating powerful open-source tools and systems. When using trame, users can create advanced applications using simple Python scripts. When using trame, it is possible to integrate with other technologies like Vuetify, Plotly and Matplotlib. With trame, it is possible to build visualization applications that are cross-platform and scalable.

trame.png

Running a simple example using trame.

trame: Local vs Remote Rendering

Exercise

Run a trame example to render a cone and try to add/update features.

Objective:

  • Study the effects of running Local Rendering

  • Study the effects of running Remote Rendering

Source Files

Please download example scripts from the following links.

Hint

You can use a similar command to start a local or remote server. Be sure to modify the file paths to match your setup. : ./pvpython /home/sherin/workspace/paraview/documents/downloads/workshop_2024/solution/trame/RemoteRendering.py --venv /home/sherin/workspace/my_env

trame: ParaView (v>=5.13) to Web

Use the following example steps to learn publishing your ParaView visualizations to the web.

  1. Setup a virtual environment with trame installed.

# create a new virtual environment
python3.10 -m venv trame_env

# activate the environment
source trame_env/bin/activate 

# install the package `paraview-trame-components`
pip install paraview-trame-components

# exit from the environment
deactivate
  1. Run a demo code from the package.

pvpython --venv trame_env -m ptc.apps.demo
trame-demo

trame demo

Exercise

Update the source code of ptc.apps.demo module to achieve a visualization shown in the image below.

Objective:

  • Modify the ptc.apps.demo module to visualize each surface vertex as a small sphere. The faces of the original surface should be hidden.

paraview-trame-web

Exercise: Sample Output

Collaborative Visualization using HPC

This section how to collaborate on visualizations using high-performance computing (HPC) clusters. The main objective here is to enable multiple researchers to collaborate in real-time on data visualization and analysis using ParaView. The setup will allow you to do shared exploration of data, making it useful for research collaboration, demonstration and presentations.

collaborative-vis.png

One Server, Multiple Clients

This section covers real-time collaboration, remote visualization, and the use of shared resources to enhance teamwork in scientific analysis.

Controlling ParaView from Jupyter Notebook

ParaView can be accessed directly from a Jupyter Notebook, providing an interactive and scriptable workflow. To access this feature, you may follow the documentation provided at https://gitlab.kitware.com/paraview/plugins/iparaview-kernel

In future, we will automate the kernel setup process. Once implemented, you’ll be able to launch a Jupyter instance (that can use ParaView in it) effortlessly as an app within EduCloud OnDemand.

Advanced Rendering

ParaView offers advanced rendering techniques, such as photorealistic rendering with ray tracing, advanced lighting and shading models, and volumetric rendering for dense 3D datasets. While these features are not currently included in the workshop, there are plans to introduce related content and exercises in the future.