vtk: data shroeder et al. chapter 5 university of texas – pan american csci 6361, spring 2014...

31
VTK: Data Shroeder et al. Chapter 5 University of Texas – Pan American CSCI 6361, Spring 2014 After Taku Komura and other lecture sets http://www.inf.ed.ac.uk/teaching/ courses/vis/

Upload: felix-wade

Post on 11-Jan-2016

245 views

Category:

Documents


2 download

TRANSCRIPT

Page 1: VTK: Data Shroeder et al. Chapter 5 University of Texas – Pan American CSCI 6361, Spring 2014 After Taku Komura and other lecture sets

VTK: Data

Shroeder et al. Chapter 5

University of Texas – Pan AmericanCSCI 6361, Spring 2014

After Taku Komura and other lecture setshttp://www.inf.ed.ac.uk/teaching/courses/vis/

Page 2: VTK: Data Shroeder et al. Chapter 5 University of Texas – Pan American CSCI 6361, Spring 2014 After Taku Komura and other lecture sets

Overview

• Provides overview or “road map” to data and structure representations in VTK

– Same data and structure representation concepts common in computer graphics

• Do understand that examples from previous weeks are more like the “high level” at which you’ll be working for the terrain and color mapping project

• Discrete vs. continuous representation

• Topology and Geometry

• VTK data representations – cell types– 0, 1, 2, 3, dimensions– Structured and unstructured

• Data attributes

Page 3: VTK: Data Shroeder et al. Chapter 5 University of Texas – Pan American CSCI 6361, Spring 2014 After Taku Komura and other lecture sets

Data Representation in Visualization

• Last time - system architecture for visualization– visualization pipeline– rendering techniques– Focus now on data

• For (computer) visualization data is– discrete (in representation)– structured / unstructured (e.g. grid / cloud)– of a specific dimension (1, 2, 3, n)

• Computer graphics, recall, is foundation– Here, will take foundational ideas and characterize

with focus on applications in visualization

• Can think of organizing structure (architecture) for data:

– Topology• How things (data elements) fit together

– Geometry• Particular values that create (instantiate) a particular

object

• Data Attributes

Page 4: VTK: Data Shroeder et al. Chapter 5 University of Texas – Pan American CSCI 6361, Spring 2014 After Taku Komura and other lecture sets

Data Representation in Visualization

• Last time - system architecture for visualization– visualization pipeline– rendering techniques– Focus now on data

• For (computer) visualization data is– discrete (in representation)– structured / unstructured (e.g. grid / cloud)– of a specific dimension (1, 2, 3, n)

• Computer graphics, recall, is foundation– Here, will take foundational ideas and characterize

with focus on applications in visualization

• Can think of organizing structure (architecture) for data:

– Topology• How things (data elements) fit together

– Geometry• Particular values that create (instantiate) a particular

object

• Data Attributes

Page 5: VTK: Data Shroeder et al. Chapter 5 University of Texas – Pan American CSCI 6361, Spring 2014 After Taku Komura and other lecture sets

Data: Discrete vs. Continuous

• Real World is continuous (duh)

• Data for visualization is discrete– Computers are good in handling discrete data– discrete representation of a real world (of abstract)

concept

• Text example of– y = x2, and f(x,y) = x2 - y2

– Obviously, continuous– To create digital / visual representation must sample

points (with which you are now familiar)• E.g., built in method for sampling over function

• However, difficult to visualize continuous shape from raw discrete sampling?

– Requires topology and interpolation– … “how things fit together”

Page 6: VTK: Data Shroeder et al. Chapter 5 University of Texas – Pan American CSCI 6361, Spring 2014 After Taku Komura and other lecture sets

Topology and Geometry

• Topology:– Just, the way the data points are “put together” …

• As lines, polygons, etc.

– More formally:• Relationships within the data invariant under

geometric transformation (e.g., orientation, translation)

– i.e., the information which vertex is connected to which edge, which face is composed of which edges , etc.

• Did not say much about transformation earlier when looking at graphics

