ESCE 4960: Open Source Software Practice Lecture 8: VTK Pipeline September 24, 2007 Dr. Will...
-
Upload
arianna-mills -
Category
Documents
-
view
219 -
download
5
Transcript of ESCE 4960: Open Source Software Practice Lecture 8: VTK Pipeline September 24, 2007 Dr. Will...
![Page 1: ESCE 4960: Open Source Software Practice Lecture 8: VTK Pipeline September 24, 2007 Dr. Will Schroeder, Kitware.](https://reader034.fdocuments.in/reader034/viewer/2022051819/5513eeda5503463a298b5eff/html5/thumbnails/1.jpg)
ESCE 4960: Open Source Software Practice Lecture 8: VTK Pipeline
September 24, 2007
ESCE 4960: Open Source Software Practice Lecture 8: VTK Pipeline
September 24, 2007
Dr. Will Schroeder, KitwareDr. Will Schroeder, Kitware
![Page 2: ESCE 4960: Open Source Software Practice Lecture 8: VTK Pipeline September 24, 2007 Dr. Will Schroeder, Kitware.](https://reader034.fdocuments.in/reader034/viewer/2022051819/5513eeda5503463a298b5eff/html5/thumbnails/2.jpg)
Open Source Software Practice Lecture 8
Visualization Pipeline Topics
Interpreters Visualization Model Pipeline Mechanics Data Management Start, End, & Progress Events Surface Rendering Volume Rendering
![Page 3: ESCE 4960: Open Source Software Practice Lecture 8: VTK Pipeline September 24, 2007 Dr. Will Schroeder, Kitware.](https://reader034.fdocuments.in/reader034/viewer/2022051819/5513eeda5503463a298b5eff/html5/thumbnails/3.jpg)
Open Source Software Practice Lecture 8
Interpreters
VTK provides automatic wrapping for the following interpreted languages:
Tcl Java Python
Interpreters provide faster turn-around (no compilation) but suffer from slower execution
![Page 4: ESCE 4960: Open Source Software Practice Lecture 8: VTK Pipeline September 24, 2007 Dr. Will Schroeder, Kitware.](https://reader034.fdocuments.in/reader034/viewer/2022051819/5513eeda5503463a298b5eff/html5/thumbnails/4.jpg)
Open Source Software Practice Lecture 8
Tcl Interpreter
To use VTK from Tcl, add the following line to the beginning of your script:
package require vtk
Create an actor in Tcl: vtkActor actor
Invoke a method: actor SetPosition 10 20 30
![Page 5: ESCE 4960: Open Source Software Practice Lecture 8: VTK Pipeline September 24, 2007 Dr. Will Schroeder, Kitware.](https://reader034.fdocuments.in/reader034/viewer/2022051819/5513eeda5503463a298b5eff/html5/thumbnails/5.jpg)
Open Source Software Practice Lecture 8
Tcl Interpreter
A special package provides a Tcl interpreter when the ‘u’ key is pressed in the render window:
package require vtkinteraction
iren AddObserver UserEvent {wm deiconify .vtkInteract}
![Page 6: ESCE 4960: Open Source Software Practice Lecture 8: VTK Pipeline September 24, 2007 Dr. Will Schroeder, Kitware.](https://reader034.fdocuments.in/reader034/viewer/2022051819/5513eeda5503463a298b5eff/html5/thumbnails/6.jpg)
Open Source Software Practice Lecture 8
Tcl Interpreter
vtkActor ListInstances: list all vtkActor objects
vtkActor ListMethods: list all vtkActor methods
anActor Print: print internal state of anActor
vtkCommand DeleteAllObjects: delete all VTK objects
vtkTkRenderWidget: embed a render window in Tk
vtkTkImageViewerWidget: embed an image window in Tk
![Page 7: ESCE 4960: Open Source Software Practice Lecture 8: VTK Pipeline September 24, 2007 Dr. Will Schroeder, Kitware.](https://reader034.fdocuments.in/reader034/viewer/2022051819/5513eeda5503463a298b5eff/html5/thumbnails/7.jpg)
Open Source Software Practice Lecture 8
Exercise 2
Run an example exercise2.tcl Use ‘u’ (user-defined) key to bring up
the interactor interface Try some commands
vtkLODActor ListInstances sphereActor Print sphereActor ListMethods
![Page 8: ESCE 4960: Open Source Software Practice Lecture 8: VTK Pipeline September 24, 2007 Dr. Will Schroeder, Kitware.](https://reader034.fdocuments.in/reader034/viewer/2022051819/5513eeda5503463a298b5eff/html5/thumbnails/8.jpg)
Open Source Software Practice Lecture 8 8
The Visualization PipelineThe Visualization Pipeline
A sequence of algorithms that operate on data objects to generate geometry that can be rendered by the graphics engine or written to a file
A sequence of algorithms that operate on data objects to generate geometry that can be rendered by the graphics engine or written to a file
Data
Filter
Data to graphicssystem
Data
Data Filter Actor
ActorMapper
Mapper
Source
![Page 9: ESCE 4960: Open Source Software Practice Lecture 8: VTK Pipeline September 24, 2007 Dr. Will Schroeder, Kitware.](https://reader034.fdocuments.in/reader034/viewer/2022051819/5513eeda5503463a298b5eff/html5/thumbnails/9.jpg)
Open Source Software Practice Lecture 8
Visualization Model
Data Objects represent data provide access to data compute information particular to data
(e.g., bounding box, derivatives)
Algorithms Ingest, transform, and output data objects
![Page 10: ESCE 4960: Open Source Software Practice Lecture 8: VTK Pipeline September 24, 2007 Dr. Will Schroeder, Kitware.](https://reader034.fdocuments.in/reader034/viewer/2022051819/5513eeda5503463a298b5eff/html5/thumbnails/10.jpg)
Open Source Software Practice Lecture 8
vtkDataObject / vtkDataSet
vtkDataObject represents a “blob” of data contain instance of vtkFieldData an array of arrays no geometric/topological structure Superclass of all VTK data objects
vtkDataSet has geometric/topological structure Consists of geometry (points) and topology (cells) Has associated point- and cell-centered data arrays Convert data object to data set with
vtkDataObjectToDataSetFilter
![Page 11: ESCE 4960: Open Source Software Practice Lecture 8: VTK Pipeline September 24, 2007 Dr. Will Schroeder, Kitware.](https://reader034.fdocuments.in/reader034/viewer/2022051819/5513eeda5503463a298b5eff/html5/thumbnails/11.jpg)
Open Source Software Practice Lecture 8 11
vtkDataObject / vtkDataSetvtkDataObject / vtkDataSet
Geometry& Topology
Point- and cell-centered
arrays
Points& Cells
Point DataCell Data
Array of arrays Field DatavtkDataObject
vtkDataSet
Concept Implementation
![Page 12: ESCE 4960: Open Source Software Practice Lecture 8: VTK Pipeline September 24, 2007 Dr. Will Schroeder, Kitware.](https://reader034.fdocuments.in/reader034/viewer/2022051819/5513eeda5503463a298b5eff/html5/thumbnails/12.jpg)
Open Source Software Practice Lecture 8
Dataset Model
A dataset is a data object with structure
Dataset structure consists of points (x-y-z coordinates) cells (e.g., polygons, lines, voxels) which are
defined by connectivity list referring to points ids Access is via integer ID implicit representations explicit representations
Cell
Points
![Page 13: ESCE 4960: Open Source Software Practice Lecture 8: VTK Pipeline September 24, 2007 Dr. Will Schroeder, Kitware.](https://reader034.fdocuments.in/reader034/viewer/2022051819/5513eeda5503463a298b5eff/html5/thumbnails/13.jpg)
Open Source Software Practice Lecture 8
vtkDataSet Subclasses
vtkPolyData
vtkImageData
vtkStructuredGrid
vtkUnstructuredGrid
vtkRectilinearGrid
![Page 14: ESCE 4960: Open Source Software Practice Lecture 8: VTK Pipeline September 24, 2007 Dr. Will Schroeder, Kitware.](https://reader034.fdocuments.in/reader034/viewer/2022051819/5513eeda5503463a298b5eff/html5/thumbnails/14.jpg)
Open Source Software Practice Lecture 8
Data Set Attributes
vtkDataSet also has point and cell attribute data: Scalars Vectors - 3-vector Tensors - 3x3 symmetric matrix Normals - unit vector Texture Coordinates 1-3D Array of arrays (I.e. FieldData)
![Page 15: ESCE 4960: Open Source Software Practice Lecture 8: VTK Pipeline September 24, 2007 Dr. Will Schroeder, Kitware.](https://reader034.fdocuments.in/reader034/viewer/2022051819/5513eeda5503463a298b5eff/html5/thumbnails/15.jpg)
Open Source Software Practice Lecture 8
Data Set Attributes (cont.)
![Page 16: ESCE 4960: Open Source Software Practice Lecture 8: VTK Pipeline September 24, 2007 Dr. Will Schroeder, Kitware.](https://reader034.fdocuments.in/reader034/viewer/2022051819/5513eeda5503463a298b5eff/html5/thumbnails/16.jpg)
Open Source Software Practice Lecture 8 16
Scalars (An Aside)Scalars (An Aside)
Scalars are represented by a vtkDataArray Scalars are typically single valued Scalars can also represent color
I (intensity) IA (intensity-alpha: alpha is opacity) RGB (red-green-blue) RGBA (RGB + alpha)
Scalars can be used to generate colors mapped through lookup table if unsigned char direct color specification
Scalars are represented by a vtkDataArray Scalars are typically single valued Scalars can also represent color
I (intensity) IA (intensity-alpha: alpha is opacity) RGB (red-green-blue) RGBA (RGB + alpha)
Scalars can be used to generate colors mapped through lookup table if unsigned char direct color specification
![Page 17: ESCE 4960: Open Source Software Practice Lecture 8: VTK Pipeline September 24, 2007 Dr. Will Schroeder, Kitware.](https://reader034.fdocuments.in/reader034/viewer/2022051819/5513eeda5503463a298b5eff/html5/thumbnails/17.jpg)
Open Source Software Practice Lecture 8
Algorithms
Source
Mapper
Filter1 or more outputs
1 or more outputs
1 or more inputs
1 or more inputs
Algorithms operate on data objects
![Page 18: ESCE 4960: Open Source Software Practice Lecture 8: VTK Pipeline September 24, 2007 Dr. Will Schroeder, Kitware.](https://reader034.fdocuments.in/reader034/viewer/2022051819/5513eeda5503463a298b5eff/html5/thumbnails/18.jpg)
Open Source Software Practice Lecture 8
Pipeline Execution Model(conceptual depiction)
direction of update (via Update())
Source
Data
Filter
Data
MapperRender()
direction of data flow (via RequestData())
![Page 19: ESCE 4960: Open Source Software Practice Lecture 8: VTK Pipeline September 24, 2007 Dr. Will Schroeder, Kitware.](https://reader034.fdocuments.in/reader034/viewer/2022051819/5513eeda5503463a298b5eff/html5/thumbnails/19.jpg)
Open Source Software Practice Lecture 8
Creating Pipeline Topology
bFilter->SetInputConnection(aFilter->GetOutputPort()); bFilter->SetInputConnection(1,aFilter->GetOutputPort(2));
aFilter bFilter
Connection
Reuse an output port: OKSeveral connections on an input port:AddInputConnection() if allowed bythe filter (ex: vtkAppendFilter)
Connection
Out
put P
orts Input Ports
0
1
0
2
1
![Page 20: ESCE 4960: Open Source Software Practice Lecture 8: VTK Pipeline September 24, 2007 Dr. Will Schroeder, Kitware.](https://reader034.fdocuments.in/reader034/viewer/2022051819/5513eeda5503463a298b5eff/html5/thumbnails/20.jpg)
Open Source Software Practice Lecture 8 20
Role of Type-CheckingRole of Type-Checking
FillInputPortInformation() specifies input dataset type FillOutputPortInformation() specifies output dataset type Type-checking performed at run-time
int vtkPolyDataAlgorithm::FillInputPortInformation( int vtkNotUsed(port), vtkInformation *info) { info->Set(vtkAlgorithm::INPUT_REQUIRED_DATA_TYPE(), ”vtkPolyData”); return 1; }
FillInputPortInformation() specifies input dataset type FillOutputPortInformation() specifies output dataset type Type-checking performed at run-time
int vtkPolyDataAlgorithm::FillInputPortInformation( int vtkNotUsed(port), vtkInformation *info) { info->Set(vtkAlgorithm::INPUT_REQUIRED_DATA_TYPE(), ”vtkPolyData”); return 1; }
![Page 21: ESCE 4960: Open Source Software Practice Lecture 8: VTK Pipeline September 24, 2007 Dr. Will Schroeder, Kitware.](https://reader034.fdocuments.in/reader034/viewer/2022051819/5513eeda5503463a298b5eff/html5/thumbnails/21.jpg)
Open Source Software Practice Lecture 8
Decimation, smoothing, normals Implemented in C++
Example Pipeline
vtkSmoothPolyDataFilter
vtkDecimatePro
vtkBYUReader
vtkPolyDataNormals
vtkPolyDataMapper
Note: data objects are notshown they are impliedfrom the output type of thefilter
![Page 22: ESCE 4960: Open Source Software Practice Lecture 8: VTK Pipeline September 24, 2007 Dr. Will Schroeder, Kitware.](https://reader034.fdocuments.in/reader034/viewer/2022051819/5513eeda5503463a298b5eff/html5/thumbnails/22.jpg)
Open Source Software Practice Lecture 8
Create Reader & Decimator
vtkBYUReader *byu = vtkBYUReader::New(); byu->SetGeometryFileName("../../vtkdata/fran_cut.g”);
vtkDecimatePro *deci = vtkDecimatePro::New(); deci->SetInputConnection( byu->GetOutputPort() ); deci->SetTargetReduction( 0.9 ); deci->PreserveTopologyOn(); deci->SetMaximumError( 0.0002 );
![Page 23: ESCE 4960: Open Source Software Practice Lecture 8: VTK Pipeline September 24, 2007 Dr. Will Schroeder, Kitware.](https://reader034.fdocuments.in/reader034/viewer/2022051819/5513eeda5503463a298b5eff/html5/thumbnails/23.jpg)
Open Source Software Practice Lecture 8
Smoother & Graphics Objects
vtkSmoothPolyDataFilter *smooth = vtkSmoothPolyDataFilter::New(); smooth->SetInputConnection(deci->GetOutputPort()); smooth->SetNumberOfIterations( 20 ); smooth->SetRelaxationFactor( 0.05 );
vtkPolyDataNormals *normals = vtkPolyDataNormals::New(); normals->SetInputConnection( smooth->GetOutputPort() );
vtkPolyDataMapper *cyberMapper = vtkPolyDataMapper::New(); cyberMapper->SetInputConnection( normals->GetOutputPort() );
vtkActor *cyberActor = vtkActor::New(); cyberActor->SetMapper (cyberMapper); cyberActor->GetProperty()->SetColor ( 1.0, 0.49, 0.25 ); cyberActor->GetProperty()->SetRepresentationToWireframe();
![Page 24: ESCE 4960: Open Source Software Practice Lecture 8: VTK Pipeline September 24, 2007 Dr. Will Schroeder, Kitware.](https://reader034.fdocuments.in/reader034/viewer/2022051819/5513eeda5503463a298b5eff/html5/thumbnails/24.jpg)
Open Source Software Practice Lecture 8
More Graphics Objects
vtkRenderer *ren1 = vtkRenderer::New();
vtkRenderWindow *renWin = vtkRenderWindow::New(); renWin->AddRenderer( ren1 );
vtkRenderWindowInteractor *iren = vtkRenderWindowInteractor ::New();iren->SetRenderWindow( renWin );
ren1->AddViewProp( cyberActor );ren1->SetBackground( 1, 1, 1 );renWin->SetSize( 500, 500 );
iren->Start();
![Page 25: ESCE 4960: Open Source Software Practice Lecture 8: VTK Pipeline September 24, 2007 Dr. Will Schroeder, Kitware.](https://reader034.fdocuments.in/reader034/viewer/2022051819/5513eeda5503463a298b5eff/html5/thumbnails/25.jpg)
Open Source Software Practice Lecture 8
Results
Before(52,260 triangles)
After Decimationand Smoothing(7,477 triangles)
![Page 26: ESCE 4960: Open Source Software Practice Lecture 8: VTK Pipeline September 24, 2007 Dr. Will Schroeder, Kitware.](https://reader034.fdocuments.in/reader034/viewer/2022051819/5513eeda5503463a298b5eff/html5/thumbnails/26.jpg)
Open Source Software Practice Lecture 8 26
Exercise 2bExercise 2b
Compile and run exercise2b.cxx Understand what the example does... How many source objects are there? How many filter objects? How many mapper objects? How many data objects are there?
Compile and run exercise2b.cxx Understand what the example does... How many source objects are there? How many filter objects? How many mapper objects? How many data objects are there?
![Page 27: ESCE 4960: Open Source Software Practice Lecture 8: VTK Pipeline September 24, 2007 Dr. Will Schroeder, Kitware.](https://reader034.fdocuments.in/reader034/viewer/2022051819/5513eeda5503463a298b5eff/html5/thumbnails/27.jpg)
Open Source Software Practice Lecture 8 27
Exercise 2b (solution)Exercise 2b (solution)
# of Sources: 1 # of Filters: 5 # of Mappers: 2
# of Data Objects: 6
# of Sources: 1 # of Filters: 5 # of Mappers: 2
# of Data Objects: 6
![Page 28: ESCE 4960: Open Source Software Practice Lecture 8: VTK Pipeline September 24, 2007 Dr. Will Schroeder, Kitware.](https://reader034.fdocuments.in/reader034/viewer/2022051819/5513eeda5503463a298b5eff/html5/thumbnails/28.jpg)
Open Source Software Practice Lecture 8 28
Exercise 2b - NotesExercise 2b - Notes
vtkImplicitFunction Any function of the form F(x,y,z) = 0
sphere of radius R: F(x,y,z) = R2 – (x2 + y2 + z2) = 0 Examples: spheres, quadrics, cones, cylinders,
planes, ellipsoids, etc. Can be combined in boolean trees
Union, difference, intersection
Powerful tools for Modeling Clipping Cutting Extracting data
vtkImplicitFunction Any function of the form F(x,y,z) = 0
sphere of radius R: F(x,y,z) = R2 – (x2 + y2 + z2) = 0 Examples: spheres, quadrics, cones, cylinders,
planes, ellipsoids, etc. Can be combined in boolean trees
Union, difference, intersection
Powerful tools for Modeling Clipping Cutting Extracting data
![Page 29: ESCE 4960: Open Source Software Practice Lecture 8: VTK Pipeline September 24, 2007 Dr. Will Schroeder, Kitware.](https://reader034.fdocuments.in/reader034/viewer/2022051819/5513eeda5503463a298b5eff/html5/thumbnails/29.jpg)
Open Source Software Practice Lecture 8
Volume Rendering
Volume rendering is the process of generating a 2D image from 3D data.
The line between volume rendering and geometric rendering is not always clear. Volume rendering may produce an image of an isosurface, or may employ geometric hardware for rendering.
![Page 30: ESCE 4960: Open Source Software Practice Lecture 8: VTK Pipeline September 24, 2007 Dr. Will Schroeder, Kitware.](https://reader034.fdocuments.in/reader034/viewer/2022051819/5513eeda5503463a298b5eff/html5/thumbnails/30.jpg)
Open Source Software Practice Lecture 8 30
Volume Data StructuresVolume Data Structures
ImageData: 3D regular rectilinear grid
UnstructuredGrid: explicit list of 3D cells
ImageData: 3D regular rectilinear grid
UnstructuredGrid: explicit list of 3D cells
![Page 31: ESCE 4960: Open Source Software Practice Lecture 8: VTK Pipeline September 24, 2007 Dr. Will Schroeder, Kitware.](https://reader034.fdocuments.in/reader034/viewer/2022051819/5513eeda5503463a298b5eff/html5/thumbnails/31.jpg)
Open Source Software Practice Lecture 8 31
3D Image Data Structure
3D RegularRectilinear Grid
vtkImageData:Dimensions = (Dx, Dy, Dz)Spacing = (Sx, Sy, Sz)Origin = (Ox, Oy, Oz)
![Page 32: ESCE 4960: Open Source Software Practice Lecture 8: VTK Pipeline September 24, 2007 Dr. Will Schroeder, Kitware.](https://reader034.fdocuments.in/reader034/viewer/2022051819/5513eeda5503463a298b5eff/html5/thumbnails/32.jpg)
Open Source Software Practice Lecture 8 32
Volume Rendering Strategies
Image-Order Approach: Traverse the image pixel-by-pixel and sample the volume via ray-casting.
RayRay CastingCasting
![Page 33: ESCE 4960: Open Source Software Practice Lecture 8: VTK Pipeline September 24, 2007 Dr. Will Schroeder, Kitware.](https://reader034.fdocuments.in/reader034/viewer/2022051819/5513eeda5503463a298b5eff/html5/thumbnails/33.jpg)
Open Source Software Practice Lecture 8 33
Volume Rendering Strategies
Object-Order Approach: Traverse the volume, and project to the image plane.
SplattingSplattingcell-by-cellcell-by-cell
Texture MappingTexture Mappingplane-by-planeplane-by-plane
![Page 34: ESCE 4960: Open Source Software Practice Lecture 8: VTK Pipeline September 24, 2007 Dr. Will Schroeder, Kitware.](https://reader034.fdocuments.in/reader034/viewer/2022051819/5513eeda5503463a298b5eff/html5/thumbnails/34.jpg)
Open Source Software Practice Lecture 8 34
Scalar Value Interpolation
v = (1-x)(1-y)(1-z)S(0,0,0) +(x)(1-y)(1-z)S(1,0,0) +(1-x)(y)(1-z)S(0,1,0) +(x)(y)(1-z)S(1,1,0) +(1-x)(1-y)(z)S(0,0,1) +(x)(1-y)(z)S(1,0,1) +(1-x)(y)(z)S(0,1,1) +(x)(y)(z)S(1,1,1)
x
yz
(0,0,0)
(1,1,1)
v = S(rnd(x), rnd(y), rnd(z))
Nearest Neighbor Trilinear
![Page 35: ESCE 4960: Open Source Software Practice Lecture 8: VTK Pipeline September 24, 2007 Dr. Will Schroeder, Kitware.](https://reader034.fdocuments.in/reader034/viewer/2022051819/5513eeda5503463a298b5eff/html5/thumbnails/35.jpg)
Open Source Software Practice Lecture 8 35
Scalar Value Interpolation
Nearest NeighborNearest NeighborInterpolationInterpolation
TrilinearTrilinearInterpolationInterpolation
![Page 36: ESCE 4960: Open Source Software Practice Lecture 8: VTK Pipeline September 24, 2007 Dr. Will Schroeder, Kitware.](https://reader034.fdocuments.in/reader034/viewer/2022051819/5513eeda5503463a298b5eff/html5/thumbnails/36.jpg)
Open Source Software Practice Lecture 8 36
Material Classification Material Classification
Transfer functions are the key to volume renderingsTransfer functions are the key to volume renderings
![Page 37: ESCE 4960: Open Source Software Practice Lecture 8: VTK Pipeline September 24, 2007 Dr. Will Schroeder, Kitware.](https://reader034.fdocuments.in/reader034/viewer/2022051819/5513eeda5503463a298b5eff/html5/thumbnails/37.jpg)
Open Source Software Practice Lecture 8 37
Material Classification
Final opacity is obtained by multiplying scalar value opacity by gradient magnitude opacity
Scalar value can be Scalar value can be classified into color classified into color and opacity (RGBA)and opacity (RGBA)
Gradient magnitude Gradient magnitude can be classified into can be classified into opacityopacity
Scalar Value
RG
BA
Gradient MagnitudeO
paci
ty
![Page 38: ESCE 4960: Open Source Software Practice Lecture 8: VTK Pipeline September 24, 2007 Dr. Will Schroeder, Kitware.](https://reader034.fdocuments.in/reader034/viewer/2022051819/5513eeda5503463a298b5eff/html5/thumbnails/38.jpg)
Open Source Software Practice Lecture 8 38
Material Classification
![Page 39: ESCE 4960: Open Source Software Practice Lecture 8: VTK Pipeline September 24, 2007 Dr. Will Schroeder, Kitware.](https://reader034.fdocuments.in/reader034/viewer/2022051819/5513eeda5503463a298b5eff/html5/thumbnails/39.jpg)
Open Source Software Practice Lecture 8 39
Implementation
RendererProp
Collection
Volume
VolumeMapper
VolumeProperty
ImageData
...
...
Property
Input Mapper
![Page 40: ESCE 4960: Open Source Software Practice Lecture 8: VTK Pipeline September 24, 2007 Dr. Will Schroeder, Kitware.](https://reader034.fdocuments.in/reader034/viewer/2022051819/5513eeda5503463a298b5eff/html5/thumbnails/40.jpg)
Open Source Software Practice Lecture 8
Implementation
vtkVolume vtkVolumeProperty vtkVolumeMapper
vtkVolumeRayCastMapper vtkFixedPointVolumeRayCastMapper vtkVolumeTextureMapper2D vtkVolumeTextureMapper3D vtkVolumeProMapper (removed in 5.0,
back in CVS)
![Page 41: ESCE 4960: Open Source Software Practice Lecture 8: VTK Pipeline September 24, 2007 Dr. Will Schroeder, Kitware.](https://reader034.fdocuments.in/reader034/viewer/2022051819/5513eeda5503463a298b5eff/html5/thumbnails/41.jpg)
Open Source Software Practice Lecture 8 41
Implementation (cont’d)Implementation (cont’d)
vtkUnstructuredGridVolumeMapper
vtkUnstructuredGridVolumeZsweepMapper vtkUnstructuredGridVolumeRayCastMapper vtkProjectedTetrahedraMapper
vtkUnstructuredGridVolumeMapper
vtkUnstructuredGridVolumeZsweepMapper vtkUnstructuredGridVolumeRayCastMapper vtkProjectedTetrahedraMapper
![Page 42: ESCE 4960: Open Source Software Practice Lecture 8: VTK Pipeline September 24, 2007 Dr. Will Schroeder, Kitware.](https://reader034.fdocuments.in/reader034/viewer/2022051819/5513eeda5503463a298b5eff/html5/thumbnails/42.jpg)
Open Source Software Practice Lecture 8 42
Volume Rendering Issues
Quality – is it accurate?
Speed – is it fast?
Intermixing – what can’t I do?
Features / Flexibility – what features does it have, and can I extend it?
![Page 43: ESCE 4960: Open Source Software Practice Lecture 8: VTK Pipeline September 24, 2007 Dr. Will Schroeder, Kitware.](https://reader034.fdocuments.in/reader034/viewer/2022051819/5513eeda5503463a298b5eff/html5/thumbnails/43.jpg)
Open Source Software Practice Lecture 8 43
Standard Features
Transfer Functions – define color and opacity per scalar value. Modulate opacity based on magnitude of the scalar gradient for edge detection.
Shading – specular / diffuse shading from multiple light sources.
Cropping – six axis-aligned cropping planes form 27 regions. Independent control of regions (limited with VolumePro)
Cut Planes – arbitrary cut planes. Limited by hardware (6 with OpenGL, 2 parallel with VolumePro)
![Page 44: ESCE 4960: Open Source Software Practice Lecture 8: VTK Pipeline September 24, 2007 Dr. Will Schroeder, Kitware.](https://reader034.fdocuments.in/reader034/viewer/2022051819/5513eeda5503463a298b5eff/html5/thumbnails/44.jpg)
Open Source Software Practice Lecture 8 44
Intermixed Geometry
High potential iron protein
CT scan of the visible woman's
knee
![Page 45: ESCE 4960: Open Source Software Practice Lecture 8: VTK Pipeline September 24, 2007 Dr. Will Schroeder, Kitware.](https://reader034.fdocuments.in/reader034/viewer/2022051819/5513eeda5503463a298b5eff/html5/thumbnails/45.jpg)
Open Source Software Practice Lecture 8 45
Volume Ray Casting
VolumeRayCastMapper
VolumeRayCastFunction
GradientEstimator
GradientEncoder
GradientShader
![Page 46: ESCE 4960: Open Source Software Practice Lecture 8: VTK Pipeline September 24, 2007 Dr. Will Schroeder, Kitware.](https://reader034.fdocuments.in/reader034/viewer/2022051819/5513eeda5503463a298b5eff/html5/thumbnails/46.jpg)
Open Source Software Practice Lecture 8 46
Ray Cast Functions
Ray Distance
Sca
lar
Valu
e
AA Ray FunctionRay Function examines the scalar values examines the scalar values encountered along a ray and produces a final encountered along a ray and produces a final pixel value according to the volume pixel value according to the volume properties and the specific function.properties and the specific function.
![Page 47: ESCE 4960: Open Source Software Practice Lecture 8: VTK Pipeline September 24, 2007 Dr. Will Schroeder, Kitware.](https://reader034.fdocuments.in/reader034/viewer/2022051819/5513eeda5503463a298b5eff/html5/thumbnails/47.jpg)
Open Source Software Practice Lecture 8 47
Maximum Intensity Function
Ray DistanceRay DistanceSca
lar
Valu
eS
cala
r V
alu
e
Scalar ValueScalar Value
Op
aci
tyO
paci
ty
Maximize Scalar Value
Maximum ValueMaximum Value
Gradient MagnitudeGradient Magnitude
Op
aci
tyO
paci
ty
![Page 48: ESCE 4960: Open Source Software Practice Lecture 8: VTK Pipeline September 24, 2007 Dr. Will Schroeder, Kitware.](https://reader034.fdocuments.in/reader034/viewer/2022051819/5513eeda5503463a298b5eff/html5/thumbnails/48.jpg)
Open Source Software Practice Lecture 8 48
Composite Function
Ray DistanceRay DistanceSca
lar
Valu
eS
cala
r V
alu
e
Scalar ValueScalar Value
Op
aci
tyO
paci
ty
Use -blending along the ray to produce final RGBA value for each pixel.
Ii = ci ai + Ii+1 (1-ai)Gradient MagnitudeGradient Magnitude
Op
aci
tyO
paci
ty
![Page 49: ESCE 4960: Open Source Software Practice Lecture 8: VTK Pipeline September 24, 2007 Dr. Will Schroeder, Kitware.](https://reader034.fdocuments.in/reader034/viewer/2022051819/5513eeda5503463a298b5eff/html5/thumbnails/49.jpg)
Open Source Software Practice Lecture 8 49
Isosurface Function
RayRay DistanceDistance
Sca
lar
Valu
eS
cala
r V
alu
e Isosurface ValueIsosurface Value
Stop ray traversal at isosurface value. Use cubic equation solver if interpolation is trilinear.
![Page 50: ESCE 4960: Open Source Software Practice Lecture 8: VTK Pipeline September 24, 2007 Dr. Will Schroeder, Kitware.](https://reader034.fdocuments.in/reader034/viewer/2022051819/5513eeda5503463a298b5eff/html5/thumbnails/50.jpg)
Open Source Software Practice Lecture 8 50
Sampling Distance
0.1 Unit0.1 UnitStep SizeStep Size
1.0 Unit1.0 UnitStep SizeStep Size
2.0 Unit2.0 UnitStep SizeStep Size
![Page 51: ESCE 4960: Open Source Software Practice Lecture 8: VTK Pipeline September 24, 2007 Dr. Will Schroeder, Kitware.](https://reader034.fdocuments.in/reader034/viewer/2022051819/5513eeda5503463a298b5eff/html5/thumbnails/51.jpg)
Open Source Software Practice Lecture 8 51
Speed / Accuracy Trade-Off
1x1 Sampling1x1 Sampling 2x2 Sampling2x2 Sampling 4x4 Sampling4x4 Sampling
Combined approach: vtkLODProp3D can be used to hold mappers of various types. A volume can be represented at multiple levels-of-detail using a geometric isosurface, texture mapping, and ray casting. A decision between levels-of-detail is made based on allocated render time.
Multi-resolution ray casting: