scientific visualization an introduction - purdue...

46
9/22/2016 1 Scientific Visualization An Introduction Vetria L. Byrd, PhD Assistant Professor Research and Technology Development Conference Missouri S&T September 13, 2016 Featuring RTD 2016 Thank You! Missouri S&T Mark Bookout Jennifer Nixon

Upload: others

Post on 04-Jun-2020

1 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Scientific Visualization An Introduction - Purdue Universityweb.ics.purdue.edu/~vbyrd/presentations/VByrd_MST_RTD_091316_… · 9/22/2016 1 Scientific Visualization An Introduction

9/22/2016

1

Scientific Visualization An Introduction

Vetria L. Byrd, PhDAssistant Professor

Research and Technology Development Conference

Missouri S&T

September 13, 2016

Featuring

RTD 2016

Thank You!Missouri S&T

Mark BookoutJennifer Nixon

Page 2: Scientific Visualization An Introduction - Purdue Universityweb.ics.purdue.edu/~vbyrd/presentations/VByrd_MST_RTD_091316_… · 9/22/2016 1 Scientific Visualization An Introduction

9/22/2016

2

Academic Preparation• Computer Science (PhD, MS)

• Biomedical Engineering (MSMBE)

Where I Am NowAssistant Professor

Purdue University

Computer Graphics Technology

CGT Advanced Data Visualization Laboratory, Director

Vetria L. Byrd, PhD

What I’ve DoneVisualization Initiatives

• Research Experience for Undergraduates in Collaborative Data Visualization Applications (2014/2015)

• BPViz: Broaden Participation in Visualization (2014/2016)

• Curriculum Development for Data Visualization

Agent for “Insight”

High Level Overview

Getting data into ParaView

Creating a simple vtk file from scratch

Running ParaView commands in the python shell

Q&A

AGENDAINTRODUCTION TO SCIENTIFIC VISUALIZATION FEATURING PARAVIEW

Page 3: Scientific Visualization An Introduction - Purdue Universityweb.ics.purdue.edu/~vbyrd/presentations/VByrd_MST_RTD_091316_… · 9/22/2016 1 Scientific Visualization An Introduction

9/22/2016

3

You are familiar with ParaView

At the very least have heard of it

You are familiar with Python

You are interested in utilizing the power of ParaView in your python scripts

ASSUMPTIONSINTRODUCTION TO SCIENTIFIC VISUALIZATION FEATURING PARAVIEW

Data Visualization ProcessHigh Level Overview

Page 4: Scientific Visualization An Introduction - Purdue Universityweb.ics.purdue.edu/~vbyrd/presentations/VByrd_MST_RTD_091316_… · 9/22/2016 1 Scientific Visualization An Introduction

9/22/2016

4

What is the purpose of Visualization?

“The purpose of visualization

is “insight”,

not pictures.”~Ben Shneiderman

Page 5: Scientific Visualization An Introduction - Purdue Universityweb.ics.purdue.edu/~vbyrd/presentations/VByrd_MST_RTD_091316_… · 9/22/2016 1 Scientific Visualization An Introduction

9/22/2016

5

What does Insight lead to?

10101010101010101010101010010101010101070101010101010010700101100110011001100110011001110011001100101010101010701010101011100010111000101111000101001101010101010101011100011001010101010101010001010701001010001010101010101010101010101010101010101010101010101010101010101010101010101010101070101011010107010101010101070101001010101010101010101010101001010010110011001100110011001100111001100110010101010101010101010101110001011100010711100010100110101010101010101110001100101010101010101000101010100101000101010101010101070101010101010101010107010101010101010101010101010101010101010101010101110011001100110010101001

• Visualizing Patterns

• Spotting Differences

How many

7’s do you

see?

Spotting Differences

“Insight” Leads to . . 

Page 6: Scientific Visualization An Introduction - Purdue Universityweb.ics.purdue.edu/~vbyrd/presentations/VByrd_MST_RTD_091316_… · 9/22/2016 1 Scientific Visualization An Introduction

9/22/2016

6

10101010101010101010101010010101010101070101010101010010700101100110011001100110011001110011001100101010101010701010101011100010111000101111000101001101010101010101011100011001010101010101010001010701001010001010101010101010101010101010101010101010101010101010101010101010101010101010101070101011010107010101010101070101001010101010101010101010101001010010110011001100110011001100111001100110010101010101010101010101110001011100010711100010100110101010101010101110001100101010101010101000101010100101000101010101010101070101010101010101010107010101010101010101010101010101010101010101010101110011001100110010101001

