Presentation is loading. Please wait.

Presentation is loading. Please wait.

ITUppsala universitet Data representation and fundamental algorithms Filip Malmberg

Similar presentations


Presentation on theme: "ITUppsala universitet Data representation and fundamental algorithms Filip Malmberg"— Presentation transcript:

1 ITUppsala universitet Data representation and fundamental algorithms Filip Malmberg filip @cb.uu.se

2 UU/IT 08-01-29 | #2@ UU/IT Data representation  Data is discrete, i.e., we only know the data at a finite set of locations.  Interpolation is used to find data values between sampled points.

3 UU/IT 08-01-29 | #3@ UU/IT Data representation Data consists of  structure (regular or irregular)  geometry (Sample locations)‏  attributes (Data at sample locations)‏

4 UU/IT 08-01-29 | #4@ UU/IT Uniform grid Regular structure Regular geometry

5 UU/IT 08-01-29 | #5@ UU/IT Image data

6 UU/IT 08-01-29 | #6@ UU/IT Multi-dimensional images  A multi-dimensional image can be considered as a function f(x,y,z,t,b), where z: third spatial direction t: time sequence b: spectral bands  Different combinations, for example f(x,y,z,t) is a 4D image representing a time sequence of volume images

7 UU/IT 08-01-29 | #7@ UU/IT Volume images  There are several different tomographic devices: Computed Tomography (CT)‏ Magnetic Resonance Imaging (MRI)‏ Positron Emission Tomography (PET)‏ and others

8 UU/IT 08-01-29 | #8@ UU/IT Computed tomography  CT produces anatomical images (attenuation maps)‏  Low contrast in soft tissue  Bone is visible  High resolution

9 UU/IT 08-01-29 | #9@ UU/IT Magnetic Resonance Imaging  MRI produces anatomical images  Very good contrast in soft tissue

10 UU/IT 08-01-29 | #10@ UU/IT Positron Emission Tomography  PET shows the concentration of a positron emitting tracer given to patient  Functional images (show physiological parameters)  Low resolution

11 UU/IT 08-01-29 | #11@ UU/IT Rectilinear grid Regular structure “Partially” regular geometry

12 UU/IT 08-01-29 | #12@ UU/IT Structured grid Regular structure Irregular geometry

13 UU/IT 08-01-29 | #13@ UU/IT Unstructured points Irregular geometry No structure

14 UU/IT 08-01-29 | #14@ UU/IT Unstructured grid The most general form of a dataset A collection of vertices, edges, faces, any cell type Connectivity information must be explicitly stored

15 UU/IT 08-01-29 | #15@ UU/IT Example: Polygon mesh

16 UU/IT 08-01-29 | #16@ UU/IT How are unstructured meshes different than regular grids? Regular Grids  mesh info accessed implicitly using grid point indices  efficient in both computation and storage  typically use finite difference (FD) discretization  Cartesian grids or logically rectangular grids

17 UU/IT 08-01-29 | #17@ UU/IT How are unstructured meshes different than regular grids? Unstructured Meshes mesh connectivity information must be stored handles complex geometries and grid adaptivity typically use finite volume or finite element (FE) discretization mesh quality becomes a concern

18 UU/IT 08-01-29 | #18@ UU/IT Data attributes  Scalar  Vector magnitude and direction  Normal a vector of magnitude 1 used for lighting  Texture coordinate mapping data points into a texture space  Tensor

19 UU/IT 08-01-29 | #19@ UU/IT Operations on datasets Geometric transformations Topological transformations Attribute transformations Combined transformations

20 UU/IT 08-01-29 | #20@ UU/IT Scalar algorithms: Color mapping  Colour mapping is a common scalar visualization technique that maps scalar data to colours  The scalar values serve as indices into a colour lookup table  Or mapping through a transfer function

21 UU/IT 08-01-29 | #21@ UU/IT Colour mapping

22 UU/IT 08-01-29 | #22@ UU/IT Scalar algorithms: Isocontour/Isosurface Extractions 2D isocontours 3D isosurface

23 UU/IT 08-01-29 | #23@ UU/IT Surface rendering of volume data  The data must be converted to an intermediate surface description using geometric primitives

24 UU/IT 08-01-29 | #24@ UU/IT Surface versus Volume rendering  Surface Rendering We assume that data to be visualized can be modelled by surfaces. Normally, we model the object with geometric primitives such as points, lines, triangles or polygons and use standard Computer Graphics techniques to render the data  Volume Rendering operates on the data itself and takes into account the changing properties inside the object

25 UU/IT 08-01-29 | #25@ UU/IT Surface reconstruction from volumes  The by far most popular method is the Marching Cubes algorithm (MC) (Lorensen et al., SIGGRAPH 1987)‏  MC uses the grey-scale information in the data to build triangulated surfaces  MC works by looking at each element of the volume dataset one at a time to decide whether its vertices are inside or outside the isosurface  This decision is made by comparing the values at the vertices of the volume elements with the value which has been defined as the surface value  If the surface passes through the volume element, the approximate position of the isosurface intersection is calculated, normally using trilinear interpolation

26 UU/IT 08-01-29 | #26@ UU/IT Isocontour vs interpolation Remember bi-linear interpolation? p2 p3 p0 p1 P = ? p4 p5 To know the value of P, we can first compute p4 and p5 and then linearly interpolate P The problem of extracting an isocontour is the inverse of value interpolation

