Introduction to Visualization: ParaView Dan Mazur, McGill HPC daniel.mazur@mcgill.ca Aug 20, 2013 1
Outline What is scientific visualization? ParaView and visualization pipelines data import 1D, 2D, 3D data visualization Isosurfaces and volume rendering Data sets and formats Putting it all together 2
Agenda (approximate) 9-10:30 - Introduction to Visualization and Paraview 10:30-10:45 Coffee break 10:45-12:00 Hands-on Activities 12:00-1:00 Lunch Break 1:00-2:30 Hands-on Activities cont. 2:30-2:45 Coffee Break 2:45-4:00 Project Introduction to visualization and ParaView 9:00 C Hands-on o Activities f f e e 11:00 10:00 Lunch 12:00 Hands-on Activities 1:00 C o f f e e 2:00 Project 3:00 3
Acknowledgements: Workshop History Based on UofA Vis Workshop Jon Johansson, Chris Want @ UofA Original materials and data sets Delivered many times at UofA BCNet/HPCS 2012 in May Westgrid Visualization Roadshow SFU (2), USask, URegina HPCS 2013 - Brian Corrie Today at McGill 4
Are you ready? Ensure that you have: Paraview installed on your laptop paraview.zip - execise files unzip paraview.zip (Linux/Unix) double click (Mac/Windows) PVExercises.pdf - exercise descriptions 5
What is Scientific Visualization? Data into knowledge: Visualization presents scientific data to the human visual and cognitive system for analysis and interpretation The goal: extract/communicate knowledge/insight. Our goal: Convert scientific data into visual form Exploration: understand the data Interactively examine the data Looking for aspects of the data that are interesting Communication: communicate the data to peers within the research group to external community (presentations, publications) 6
Neo: Do you always look at it encoded? Cypher: You get used to it. All I see is blonde, brunette, red-head... 7
8
ParaView Paraview provides a full set of tools for manipulating, transforming, processing, rendering and animating data Allows for visualization and analysis methods based on points, lines, areas, volumes, images or geometric primitives in any combination Provides powerful parallel execution and advanced display (3D stereoscopic viewing) http://www.paraview.org 9
ParaView Project began in 2000 ParaView is open source ParaView is supported by Kitware Kitware contributes to ParaView development ParaView is built on top of the Visualization Toolkit (VTK) Kitware, Inc. and Los Alamos National Laboratory. VTK came out of GE Research First public release in October 2002: ParaView 0.6 10
ParaView Architecture ParaView uses a client-server model The client process is the user interface In stand-alone mode the client does all processing on the local machine it always runs on a workstation (desktop) The server does computation In a single process on a local/remote machine, or In many processes on a cluster 11
Paraview Modes Stand-alone mode Client/server mode Computations and user interface are run on same machine Computations are run on a server Parallel mode Server launches an mpi job on a cluster 12
Exercise 1: Starting ParaView Linux/Unix: type paraview Windows: Select paraview from start menu Mac: click ParaView in App folder ParaView GUI should start up The server pvserver is run for you 13
Optional Exercise: Connect to Guillimin log in ssh class01@guillimin.clumeq.ca Set up port forwarding Start an interactive job on lmgpu msub -q lmgpu -I -l nodes=1:ppn=1,walltime=1:00:00 Wait for job to start Start the paraview server module load paraview pvserver ssh guillimin.clumeq.ca -L 11111:lm-2r02-n79:1111 In local ParaView File > Connect > Add Server localhost:11111 Click Configure > Manual > Save Click Connect This is not necessary for today, the lab workstations have plenty of power for our data sets We will develop Guillimin's remote visualization capabilities as phase II comes online and with user interest 14
ParaView Interface Menus Toolbars Pipeline Browser Object Inspector 3D view 15
Visualization Pipeline Reader Imports data from a source (e.g. data file) Filter Filter modify and/or manipulate data modify and/or manipulate data Filter Mapper Transform data to geometry (e.g. points, lines, polygons, colours) Renderer Converts geometry into an image (e.g. pixels, vector graphics, polygons, volume rendering) modify and/or manipulate data 16
Visualization Pipeline Most visualization packages use a pipeline model (ParaView, VTK, VisIT, Avizo) Pipeline components can be combined in many different ways to create a visualization Developers can add new components to the system to extend the package's functionality ParaView allows python scripts as filters 17
Object-Based Rendering Object based model with lighting Arrange the view (camera) Render image from the camera position 18
Object Rendering Results in an image as seen from the camera's viewpoint Lights give shading, highlights and can modify color Surfaces nearest the camera occlude those behind 19
ParaView Objects ParaView supports many techniques for generating renderable objects from data. For scalar data these include: Points and glyphs Contours and isosurfaces Histograms Two-dimensional and three-dimensional plots For vector data Arrow plots, streamlines, etc 20
ParaView Objects Annotations Ribbons, tubes, axes, text Display of data locations, meshes and boundaries Data interactions are also supported: probing (selecting a location in a volume) picking (selecting a location on the surface of an object) arbitrary surface and volume sampling arbitrary cutting/mapping planes 21
Importing Data Avoid data conversion! For best results generate your data in a vtk file format STRUCTURED_POINTS STRUCTURED_GRID RECTILINEAR_GRID UNSTRUCTURED_GRID POLYDATA VTK XML Many common scientific data file formats can be opened and visualized 22
ParaView Data Formats VTK:.vtk,.pvtk,.vtp,.vtu,.vti,.vts,.vtr,.pvtp,.pvtu,.pvti,.pvts,.pvtr,.vtm,.vtmb,.vthb Paraview:.pvd Self-describing data formats: HDF5, netcdf Ensight:.case,.sos Protein Data Bank:.pdb Xmol Molecule Files:.xyz Gaussian Cube Files:.cube POP Ocean Files:.pop Images:.png,.tif RAW (binary):.raw lots of others, look at: File Open File Files of type: Open Source: Add a custom reader for your own data format 23
Pipelines The eye icon controls whether the output of a fileter is visible in the active window Data flows from the data source/reader down through the filters PVServer Data Source Filters Data Flow A program in ParaView is called a visualization pipeline 24
Pipelines The highlighted filter can be configured through the Object Inspector The data produced by the filter is described in the Information tab 25
Pipelines You can change a filter's behaviour in the Properties tab Click Apply when you want your changes to take effect 26
Exercise 2: Pipelines File->Open the sample data set paraview/bumps/bu mps.vtk Change the colors for the data Properties->Edit Select the Rainbow colormap 27
28
Exercise 2: Pipelines Add dimension to data Use WarpByScalar filter Uses scalar value as Zdimension Scale magnitude of offset Set the scale factor to 5 29
Exercise 3: ParaView Windows Reproduce this image: Use objects from the Sources menu Cone Sphere Box Cylinder Use the icons in the upper right of a window to split the view 30
ParaView Views ParaView has many types of views Some filters open a view window suitable to the filter's output e.g. histograms 31
Exercise 4: 1D data Please do activity 2 from the handout You will recreate the plots seen here 32
Exercise 5: 2D data Please do activity 3 from the handout You will recreate the plots seen here 33
Exercise 6: Animation ParaView is capable of easily making simple animations Not designed for complex animations Activity: Please do activity 4 from your handout 34
Exercise 7: 3D Data 3D regular grid data - e.g. Medical CT scan Slice planes through gridded data Please reconstruct the following image using Slice filters on the jaw_16bit.vti data file: 35
Exercise 8: Isosurfaces Use isosurfaces to generate the visualization 3D-Data/jow_8bit.vti Isosurfaces with different colours represent the jaw, spine and skin 36
Big Project: Electric Field Let's put together what we've learned to create a visualization project involving: A scalar field A vector field Annotations 37
Electric Potential Consider the electric potential due to a dielectric cylinder introduced into a constant electric field,. The parameters used are: 38
The Goal: Create this visualization 39
Task 1: Create a VTK File In the directory paraview/epot is a file containing the electric potential data in ascii text format Add an appropriate header to create a vtk file (hint: refer to Bumps.vtk) The origin is -50 for each axis The data spacing is 1 with 101 points along each axis There are 1013 points in the volume 40
Task 2: Slice the data set Open your.vtk file with ParaView Add a slice filter Origin = 0, 0, -49.99 (not -50.0) Z Normal 41
Task 3: Contour Lines Add a contour filter Delete the default range and click on Add Range From = -1750, To = 1750, Steps = 8 This adds 8 lines Can you make them tubes? 42
43
Task 4: Compute Electric Field Use the Gradient filter and the Calculator filter to compute the electric field from the electric potential: Use the Gradient filter on the potential In the properties tab of the Calculator set Result Array name to ElectricField Calculate the expression: -EPotentialGradient 44
Electric Field Use a slice filter to put a slice in the center of the volume If the input of the slice is a vector field, the magnitude will be displayed 45
Magnitude of the Electric Field 46
Streamlines Use a StreamTracer filter to the Calculator generating the Electric field Use a line source to seed the streamlines Seed Type: Line Source Point1 = (50,50,0) Point2 = (50,-50,0) Resolution=10 Add tubes to the lines 47
Streamlines 48
Glyphs The top slice of our goal visualization shows glyphs at some grid points of the electric field Add a slice filter to the Calculator filter (electric field) Origin=(0,0,50) Use a MaskPoints filter to control the points in the slice that will be glyphed Arrows indicating the direction and magnitude of the vector field Set On Ratio to 10, Check the Random box with Randomized ID strides Add a Glyph module with Glyph Type: Arrow Scale Mode: Vector Adjust the arrow size parameters to your liking 49
Glyphs 50
Final view of the data We have created three visualizations of the data on three different slices We are still lacking context! Add information to help the viewer understand what they are looking at 51
Adding Meaning Annotations: titles, labels, explanations Outline: define the volume of space being visualized Axes: orientation, scale Legend: map the colours to a scale Geometry: Add a cylinder to represent the dielectric cylinder 52
Annotations 53
Adding Meaning Annotations: titles, labels, explanations Use Outline filter on original data, add tubes Axes: orientation, scale Display tab, Show Cube Axes Legend: map the colours to a scale Sources -> Text Outline: define the volume of space being visualized Display tab, Edit Color Map Geometry: Add a cylinder to represent the dielectric cylinder Sources -> Cylinder Height: 100 Radius: 10 Resolution: 50 Opacity: 0.5 Orientation: (90,0,0) 54
Putting it all together... 55
Putting it all together... Goals of the exercise... Extract relevant information from the data set Show a variety of techniques that can be applied to the data set Provide enough annotation to orient the viewer Provide a visualization that communicates insight/understanding 56
Visualization Information Compute Canada http://computecanada.ca/index.php/en/resources/visuali zation Software Kitware - http://www.kitware.com ParaView - http://www.paraview.org VTK - http://www.vtk.org VisIT - http://wci.llnl.gov/codes/visit/ Avizo - http://www.vsg3d.com/avizo/overview 57
The End What questions do you have? 58