CDS 130 - 003 Fall, 2010 Computing for Scientists Visualization (Oct. 28, 2010 – Nov. 09, 2010) Jie Zhang Copyright ©

Slides:



Advertisements
Similar presentations
Laboratory of Image Processing Pier Luigi Mazzeo
Advertisements

CDS 301 Fall, 2009 Scalar Visualization Chap. 5 September 24, 2009 Jie Zhang Copyright ©
Informationsteknologi Monday, October 29, 2007Computer Graphics - Class 21 Today’s class Graphics programming Color.
HCI 530 : Seminar (HCI) Damian Schofield.
Raster Data. The Raster Data Model The Raster Data Model is used to model spatial phenomena that vary continuously over a surface and that do not have.
Graphics File Formats. 2 Graphics Data n Vector data –Lines –Polygons –Curves n Bitmap data –Array of pixels –Numerical values corresponding to gray-
1 King ABDUL AZIZ University Faculty Of Computing and Information Technology CS 454 Computer graphicsIntroduction Dr. Eng. Farag Elnagahy
Scientific Data Representation and Mapping
MULTIMEDIA TECHNOLOGY SMM 3001 MEDIA - GRAPHICS. In this chapter how the computer creates, stores, and displays graphic images how the computer creates,
Colour Digital Multimedia, 2nd edition Nigel Chapman & Jenny Chapman
Digital Multimedia, 2nd edition Nigel Chapman & Jenny Chapman Chapter 6 This presentation © 2004, MacAvon Media Productions Colour.
Spatial data models (types)
Course Website: Digital Image Processing Colour Image Processing.
Digital Image Processing Colour Image Processing.
1 Computer Graphics Week13 –Shading Models. Shading Models Flat Shading Model: In this technique, each surface is assumed to have one normal vector (usually.
Scalar Visualization Chap. 5 September 23, 2008 Jie Zhang Copyright ©
Technology and Historical Overview. Introduction to 3d Computer Graphics  3D computer graphics is the science, study, and method of projecting a mathematical.
Lab #5-6 Follow-Up: More Python; Images Images ● A signal (e.g. sound, temperature infrared sensor reading) is a single (one- dimensional) quantity that.
Human Eye and Color Rays of light enter the pupil and strike the back of the eye (retina) – signals go to the optic nerve and eventually to the brain Retina.
Color Image Processing A spectrum of possibilities…
CDS 301 Fall, 2009 Data Representation Chap. 3 September 10, 2009 Jie Zhang Copyright ©
I-1 Steps of Image Generation –Create a model of the objects –Create a model for the illumination of the objects –Create an image (render) the result I.
Graphics Graphics Korea University cgvr.korea.ac.kr Raster Graphics 고려대학교 컴퓨터 그래픽스 연구실.
CDS 301 Fall, 2009 Vector Visualization Chap. 6 October 7, 2009 Jie Zhang Copyright ©
© 1999 Rochester Institute of Technology Introduction to Digital Imaging.
Nov 061 Size Control How is a component’s size determined during layout and during resize operations? Three factors determine component sizes: The component’s.
Topic 5 - Imaging Mapping - II DIGITAL IMAGE PROCESSING Course 3624 Department of Physics and Astronomy Professor Bob Warwick.
Digital Image Processing Lecture 6: Image Geometry
Computer Graphics: Programming, Problem Solving, and Visual Communication Steve Cunningham California State University Stanislaus and Grinnell College.
1 Computer Graphics Week2 –Creating a Picture. Steps for creating a picture Creating a model Perform necessary transformation Lighting and rendering the.
CS112 Scientific Computation Department of Computer Science Wellesley College Numb3rs Number and image types.
Image Representation. Digital Cameras Scanned Film & Photographs Digitized TV Signals Computer Graphics Radar & Sonar Medical Imaging Devices (X-Ray,
The Rendering Pipeline CS 445/645 Introduction to Computer Graphics David Luebke, Spring 2003.
Computer Graphics Chapter 6 Andreas Savva. 2 Interactive Graphics Graphics provides one of the most natural means of communicating with a computer. Interactive.
CHAPTER 8 Color and Texture Mapping © 2008 Cengage Learning EMEA.
Volume Visualization Presented by Zhao, hai. What’ volume visualization Volume visualization is the creation of graphical representations of data sets.
DIGITAL IMAGE. Basic Image Concepts An image is a spatial representation of an object An image can be thought of as a function with resulting values of.
2D Routines in 3D. Outline Announcements –HW II--due Friday. 5PM HW1 & Cookie Grids & Meshes Representing f(x,y) Lines & Surfaces in 3D Survey.
Introduction to Computer Graphics
Color Web Design Professor Frank. Color Displays Based on cathode ray tubes (CRTs) or back- lighted flat-screen Monitors transmit light - displays use.
RENDERING Introduction to Shading models – Flat and Smooth shading – Adding texture to faces – Adding shadows of objects – Building a camera in a program.
June 14, ‘99 COLORS IN MATLAB.
CHAPTER 5 CONTOURING. 5.3 CONTOURING Fig 5.7. Relationship between color banding and contouring Contour line (isoline): the same scalar value, or isovalue.
Intro to Color Theory. Objectives Identify and discuss various color models including RGB, CMYK, Black/white and spot color. Investigate color mixing.
Computer Science 121 Scientific Computing Winter 2014 Chapter 14 Images.
SCALAR VISUALIZATION. OUTLINE Visualizing scalar data A number of the most popular scalar visualization techniques Color mapping Contouring Height plots.
CDS 301 Fall, 2008 From Graphics to Visualization Chap. 2 Sep. 3, 2009 Jie Zhang Copyright ©
CDS Fall, 2011 Computing for Scientists Visualization Jie Zhang Copyright ©
CDS 301 Fall, 2008 Domain-Modeling Techniques Chap. 8 November 04, 2008 Jie Zhang Copyright ©
© ExplorNet’s Centers for Quality Teaching and Learning 1 Objective % Understand concepts used to create digital graphics.
CDS 301 Fall, 2008 Data Representation Chap. 3 September 2, 2008 Jie Zhang Copyright ©
Digital Image Processing CCS331 Relationships of Pixel 1.
EEE 242 Computer Tools for Electrical Engineering
The Elements of Art Mrs. Love The Elements of Art There are 7 basic elements of art. These elements are the visual language of art.
1 of 32 Computer Graphics Color. 2 of 32 Basics Of Color elements of color:
CDS 301 Fall, 2009 Scientific Information and Data Visualization Introduction Sep. 1, 2009 Jie Zhang Copyright ©
Objective % Explain design concepts used to create digital graphics.
Initial Display Alternatives and Scientific Visualization
Computer Graphics: An Introduction
Half Toning Dithering RGB CMYK Models
Images In Matlab.
Volume Visualization Chap. 10 November 20 , 2008 Jie Zhang Copyright ©
Ch3 Graphics Overview of Plotting Editing Plots
3D Graphics Rendering PPT By Ricardo Veguilla.
Volume Visualization Chap. 10 December 3 , 2009 Jie Zhang Copyright ©
Computer Vision Lecture 4: Color
Digital Image Processing using MATLAB
Domain-Modeling Techniques
Color Model By : Mustafa Salam.
Objective % Explain design concepts used to create digital graphics.
Presentation transcript:

CDS Fall, 2010 Computing for Scientists Visualization (Oct. 28, 2010 – Nov. 09, 2010) Jie Zhang Copyright ©

Content 1.Introduction 2.Computer Visualization Pipeline 3.2-D Data Visualization –Height-plot method –Color map method References: (1)“Data Visualization: Principles and Practice”, by Alexandru C. Telea, A. K. Peters Ltd, ISBN-13: , 2008 (2)CDS 301 “Scientific Information and Data Visualization”, Fall 2009 at

1. Introduction What is visualization? Why visualization?

Picture A Picture Is Worth a Thousand Words Cave Painting: the dawn of civilization

Graph: Height-Plot Height plot of the Predator-Prey Model Numeric output of the Predator-Prey Model A graph is worth one thousand numbers Year Population

Graph: 3-D Height-Plot Numeric output: a 2-Dimension data array, which is the same as ……

Graph: 3-D Height-Plot Height plot A graph is worth one million numbers

Visualization is a cognitive process performed by humans in forming a mental image of a domain space Visualization - Cognition Human Cognition Most effective way human takes in information, digest information, making decision, and being creative. The most important among the five senses

Scientific visualization is an interdisciplinary branch of science primarily concerned with the visualization of three dimensional phenomena (meteorological, medical, biological etc) where the emphasis is on realistic rendering of volumes, surfaces, illumination sources with a dynamic (time) component. Friendly (2008), also What is Scientific Visualization At Information Age

Goal of Scientific Visualization Provide scientific insights Effective communication

Example: Scalar Data Height plot of a 2-D data, and the contour lines In topology, the data are of 2-D: a curved surface The data are mapped into 3-D geometric space in computer memory The data are then rendered onto a 2-D visual plane on a screen

Example: Vector Data Stream tubes: show how water flows through a box with an inlet at the top-right and an outlet at the lower-left of the box; the data are (1) 3-D volume, (2) vector

Example: Unstructured Data Scattered Point Cloud and Surface Reconstruction. The data are a set of sampled data points in 3-D space, and the distribution of data is unstructured; need to reconstruct the surface from the scattered points Sampled dataRendered data

Example: Volume Visualization 3-D data of human head. Instead of showing a subset (e.g, a slice as in CT images), the whole 3-D data are shown at once using the technique of Opacity Transfer Function

Example: Information Visu. The file system of FFmpeg, a popular software package for encoding audio and video data into digital format Information, such as name and address, can not be interpolated; the visualization focuses on the relations.

An attempt at visualizing the Fourth Dimension: Take a point, stretch it into a line, curl it into a circle, twist it into a sphere, and punch through the sphere. --Albert Einstein--

2. Computer Visualization Pipeline How to do it by a computer? We illustrate the process using the well known 2-D Gaussian function:

Gaussian Function in 1-D It is straightforward to visualize the 1-D Gaussian function (1)Choose a data domain, e.g., x in [-3.0, 3.0] (2)Choose a set of regular points in x, e.g., step size 0.5: x 1 =-3.0, x 2 =-2.5, x 3 =-2.0, x 4 =-2.5……….X 13 =3.0 (3)Calculate the corresponding functional value f(x i ) (4)Draw the 13 data points (x i, f(x i )) for i=1:13 (5)Connecting these points to form a curve, which shows the Gaussian function

Gaussian Function in 1-D x=-3.0:0.1:3.0; %declare the domain space and define the grid % x: one dimensional data array y=exp(-power(x,2)); %calculate the discrete functional value % y: also one dimensional data array plot(x,y,'*') hold on plot(x,y) xlabel('x') ylabel('y') title('Gaussian 1D') print -dpng 'Gaussian_1d.png' X: 1-D data array interval or domain: from -3.0 to 3.0 sub-interval: 0.1 value=[-3.0, -2.9, -2.8,………2.9, 3.0] number of elements: N=61

Gaussian Function in 1-D

Gaussian Function in 2-D We know the result. In a height-plot format, It should look like something below. But how to do it through the computer? A 3-D height plot showing the Gaussian Surface The Grid on the domain Created by PARAVIEW, a power visualization package

Pipeline Step 1: Data Acquisition Step 1: data acquisition. For any input data (experiment, simulation etc), convert the data into a discrete dataset over a regular grid Gaussian Example: Choose a uniform grid in the domain space Nx=30 (i=1:30) Ny=30 (j=1:30) Calculate the functional value at these grid points This creates a set of 30 X 30, or 900 in total discrete 3D data points [x,y,z]

Pipeline Step 2: Data Mapping Step 2: Mapping the discrete dataset onto a 3-D scene. Neighboring discrete data points are grouped to form graphic primitive shapes that a computer can handle efficiently, e.g., point, line, triangle, quadrilateral, and tetrahedron Computer graphics only handles a 3-D scene Gaussian Example: Form a set of four- vertex polygons or quadrilateral in 3-D space For each quadrilateral, the position of the four vertices are known, and its normal direction is calculated (in order to determine its luminance)

Pipeline Step 2: Data Mapping Quadrilateral shape

Pipeline Step 3: Rendering Step 3: Computer graphics renders the 3-D scene (a set of primitive shapes) onto a 2D projected place, by 1.Choose the view angle 2.Choose the light source 3.Choose the shading Gaussian Example: Viewed from top-front From a point light source in the front Smooth shading

Shading Flat ShadingGouraud Shading

Shading Flat shading: Given a polygon surface (e.g., quadrilateral), flat shading applies the lighting model once for the complete polygon, e.g., for the center point The whole polygon surface has the same light intensity The least expensive But visual artifact of the “faceted” surface Gouraud shading (or smooth shading): Apply lighting model at every vertex of the polygon The intensity between the vertices are calculated using interpolation, thus yielding smooth variation

Visualization Pipeline float data[N_x,N_y] Quadrilateral in 3D Continuous data Discrete dataset Geometric object Displayed image 1. Data Acquisition 2. Data Mapping 3. Rendering

Visualization Pipeline: Summary Step 1: data acquisition, which is to convert any input data into a discrete dataset within a domain. For Gaussian function, the input is a continuous Gaussian function, the output is a discrete dataset Step 2: data mapping: which is to map the discrete dataset from step one (input) onto a 3-D scene (output) in computer memory. For Gaussian function, the output is a set of quadrilaterals in 3-D space. Each quadrilateral has four vertexes. Step 3: rendering, which is to display the 3-D scene created in step 2 (input) onto a projected 2-D image (output).

3. 2-D data Visualization- (Nov. 1, 2010)

Visualization with Matlab Watch Matlab tutorial video on arrays, including indexing and “find” function: “ alizing-data-overview-matlab-video- demonstration.html”

2-D Data Visualization Method 1: Height plot Create 2-D data array in Matlab Nested “For” loop in Matlab “surf” in Matlab Method 2: Colormap RGB color system “image” in Matlab

Height-Plot Method

Height Plot Population plot from Natalia Lattanzio

Gaussian Function (1)Choose a data domain, e.g., x in [-3.0, 3.0] (2)Choose a set of regular points in x with a subinterval of 0.1: x 1 =-3.0, x 2 =-2.9, x 3 =-2.8, x 4 =-2.7……….X 13 =3.0 (3)Calculate the corresponding functional value f(x i ) (4)Draw the 61 data points (x i, f(x i )) for i=1:61 (5)Connecting these points to form a curve, which shows the Gaussian function

Gaussian Function in 1-D %find number of intervals x_start=-3.0 x_end=3.0 x_sub=0.1 N=(x_end-x_start)/x_sub %number of iteration N+1 %for loop to find discrete x and y values for i=[1:N+1] x(i)=x_start+(i-1)*x_sub; y(i)=exp(-power(x(i),2)); end plot(x,y,'*') hold on plot(x,y) X: 1-D data array interval or domain: from -3.0 to 3.0 sub-interval: 0.1 value=[-3.0, -2.9, -2.8,………2.9, 3.0] number of elements: N=61

Gaussian Function in 1-D

sine Function (1)Choose a data domain, x in [-6.28, 6.28] or [-2π,2π] (2)Choose a set of regular points in x with a subinterval of 0.1: x 1 =-6.28, x 2 =-6.18, x 3 = , x 4 =-2.7…x..=6.28 (3)Calculate the corresponding functional value f(x i ) (4)Connecting these points to form a curve, which shows the sine function Class activity y=sin(x) % sine function in Matlab

Height-Plot of 2-D Gaussian

2-D Array Watch Matlab tutorial video on arrays, including indexing and “find” function: “ king-with-arrays-matlab-video-tutorial.html” A large amount of scientific data are in the format of 2-D array, e.g., images

2-D Array Create 1-D array >> a=[1,2,3,4,5] >> a=[ ] >> a=1:5 >> a=[1:5] %indexing and assigning values using for loops %.e.g., assign x^2 for i=[1:5] x(i)=power(i,2) end %what are x? Index is used to access the array >>x(3)

2-D Array Create 2-D array >> a=[1,2,3;4,5,6;7,8,9] %3 x 3 array a=

2-D Array Index of 2-D array (1,1) (1,2) (1,3) (2,1) (2,2) (2,3) (3,1) (3,2) (3,3) >>a(1,1) 1 >>a(2,3) 6 >>a(i,j) Index of a 2-D array has two subscripts First subscript, often noted by “i”, indicate the row number Second subscript, often noted by “j”, indicate the column number

(continued) (Nov. 4, 2010)

2-D Array Visualize the index and the value of a 2-D array >> a=[1,2,3;4,5,6;7,8,9] %3 x 3 array a= >>surf(a)

2-D Array Re-assign the value of the elements >> a=(2,2) ans = 5 >>a(2,2)=10 a=

2-D Array a= Group exercise: (1) Create the following 2-D array (2) Visualize it using “surf” (3) Change the element at (2,2) to 20 (4) Visualize the new 2-D array

Nested FOR loops Create a 2-D array using nested FOR loops for i=[1:3] for j=[1:3] a(i,j)=j+(i-1)*3; end a= Double FOR loop is a quick way to go through every data elements in the 2-D data array Assign the value Check the value Change the value

Nested FOR loops for i=[1:3] for j=[1:3] a(i,j)=i+j end End a= ? ? ? Find the values of the following double FOR loops:

2-D height plot Draw a 2-D function in the following domain space: (1)x between [-3, 3], with step size of 0.1 (2)y between [-3,3], with step size of 0.1

2-D height plot x_start=-3.0 x_end=3.0 x_sub=0.1 Nx=(x_end-x_start)/x_sub %number of points along x y_start=-3.0 y_end=3.0 y_sub=0.1 Ny=(y_end-y_start)/y_sub %number of points along y for i=[1:Nx] for j=[1:Ny] x(i)=x_start+i*x_sub; y(j)=y_start+j*y_sub; f(i,j)=exp(-(power(x(i),2)+power(y(j),2))) end surf(f)

2-D height plot

Draw the following 2-D function in the following domain space: (1)x between [-3, 3], with step size of 0.1 (2)y between [-3,3], with step size of 0.1 Group exercise:

2-D height plot

Image method and Colormap (Nov. 4, 2010)

Color Question: Do scientific data have intrinsic color? For example, temperature reading around the globe. For example, the values of 2-D Gaussian function

Color Answer: Most scientific data concern about value, strength, or intensity. They have no color Color image of scientific data are called pseudo- color image, which uses color as a cue to indicate the value of the data.

Colormap Gray-scale MapRainbow Colormap

Computer Color A special type of vector with dimension c=3 The value of a color = (R, G, B) RGB system: convenient for computer R: red G: green B: blue HSV system: intuitive for human H: Hue (the color, from red to blue) S: Saturation (purity of the color, or how much is mixed with white V: Value (the brightness)

Computer Color A pixel of a LCD monitor contains three sub-pixels: R, G, B Each sub-pixel displays the intensity of one primary color Modern LCD monitor uses 1 Byte or 8 bits to determine the intensity of the primary color Each primary color has 255 intensity levels The number of colors of a LCD monitor = 255 (red) x 255 (green) x 255 (blue) = 16,581,375 Or 16 million different colors The monitor shows true color Human eyes discern 10 million color

(continued) (Nov. 9, 2010)

RGB Cube R G B yellow magenta Cyan

RGB System Every color is represented as a mix of “pure” red, green and blue colors in different amount Equal amounts of the three colors give gray shades RGB cube main diagonal line connecting the points (0,0,0) and (1,1,1) is the locus of all the grayscale value Color (0,0,0): dark Color (1,1,1): white Color (0.5,0.5,0.5): gray level between dark and white Color (1,0,0): Red Color (0,1,0): Green Color (1,1,0): ? (1,0,1): ? (0,1,1): ?

Colormap in Matlab To select a colormap interactively: Use the “Colormap” menu in the “Figure Properties” pane of the “Plot Tools GUI” Matlab built-in Colormap

Example: Re-usable function function gauss = Gaussian_2d () x_start=-3.0 x_end=3.0 x_sub=0.1 Nx=(x_end-x_start)/x_sub %number of points along x y_start=-3.0 y_end=3.0 y_sub=0.1 Ny=(y_end-y_start)/y_sub %number of points along y for i=[1:Nx] for j=[1:Ny] x(i)=x_start+i*x_sub; y(j)=y_start+j*y_sub; f(i,j)=exp(-(power(x(i),2)+power(y(j),2))) end gauss=f; endfunction Return value

Colormap in Matalb >z=Gaussian_2d >surf(z) %default color map “jet” >colormap(gray) >colormap(jet) Call the function you created and visualize it Use “Colormap” to change color colormap(jet) colormap(gray)

colormap Create the following 2-D array in Matlab/Octave >a=(1,2,3;4,5,6;7,8,9) Visualize it using “surf” function, the surface function or 3-D height-plot provided by Matalb Change to colormap to “gray”, “jet”, “spring”, ‘hot” et al. Group exercise:

Colormap in Matalb >m=gray >size(m) ans = 64 3 >m ……… How does a colormap work? map your data value on each pixel (e.g., row i, column j) into a color based on the colormap Re-scale is needed Row 1 Row 2 Row 3 Row 4 Row Row 62 Row 63 Row 64 A data value of 5.0 will correspond to color (0.063, 0.063, 0.063), and computer understands this color and will display it correctly A data value of 0 will correspond to color (0, 0, 0), or dark pixel A data value of 64 will correspond to color (1, 1, 1) or a white pixel Your data need to be re- scaled between 0 and 64 “surf” do re-scale for you

Colormap: re-scale What happens in computer is that, the data range of the 2- D Gaussian function from 0 to 1, is mapped to the color range from 1 to in function value corresponds to color number 1 1 in function value corresponds to color number 64 Any value in between in function is re-scaled to a value between 1 and in function corresponds to color number 32 you use a colormap of 64 colors to visualize a 2-D data, e.g., 2-D Gaussian

colormap Create the following 2-D array in Matlab/Octave >a=(1,2,3;4,5,6;7,8,9) Visualize it using “surf” function, the surface function or 3-D height-plot provided by Matalb Change the size of the colormap >surf(a) >colormap(gray(64)) % gray colormap with 64 colors >colormap(gray(9)) % gray colormap with 9 colors >colormap(gray(2)) % gray colormap with 2 colors >m=colormap(gray(2)) Group exercise: Do you understand the changes?

“image” method in Matlab For many applications, you want to show your data as a flat image, when your data are given as a 2-D matrix. “image” does the trick for you “image” does not scale the data for you. >z=Gaussian_2d %get the 2-D data >colormap(gray) %choose gray colormap >image(z) % show the image % but it does not work % it is dark >image(z*64) >image(z*256) It does not work! It works! Why? Why it saturates at the center?

“image” method in Matlab 2-D Gaussian image in gray colormap 2-D Gaussian image in jet colormap

colormap Group exercise: visualize the following 2-D array using “image” method >for i=[1:64] >for j=[1:64] >f(i,j)=i >end >colormap(gray(64)) >image(a) %repeat the process, but change f(i,j)=j %Do you fully understand what you get? %what if colormap(gray(32)) %what if colormap(gray(128)) >m=colormap(jet(10)) % check out the color array

Question: what visualization techniques are used in this image?

The End