Scientific visualisation in 2D and 3D



Similar documents
Last lecture... Computer Graphics:

Simple visualizations of unstructured grids with VTK

MayaVi: A free tool for CFD data visualization

Introduction to Visualization with VTK and ParaView

Scientific Visualization

VisIt Visualization Tool

Visualization and Post Processing of OpenFOAM results a Brie. a Brief Introduction to VTK

Instructions for Creating a Poster for Arts and Humanities Research Day Using PowerPoint

GnuPlot, an Introduction


Visualizing Data: Scalable Interactivity

Visualization with ParaView. Greg Johnson

Visualization of 2D Domains

Plotting: Customizing the Graph

How To Draw In Autocad

Fireworks CS4 Tutorial Part 1: Intro

GR Framework / MODBUS on Raspberry Pi

KaleidaGraph Quick Start Guide

Geant4 Visualization. Andrea Dotti April 19th, 2015 Geant4 M&C+SNA+MC 2015

designed and prepared for california safe routes to school by circle design circledesign.net Graphic Standards

Chaco: A Plotting Package for Scientists and Engineers. David C. Morrill Enthought, Inc.

ArcGIS ArcMap: Printing, Exporting, and ArcPress

6 th Annual EclipseCon Introduction to BIRT Report Development. John Ward

Visualizing Electromagnetic Fields: The Visualization Toolkit. Michael Selvanayagam

Periodontology. Digital Art Guidelines JOURNAL OF. Monochrome Combination Halftones (grayscale or color images with text and/or line art)

Visualization with ParaView

Facts about Visualization Pipelines, applicable to VisIt and ParaView

Graphic Design. Background: The part of an artwork that appears to be farthest from the viewer, or in the distance of the scene.

Computer Applications in Textile Engineering. Computer Applications in Textile Engineering

imc FAMOS 6.3 visualization signal analysis data processing test reporting Comprehensive data analysis and documentation imc productive testing

NDSU Technology Learning & Media Center

VisIVO, a VO-Enabled tool for Scientific Visualization and Data Analysis: Overview and Demo

Introduction to Computer Graphics

Scientific Graphing in Excel 2010

VisCMD: Visualizing Cloud Modeling Data

Microsoft Excel 2010 Charts and Graphs

Graphics in R. Biostatistics 615/815

From mathematics to a nice figure in a LaTeX document

GUIDELINES FOR PREPARING POSTERS USING POWERPOINT PRESENTATION SOFTWARE

Table of Contents. I. Banner Design Studio Overview II. Banner Creation Methods III. User Interface... 8

A Basic Summary of Image Formats

Why are we teaching you VisIt?

Publisher 2010 Cheat Sheet

imc FAMOS 6.3 visualization signal analysis data processing test reporting Comprehensive data analysis and documentation imc productive testing

Scientific Visualization with Open Source Tools. HM 2014 Julien Jomier

Adobe Illustrator CS5 Part 1: Introduction to Illustrator

Post-processing and Visualization with Open-Source Tools. Journée Scientifique Centre Image April 9, Julien Jomier

Introduction to Paraview. H.D.Rajesh

Visualisatie BMT. Introduction, visualization, visualization pipeline. Arjan Kok Huub van de Wetering

CREATING POSTERS WITH POWERPOINT

Modern PHP Graphics with Cairo. Michael Maclean FrOSCon 2011

Visualization with OpenDX

KB COPY CENTRE. RM 2300 JCMB The King s Buildings West Mains Road Edinburgh EH9 3JZ. Telephone:

CIS 467/602-01: Data Visualization

Intro to Excel spreadsheets

VisIVO, an open source, interoperable visualization tool for the Virtual Observatory

Getting more out of Matplotlib with GR

Today's Topics. COMP 388/441: Human-Computer Interaction. simple 2D plotting. 1D techniques. Ancient plotting techniques. Data Visualization:

James Ahrens, Berk Geveci, Charles Law. Technical Report

Visualize your data with gnuplot

Interactive Voting System. IVS-Basic IVS-Professional 4.4

STATGRAPHICS Online. Statistical Analysis and Data Visualization System. Revised 6/21/2012. Copyright 2012 by StatPoint Technologies, Inc.

Raising the Bar (Chart)

Excel -- Creating Charts

