yingcai xiao
DESCRIPTION
Chapter 5 Basic Data Representation. Yingcai Xiao. Characteristics of Data. Discrete Interpolation P1, P2 Regular/Irregular Data Dimensions. Data Structure Design Criterion. Compact (save space) Efficient (fast retrieval) Map- able (easy to convert) - PowerPoint PPT PresentationTRANSCRIPT
![Page 1: Yingcai Xiao](https://reader036.vdocuments.us/reader036/viewer/2022062314/56813fc1550346895daaa11a/html5/thumbnails/1.jpg)
Yingcai Xiao
Chapter 5
Basic Data Representation
![Page 2: Yingcai Xiao](https://reader036.vdocuments.us/reader036/viewer/2022062314/56813fc1550346895daaa11a/html5/thumbnails/2.jpg)
Characteristics of Data
• DiscreteInterpolation
P1, P2• Regular/Irregular• Data Dimensions
![Page 3: Yingcai Xiao](https://reader036.vdocuments.us/reader036/viewer/2022062314/56813fc1550346895daaa11a/html5/thumbnails/3.jpg)
Data Structure Data Structure Design Criterion
• Compact (save space)
• Efficient (fast retrieval)
• Map-able (easy to convert)
• Minimal Coverage (small foot prints)
• Simple (easy to use)
![Page 4: Yingcai Xiao](https://reader036.vdocuments.us/reader036/viewer/2022062314/56813fc1550346895daaa11a/html5/thumbnails/4.jpg)
DatasetDataset
• Data objects in the visualization pipeline are called datasets
• consisting of two pieces: an organizing structure and supplemental data attributes.
![Page 5: Yingcai Xiao](https://reader036.vdocuments.us/reader036/viewer/2022062314/56813fc1550346895daaa11a/html5/thumbnails/5.jpg)
DatasetDataset
Structure: topology and geometry•Topology: is the set of properties invariant under certain geometric transformations.•Geometry: is the instantiation of the topology; the specification of positions in a 3D space.•VTK Model: the structure consists of cells and points. The cells specify the topology; while the points specify the geometry
![Page 6: Yingcai Xiao](https://reader036.vdocuments.us/reader036/viewer/2022062314/56813fc1550346895daaa11a/html5/thumbnails/6.jpg)
DatasetDataset
Dataset Attribute:•Data to be visualized. •Associated with each point.•Typical attributes: scalars, vectors, normals, texture coordinates, tensors, and user-defined data.
![Page 7: Yingcai Xiao](https://reader036.vdocuments.us/reader036/viewer/2022062314/56813fc1550346895daaa11a/html5/thumbnails/7.jpg)
Cell TypesCell Types
• A data set consists of one or more cells• A cell is defined by a “type” and an ordered list of
point• Type: topology, cell type• Ordered list: geometry, points• Together: organizational structure• Use Set: all the cells using a point:
U(pi) = {Ci: pi Ci}
• A data set consists of one or more cells• A cell is defined by a “type” and an ordered list of
point• Type: topology, cell type• Ordered list: geometry, points• Together: organizational structure• Use Set: all the cells using a point:
U(pi) = {Ci: pi Ci}
![Page 8: Yingcai Xiao](https://reader036.vdocuments.us/reader036/viewer/2022062314/56813fc1550346895daaa11a/html5/thumbnails/8.jpg)
Cell TypesCell Types
Vertex: zero-dimensional cell, It is defined by a single point. vtkVertexLine: one dimensional cell. It is defined by two points. vtkLinePolyline: is a composite one-dimensional cell consisting of n connected lines. It is defined by an ordered list of n+1 points. vtkPolyLineTriangle: is a primary two-dimensional cell. The triangle is defined by a counter-clockwise ordered list of three points. vtkTrianglePolygon: is a primary two-dimensional cell. The polygon is defined by an ordered list of three or more points lying in a planeTetrahedron: is a primary three-dimensional cell. It is defined by a list of four nonplanar point. VtkTetrahedron
Vertex: zero-dimensional cell, It is defined by a single point. vtkVertexLine: one dimensional cell. It is defined by two points. vtkLinePolyline: is a composite one-dimensional cell consisting of n connected lines. It is defined by an ordered list of n+1 points. vtkPolyLineTriangle: is a primary two-dimensional cell. The triangle is defined by a counter-clockwise ordered list of three points. vtkTrianglePolygon: is a primary two-dimensional cell. The polygon is defined by an ordered list of three or more points lying in a planeTetrahedron: is a primary three-dimensional cell. It is defined by a list of four nonplanar point. VtkTetrahedron
![Page 9: Yingcai Xiao](https://reader036.vdocuments.us/reader036/viewer/2022062314/56813fc1550346895daaa11a/html5/thumbnails/9.jpg)
Attribute Data
Attribute data is information associated with the structure of the dataset. It is what to be visualized.
Dataset Attribute Model
Scalars Vectors Normals Texture Coordinates Tensors (The rank of a tensor is the dimension of the matrix
containing its values.) User-defined
![Page 10: Yingcai Xiao](https://reader036.vdocuments.us/reader036/viewer/2022062314/56813fc1550346895daaa11a/html5/thumbnails/10.jpg)
Type of Datasets
Dependent on topology of the dataset.
Uniform Grid (uniform in each direction, vtkImageData)
Parameters:
Dimension: nx, ny, nz
Origin: x0, y0, z0
Spacing: dx, dy, dz
![Page 11: Yingcai Xiao](https://reader036.vdocuments.us/reader036/viewer/2022062314/56813fc1550346895daaa11a/html5/thumbnails/11.jpg)
Type of Datasets: Uniform Grid Uniform Grid
IJK space
x = i*dx + x0
y = j*dy + y0
z = k*dz + z0
Data array (i, j, k), loop i first, then j, k last.
Simple, compact and speedy retrieval.
Not flexible
Represented by vtkImageData in VTK.
Example: Fig. 5-18.
![Page 12: Yingcai Xiao](https://reader036.vdocuments.us/reader036/viewer/2022062314/56813fc1550346895daaa11a/html5/thumbnails/12.jpg)
Rectlinear Grid
Dimension: nx, ny, nz
Nonuniform spacing, but straight grid lines.
float x[44]={0.0,1.2,2.8,3.9…….}
float y[33]={1.0,……………}
float z[22]={0.8,……………}
![Page 13: Yingcai Xiao](https://reader036.vdocuments.us/reader036/viewer/2022062314/56813fc1550346895daaa11a/html5/thumbnails/13.jpg)
Rectlinear Grid
IJK space.
x = x[I]; y = y[J]; z = z[K]; Data array (i, j, k), i changes first, then j, k last.
Simple
compact (takes O(nx + ny + nz) more space)
speedy retrieval
Little more flexible
![Page 14: Yingcai Xiao](https://reader036.vdocuments.us/reader036/viewer/2022062314/56813fc1550346895daaa11a/html5/thumbnails/14.jpg)
Rectlinear Grid (Example Code)
vtkFloatArray * xCoords=vtkFloatArray::New();
for(i=0;i<44;i++) xCoords-> InsertNextValue(x[i])
vtkFloatArray * yCoords=vtkFloatArray::New();
for(i=0;i<33;i++) yCoords-> InsertNextValue(y[i])
vtkFloatArray * zCoords=vtkFloatArray::New();
for(i=0;i<22;i++) zCoords-> InsertNextValue(z[i])
vtkRectiLinearGrid * rgrid=vtkRectiLinearGrid::New();
rgridsetXCoordinates(xCoords); rgridsetYCoordinates(yCoords);
rgridsetZCoordinates(zCoords);
rgridSetDimensions(44,33,22);
![Page 15: Yingcai Xiao](https://reader036.vdocuments.us/reader036/viewer/2022062314/56813fc1550346895daaa11a/html5/thumbnails/15.jpg)
Structured Grid
Dimension: nx, ny, nz
Nonuniform spacing
IJK space (no formula)
Coordinates of each grid node need to be given.
x(I,J,K), y(I,J,K), z(I,J,K)
![Page 16: Yingcai Xiao](https://reader036.vdocuments.us/reader036/viewer/2022062314/56813fc1550346895daaa11a/html5/thumbnails/16.jpg)
Data Set:
Internal Memory Structurein
Generic Form
![Page 17: Yingcai Xiao](https://reader036.vdocuments.us/reader036/viewer/2022062314/56813fc1550346895daaa11a/html5/thumbnails/17.jpg)
Unstructured Grid
• No dimensions parameters: nx, ny, nz
• No IJK space
• Coordinates of each node need to be given
• Most flexible, can represent any structures of data
• Not compact (need space to save xyz values and cell information)
• Slow retrieval
![Page 18: Yingcai Xiao](https://reader036.vdocuments.us/reader036/viewer/2022062314/56813fc1550346895daaa11a/html5/thumbnails/18.jpg)
Data SetInternal MemoryStructure
![Page 19: Yingcai Xiao](https://reader036.vdocuments.us/reader036/viewer/2022062314/56813fc1550346895daaa11a/html5/thumbnails/19.jpg)
Unstructured Surface
Polygonal Surface (PolyData)
No dimensions parameters: nx, ny, nz
No IJK space
Coordinates of each node need to be given
Data value(s) on each node needs to be given
![Page 20: Yingcai Xiao](https://reader036.vdocuments.us/reader036/viewer/2022062314/56813fc1550346895daaa11a/html5/thumbnails/20.jpg)
Structure Representation
P1 of T1 and P2 of T2 are connected at P(1,0,0)
![Page 21: Yingcai Xiao](https://reader036.vdocuments.us/reader036/viewer/2022062314/56813fc1550346895daaa11a/html5/thumbnails/21.jpg)
Structure RepresentationThe Wrong Way: Making Copies
class Tri { public: point P1, P2, P3; };
T2.P2.x=1.0;
T2.P2.y=0.0;
T2.P2.z=0.0;
………
Tri T1, T2;
T1.P1.x=1.0;
T1.P1.y=0.0;
T1.P1.z=0.0;
…….
![Page 22: Yingcai Xiao](https://reader036.vdocuments.us/reader036/viewer/2022062314/56813fc1550346895daaa11a/html5/thumbnails/22.jpg)
Structure Representation: Wrong WayEach triangle keeps a copy of the vertex values.
Drawback: if the coordinate of P is changed, all cells having a copy of its value need to be updated.
![Page 23: Yingcai Xiao](https://reader036.vdocuments.us/reader036/viewer/2022062314/56813fc1550346895daaa11a/html5/thumbnails/23.jpg)
Structure Representation: Correct Way
Save the vertex values in an array (Point List).
Store the indexes of the vertexes for each triangle in the triangle definition
![Page 24: Yingcai Xiao](https://reader036.vdocuments.us/reader036/viewer/2022062314/56813fc1550346895daaa11a/html5/thumbnails/24.jpg)
Structure RepresentationThe Correct Way: Indexing
Point List
P0.x=0.0;
P0.y=0.0;
P0.z=0.0;
P1.x=1.0;
P1.y=0.0;
P1.z=0.0;
P2.x=1.0;
P2.y=1.0;
P2.z=0.0;
P3.x=0.0;
P3.y=1.0;
P3.z=0.0;
![Page 25: Yingcai Xiao](https://reader036.vdocuments.us/reader036/viewer/2022062314/56813fc1550346895daaa11a/html5/thumbnails/25.jpg)
Structure RepresentationThe Correct Way: Indexing
class Tri{ public: int ID1, ID2, ID3; };
Tri T1, T2;
T1.ID1=0;
T1.ID2=1;
T1.ID3=3;
T2.ID1=1;
T2.ID2=2;
T2.ID3=3;
![Page 26: Yingcai Xiao](https://reader036.vdocuments.us/reader036/viewer/2022062314/56813fc1550346895daaa11a/html5/thumbnails/26.jpg)
Structure Representation: The Correct Way: IndexingEach triangle keeps an index list (cell list) of its vertexes.
If the coordinate of P is changed, none of the cells using it needs to be changed. Only the one copy of its value in the point list needs to be updated.
![Page 27: Yingcai Xiao](https://reader036.vdocuments.us/reader036/viewer/2022062314/56813fc1550346895daaa11a/html5/thumbnails/27.jpg)
DatasetDataset
Structure: topology and geometry•Topology: is the set of properties invariant under certain geometric transformations.•Geometry: is the instantiation of the topology; the specification of positions in a 3D space.•VTK Model: the structure consists of cells and points. The cells specify the topology; while the points specify the geometry
![Page 28: Yingcai Xiao](https://reader036.vdocuments.us/reader036/viewer/2022062314/56813fc1550346895daaa11a/html5/thumbnails/28.jpg)
Data SetInternal MemoryStructure
![Page 29: Yingcai Xiao](https://reader036.vdocuments.us/reader036/viewer/2022062314/56813fc1550346895daaa11a/html5/thumbnails/29.jpg)
Summary of VTK Data StructuresSummary of VTK Data Structures