10101010101010101010101010010101010101070101010101010010700101100110011001100110011001110011001100101010101010701010101011100010111000101111000101001101010101010101011100011001010101010101010001010701001010001010101010101010101010101010101010101010101010101010101010101010101010101010101070101011010107010101010101070101001010101010101010101010101001010010110011001100110011001100111001100110010101010101010101010101110001011100010711100010100110101010101010101110001100101010101010101000101010100101000101010101010101070101010101010101010107010101010101010101010101010101010101010101010101110011001100110010101001

Spotting Differences

“Insight” Leads to . . 

Allows users to answer questions they didn’t know they had

“Insight” Leads to . . 

Human Genome Projecthttps://pradipjntu.files.wordpress.com/2011/05/molecularmachine.jpg

Page 7: Scientific Visualization An Introduction - Purdue Universityweb.ics.purdue.edu/~vbyrd/presentations/VByrd_MST_RTD_091316_… · 9/22/2016 1 Scientific Visualization An Introduction

9/22/2016

7

The Challenger Disaster

http://en.wikipedia.org/wiki/33 File: Challenger_explosion.jpg

“Insight” Leads to . . 

Visualizing Spatial Relationships

“Insight” Leads to . . 

Muehlenhaus, I. (2012). Chapter 8, Visualizing Spatial Relationships, Visualize This: The Flowing Data Guide to Design, Visualization, and Statistics, pp 271‐326.

http://datafl.ws/197

http://datafl.ws/198

Page 8: Scientific Visualization An Introduction - Purdue Universityweb.ics.purdue.edu/~vbyrd/presentations/VByrd_MST_RTD_091316_… · 9/22/2016 1 Scientific Visualization An Introduction

9/22/2016

8

“Insight” Tells a Story

Insight

Explanation 

Tells a Story

Page 9: Scientific Visualization An Introduction - Purdue Universityweb.ics.purdue.edu/~vbyrd/presentations/VByrd_MST_RTD_091316_… · 9/22/2016 1 Scientific Visualization An Introduction

9/22/2016

9

Visualization Applications

BioVis

InfoVis

GeoVis

SciVis

The visualization of biological data; often grouped with computer animation

Interdisciplinary study of the “visual representation” of large‐scale collections of non‐numerical information

Communicates geospatial information in ways that, when combined with human understanding, allow for data exploration and decision‐making processes

Primarily concerned with the visualization of three‐dimensional phenomena; Emphases on realistic renderings of volumes, surfaces, illumination sources, etc.

Page 10: Scientific Visualization An Introduction - Purdue Universityweb.ics.purdue.edu/~vbyrd/presentations/VByrd_MST_RTD_091316_… · 9/22/2016 1 Scientific Visualization An Introduction

9/22/2016

10

Scientific Visualization Pipeline

20http://www.bu.edu/tech/research/training/tutorials/introduction‐to‐scientific‐visualization‐tutorial/the‐scientific‐visualization‐pipeline/

Input Data

Prepared Data

SciVis Model Data

Computer Graphics Data

Image Data

Produce Input Data

Analyze, Filter, Reformat

Apply Sci Vis Techniques

Map to Geometry

Render, Post process

View Results

Scientific Visualization Pipeline: Step 1 . . .

Simulated Data

Images

Numerical

Some measured value

Observed Phenomena

Adopted from http://www.bu.edu/tech/research/training/tutorials/introduction‐to‐scientific‐visualization‐tutorial/the‐scientific‐visualization‐pipeline/

Page 11: Scientific Visualization An Introduction - Purdue Universityweb.ics.purdue.edu/~vbyrd/presentations/VByrd_MST_RTD_091316_… · 9/22/2016 1 Scientific Visualization An Introduction

9/22/2016

11

Cleaning up the data• Removing noise

• Replacing missing values

• Clamping values to be within a specific range of interest

Performing operations to yield more useful data

Adopted from http://www.bu.edu/tech/research/training/tutorials/introduction‐to‐scientific‐visualization‐tutorial/the‐scientific‐visualization‐pipeline/

Scientific Visualization Pipeline: Step 2 . . .

Converts raw information into something more understandable

Visually extracting meaning from a scientific data set using various techniques

Contour Clip Threshold Glyphs Streamlines

Adopted from http://www.bu.edu/tech/research/training/tutorials/introduction‐to‐scientific‐visualization‐tutorial/the‐scientific‐visualization‐pipeline/