– Idea is that classes of transformations preserve certain properties

– E.g., affine transformations for computer graphics

• Geometry:– Just, putting particular values in for the elements

of particular topology– Creating an instance of (or instantiating) a

particular form

Topology is invariant undergeometric transformation

Page 7: VTK: Data Shroeder et al. Chapter 5 University of Texas – Pan American CSCI 6361, Spring 2014 After Taku Komura and other lecture sets

Interpolation and Topology

• For various reasons interpolation is important in visualization

– Recall cg shading, e.g., Gouraud– Pragmatically, for storage efficiency– For representing change over known (or ascribed)

values

• Interpolation: – Increasing resolution of a discrete representation by

producing intermediate samples

• Use interpolation to shade whole cube:– in example: producing intermediate color pixels over

cube topology from discrete vertex samples

• Example:– Vertices represent spatial temperature at the 8 discrete

points?• e.g. a color scale with blue(=cold) -> green ->

red( = hot)– How to visualize temperature field over whole cube?

Page 8: VTK: Data Shroeder et al. Chapter 5 University of Texas – Pan American CSCI 6361, Spring 2014 After Taku Komura and other lecture sets

Detail: Interpolate over a RectangleOptional – see text

• How till the red color dot on the right lower corner affect the color of the point near the left top?

• What happens if we change the representation?

• Discrete data samples remain the same– Topology has changed => affects interpolation =>

effects visualization

Page 9: VTK: Data Shroeder et al. Chapter 5 University of Texas – Pan American CSCI 6361, Spring 2014 After Taku Komura and other lecture sets

Interpolation in Digital ImagesOften used technique

• Some digital cameras use interpolation to produce a larger image than the sensor captured

– Also using the topology of data– E.g. below: top, just increase size – original pixels evident, bottom, interpolate

• From computer graphics– Various smoothing (and antialiasing) algorithms, effectively “interpolation”, as used here

Page 10: VTK: Data Shroeder et al. Chapter 5 University of Texas – Pan American CSCI 6361, Spring 2014 After Taku Komura and other lecture sets

Topological Dimension, or, Dimensionality

• Data has an inherent topological dimension – I.e., minimum number of independent

continuous variables needed to specify the location inside the data

– Or, just, dimensionality

– Points : 0D,– Lines, curves : 1D,– Surfaces : 2D,– Volumes : 3D– Time dependent volumes : 4D– and, n-dimensional …

Page 11: VTK: Data Shroeder et al. Chapter 5 University of Texas – Pan American CSCI 6361, Spring 2014 After Taku Komura and other lecture sets

VTK Data RepresentationVTK-ese, or terminology

• Data objects: structure + value– A “dataset”

Page 12: VTK: Data Shroeder et al. Chapter 5 University of Texas – Pan American CSCI 6361, Spring 2014 After Taku Komura and other lecture sets

Dataset, again

• Again, dataset consists of 2 main components– Structure of the data

• Structure gives spatial meaning to the attributes

– Value• Attributes associated to particular

parts of the structure• Example:

– values = { blue, green, green, green, green, green, turquoise, red}

– attributes alone are meaningless without structure

Page 13: VTK: Data Shroeder et al. Chapter 5 University of Texas – Pan American CSCI 6361, Spring 2014 After Taku Komura and other lecture sets

Structure of DataAgain

• Structure has 2 main parts– Topology :

• determines interpolation required for visualization

• “shape” of data

– Geometry• instantiation of the topology• specific position of points in geometric

space

Page 14: VTK: Data Shroeder et al. Chapter 5 University of Texas – Pan American CSCI 6361, Spring 2014 After Taku Komura and other lecture sets

Concrete Representation of DatasetsPutting things together in VTK

• Points specify where the data is known– specify geometry

• Cells allow us to interpolate between points– specify topology of points

Page 15: VTK: Data Shroeder et al. Chapter 5 University of Texas – Pan American CSCI 6361, Spring 2014 After Taku Komura and other lecture sets

VTK CellsSimilar to OpenGL – no surprise