Printing Guide. MapInfo Pro Version Contents:

Quickstart for Desktop Version

So you say you want something printed...

IE Class Web Design Curriculum

Chapter 4 Creating Charts and Graphs

JavaFX Session Agenda

Integration of C++ digital processing libraries and VTK through Tcl/Tk dynamic loadable extensions

Lab 3. GIS Data Entry and Editing.

MapInfo Professional Version Printing Guide

2: Introducing image synthesis. Some orientation how did we get here? Graphics system architecture Overview of OpenGL / GLU / GLUT

Big Data: Rethinking Text Visualization

ExpertCAD Release Summary March 2010

version 3.0 tutorial - Turbulent mixing in a T-junction with CFDSTUDY in SALOME contact: saturne-support@edf.fr

WIN32TRACE USER S GUIDE

Advanced visualization with VisNow platform Case study #2 3D scalar data visualization

An introduction to 3D draughting & solid modelling using AutoCAD

Gerrit Stols

Visualization methods for patent data

Volume visualization I Elvins

Material for tutorial. Twitter: prabhu_r. Slides: Demos:

Digital Preservation. Guidance Note: Graphics File Formats

OpenFOAM postprocessing and advanced running options

QUICK REFERENCE: ADOBE ILLUSTRATOR CS2 AND CS3 SECTION 1: CS3 TOOL BOX: PAGE 2 SECTION 2: CS2 TOOL BOX: PAGE 11

User Guide. idraw for Mac OS X v2.5.1

GeoGebra. 10 lessons. Gerrit Stols

Each function call carries out a single task associated with drawing the graph.

Lecture Notes, CEng 477

You can make your own layout / theme for your PowerPoint project.

Tips for optimizing your publications for commercial printing

Fireworks 3 Animation and Rollovers

The following is an overview of lessons included in the tutorial.

LEAGUE OF WOMEN VOTERS NAME & LOGO GUIDELINES

ABL Advisor :: Online Advertising Specifications

GR A universal framework for visualization applications

Transcription:

Scientific visualisation in 2D and 3D Roman Putanowicz R.Putanowicz@L5.pk.edu.pl Some rights reserved (CC) 2010. See License slide. 1

Right tool for the right job gnuplot All sorts of 2D visualisation and simple 3D visualisation octave More advanced 2D visualisations that require extensive data manipulations octave + octaviz Simple 3D programming VTK Advanced computer graphics and 3D programming ParaView, OpenDX 3D visualisations 2

Part I Gnuplot Overview 3

Gnuplot Home page: http://www.gnuplot.info/ Portable: MS Windows, GNU/Linux, UNIX, and OSX. Book: Gnuplot in Action. Understanding Data with Graphs, Philipp K. Janert, Manning Publications Co., 2009 4

Plotting functions given by formulas 1 f(x) = 1/(1+(x*sin(x))**2) 2 plot f(x) 5

Axes setup 1 f(x) = 1/(1+(x*sin(x))**2) 2 plot f(x) 3 set xrange[-5:5] 4 set yrange[0:1.3] 5 replot 6

Labels and graph tytle 1 f(x) = 1/(1+(x*sin(x))**2) 2 plot f(x) 3 set xrange[-5:5] 4 set yrange[0:1.3] 5 set xlabel "Temperature [K]" 6 set ylabel "Distance [m]" 7 set title \ 8 "Temperature distribution" 9 replot 7

Setting lines and markers style 1 f(x) = 1/(1+(x*sin(x))**2) 2 set xrange[-5:5] 3 set yrange[0:1.3] 4 set xlabel "Temperature [K]" 5 set ylabel "Distance [m]" 6 set title \ 7 "Temperature distribution" 8 set style lines 1 lw 0 linecolor rgb "green" pt 5 ps 2 pointinterval 5 9 set style lines 2 lc rgb "red" 10 plot f(x) with linespoints ls 1, f(x) notitle ls 2 8

Legend 1 f(x) = 1/(1+(x*sin(x))**2) 2 set xrange[-5:5] 3 set yrange[0:1.3] 4 set xlabel "Temperature [K]" 5 set ylabel "Distance [m]" 6 set title \ 7 "Temperature distribution" 8 set style lines 1 lc rgb "red" 9 set style lines 2 lw 0 linecolor rgb "green" pt 5 ps 2 pointinterval 5 10 set style lines 3 linecolor rgb "blue" lw 3 11 set key left width 1 height 1 box ls 3 12 plot f(x) w linespoint title "f(x) samples" ls 2, f(x) ls 1 9