27 UU/IT 08-01-29 | #27@ UU/IT Isocontour, cont’d p2 p3 p0 p1 (2) Calculate the positions of P (3) Connect the points with lines We can solve the problem based on linear interpolation (1) Identify edges that contain points P with value C, i.e., if pi < C < pj

28 UU/IT 08-01-29 | #28@ UU/IT In how many ways can a contour intersect a 2D cell? Two contours pass through the cell In fact, there are only 4 unique topological cases Contour completely outside cell One vertex inside, three vertices outside (or vice versa)‏ Two vertices inside, two vertices outside

29 UU/IT 08-01-29 | #29@ UU/IT Marching Squares 4 pixels in a 2 x 2 neighbourhood 8 of 16 possible configurations

30 UU/IT 08-01-29 | #30@ UU/IT Divide-and-conquer Algorithm Look at one cell at a time Compare the values at 4 vertices with the isovalue C Linearly interpolate along the edges Connect the interpolated points together

31 UU/IT 08-01-29 | #31@ UU/IT Boundary representations Pixel edges Marching squares

32 UU/IT 08-01-29 | #32@ UU/IT Marching Cubes A marching cube is bounded by the 8 voxels in a 2 x 2 x 2 neighbourhood If object (value=1) and background (value=0) are considered, then there are 28 = 256 possible configurations of the 8 voxels

33 UU/IT 08-01-29 | #33@ UU/IT Conversion of voxel data to triangulated surfaces

34 UU/IT 08-01-29 | #34@ UU/IT MC algorithm Step 1 – Create the cubes using the centres of 8 voxels; four from slice k four from slice k+1 1 3 2 4 5 7 6 8

35 UU/IT 08-01-29 | #35@ UU/IT MC algorithm Step 2 - Classify each vertex of the cube 1 = inside the object 0 = outside the object Step 3 - Build an index The classification gives an 8-bit index number (e.g., 01100111, 00110010) for each cube

36 UU/IT 08-01-29 | #36@ UU/IT Cube example Marching cube configuration 001100102 = 50, Case 5, 3 triangles

37 UU/IT 08-01-29 | #37@ UU/IT MC algorithm Step 4 – Get the edge list For a given index, access a list of cube edges (a lookup table) that contains triangle vertices 1 3 2 4 5 7 6 8 1211 10 9

38 UU/IT 08-01-29 | #38@ UU/IT MC algorithm Step 5 - Interpolate the triangle vertices For the cube edges, find the intersection points using (linear) interpolation of the density values The midpoint of the cube edge may be chosen for the triangle vertex

39 UU/IT 08-01-29 | #39@ UU/IT MC algorithm, final step Step 6 - Calculate a unit normal for each triangle vertex Estimate a gradient vector G at each cube vertex using central differences of the density data D Gx(i,j,k) = D(i+1, j, k) - D(i-1, j, k) ‏ Gy(i,j,k) = D(i, j+1, k) - D(i, j-1, k) ‏ Gz(i,j,k) = D(i, j, k+1) - D(i, j, k-1) ‏ Interpolate the gradient at the intersection, i.e., the triangle vertex Rendering algorithms use the normals to produce, e.g., Gouraud shading

40 UU/IT 08-01-29 | #40@ UU/IT Marching Cubes - Algorithm in summary 1. Create a cube 2. Classify each vertex 3. Build an index 4. Get edge list 5. Interpolate triangle vertices 6. Calculate and interpolate normals

41 UU/IT 08-01-29 | #41@ UU/IT More cube examples Case 1Case 2Case 8

42 UU/IT 08-01-29 | #42@ UU/IT Non-boundary cubes Completely outside object Completely inside object

43 UU/IT 08-01-29 | #43@ UU/IT Tricky configurations Case 6 5 triangles

44 UU/IT 08-01-29 | #44@ UU/IT MC – Pros and cons ? Straightforward to implement Fast to generate Generates many, many triangles Does not always connect things in a correct way (ambiguities)‏ The generated surfaces are not perfectly smooth

45 UU/IT 08-01-29 | #45@ UU/IT MC – Pros and cons

46 UU/IT 08-01-29 | #46@ UU/IT Voxel examples: sphere and cube

47 UU/IT 08-01-29 | #47@ UU/IT MC examples: sphere and cube

48 UU/IT 08-01-29 | #48@ UU/IT Vector algorithms Vector data is a 3D representation of direction and magnitude Like scalar fields, vectors are defined at discrete points

49 UU/IT 08-01-29 | #49@ UU/IT Vector field visualization challenges Displaying a vector requires more visual attributes (u,v,w) has direction and magnitude Displaying a vector requires more screen space more than one pixel is required to display an arrow It becomes more challenging to display a dense vector field

50 UU/IT 08-01-29 | #50@ UU/IT Glyphs A general visualization technique used to represent data using a meaningful shape or pictorial representation Each glyph is generally a function of its input data and may change size, orientation, colour, and shape Example: oriented arrows, cones, etc.

51 UU/IT 08-01-29 | #51@ UU/IT Animated particles Advection of (massless) particles through the vector field

52 UU/IT 08-01-29 | #52@ UU/IT Streamlines Curves that connect particle positions Start from one or more seed-points

53 ITUppsala universitet Data representation and fundamental algorithms Filip Malmberg filip @cb.uu.se


Download ppt "ITUppsala universitet Data representation and fundamental algorithms Filip Malmberg"

Similar presentations


Ads by Google