• Quite similar in all graphics applications

• Fundamental building blocks of shapes

• Defined by topological dimension– 1,2,3d

• Specified as an ordered point list

• Primary or composite cells– composite : consists of one or

more primary cells

Page 16: VTK: Data Shroeder et al. Chapter 5 University of Texas – Pan American CSCI 6361, Spring 2014 After Taku Komura and other lecture sets

0 and 1 Dimensional Cell Types(straightforward)

• Zero-dimensional– Vertex

• Primary zero-dimensional cell• Definition: single point

– Polyvertex• Composite zero-dimensional cell

– composite : comprises of several vertex cells• Definition: arbitrarily ordered set of points

• One-dimensional– Line

• Primary one-dimensional cell type• Definition: 2 points, direction is from first to

second point.

– Polyline• Composite one-dimensional cell type• Definition: an ordered set of n+1 points,

where n is the number of lines in the polyline

Page 17: VTK: Data Shroeder et al. Chapter 5 University of Texas – Pan American CSCI 6361, Spring 2014 After Taku Komura and other lecture sets

Two-Dimensional Cell TypesMany to enhance polygon representation flexibility

• Triangle– Primary 2D cell type– Definition: counter-clockwise ordering of 3 points

• order of the points specifies the direction of the surface normal

• Triangle strip– Composite 2D cell consisting of a strip of triangles– Definition: ordered list of n+2 points

• n is the number of triangles

• Quadrilateral– Primary 2D cell type– Definition: ordered list of four points lying in a plane

• constraints: convex + edges must not intersect

• Pixel– Primary 2D cell, consisting of 4 points

• topologically equivalent to a quadrilateral• constraints: perpendicular edges; axis aligned

– numbering is in increasing axis coordinates

• Polygon– Primary 2D cell type– Definition: ordered list of 3 or more points

• constraint: may not self-intersect

Page 18: VTK: Data Shroeder et al. Chapter 5 University of Texas – Pan American CSCI 6361, Spring 2014 After Taku Komura and other lecture sets

Three-Dimensional Cell Types

• Tetrahedron– Definition: list of 4 non-planar points

• Six edges, four faces

• Hexahedron– Definition: ordered list of 8 points

• six quadrilateral faces, 12 edges, 8 vertices• constraint: edges and faces must not intersect

• Voxel– “Volume pixel”– Topologically equivalent to Hexahedron– constraint: each face is perpendicular to a

coordinate axis– “3D pixels”– Don’t deal with, but foundation of much

Page 19: VTK: Data Shroeder et al. Chapter 5 University of Texas – Pan American CSCI 6361, Spring 2014 After Taku Komura and other lecture sets

Example: Hexahedron Cell

• In fact each cell type represented by set/list of points– From computer graphics, “vertex list”, etc.– Definition: ordered list of 8 points

• six quadrilateral faces, 12 edges, 8 vertices• constraint: edges and faces must not intersect

Page 20: VTK: Data Shroeder et al. Chapter 5 University of Texas – Pan American CSCI 6361, Spring 2014 After Taku Komura and other lecture sets

Example Applications & Cell Types

• Lines– Segmentation of tissues from

images

• Pixels– images, regular height map

data

• Quadrilaterals– Finite element analysis

• Voxels : “3D pixels”– volume data : medical

scanners

Page 21: VTK: Data Shroeder et al. Chapter 5 University of Texas – Pan American CSCI 6361, Spring 2014 After Taku Komura and other lecture sets

Attribute DataDetails and examples

• Information associated with data topology

– usually associated to points or cells

• Examples :– temperature, wind speed, humidity, rain fall

(meteorology)– heat flux, stress, vibration (engineering)– surface normal, color (computer graphics)

• Usually categorized into specific types:

– scalar (1D)– vector (commonly 2D or 3D; ND in RN)– tensor (N dimensional array)

Page 22: VTK: Data Shroeder et al. Chapter 5 University of Texas – Pan American CSCI 6361, Spring 2014 After Taku Komura and other lecture sets

Attribute Data : Scalar