Plotting many functions 1 f(x) = 1/(1+x**2) 2 set xrange[-5:5] 3 plot f(x), sin(x) 4 replot cos(x) w points 10

Filled functions 1 f1(x) = 0.2*cos(x) 2 f2(x) = 0.5*sin(x) 3 f3(x) = 1/(1+x**2) 4 t1 = "0.2*cos(x)" 5 t2 = "0.5*sin(x)" 6 t3 = "1/(1+x**2)" 7 set clip two 8 unset colorbox 9 set xrange [-5:5] 10 set style fill solid 1.00 noborder 11 set style function filledcurves y1=0 12 set title "Solid filled curves" 13 plot 0.2*cos(x) fs solid 1.0 lc rgb "forest-green" title t1 14 replot 0.5*sin(x) lc rgb "gold" title t2 15 replot 1/(1+x**2) lc rgb "red" title t3 11

Transparent filling 12

Saving figures Selected formats: Nazwa Description canvas HTML Canvas object cgm Computer Graphics Metafile corel EPS format for CorelDRAW dumb ascii art for anything that prints text dxf dxf-file for AutoCad (default size 120x80) fig FIG graphics language for XFIG graphics editor gif GIF images using libgd and TrueType fonts jpeg JPEG images using libgd and TrueType fonts latex LaTeX picture environment pdfcairo pdf terminal based on cairo png PNG images using libgd and TrueType fonts pngcairo png terminal based on cairo postscript PostScript graphics, including EPSF embedded files (*.eps) svg W3C Scalable Vector Graphics driver wxt wxwidgets cross-platform windowed terminal x11 X11 Window System 13

Saving in vector formats fig gnuplot> set output rys.fig gnuplot> set term fig Terminal type set to fig Options are color small pointsmax 1000 landscape inches \ dashed textnormal font Times Roman fontsize 10 linewidth 1\ depth 10 version 3.2 PostScript gnuplot> set output rys.ps gnuplot> set term postscript color Terminal type set to postscript Options are landscape noenhanced defaultplex leveldefault color \ colortext dashed dashlength 1.0 linewidth 1.0 butt noclip \ palfuncparam 2000,0.003 Helvetica 14 14

Saving in raster formats GIF gnuplot> set output rys.gif gnuplot> set term gif Terminal type set to gif Options are truecolor nocrop \ font /usr/share/fonts/truetype/ttf liberation/liberationsans Regular.ttf 12\ size 640,480 PNG gnuplot> set output rys.png gnuplot> set term png Terminal type set to png Options are truecolor nocrop font /usr/share/fonts/truetype/ttf liberation/liberationsans Regular.ttf 12\ size 640,480 15

Data visualisation Data file: 1 1 0 2 2 3 3 3 5 4 4-1 5 5-2 6 6 0 7 7 4 8 8 3.5 9 9 2 10 10 0 Script: 1 set xzeroaxis 2 plot data w l 16

Operation on data stream and data filtering Gnuplot provides tools for filtering input data stream and selecting data to be plotted. selecting data records option every selecting data columns option using selecting data sets option index data interpolation and approximation option smooth filtering through external programs 17

Overlays 1 set object 1 rect from graph 0, 0 to graph 0.6, 0.7 front fc rgb "green" 2 set key left 3 set multiplot 4 plot sin(x) 5 unset object 1 6 set key outside center top 7 set size 0.5,0.6 8 set origin 0.1, 0.1 9 plot cos(x) lc rgb "black" 18

Subwindows 1 set multiplot layout 2, 2 2 set key outside center top 3 plot sin(x) 4 plot cos(x) 5 plot x*x 6 plot 1/(1+x**2) 19

Histograms Script and data taken form gnuplot distribution. 20

