Envisioning Information Lecture 11 – Scientific Visualization Introduction Scalar 1D Data Ken Brodlie kwb@comp.leeds.ac.uk ENV 2006 11.1 Data Visualization = Scientific Vis + Information Vis • Information Visualization • Scientific Visualization – Numeric and non-numeric data – Numerical data from science, engineering and medicine Automobile web site - visualizing links Ozone layer around earth ENV 2006 11.2 Scientific Visualization – What is it? Reality Observation Simulation Data Visualization Images, animation ENV 2006 11.3 A Simple Example This table shows the observed oxygen levels in the flue gas, when coal undergoes combustion in a furnace TIME (mins) 0 2 4 OXYGEN (%) 20.8 8.8 4.2 ENV 2006 10 28 30 32 0.5 3.9 6.2 9.6 11.4 Visualizing the Data - but is this what we want to see? ENV 2006 11.5 Estimating behaviour between the data - but is this believable? ENV 2006 11.6 Now it looks believable… but something is wrong ENV 2006 11.7 At least this is credible.. ENV 2006 11.8 What Have We Learnt? • It is not only the data that we wish to visualize - it is also the bits inbetween! • The data are samples from some underlying ‘field’ which we wish to understand • First step is to create from the data a ‘best’ estimate of the underlying field - we shall call this a MODEL • This needs to be done with care and may need guidance from the scientist • The process of fitting a continuous curve (or surface, or volume) through given data is known as INTERPOLATION ENV 2006 11.9 Data Enrichment • This process is sometimes called ‘data enrichment’ or ‘enhancement’ • If data is sparse, but accurate, we INTERPOLATE to get sufficient data to create a meaningful representation of our model • If sparse, but in error, we may need to APPROXIMATE ENV 2006 11.10 The Visualization Process • Overall the Visualization Process can be divided into four logical operations: – DATA SELECTION: choose the portion of data we want to analyse – DATA ENRICHMENT: interpolating, or approximating raw data - effectively creating a model – MAPPING: conversion of data into a geometric representation – RENDERING: assigning visual properties to the geometrical objects (eg colour, texture) and creating an image ENV 2006 11.11 Back to the simple example Data Select Enrich Map Render Extract part of data we are interested in Interpolate to create model Select a line graph as technique and create line segments from enriched data Draw line segments on display in suitable colour, line style and width ENV 2006 11.12 Visualization Software Systems • This model has become the basis of a family of visualization software systems – developed from late 1980s • Visualization seen as a pipeline of simple processes eg contouring – read in data – create contour lines – draw contour lines • Systems provide modules implementing these steps… • .. Plus a ‘visual programming’ environment to allow user to connect modules together ENV 2006 11.13 Visual Programming - IRIS Explorer ENV 2006 11.14 Visual programming systems • Visual programming allows easy experimentation which is what one needs in visualization • Examples are: – IRIS Explorer www.nag.co.uk – AVS www.avs.com – OpenDX (grown from IBM Visualization Data Explorer) www.opendx.org ENV 2006 11.15 Classification of mapping techniques • The mapping stage is where we decide which visualization technique to apply to our ‘enriched’ data • There are a bewildering range of these techniques - how do we know which to choose? • First step is to classify the data into sets and associate different techniques with different sets. ENV 2006 11.16 Back to the simple example • The underlying field is a function F(x) – F represents the oxygen level and is the DEPENDENT variable – x represents the time and is the INDEPENDENT variable • It is a one dimensional scalar field because – the independent variable x is 1D – the dependent variable F is a scalar value ENV 2006 11.17 General classification scheme • The underlying field can be regarded as a function of many variables: say F(x) where F and x are both vectors: F = (F1, F2, ... Fm) x = (x1, x2, ... xn) • The dimension is n • The dependent variable can be scalar (m=1) or vector (m>1) ENV 2006 11.18 A Simple Notation • This leads to a simple classification of data as: EnS/V • So the simple example is of type: E1S • Flow within a volume can be classed as: E3V3 ENV 2006 11.19 Exercise • Can you give suitable techniques for the following classes: • ES1 • ES2 • ES3 • EV33 ENV 2006 11.20 Overview of Visualization Techniques Different techniques for different types of data ENV 2006 11.21 Scalar 1D data: ES1 • • • Scalar: 1 value 1D: value is measured in terms of 1 other variable The humble graph! A nice example of web-based visualization…. http://fx.sauder.ubc.ca/plot.html • Clear overlap here between SciVis and InfoVis… http://fx.sauder.ubc.ca/plot.html ENV 2006 11.22 Scalar 2D Data: ES2 • Here is yesterday’s temperature over USA http://weather.unisys.com/surface/ • Can you use a 1D technique for this sort of data? • Can you improve this visualization? ENV 2006 11.23 Scalar 2D Data: ES2 • • Here is a surface view of the tsunami… For movies, see: http://www.pmel.noaa.gov/tsunami/indo_1204. html movie ENV 2006 11.24 Scalar 3D Data: ES3 • As dimension increases, it becomes harder to visualize on a 2D surface • Here we see a lobster within resin.. where the resin is represented as semitransparent • Technique known as volume rendering Image from D. Bartz and M. Meissner ENV 2006 11.25 Vector 2D Data:EV22 • This is a flow field in two dimensions • Simple technique is to use arrows.. • What are the strengths and weaknesses of this approach? • During the module, we will discover better techniques for this ENV 2006 11.26 Vector 3D Data:EV33 • • • This is flow in a volume Arrows become extremely cluttered Here we are tracing the path of a particle through the volume ENV 2006 11.27 Visualization Techniques – Scalar 1D Data ENV 2006 11.28 1D Interpolation – The Problem f 4 3 2 1 0 1 1.75 2 3 4 x Given (x1,f1), (x2,f2), (x3,f3), (x4,f4) - estimate the value of f at other values of x - say, x*. Suppose x*=1.75 ENV 2006 11.29 Nearest Neighbour f 4 3 2 1 0 1 1.75 2 3 4 x Take f-value at x* as f-value of nearest data sample. So if x* = 1.75, then f estimated as 3 ENV 2006 11.30 Linear Interpolation f 4 3 2.5 2 1 0 1 1.75 2 3 4 x Join data points with straight lines- read off f-value corresponding to x*.. in the case that x*=1.75, then f estimated as 2.5 ENV 2006 11.31 Linear Interpolation – Doing the Calculation Suppose x* lies between x1 and x2. Then apply the transformation: f1 f* f2 t = (x-x1)/(x2-x1) so that t goes from 0 to 1. x x 1 0 x* t* f(x*) = (1-t*) f1 + t* f2 t*=(1.75-1)/(2-1)=0.75 2 1 f(1.75)=0.25*1+0.75*3 =2.5 The functions j(t)=1-t and k(t)=t are basis functions. OR, saving a multiplication: f(x*) = f1 + t* ( f2 - f1 ) f(1.75)=1+0.75*(3-1) =2.5 ENV 2006 11.32 Nearest Neighbour and Linear Interpolation • Nearest Neighbour – Very fast : no arithmetic involved – Continuity : discontinuous value – Bounds : bounds fixed at data extremes • Linear Interpolation – Fast : one multiply, one divide – Continuity : value only continuous, not slope (C0) – Bounds : bounds fixed at data extremes ENV 2006 11.33 Drawing a Smooth Curve • Rather than straight line between points, we create a curve piece We estimate the slopes g1 and g2 at the data points, and construct curve which has these values and these slopes at end-points g1 f1 g2 f2 x1 x2 ENV 2006 11.34 Slope Estimation • Slopes estimated as some average of the slopes of adjacent chords - eg to estimate slope at x2 g2 g2 usually arithmetic mean (ie average) of f2 f1 f3 =(f2-f1)/(x2-x1) x1 x2 x3 ENV 2006 11.35 Piecewise Cubic Interpolation Once the slopes at x1 and x2 are known, this is sufficient to define a unique cubic polynomial in the interval [x1,x2] f(x) = c1(x) * f1 + c2(x) * f2 + h*(d1(x) * g1 - d2(x) * g2) g1 f1 g2 f2 x1 x2 ENV 2006 ci(x), di(x) are cubic Hermite basis functions, h = x2 – x1. 11.36 Cubic Hermite Basis Functions Here they are: Again set t = (x - x1)/(x2 – x1) c1 (t) = 3(1-t)2 - 2(1-t)3 c2 (t) = 3t2 - 2t3 d1 (t) = (1-t)2 - (1-t)3 d2 (t) = t2 - t3 Check the values at x = x1, x2 (ie t=0,1) ENV 2006 11.37 Coal data - cubic interpolation ENV 2006 11.38 Piecewise Cubic Interpolation • More computation needed than with nearest neighbour or linear interpolation. • Continuity: slope continuity (C1) by construction - and cubic splines will give second derivative continuity (C2) • Bounds: bounds not controlled generally - eg if arithmetic mean used in slope estimation... ENV 2006 11.39 Shape Control • However special choices for slope estimation do give control over shape • If the harmonic mean is used 1/g2 = 0.5 ( 1/1 + 1/2) then we find that f(x) lies within the bounds of the data ENV 2006 11.40 Coal data – keeping within the bounds of the data ENV 2006 11.41 Rendering Line Graphs • The final rendering step is straightforward • We can assume that the underlying graphics system will be able to draw straight line segments • Thus the linear interpolation case is trivial • For curves, we do an approximation as sequence of small line segments ENV 2006 11.42