Scientific Visualization Pipeline: Step 3

Page 12: Scientific Visualization An Introduction - Purdue Universityweb.ics.purdue.edu/~vbyrd/presentations/VByrd_MST_RTD_091316_… · 9/22/2016 1 Scientific Visualization An Introduction

9/22/2016

12

Scalars, vectors, tensors

1D, 2D, 3D

Mesh

Adopted from http://www.bu.edu/tech/research/training/tutorials/introduction‐to‐scientific‐visualization‐tutorial/the‐scientific‐visualization‐pipeline/

Scientific Visualization Pipeline Step 4 . . .

Adopted from http://www.bu.edu/tech/research/training/tutorials/introduction‐to‐scientific‐visualization‐tutorial/the‐scientific‐visualization‐pipeline/

Data Representation

Display

Graphic Primitives

Visualization Primitives

Iteration and 

Refinement

Scientific Visualization Pipeline: Step 5 . . .

Page 13: Scientific Visualization An Introduction - Purdue Universityweb.ics.purdue.edu/~vbyrd/presentations/VByrd_MST_RTD_091316_… · 9/22/2016 1 Scientific Visualization An Introduction

9/22/2016

13

Adopted from http://www.bu.edu/tech/research/training/tutorials/introduction‐to‐scientific‐visualization‐tutorial/the‐scientific‐visualization‐pipeline/

Scientific Visualization Pipeline: Step 6 . . .

Output from ParaView

http://www.bu.edu/tech/research/training/tutorials/introduction‐to‐scientific‐visualization‐tutorial/the‐scientific‐visualization‐pipeline/

What’s Missing?

Page 14: Scientific Visualization An Introduction - Purdue Universityweb.ics.purdue.edu/~vbyrd/presentations/VByrd_MST_RTD_091316_… · 9/22/2016 1 Scientific Visualization An Introduction

9/22/2016

14

http://www.bu.edu/tech/research/training/tutorials/introduction‐to‐scientific‐visualization‐tutorial/the‐scientific‐visualization‐pipeline/

Visualization is an iterative process

Visualization is the tool that will take us forward from the traditional output of high performance computing (HPC) that we are used to into a visual medium that allows researchers to collaborate and elaborate on the finding's they’ve got.

Tim CarrollDirector and Global Lead, Dell Research Computing SolutionsHPC Source (Spring 2011)

Page 15: Scientific Visualization An Introduction - Purdue Universityweb.ics.purdue.edu/~vbyrd/presentations/VByrd_MST_RTD_091316_… · 9/22/2016 1 Scientific Visualization An Introduction

9/22/2016

15

Large data produced by large simulations produce large visualization results and require large visualization resources

Texas Advanced Computing Center

Terabytes of data

AT LEAST Terabytes of 

Vis

GigapixelImages

Resampling, Application,  . . .

Resolution to Capture Feature Detail

Data visualization is becoming an increasingly important component of analytics in the age of big data (SAS: Five big data challenges and how to overcome them with visual analytics)http://www.sas.com/resources/asset/five-big-data-challenges-article.pdf

Between now and 2020, the information in the Digital Universe will grow by a factor of 44; the number of “files” in it to be managed will grow by a factor of 67

Gantz, J., and Reinsel, D. (2012). The Digital Universe in 2020: Big Data, Bigger Digital Shadows, and Biggest Growth in the Far East. IDC IVIEW, Sponsored by EMC Corporation

Page 16: Scientific Visualization An Introduction - Purdue Universityweb.ics.purdue.edu/~vbyrd/presentations/VByrd_MST_RTD_091316_… · 9/22/2016 1 Scientific Visualization An Introduction

9/22/2016

16

Getting Your Data Into ParaView

Three Basic Steps:

• First your data must be read into ParaView

• Next, you may apply any number of filters that process the data to generate, extract, or derive features from the data

• Finally, a viewable image is rendered from the data

Page 17: Scientific Visualization An Introduction - Purdue Universityweb.ics.purdue.edu/~vbyrd/presentations/VByrd_MST_RTD_091316_… · 9/22/2016 1 Scientific Visualization An Introduction

9/22/2016

17

• Open source, multiplatform

• Supports distributed computation models

• Extensible modular architecture

• Available for 3D computer graphics, image processing and visualization

• Collection of C++ libraries

• Leveraged by many applications

• Divided into logical areas• Filtering• Information Visualization• Volume Rendering

• Cross platform, using OpenGL

