VTK: The Visualiza.on Toolkit Part II: Visualiza.on Model - - PowerPoint PPT Presentation
VTK: The Visualiza.on Toolkit Part II: Visualiza.on Model - - PowerPoint PPT Presentation
VTK: The Visualiza.on Toolkit Part II: Visualiza.on Model Han-Wei Shen The Ohio State University VTK Visualiza.on Model Graphics and Visualiza.on
VTK ¡Visualiza.on ¡Model ¡
- Graphics ¡and ¡Visualiza.on ¡Model ¡
– Graphics ¡model: ¡rendering ¡ – Visualiza.on ¡model: ¡transforma.on ¡and ¡ representa.on ¡ ¡
Data source Visualization Graphics
Data Flow System: Pipeline execution
The ¡Role ¡of ¡Visualiza.on ¡Model ¡
- ¡Conver.ng ¡data ¡from ¡its ¡original ¡form ¡into ¡graphical ¡form ¡ ¡
- ¡Deal ¡with ¡the ¡issues ¡of ¡transforma)on ¡and ¡representa)on ¡
- ¡Representa.on: ¡internal ¡data ¡structures ¡ ¡
- ¡Transforma.on: ¡data ¡to ¡graphics ¡ ¡
¡ ¡Example: ¡stock ¡price ¡display ¡ ¡
Internal ¡(computa.onal) ¡representa.on: ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡Arrays ¡of ¡stock ¡prices ¡
Price[i] ¡= ¡17100, ¡16950, ¡17073, ¡17050,… ¡ ¡ Time[i] ¡= ¡10, ¡10:30, ¡11, ¡11:30, ¡12, ¡… ¡ ¡
Graphical ¡Representa.on: ¡ ¡x-‑y ¡plot ¡ ¡
3D ¡Plot ¡Example ¡ ¡
Quadric function:
f(x,y,z) = a0 x + a1 y + a2 z + a3 xy + a4 yz + a5 xz + a6 x2 + a7 y2 + a8 z2
3D ¡Plot ¡Example ¡ ¡
Quadric function:
- Evaluate ¡the ¡func.on ¡at ¡a ¡
pre-‑determined ¡x,y,z ¡ samples ¡
f(x,y,z) = a0 x + a1 y + a2 z + a3 xy + a4 yz + a5 xz + a6 x2 + a7 y2 + a8 z2
3D ¡Plot ¡Example ¡ ¡
Quadric function:
- Evaluate ¡the ¡func.on ¡at ¡a ¡
pre-‑determined ¡x,y,z ¡ samples ¡
- Store ¡the ¡func.on ¡values ¡
into ¡a ¡3D ¡array ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡
f(x,y,z) = a0 x + a1 y + a2 z + a3 xy + a4 yz + a5 xz + a6 x2 + a7 y2 + a8 z2 X ¡ Y ¡ Z ¡ f ¡ 0 ¡ 0 ¡ 0 ¡ 1 ¡ 0 ¡ 0 ¡ 2 ¡ 0 ¡ 0 ¡ … ¡ … ¡ … ¡
3D ¡Plot ¡Example ¡ ¡
Quadric function:
- Evaluate ¡the ¡func.on ¡at ¡a ¡
pre-‑determined ¡x,y,z ¡ samples ¡
- Store ¡the ¡func.on ¡values ¡
into ¡a ¡3D ¡array ¡ ¡ ¡
- Generate ¡a ¡3D ¡surface ¡
corresponding ¡to ¡f(x,y,z) ¡= ¡c ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡(this ¡is ¡called ¡an ¡isosurface) ¡ ¡
f(x,y,z) = a0 x + a1 y + a2 z + a3 xy + a4 yz + a5 xz + a6 x2 + a7 y2 + a8 z2
Find all (x,y,z) f(x,y,z) = c
X ¡ Y ¡ Z ¡ f ¡ 0 ¡ 0 ¡ 0 ¡ 1 ¡ 0 ¡ 0 ¡ 2 ¡ 0 ¡ 0 ¡ … ¡ … ¡ … ¡
3D ¡Plot ¡Example ¡ ¡
Quadric function:
- Evaluate ¡the ¡func.on ¡at ¡a ¡
pre-‑determined ¡x,y,z ¡ samples ¡
- Store ¡the ¡func.on ¡values ¡
into ¡a ¡3D ¡array ¡ ¡ ¡
- Generate ¡a ¡3D ¡surface ¡
corresponding ¡to ¡f(x,y,z) ¡= ¡c ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡(this ¡is ¡called ¡an ¡isosurface) ¡ ¡
- Display ¡the ¡surface ¡
f(x,y,z) = a0 x + a1 y + a2 z + a3 xy + a4 yz + a5 xz + a6 x2 + a7 y2 + a8 z2
Transformation (visualization)
Find all (x,y,z) f(x,y,z) = c
F[x][y][z] = f(x,y,z) X ¡ Y ¡ Z ¡ f ¡ 0 ¡ 0 ¡ 0 ¡ 1 ¡ 0 ¡ 0 ¡ 2 ¡ 0 ¡ 0 ¡ … ¡ … ¡ … ¡
VTK ¡Visualiza.on ¡Model ¡
- Func.on ¡model: ¡Transforma.on ¡
– steps ¡to ¡create ¡visualiza.on ¡(how ¡ ¡data ¡flow ¡through ¡ the ¡system) ¡
- Object ¡model: ¡objects ¡that ¡par.cipate ¡in ¡the ¡func.on ¡
model ¡ ¡ – processes ¡and ¡internal ¡data ¡structures ¡
How ¡is ¡a ¡visualiza.on ¡process ¡described ¡in ¡VTK? ¡
Visualiza.on ¡pipeline: ¡ ¡It ¡describes ¡the ¡flow ¡of ¡data ¡from ¡its ¡
- riginal ¡form ¡to ¡the ¡final ¡image ¡output ¡ ¡
Visualiza.on ¡Pipeline ¡= ¡ ¡ ¡ ¡Func.on ¡Model ¡+ ¡Object ¡Model ¡ ¡
VTK ¡Func.on ¡Model ¡ ¡
Sample F(x,y,z)
Point Array
Extract Surface
Polygon
Display
- ¡Func.on ¡model ¡is ¡to ¡Illustrate ¡
the ¡steps ¡to ¡create ¡visualiza.on ¡
: process : data : data flow direction
VTK ¡Object ¡Model ¡
Describe ¡the ¡objects ¡that ¡par.cipate ¡in ¡the ¡func.on ¡ model ¡(visualiza.on ¡pipeline) ¡
VTK ¡Object ¡Model ¡
Describe ¡the ¡objects ¡that ¡par.cipate ¡in ¡the ¡func.onal ¡ model ¡(visualiza.on ¡pipeline) ¡
- Process ¡Object: ¡Operates ¡on ¡(transform) ¡the ¡data ¡objects ¡
¡ ¡ ¡ ¡ ¡-‑ ¡Example: ¡genera.ng ¡surfaces ¡from ¡F(x,y,z) ¡ ¡
VTK ¡Object ¡Model ¡
Describe ¡which ¡objects ¡operate ¡on ¡the ¡func.onal ¡ model ¡(visualiza.on ¡pipeline) ¡
- Process ¡Object: ¡Operates ¡on ¡(transform) ¡the ¡data ¡objects ¡
¡ ¡ ¡ ¡ ¡-‑ ¡Example: ¡genera.ng ¡surfaces ¡from ¡F(x,y,z) ¡ ¡
- ¡Data ¡Object: ¡Represent ¡informa)on ¡and ¡methods ¡to ¡create, ¡
access, ¡and ¡delete ¡the ¡informa.on ¡ ¡ ¡ ¡ ¡ ¡-‑ ¡Example: ¡the ¡3D ¡point ¡array ¡F(x,y,z) ¡ ¡
Visualization model
Process ¡Objects ¡
- Source: ¡ ¡Interface ¡to ¡external ¡data ¡sources ¡
¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡or ¡generate ¡data ¡procedurally ¡
Graphics model Filter Mapper Actor Renderer Source
Visualization model
Process ¡Objects ¡
- Source: ¡ ¡Interface ¡to ¡external ¡data ¡sources ¡
¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡or ¡generate ¡data ¡procedurally ¡
- ¡ ¡Filter: ¡ ¡ ¡ ¡ ¡Transform ¡the ¡data ¡input ¡ ¡
Graphics model Filter Mapper Actor Renderer Source
Visualization model
Process ¡Objects ¡
- Source: ¡ ¡Interface ¡to ¡external ¡data ¡sources ¡
¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡or ¡generate ¡data ¡procedurally ¡
- ¡ ¡Filter: ¡ ¡ ¡ ¡ ¡Transform ¡the ¡data ¡input ¡ ¡
- ¡ ¡Mapper: ¡ ¡The ¡sink ¡of ¡the ¡func.onal ¡model, ¡ ¡
¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡interface ¡with ¡the ¡graphics ¡model ¡
Graphics model Filter Actor Renderer Source Mapper
Process ¡Objects ¡(cont’d) ¡
Sample F(x,y,z) Extract Surface Display
Point Array Polygon
Source Filter Mapper + Graphics Model
Objects
Data ¡Objects ¡
Data ¡Object: ¡Dataset ¡ ¡
- ¡ ¡Structures: ¡how ¡the ¡informa.on ¡is ¡organized ¡
- ‑ ¡Topology ¡
- ‑ ¡Geometry ¡ ¡
- ¡ ¡Aeributes: ¡store ¡the ¡informa.on ¡we ¡want ¡ ¡
¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡to ¡visualize. ¡ ¡e.g. ¡func.on ¡values ¡
Data ¡Objects: ¡structures ¡
- Topology: ¡ ¡
- ‑ ¡Invariant ¡under ¡geometric ¡transforma.on ¡ ¡
¡(rota.on, ¡transla.on, ¡scaling ¡etc) ¡
- ‑ ¡Topological ¡structures: ¡Cells ¡ ¡
- ¡Geometry: ¡ ¡
- ‑ ¡The ¡instan.a.on ¡of ¡the ¡topology ¡
- ‑ ¡Geometric ¡ ¡structures: ¡cells ¡with ¡ ¡
¡ ¡ ¡ ¡ ¡ ¡posi.ons ¡in ¡3D ¡space ¡ ¡
¡VTK ¡Cell ¡Types ¡
(a) vertex (b) Polyvertex (c) line (d) polyline (e) triangle (e) Quadrilateral (e) Polygon (f) Tetrahedron (f) Hexahedron
And more
VTK ¡Data ¡Aeributes ¡
- The ¡informa.on ¡stored ¡at ¡each ¡corner ¡of ¡the ¡
cell ¡
– Scalars: ¡temperature, ¡pressure, ¡etc ¡ – Vector: ¡velocitys ¡ – Normals: ¡surface ¡direc.ons ¡ – Texture ¡coordinates: ¡graphics ¡specific ¡ – Tensors: ¡matrices ¡ ¡
VTK ¡Datasets ¡
A Collection of structures and attributes
Structured Grid Rectilinear Grid Unstructured Points Structured Grid Polygonal Grid Unstructured Grid
Pipeline ¡Connec.ons ¡ ¡
- Type-‑Checking: ¡the ¡type ¡of ¡input ¡data ¡and ¡the ¡
expected ¡input ¡to ¡a ¡filter ¡should ¡match, ¡which ¡can ¡be ¡ checked ¡at ¡compile, ¡link, ¡or ¡run ¡.me ¡ ¡
- ¡Mul.plicity: ¡a ¡filter ¡can ¡have ¡one ¡or ¡mul.ple ¡output, ¡
and ¡each ¡output ¡can ¡have ¡mul.ple ¡fan-‑out, ¡that ¡is, ¡ ¡ connected ¡to ¡one ¡or ¡mul.ple ¡downstream ¡processes ¡ ¡
Filter Data Filter Data Data Filter Data Data
Pipeline ¡Execu.on ¡ ¡
- A ¡visualiza.on ¡pipeline ¡is ¡ohen ¡executed ¡mul.ple ¡
.mes, ¡when ¡the ¡algorithm ¡parameters ¡are ¡changed ¡ for ¡example. ¡ ¡
- How ¡a ¡visualiza.on ¡pipeline ¡is ¡executed ¡is ¡very ¡much ¡
related ¡to ¡the ¡performance ¡ ¡
- A ¡process ¡object ¡should ¡re-‑execute ¡only ¡if ¡changes ¡
- ccur ¡to ¡its ¡input ¡
– Demand-‑driven ¡approach: ¡when ¡the ¡output ¡of ¡the ¡process ¡ is ¡needed ¡ ¡ – Event-‑driven ¡approach: ¡when ¡changes ¡to ¡the ¡process ¡or ¡to ¡ the ¡input ¡data ¡
Pipeline ¡Synchroniza.on ¡ ¡
- Pipeline ¡synchroniza.on ¡– ¡synchroniza.on ¡is ¡
needed ¡between ¡the ¡processes ¡in ¡the ¡ visualiza.on ¡pipeline ¡ ¡
– Explicit ¡execu.on: ¡a ¡centralized ¡execu.ve ¡is ¡used ¡to ¡ track ¡changes ¡and ¡coordinate ¡network ¡execu.on ¡ ¡ – Implicit ¡execu.on: ¡
- ¡each ¡process ¡propagate ¡the ¡execu.on ¡request ¡to ¡its ¡
upstream ¡processes, ¡un.l ¡the ¡request ¡reaches ¡the ¡source ¡of ¡ the ¡pipeline ¡
- The ¡source ¡process ¡then ¡examine ¡its ¡input ¡and ¡output ¡to ¡
decide ¡whether ¡it ¡should ¡execute ¡ ¡
- Then ¡recursively ¡push ¡the ¡command ¡for ¡checking ¡down ¡to ¡
the ¡pipeline ¡ ¡
VTK uses this