Histograms 1 set boxwidth 0.9 absolute 2 set style fill solid 1.00 border 1 3 set style histogram clustered gap 1 title offset character 0, 0, 0 4 set datafile missing 5 set style data histograms 6 set xtics border in scale 1,0.5 nomirror rotate by 45 offset character 0, 0, 0 7 set xtics ( 1891 1900 0.00000, 1901 1910 1.00000, 1911 1920 2.00000, 1921 1930 3.00000, 1931 1940 4.00000, 1941 1950 5.00000, 1951 1960 6.00000, 1961 1970 7.00000) 8 set title US immigration from Northern Europe\n Plot selected data columns as histogram of clustered boxes 9 set yrange [ 0.00000 : 300000. ] noreverse nowriteback 10 plot immigration.dat using 6:xtic(1) ti col, u 12 ti col, u 13 ti col, u 14 ti col 21

Pie plots 1 circ="circle at 0,0 size 1" 2 wedge(color, s, e, title)= sprintf("set obj %d @circ arc [%d:%d] fc rgb c%d;\ 3 replot -2 linecolor rgb c%d title \"%s\"",color,s,e,color,color,title) 4 set style fill solid 1.0 border -1 5 set key outside horizontal center top 6 set size square 7 set notics 8 set xrange [-1.2:1.2] 9 set yrange [-1.2:1.2] 10 c1="red" 11 c2="orange" 12 c3="yellow" 13 c4="forest-green" 14 c5="dark-turquoise" 15 c6="dark-magenta" 16 set style function filledcurves 17 set macro 18 plot -2 notitle 19 eval wedge(1,0,40, "Carbon 11.1%") 20 eval wedge(2,40,70, "Gold 8.3%") 21 eval wedge(3,70,90, "Mercury 5.5%") 22 eval wedge(4,90,120, "Iron 8.3%") 23 eval wedge(5,120,220, "Silver 27.7%") 24 eval wedge(6,220,360, "Tungsten 38.8%") 22

Plotting parametric curves 1 set xrange[-10:10] 2 set yrange[-10:10] 3 set size square 4 set parametric 5 set termoption enhanced 6 R=4 7 set key Left left 8 plot R*cos(t),R*sin(t) title "Circle R=4" 9 replot 0.5*t**2, t title "Parabole:\n x=t^2/2\n\r y=t" 23

Interactive elements New terminal type based on wx library allows some user interaction like rotating, panning and zooming with mouse. It also provides the way to define keyboard short-cuts for user commands. 24

Visualisation of function of two variables 1 f(x,y) = x*x-y*y 2 set isosamples 25, 25 3 unset key 4 set style fill solid 0.50 border 5 set hidden3d front offset 1 trianglepattern 3 undefined 1 altdiagonal bentover 6 set xyplane at 0 7 set palette rgbformulae 31, -11, 32 8 set colorbox vertical origin screen 0.9, 0.2, 0 size screen 0.05, 0.6, 0 front bdefault 9 splot f(x,y) with pm3d 10 replot f(x,y) with lines lt 1 lc rgb "#000000" 25

Command line history history show the complete history history 5 show last 5 entries in the history history quiet 5 show last 5 entries without entry numbers history hist.gp write the complete history to file hist.gp history hist.gp append append the complete history to file hist.gp history 10 head -5 >>diary.gp write 5 history commands using pipe history 10 hist.gp write last 10 commands to file hist.gp history?load show all history entries starting with load history? set c like above, several words enclosed in quotes hi!reread execute last entry starting with reread hist! set xr like above, several words enclosed in quotes hi!hi guess yourself :-)) 26

Gnuplot scripts Gnuplot scripts can be run in terminal during interactive gnuplot session using load command. 27

Other gnuplot features More gnuplot features can be seen at gnuplot demo pages: http://gnuplot.sourceforge.net/demo/ 28

Part II VTK Overview 29

VTK Visualization Toolkit The Visualization ToolKit (VTK) is an open source, freely available software system for 3D computer graphics, image processing, and visualization. Book: The Visualization Toolkit, An Object-Oriented to 3D Graphics, 2nd edition, Prentice-Hall Software: http://www.kitware.com/vtk.html 30

VTK Applications 31

VTK Applications cont. 32

VTK Applications cont. 33

VTK Applications cont. 34

VTK on jinx Which packages: dpkg l grep i vtk Visualization Toolkit - A high level 3D visualization library VTK header files for building C++ code Python bindings for VTK Tcl bindings for VTK VTK class reference documentation C++, Tcl and Python example programs/scripts 35