• Single valued data at each location– simplest and most common form of visualisation data

Page 23: VTK: Data Shroeder et al. Chapter 5 University of Texas – Pan American CSCI 6361, Spring 2014 After Taku Komura and other lecture sets

Attribute Data: Vector Data

• Magnitude and direction at each location– 3D triplet of values (i, j, k)– Also Normals – vectors of unit length (magnitude = 1)

Page 24: VTK: Data Shroeder et al. Chapter 5 University of Texas – Pan American CSCI 6361, Spring 2014 After Taku Komura and other lecture sets

Dataset TypesOverview + detail

• Defined by structure type: regular or irregular

• If there is a mathematical relationship between the point and cell positions it is regular

– if the points are regular, the geometry is regular– if the cells are regular, the topology is regular

• Regular data can be implicitly represented– saves storage and computation (e.g. grid based representation)

• Datasets with implicit topology– Structured points (regular grid)– Rectilinear grid– Structured grid

• Datasets without implicit topology– Unstructured grid (has topology)– Polygonal data (might have topology)– Unstructured points (does not have topology)

Page 25: VTK: Data Shroeder et al. Chapter 5 University of Texas – Pan American CSCI 6361, Spring 2014 After Taku Komura and other lecture sets

Regular: Structured Points & Rectilinear Grid

• Structured points– Points & cells arranged in a regular

grid• axis aligned grid• for line elements (1D), pixels (2D)

or voxels (3D)• e.g. images (2D), medical scanners

(3D)• regular topology and geometry

– uniform, equally spaced, axis aligned cells

• Rectilinear Grid– Points and cells arranged in a

regular grid• topology is regular• geometry is partially regular• points are arranged along the axes

but the spacing may vary• e.g. log-scale

Page 26: VTK: Data Shroeder et al. Chapter 5 University of Texas – Pan American CSCI 6361, Spring 2014 After Taku Komura and other lecture sets

Example: Global Climate Model

• How well does rectilinear grid using regular latitude-longitude grid represent earth?

Page 27: VTK: Data Shroeder et al. Chapter 5 University of Texas – Pan American CSCI 6361, Spring 2014 After Taku Komura and other lecture sets

Example: But, Earth is a Sphere

• Problem: as approach pole, cell size gets smaller!

Page 28: VTK: Data Shroeder et al. Chapter 5 University of Texas – Pan American CSCI 6361, Spring 2014 After Taku Komura and other lecture sets

Semi-Regular : Structured Grid

• Regular topology

• Irregular geometry (completely)

• Surface triangulations are structured grids– common topology

• = triangles

• Not all polygon surfaces have regular topology

Page 29: VTK: Data Shroeder et al. Chapter 5 University of Texas – Pan American CSCI 6361, Spring 2014 After Taku Komura and other lecture sets

Irregular: Unstructured Points and Grids

• Unstructured Points– Points irregularly located in space– No topology– No structured geometry

• e.g. sparse measurements of temperature etc.– Difficult to visualize

• e.g., unstructured point clouds• Can be from 3D scanners

– Need surface reconstruction from unstructured points clouds

• topology recovery

• Unstructured Grid– Both topology and geometry unstructured

• can range from 0D to 3D topologies• general, flexible, inefficient to store• e.g. finite element analysis

– Using higher resolution grids near where precise simulation is needed,rough grids for regions less important

– Same verticies might be both a structured (implicit topology) and unstructured grid

Page 30: VTK: Data Shroeder et al. Chapter 5 University of Texas – Pan American CSCI 6361, Spring 2014 After Taku Komura and other lecture sets

Polygonal Data - Rendering

• Essential representation for visualization (and computer graphics)

• Consists of points, lines, polygons – graphics primitives

– irregular geometry– irregular topology– Usually irregular (modelled by

humans, or sticking regular data together)

– used for rendering

Page 31: VTK: Data Shroeder et al. Chapter 5 University of Texas – Pan American CSCI 6361, Spring 2014 After Taku Komura and other lecture sets

End

• .