• Wrapped in Python, Tool Command Language (Tcl) and Java

ParaView is an end-user application with support for

• Parallel Data Archiving

• Parallel Reading

• Parallel Processing

• Parallel Rendering

• Single node, Client-Server, MPI Cluster Rendering

Page 18: Scientific Visualization An Introduction - Purdue Universityweb.ics.purdue.edu/~vbyrd/presentations/VByrd_MST_RTD_091316_… · 9/22/2016 1 Scientific Visualization An Introduction

9/22/2016

18

• Multi-platform parallel data analysis and visualization application

• Mature, feature-rich interface

• Good for general purpose, rapid visualization

Mac

Windows

Linux

• Open Source . . . It’s Free!

• http://www.paraview.org/

• Built upon the Visualization Toolkit (VTK) library

• Primary contributors:

Kitware, Inc.

Sandia National Laboratory

Los Alamos National Laboratory

Army Research Laboratory

Page 19: Scientific Visualization An Introduction - Purdue Universityweb.ics.purdue.edu/~vbyrd/presentations/VByrd_MST_RTD_091316_… · 9/22/2016 1 Scientific Visualization An Introduction

9/22/2016

19

Grid – regular structure, all voxels (cells) are the same size and shape

Adopted from The ParaView Tutorial, The Basics of Visualization, version 3.98

Curvilinear – regularly gridded mesh shaping function applied

Adopted from The ParaView Tutorial, The Basics of Visualization, version 3.98

Page 20: Scientific Visualization An Introduction - Purdue Universityweb.ics.purdue.edu/~vbyrd/presentations/VByrd_MST_RTD_091316_… · 9/22/2016 1 Scientific Visualization An Introduction

9/22/2016

20

Unstructured grid – irregular mesh typically composed of tetrahedra, prisms, pyramids, or hexahedra

Adopted from The ParaView Tutorial, The Basics of Visualization, version 3.98

• Point data

• Polygonal data

• Images

• Multi-block

• Adaptive Mesh Refinement (AMR)

• Time series support

Page 21: Scientific Visualization An Introduction - Purdue Universityweb.ics.purdue.edu/~vbyrd/presentations/VByrd_MST_RTD_091316_… · 9/22/2016 1 Scientific Visualization An Introduction

9/22/2016

21

• Isosurfaces

• Cutting planes

• Streamlines

• Glyphs

• Volume rendering

• Clipping

• Height maps

• & more

• Supports derived variables

• Scriptable via Python

• Saves animations

• Can run in parallel / distributed mode for large data visualization

Page 22: Scientific Visualization An Introduction - Purdue Universityweb.ics.purdue.edu/~vbyrd/presentations/VByrd_MST_RTD_091316_… · 9/22/2016 1 Scientific Visualization An Introduction

9/22/2016

22

ParaView 5.0.0Let’s get started . . . .

Menu Bar

Tool Bar

Pipeline Browser

Object Inspector

3D Viewer

Page 23: Scientific Visualization An Introduction - Purdue Universityweb.ics.purdue.edu/~vbyrd/presentations/VByrd_MST_RTD_091316_… · 9/22/2016 1 Scientific Visualization An Introduction

9/22/2016

23

Getting Data Into VTK File FormatSample File

Many more . . . 

Page 24: Scientific Visualization An Introduction - Purdue Universityweb.ics.purdue.edu/~vbyrd/presentations/VByrd_MST_RTD_091316_… · 9/22/2016 1 Scientific Visualization An Introduction

9/22/2016

24