Technical Overview C++ implementation Open source Scripting interface: Tcl/Tk, Python, Java Portable Supports parallelization Commercial support Not super-fast graphics engine Very large not a toy Requires decent system to use it effectively 36

VTK: 3D Graphics Surface Rendering: OpenGL, gl, starbase, xgl Volume Rendering Flexible ray casting implementation Support for VoumePRO volume rendering hardware Supports mixing opaque surface geometry and volume rendering Rendering primitives: points, lines, polygons, tringle strips, volumes 37

VTK: Datasets Types Structured Points Rectlinear Grid Polygonal Data Structured Grid Unstructured Points Unstructured Grid 38

VTK: Cell Types Vertex Polyline Pixel Tetrahedron Polyvertex Triangle strip Quad Hexahedron Line Triangle Polygon Voxel 39

VTK: Atribute Types Scalars (single valued + grayscale, grayscale-alpha, rgb, rgb-alpha) Vectors 3x3 Tensors Texture Coordinates (1-3D) Field Data 40

VTK: Scalar Algorithms 41

VTK: Scalar Algorithms cont. 42

VTK: Scalar Algorithms cont. 43

VTK: Scalar Algorithms cont. 44

VTK: Vector Algorithms 45

VTK: Vector Algorithms cont. 46

VTK: Tensor Algorithms 47

VTK: Multidimensional solution 48

VTK: Modeling Algorithms 49

VTK: Modeling Algorithms cont. 50

VTK: Modeling Algorithms cont. 51

VTK:Imaging 52

VTK: Visualization Pipeline Demand-driven data-flow with automatic network updates Network looping and feedback supported Supports multiple input/multiple output filters vtkspheresource vtkpolydatamapper vtkactor vtkrenerer vtkrendererwindow vtkrenderer WindowInteractor 53

VTK: Programming - Tcl/Tk 1 vtkspheresource sphere 2 sphere SetRadius 1.0 3 sphere SetThetaResolution 18 4 sphere SetPhiResolution 18 5 vtkpolydatamapper map 6 map SetInput [sphere GetOutput] 7 vtkactor asphere 8 asphere SetMapper map 9 [asphere GetProperty] SetColor 0 0 1 10 vtkrenderwindow renwin 11 vtkrenderer ren1 12 renwin AddRenderer ren1 13 vtkrenderwindowinteractor iren 14 iren SetRenderWindow renwin 15 ren1 AddActor asphere 16 ren1 SetBackground 1 1 1 17 renwin Render 18 wm withdraw. 54

Mayavi free scientific data visualizer implemented in Python + Tkinter + VTK A pipeline browser can browse and edit objects in the VTK pipeline. Visualize computational grids. Visualize scalar, vector and tensor data. A modular design so you can add your own modules and filters. Output to: PostScript, PPM/BMP/TIFF/JPEG/PNG, Open Inventor, VRML or RenderMan. 55

Mayavi - examples 56

57

58

Credits Most of the figures in this part and Tcl/Tk example come from VTK distribution. 59

Part III VTK Programming 60

VTK: Visualization Pipe vtkconesource vtkpolydatamapper vtkactor vtkrenerer vtkrendererwindow vtkrenderer WindowInteractor 61

VTK: Programming - C++ 1 #include vtkconesource.h 2 #include vtkpolydatamapper.h 3 #include vtkrenderwindow.h 4 #include vtkrenderwindowinteractor.h 5 #include vtkactor.h 6 #include vtkrenderer.h 7 8 int main( int argc, char argv[] ) { 9 10 vtkconesource cone = 11 vtkconesource::new(); 12 cone >SetHeight( 3.0 ); 13 cone >SetRadius( 1.0 ); 14 cone >SetResolution( 5 ); 15 vtkpolydatamapper conemapper = 16 vtkpolydatamapper::new(); 17 conemapper >SetInput( 18 cone >GetOutput() ); 19 20 vtkactor coneactor = 21 vtkactor::new(); 22 coneactor >SetMapper( conemapper ); 23 vtkrenderer ren1= 24 vtkrenderer::new(); 25 ren1 >AddActor( coneactor ); 26 ren1 >SetBackground(0.1, 0.2, 0.4); 27 vtkrenderwindow renwin = 28 vtkrenderwindow::new(); 29 renwin >AddRenderer( ren1 ); 30 renwin >SetSize( 400, 400 ); 31 32 vtkrenderwindowinteractor iren = 33 vtkrenderwindowinteractor::new(); 34 iren >SetRenderWindow(renWin); 35 36 iren >Initialize(); 37 iren >Start(); 38 39 return 0; 40 } 62