• VTK (http://www.vtk.org/VTK/img/file-formats.pdf)

• EnSight

• Plot3D

• Various polygonal formats

• Users can write data readers to extend support to other formats

• Conversion to the VTK format is straightforward

• ASCII or binary

• Supports all VTK grid types

• Easiest for data conversion

VTK simple legacy format (http://www.vtk.org/VTK/img/file‐formats.pdf)

Page 25: Scientific Visualization An Introduction - Purdue Universityweb.ics.purdue.edu/~vbyrd/presentations/VByrd_MST_RTD_091316_… · 9/22/2016 1 Scientific Visualization An Introduction

9/22/2016

25

The data• Simulated

temperature values

• Sample size: 100 x 100

• Rectilinear Grid

# vtk DataFile Version 2.0

Rectilinear grid of temperature values

ASCII

DATASET RECTILINEAR_GRID

Page 26: Scientific Visualization An Introduction - Purdue Universityweb.ics.purdue.edu/~vbyrd/presentations/VByrd_MST_RTD_091316_… · 9/22/2016 1 Scientific Visualization An Introduction

9/22/2016

26

# vtk DataFile Version 2.0Rectilinear grid of temperature valuesASCIIDATASET RECTILINEAR_GRIDDIMENSIONS 100 100 1

X_COORDINATES 100 float0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99

Y_COORDINATES 100 float0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99

Z_COORDINATES 1 float0

* Although this is a 2D grid, the z‐coordinate must be included and represented in the DIMENSIONS

# vtk DataFile Version 2.0Rectilinear grid of temperature valuesASCIIDATASET RECTILINEAR_GRIDDIMENSIONS 100 100 1X_COORDINATES 100 float0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99Y_COORDINATES 100 float0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99Z_COORDINATES 1 float0POINT_DATA 10000SCALARS temperature floatLOOKUP_TABLE default

x‐dimension * y‐dimension * z‐dimension*  * 

Page 27: Scientific Visualization An Introduction - Purdue Universityweb.ics.purdue.edu/~vbyrd/presentations/VByrd_MST_RTD_091316_… · 9/22/2016 1 Scientific Visualization An Introduction

9/22/2016

27

# vtk DataFile Version 2.0

Rectilinear grid of temperature values

ASCII

DATASET RECTILINEAR_GRID

DIMENSIONS 100 100 1

X_COORDINATES 100 float

0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99

Y_COORDINATES 100 float

0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99

Z_COORDINATES 1 float

0

POINT_DATA 10000

SCALARS temperature float

LOOKUP_TABLE default

20.18 20.36 20.54 20.73 20.93 21.13 21.35 21.58 21.82 22.09 22.38 22.70 23.06 23.46 23.92 24.44 25.05 25.77 26.63 27.68 28.99 30.68 32.90 35.99 40.50 47.61 60.00 84.65 142.03 300.00 300.00 300.00 300.00 300.00 300.00 300.00 300.00 289.04 288.50 287.82

:

:

• File  Open Locate and open file you just saved

• Click Apply

Page 28: Scientific Visualization An Introduction - Purdue Universityweb.ics.purdue.edu/~vbyrd/presentations/VByrd_MST_RTD_091316_… · 9/22/2016 1 Scientific Visualization An Introduction

9/22/2016

28

Add Contour Plot Set the range of values

From 20.01

To: 300

Step 10

EXERCISE: VISUALIZE SAMPLE DATA

Filters

Common

Contour

Split Window

Page 29: Scientific Visualization An Introduction - Purdue Universityweb.ics.purdue.edu/~vbyrd/presentations/VByrd_MST_RTD_091316_… · 9/22/2016 1 Scientific Visualization An Introduction

9/22/2016

29

Delete all objects in the Pipeline Browser

Select an object in the Pipeline Browser

Click the Delete button (or right click, then Delete)

To select multiple objects press and hold the CTRL key while selecting objects

You should be here

ParaView/Python ScriptingA short introduction to ParaView’s Python Interface

In stand‐alone mode

Page 30: Scientific Visualization An Introduction - Purdue Universityweb.ics.purdue.edu/~vbyrd/presentations/VByrd_MST_RTD_091316_… · 9/22/2016 1 Scientific Visualization An Introduction

9/22/2016

30

Can run in two modes:

[1] Stand-alone

[2] Client Server – where the server is usually a visualization cluster

Rich scripting support through Python.

Available

As part of the ParaView Client (ParaView)

An MPI-enabled batch application (pvbatch)

The ParaView python client (pvpython) or

Any other Python-enabled application

Using Python, users and developers can gain access to the ParaView engine called Server Manager

Page 31: Scientific Visualization An Introduction - Purdue Universityweb.ics.purdue.edu/~vbyrd/presentations/VByrd_MST_RTD_091316_… · 9/22/2016 1 Scientific Visualization An Introduction

9/22/2016

31

• Library

• Designed to make it easy to build distributed client-server applications

SERVER MANAGER

Start ParaViewOpen Python Shell: Tools Python Shell

PYTHON SHELL – USING PARAVIEW CLIENT

Page 32: Scientific Visualization An Introduction - Purdue Universityweb.ics.purdue.edu/~vbyrd/presentations/VByrd_MST_RTD_091316_… · 9/22/2016 1 Scientific Visualization An Introduction

9/22/2016

32

CREATING A PIPELINE

Create a Cone Object type:

>>> cone = Cone()

Create a Cone Object:

>>> cone = Cone()

CREATING A PIPELINE

Page 33: Scientific Visualization An Introduction - Purdue Universityweb.ics.purdue.edu/~vbyrd/presentations/VByrd_MST_RTD_091316_… · 9/22/2016 1 Scientific Visualization An Introduction

9/22/2016

33

Create a Cone Object type:

>>> cone = Cone()

>>> help(cone)

CREATING A PIPELINE

Create a Cone Object:

>>> cone = Cone()

>>> help(cone)

This gives you the full list

of properties.

CREATING A PIPELINE

Page 34: Scientific Visualization An Introduction - Purdue Universityweb.ics.purdue.edu/~vbyrd/presentations/VByrd_MST_RTD_091316_… · 9/22/2016 1 Scientific Visualization An Introduction

9/22/2016

34

Create a Cone Object:

>>> cone = Cone()

>>> help(cone)

Check what the resolution property is set to type:

>>> cone.Resolution

OUTPUT

>>> cone.Resolution

6

>>>

CREATING A PIPELINE

Create a Cone Object:

>>> cone = Cone()

>>> help(cone)

>>> cone.Resolution

You can increase the resolution, type:

>>> cone.Resolution = 32

OUTPUT

>>> cone.Resolution

6

>>>

CREATING A PIPELINE

Page 35: Scientific Visualization An Introduction - Purdue Universityweb.ics.purdue.edu/~vbyrd/presentations/VByrd_MST_RTD_091316_… · 9/22/2016 1 Scientific Visualization An Introduction

9/22/2016

35

Create a Cone Object:

>>> cone = Cone()

>>> help(cone)

>>> cone.Resolution

You can increase the resolution:

>>> cone.Resolution = 32

OUTPUT

>>> cone.Resolution

6

>>> cone.Resolution = 32

>>>

CREATING A PIPELINE

You could have specified a value for resolution when creating the object>>> cone = Cone(Resolution=32)

You could have specified a value for resolution when creating the object>>> cone = Cone(Resolution=32)

Create a Cone Object:

>>> cone = Cone()

>>> help(cone)

>>> cone.Resolution

You can assign values to any number of properties during construction using keyword arguments:

Type:

>>> cone.Center

[0.0, 0.0, 0.0]

OUTPUT

>>> cone.Resolution

6

>>> cone.Resolution = 32

>>> cone.Center

[0.0, 0.0, 0.0]

CREATING A PIPELINE

Page 36: Scientific Visualization An Introduction - Purdue Universityweb.ics.purdue.edu/~vbyrd/presentations/VByrd_MST_RTD_091316_… · 9/22/2016 1 Scientific Visualization An Introduction

9/22/2016

36

Create a Cone Object:

>>> cone = Cone()

>>> help(cone)

>>> cone.Resolution

>>> cone.Center

>>> cone.Center = [1, 2, 3]

CREATING A PIPELINE

Create a Cone Object:

>>> cone = Cone()

>>> help(cone)

>>> cone.Resolution

>>> cone.Center

>>> cone.Center = [1, 2, 3]

>>> cone.Center[0:2] = [2, 4]

>>> cone.Center

[2.0, 4.0, 3.0]

CREATING A PIPELINE

Vector properties such as this one support setting and retrieval of individual elements, as well as slices (ranges of elements).

Vector properties such as this one support setting and retrieval of individual elements, as well as slices (ranges of elements).

Page 37: Scientific Visualization An Introduction - Purdue Universityweb.ics.purdue.edu/~vbyrd/presentations/VByrd_MST_RTD_091316_… · 9/22/2016 1 Scientific Visualization An Introduction

9/22/2016

37

Create a Cone Object:

>>> cone = Cone()

>>> help(cone)

>>> cone.Resolution

>>> cone.Center

>>> cone.Center = [1, 2, 3]

>>> cone.Center[0:2] = [2, 4]

>>> cone.Center

[2.0, 4.0, 3.0]

CREATING A PIPELINE

Apply a shrink filter to the coneApply a shrink filter to the cone

>>> shrinkFilter = Shrink(cone)

Create a Cone Object:

>>> cone = Cone()

>>> help(cone)

>>> cone.Resolution

>>> cone.Center

>>> cone.Center = [1, 2, 3]

>>> cone.Center[0:2] = [2, 4]

>>> cone.Center

[2.0, 4.0, 3.0]

CREATING A PIPELINE

Apply a shrink filter to the coneApply a shrink filter to the cone

>>> shrinkFilter = Shrink(cone)

>>> shrinkFilter.Input

Page 38: Scientific Visualization An Introduction - Purdue Universityweb.ics.purdue.edu/~vbyrd/presentations/VByrd_MST_RTD_091316_… · 9/22/2016 1 Scientific Visualization An Introduction

9/22/2016

38

Create a Cone Object:

>>> cone = Cone()

>>> help(cone)

>>> cone.Resolution

>>> cone.Center

>>> cone.Center = [1, 2, 3]

>>> cone.Center[0:2] = [2, 4]

>>> cone.Center

[2.0, 4.0, 3.0]

>>> shrinkFilter = Shrink(cone)

>>> shrinkFilter.Input

<paraview.servermanager.Cone object at 0x000000000896EEB8>

>>>

CREATING A PIPELINE

Create a Cone Object:>>> cone = Cone()>>> help(cone)>>> cone.Resolution>>> cone.Center>>> cone.Center = [1, 2, 3]>>> cone.Center[0:2] = [2, 4]>>> cone.Center[2.0, 4.0, 3.0]>>> shrinkFilter = Shrink(cone)>>> shrinkFilter.Input<paraview.servermanager.Coneobject at 0x000000000896EEB8>>>>

CREATING A PIPELINE

Page 39: Scientific Visualization An Introduction - Purdue Universityweb.ics.purdue.edu/~vbyrd/presentations/VByrd_MST_RTD_091316_… · 9/22/2016 1 Scientific Visualization An Introduction

9/22/2016

39

Create a Cone Object:>>> cone = Cone()>>> help(cone)>>> cone.Resolution>>> cone.Center>>> cone.Center = [1, 2, 3]>>> cone.Center[0:2] = [2, 4]>>> cone.Center[2.0, 4.0, 3.0]>>> shrinkFilter = Shrink(cone)>>> shrinkFilter.Input<paraview.servermanager.Coneobject at 0x000000000896EEB8>>>>

At this point you can force ParaView to update, which will also cause the execution of the cone source

CREATING A PIPELINE

Create a Cone Object:

>>> shrinkFilter.UpdatePipeline()

>>> shrinkFilter.GetDataInformation().GetNumberOfCells()

33L

>>> shrinkFilter.GetDataInformation().GetNumberOfPoints()

128L

>>>

CREATING A PIPELINE

Page 40: Scientific Visualization An Introduction - Purdue Universityweb.ics.purdue.edu/~vbyrd/presentations/VByrd_MST_RTD_091316_… · 9/22/2016 1 Scientific Visualization An Introduction

9/22/2016

40

Create Cone Object

Set Cone Resolution

Set Cone Center Properties

Apply Shrink Filter to the Cone

Updated Pipeline

CREATING A PIPELINE

Two objects are needed to render the output

• A representation – takes a data object and renders it in a view

• A view – responsible for managing a render context and a collection of representations

RENDERING

Page 41: Scientific Visualization An Introduction - Purdue Universityweb.ics.purdue.edu/~vbyrd/presentations/VByrd_MST_RTD_091316_… · 9/22/2016 1 Scientific Visualization An Introduction

9/22/2016

41

Type at prompt:

>>> Show(shrinkFilter)

>>> Render()

OUTPUT

>>> Show(shrinkFilter)

<paraview.servermanager.UnstructuredGridRepresentation object at 0x000000000BE85B70>

>>> Render()

<paraview.servermanager.RenderView object at 0x000000000C26D278>

>>>

RENDERING

Should see something similar to this

RENDERING

Page 42: Scientific Visualization An Introduction - Purdue Universityweb.ics.purdue.edu/~vbyrd/presentations/VByrd_MST_RTD_091316_… · 9/22/2016 1 Scientific Visualization An Introduction

9/22/2016

42

# Create a cone and assign it as the active object# Set a property of the active object# Apply the shrink filter to the active object# Shrink is now active# Show shrink# Render the active view

CREATING A PIPELINE – WHAT DID WE DO?

The value returned by Cone() and Shrink() was assigned to Python variables and used to build the pipeline

ParaView keeps track of the last pipeline object created by the user. This allows you to accomplish everything that was just done

CREATING A PIPELINE

Page 43: Scientific Visualization An Introduction - Purdue Universityweb.ics.purdue.edu/~vbyrd/presentations/VByrd_MST_RTD_091316_… · 9/22/2016 1 Scientific Visualization An Introduction

9/22/2016

43

CREATING A PIPELINE

>>> from paraview.simple import * # Create a cone and assign it as the active object>>> Cone() <paraview.servermanager.Cone object at 0x2910f0># Set a property of the active object>>> SetProperties(Resolution=32) # Apply the shrink filter to the active object# Shrink is now active>>> Shrink() <paraview.servermanager.Shrink object at 0xaf64050># Show shrink>>> Show() <paraview.servermanager.UnstructuredGridRepresentation object at 0xaf57f90># Render the active view>>> Render() <paraview.servermanager.RenderView object at 0xaf57ff0>

http://www.paraview.org/ParaView/Doc/Nightly/www/py‐doc/quick‐start.html

Type the following code in a text editor

Cone()

SetProperties(Resolution=32)

Shrink()

Show()

Render()

Save file as testScript.py

Click RUN SCRIPT from Python Shell

Locate and select script

Click OK

Should see

•New objects in Pipeline Browser

•Cone rendering in 3D Viewer

Page 44: Scientific Visualization An Introduction - Purdue Universityweb.ics.purdue.edu/~vbyrd/presentations/VByrd_MST_RTD_091316_… · 9/22/2016 1 Scientific Visualization An Introduction

9/22/2016

44

Locate and select pvpython (Python Shell) from ParaView application folder

Type (text in red):

>>> from paraview.simple import*

>>> SetProperties(Resolution=32)

>>> Shrink()

>>> Show()

>>> Render()

Should see a new visualization Toolkit window with output

Will not have ability to rotate output

>>> sphere = Sphere()

>>> help(sphere)

>>> sphere.ThetaResolution

>>> sphere.PhiResolution

>>> sphere = Sphere(PhiResolution=32)

>>> sphere = Sphere(ThetaResolution=32)

>>> sphere.Center = [1,2,3]

>>> shrinkFilter = Shrink(sphere)

>>> shrinkFilter.Input

>>> shrinkFilter.UpdatePipeline()

>>> shrinkFilter.GetDataInformation().GetNumberOfCells()

>>> shrinkFilter.GetDataInformation().GetNumberOfPoints()

>>> Show(shrinkFilter)

>>> Render()

TRY THIS

Page 45: Scientific Visualization An Introduction - Purdue Universityweb.ics.purdue.edu/~vbyrd/presentations/VByrd_MST_RTD_091316_… · 9/22/2016 1 Scientific Visualization An Introduction

9/22/2016

45

• The simple module is a ParaViewcomponent written using Python on top of the Server Manager C++ Library.

• Can be loaded from Python interpreters running in several applications

pvpython: The python application, distributed with the ParaView application suite, is a Python client to the ParaViewsevers.

Supports interactive and batch execution

pvbatch: Also distributed with the ParaView application suite, is a Python application designed to run batch scripts on distributed servers

paraview: Python scripts can be run from the paraview client using the Python shell that is invoked from Tools | Python Shell

Supports interactive mode as well as loading of scripts from files.

High Level Overview

Getting data into ParaView

Creating a simple vtk file from scratch

Running ParaView commands in the python shell

WHAT DID WE DO?INTRODUCTION TO SCIENTIFIC VISUALIZATION FEATURING PARAVIEW

Page 46: Scientific Visualization An Introduction - Purdue Universityweb.ics.purdue.edu/~vbyrd/presentations/VByrd_MST_RTD_091316_… · 9/22/2016 1 Scientific Visualization An Introduction

9/22/2016

46

ParaView User’s Guide: Downloaded with ParaViewhttp://www.paraview.org

ParaView Quick Starthttp://www.paraview.org/ParaView/Doc/Nightly/www/py-doc/quick-start.html

ParaView Sample Datahttp://www.paraview.org/Wiki/The_ParaView_Tutorial

ParaView/Python Scripting – KitwarePublichttp://www.paraview.org/Wiki/ParaView/Python_Scripting

http://www.paraview.org/ParaView/Doc/Nightly/www/py-doc/quick-start.html

ParaView Server Managerhttp://www.paraview.org/ParaView/Doc/Nightly/www/py-doc/paraview.servermanager.html

ADDITIONAL RESOURCES

Vetria L. Byrd

Assistant Professor

Computer Graphics Technology

[email protected]

Purdue Polytechnic Institutepolytechnic.purdue.edu

/ TechPurdue

https://polytechnic.purdue.edu/profile/vbyrd@VByrdPhD, @BPViz, @VisREU

g{tÇ~ çÉâ4