VTK: Programming - Makefile 1 CXX = g++ g Wall 2 3 # for queen VTK 4.2 4 #INCLUDES = I. I/home/pracow/putanowr/include/vtk 5 #LDFLAGS = L/home/pracow/putanowr/lib/vtk \ 6 L/usr/X11R6/lib 7 #LDADD = lvtkcommon lvtkio lvtkgraphics \ 8 lvtkrendering lgl lx11 lm 9 10 #for jinx VTK 3.2 11 INCLUDES = I. I/usr/include/vtk 12 LDFLAGS = L/usr/lib/vtk L/usr/X11R6/lib 13 LDADD = lvtkcommon lvtkgraphics lgl \ 14 lxt lx11 lm 15 16 #for foo VTK 4.2 17 #INCLUDES = I. I/opt/include/vtk 18 #LDFLAGS = L/opt/lib/vtk L/usr/X11R6/lib 19 #LDADD = lvtkcommon lvtkio lvtkgraphics \ 20 lvtkrendering lgl lx11 lm 21 22 %.o : %.cxx 23 $(CXX) c $(INCLUDES) $< o $@ 24 25 Cone1 : Cone1.o 26 $(CXX) $ˆ $(LDFLAGS) $(LDADD) o $@ 27 28.PHONY : clean distclean 29 clean : 30 /bin/rm rf.o 31 distclean : 32 rm f Cone1 63

VTK: Programming - Tcl/Tk 1 package require vtk 2 package require vtkinteraction 3 4 vtkconesource cone 5 cone SetHeight 3.0 6 cone SetRadius 1.0 7 cone SetResolution 5 8 9 vtkpolydatamapper conemapper 10 conemapper SetInput [cone GetOutput] 11 12 vtkactor coneactor 13 coneactor SetMapper conemapper 14 15 vtkrenderer ren1 16 ren1 AddActor coneactor 17 ren1 SetBackground 0.1 0.2 0.4 18 vtkrenderwindow renwin 19 renwin AddRenderer ren1 20 renwin SetSize 400 400 21 22 vtkrenderwindowinteractor iren 23 iren SetRenderWindow renwin 24 iren Initialize 25 26 wm withdraw. 64

Part IV OpenDX Overview 65

OpenDX Open source software project based on IBM s Visualization Data Explored (DX) Powerful, full-featured visualization system Visual programming, advanced GUI Modular design, object-oriented, self-describing data model C implementation Scripting Python and Tcl/Tk wrappers 66

Visual Programs Gradient 67

Visual Programs Gradient 68

Visual Programs Gradient 69

Visual Programs Streamlines 70

Visual Programs Streamlines 71

Visual Programs isosurfaces 72

Visual Programs Isosurfaces 73

Credits All figures in this presentation come from OpenDx distribution. 74

References 1. Gnuplot home page http://www.gnuplot.info 2. Gnuplot demo page http://gnuplot.sourceforge.net/demo 3. GNU Octave http://www.gnu.org 4. Octaviz http://octaviz.sourceforge.net/ 5. VTK - The Visualization Toolkit http://www.vtk.org 6. OpenDX http://www.opendx.org 7. Own materials 75

Thank you for your attention 76

License This work is licensed under the Creative Commons Attribution-Share Alike 3.0 Unported License. To view a copy of this license, either visit http://creativecommons.org/licenses/by-sa/3.0/deed.en; or, send a letter to Creative Commons, 171 2nd Street, Suite 300, San Francisco, California, 94105, USA. You are free: to share to copy, distribute and transmit the work to remix to adapt the work Under the following conditions: attribution You must attribute the work in the manner specified by the author or licensor (but not in any way that suggests that they endorse you or your use of the work). share alike If you alter, transform, or build upon this work, you may distribute the resulting work only under the same or similar license to this one. 77