visualization history
Post on 15-Jan-2016
74 Views
Preview:
DESCRIPTION
TRANSCRIPT
Visualization HistoryVisualization History
• Visualization librariesVisualization libraries– Embed into simulation codeEmbed into simulation code– Outputs images (plots) during run-time.Outputs images (plots) during run-time.
• Post-process of restart dumpsPost-process of restart dumps– Custom tools for custom data formatsCustom tools for custom data formats– Custom derived data, data mappersCustom derived data, data mappers
Visual ProgrammingVisual Programming
• Haberli’s landmark ConMan paper -Haberli’s landmark ConMan paper -1985?1985?
• Extension of Unix pipes.Extension of Unix pipes.• Take a small specialized programTake a small specialized program
– Provide wrapper for remote procedure and Provide wrapper for remote procedure and shared memoryshared memory
– Provide GUI for parameters (args) of the Provide GUI for parameters (args) of the program.program.
Early Visual Prog. Env.Early Visual Prog. Env.
• Data Push modelsData Push models– aPe - Ohio State / OSC aPe - Ohio State / OSC – AVS - Advanced Visualization SystemAVS - Advanced Visualization System
• Stellar Computer– Khoros - Univ. of New Mexico?Khoros - Univ. of New Mexico?– Iris Explorer – SGI / NAGIris Explorer – SGI / NAG
• Data Flow modelData Flow model
Great conceptsGreat concepts
• Very similar to Corba supportVery similar to Corba support– provides the shared memory provides the shared memory
communicationcommunication– each “module” is it’s own processeach “module” is it’s own process
• Can reside on it’s own CPU• Can reside across the network
• Tools to automatically convert a C, C+Tools to automatically convert a C, C++ or Fortran program to a module.+ or Fortran program to a module.
ProblemsProblems
• Data pushed to module AData pushed to module A• Data modified by A (a “mapper”) and Data modified by A (a “mapper”) and
pushed to both modules B and C.pushed to both modules B and C.• Four copies of the data now existFour copies of the data now exist
Read
A
CB
Execution ModelExecution Model
• Each module has a set of parameters Each module has a set of parameters or state that controls its output.or state that controls its output.
• A change to Module B’s parameters A change to Module B’s parameters only requires re-executing B.only requires re-executing B.
• A change to Module A’s parameters, A change to Module A’s parameters, will re-execute A and send new data will re-execute A and send new data to both B and C.to both B and C.
Read
A
CB
Data Push vs Data PullData Push vs Data Pull
• Data PushData Push– Push data when changedPush data when changed
• Data PullData Pull– Only request data when neededOnly request data when needed– Break the data into chunks, and only Break the data into chunks, and only
request small chunks at a time.request small chunks at a time.
• Multiple windows (paths)Multiple windows (paths)• Memory requirements reducedMemory requirements reduced
Early Visual Prog. Env.Early Visual Prog. Env.
• Data Pull ModelsData Pull Models– Data Explorer (Dx) - IBMData Explorer (Dx) - IBM
• Data centric– AVS/ExpressAVS/Express– Image Vision - SGIImage Vision - SGI– Java Advanced ImagingJava Advanced Imaging– VtkVtk
– Much more complicate, Much more flexibleMuch more complicate, Much more flexible
VTKVTKThe Visualization ToolkitThe Visualization Toolkit
William J. SchroederWilliam J. SchroederPresident, Kitware, Inc.President, Kitware, Inc.
Rensselaer SCOREC Research AssociateRensselaer SCOREC Research Associate
www.kitware.comwww.kitware.comwww.vtk.orgwww.vtk.org
will.schroeder@kitware.comwill.schroeder@kitware.com
Modified byRoger Crawfis
ThemesThemes
• OverviewOverview
• ArchitectureArchitecture
• Graphic SubsystemGraphic Subsystem
• Visualization PipelineVisualization Pipeline
• InteractionInteraction
• Software ProcessSoftware Process
• ConclusionConclusion
Taxonomy of Visualization Taxonomy of Visualization SystemsSystems• Toolkits / LibrariesToolkits / Libraries
– ComponentsComponents– Little or no GUILittle or no GUI– Meant to be integrated with other systems/toolkitsMeant to be integrated with other systems/toolkits– Programming requiredProgramming required
• Development EnvironmentsDevelopment Environments– ComponentsComponents– GUI-assisted (visual) programmingGUI-assisted (visual) programming
• ApplicationsApplications– Turn-keyTurn-key– Minimal programmingMinimal programming
What Is VTK?What Is VTK?
A visualization A visualization toolkittoolkit– Designed and implemented using object-oriented principlesDesigned and implemented using object-oriented principles
– C++ class library (~700+ classes; ~425,000 LOC; C++ class library (~700+ classes; ~425,000 LOC; <225,000 executable lines)<225,000 executable lines)
– Automated Java, TCL, Python bindingsAutomated Java, TCL, Python bindings
– Portable across Unix, Windows, Mac OSXPortable across Unix, Windows, Mac OSX
– Supports 3D/2D graphics, visualization, image processing, Supports 3D/2D graphics, visualization, image processing, volume renderingvolume rendering
– Focused on scientific visualization, some support for Focused on scientific visualization, some support for higher-dimensional visualizationhigher-dimensional visualization
– Open-source (BSD-style, not GPL)Open-source (BSD-style, not GPL)
– www.vtk.orgwww.vtk.org
A visualization A visualization toolkittoolkit– Designed and implemented using object-oriented principlesDesigned and implemented using object-oriented principles
– C++ class library (~700+ classes; ~425,000 LOC; C++ class library (~700+ classes; ~425,000 LOC; <225,000 executable lines)<225,000 executable lines)
– Automated Java, TCL, Python bindingsAutomated Java, TCL, Python bindings
– Portable across Unix, Windows, Mac OSXPortable across Unix, Windows, Mac OSX
– Supports 3D/2D graphics, visualization, image processing, Supports 3D/2D graphics, visualization, image processing, volume renderingvolume rendering
– Focused on scientific visualization, some support for Focused on scientific visualization, some support for higher-dimensional visualizationhigher-dimensional visualization
– Open-source (BSD-style, not GPL)Open-source (BSD-style, not GPL)
– www.vtk.orgwww.vtk.org
VTK Is A Toolkit, Not a VTK Is A Toolkit, Not a SystemSystem• EmbeddableEmbeddable
– Plays with other softwarePlays with other software
• SeparableSeparable– Can pull out “pieces”Can pull out “pieces”
• AdaptableAdaptable– Not dependent on GUINot dependent on GUI
• X, Motif, Windows, Mac, Qt, FLTK, Tk, wxWindows, etc.
– Not dependent on rendering libraryNot dependent on rendering library• OpenGL, others
HistoryHistory
• Precursor: GE Legacy System LYMB (circa 1983)Precursor: GE Legacy System LYMB (circa 1983)
• Proprietary software issues led to Proprietary software issues led to open-source VTK project to create:open-source VTK project to create:– TextbookTextbook– Sample codeSample code
• December ‘93 work begins on VTK December ‘93 work begins on VTK text/softwaretext/software
• June 1998 Kitware forms: June 1998 Kitware forms: VTK Commercial SupportVTK Commercial Support
Things It DoesThings It Does
More Things: Image-More Things: Image-ProcessingProcessing
Volume RenderingVolume Rendering
Combined Volume/SurfaceCombined Volume/SurfaceRenderingRendering
FunctionalityFunctionality
• Graphics / ModelingGraphics / Modeling– Smoothing, decimation, extrusion, Delaunay Smoothing, decimation, extrusion, Delaunay
triangulation (2D/3D), etc.triangulation (2D/3D), etc.
• Image ProcessingImage Processing– 100’s of filters100’s of filters– Integrated 2D / 3DIntegrated 2D / 3D
• VisualizationVisualization– Scalar, vector, tensor fields (100’s of filters)Scalar, vector, tensor fields (100’s of filters)– Probing, cutting, clipping, extractionProbing, cutting, clipping, extraction– Volume renderingVolume rendering
• Multi-dimensionalMulti-dimensional– Projection, resamplingProjection, resampling
How To Use ItHow To Use It
• Choose programming languageChoose programming language– C++C++– TclTcl– PythonPython– JavaJava
• Assemble components to build Assemble components to build applicationsapplications
Typical Application (in C+Typical Application (in C++)+)
vtkSphereSourcevtkSphereSource *sphere = vtkSphereSource()::New(); *sphere = vtkSphereSource()::New(); // create data pipeline // create data pipeline
vtkPolyDataMappervtkPolyDataMapper *sphereMapper = vtkPolyDataMapper::New(); *sphereMapper = vtkPolyDataMapper::New();sphereMappersphereMapperSetInput(sphereSetInput(sphereGetOutput());GetOutput());
vtkActorvtkActor *sphereActor = vtkActor::New(); *sphereActor = vtkActor::New(); sphereActorsphereActorSetMapper(sphereMapper); SetMapper(sphereMapper); // mapper connects the actor with // mapper connects the actor with
pipelinepipeline
vtkRenderervtkRenderer *renderer = vtkRenderer::New(); *renderer = vtkRenderer::New(); // graphics library independent// graphics library independentvtkRenderWindowvtkRenderWindow *renWin = vtkRenderWindow::New(); *renWin = vtkRenderWindow::New();
renWinrenWinAddRenderer(renderer);AddRenderer(renderer);vtkRenderWindowInteractorvtkRenderWindowInteractor *iren = vtkRenderWindowInteractor::New(); *iren = vtkRenderWindowInteractor::New();
irenirenSetRenderWindow(renWin);SetRenderWindow(renWin);
rendererrendererAddActor(sphereActor);AddActor(sphereActor);rendererrendererSetBackground(1,1,1);SetBackground(1,1,1);renWinrenWinSetSize(300,300);SetSize(300,300);
renWinrenWinRender();Render();irenirenStart(); Start(); // being event loop// being event loop
ArchitectureArchitecture
• Compiled / InterpretedCompiled / Interpreted– C++ coreC++ core– Tcl, Python, Java wrappersTcl, Python, Java wrappers
• SubsystemsSubsystems– GraphicsGraphics– Visualization pipelineVisualization pipeline
• Image processing• 3D data processing
– InteractionInteraction
VTK ArchitectureVTK Architecture
• Compiled C++ coreCompiled C++ core– PerformancePerformance– Code correctnessCode correctness
• Wrapper layerWrapper layer– Often interpreted (e.g. Tcl)Often interpreted (e.g. Tcl)– Can be compiled layerCan be compiled layer
• Microsoft COM
C++core
Wrappers
Wrapper layergenerated automatically during build process
Tcl InterpreterTcl Interpreter
• source vtkInt.tcl (define interpreter source vtkInt.tcl (define interpreter GUI)GUI)
Code ComparisonCode Comparison
• C++C++
vtkShrinkFilter *sf;vtkShrinkFilter *sf;
sf = vtkShrinkFilter::New();sf = vtkShrinkFilter::New();
sf->SetShrinkFactor(0.8);sf->SetShrinkFactor(0.8);
vtkPolyDataMapper *m;vtkPolyDataMapper *m;
m = m = vtkPolyDataMapper::New();vtkPolyDataMapper::New();
m->SetInput( sf-m->SetInput( sf->GetOutput() );>GetOutput() );
• TclTcl
vtkShrinkFilter sfvtkShrinkFilter sf
sf SetShrinkFactor 0.8sf SetShrinkFactor 0.8
vtkPolyDataMapper mvtkPolyDataMapper m
m SetInput [ sf GetOutput ]m SetInput [ sf GetOutput ]
Graphics SubsystemGraphics Subsystem
• LightsLights• CamerasCameras• ActorsActors• MappersMappers• TransformsTransforms• PropertiesProperties• Render WindowRender Window• RendererRenderer
The VTK Graphics The VTK Graphics SubsystemSubsystemA VTK A VTK scenescene consists of: consists of:• vtkRenderWindow - contains the final imagevtkRenderWindow - contains the final image• vtkRenderer - draws into the render windowvtkRenderer - draws into the render window• vtkActor - combines properties / geometryvtkActor - combines properties / geometry
– vtkProp, vtkProp3D are superclasses vtkProp, vtkProp3D are superclasses – vtkPropertyvtkProperty
• vtkLights - illuminate actorsvtkLights - illuminate actors• vtkCamera - renders the scenevtkCamera - renders the scene• vtkMapper - represents geometryvtkMapper - represents geometry
– vtkPolyDataGeometry, vtkDataSetMapper are vtkPolyDataGeometry, vtkDataSetMapper are subclassessubclasses
• vtkTransform - position actorsvtkTransform - position actors
Graphics ModelGraphics Model
Instances of render window (vtkRenderWindow)
Actor instances(vtkActor)
Renderer instances(vtkRenderer)
Visualization PipelineVisualization Pipeline
• Data objectsData objects
• Process objectsProcess objects
• PipelinesPipelines
• Managing executionManaging execution
The Visualization PipelineThe Visualization Pipeline
A sequence of A sequence of process objectsprocess objects that operate on that operate on data data objectsobjects to generate geometry that can be rendered to generate geometry that can be rendered by the graphics engine or written to a fileby the graphics engine or written to a file
Data
Filter
Data to graphicssystem
Data
Data Filter Actor
ActorMapper
Mapper
Source
Visualization ModelVisualization Model
• Data ObjectsData Objects– represent datarepresent data– provide access to dataprovide access to data– compute information particular to datacompute information particular to data
(e.g., bounding box, derivatives)(e.g., bounding box, derivatives)
• Process ObjectsProcess Objects– Ingest, transform, and output data objectsIngest, transform, and output data objects– represent visualization algorithmsrepresent visualization algorithms
vtkDataObject / vtkDataObject / vtkDataSetvtkDataSet• vtkDataObject represents a “blob” of datavtkDataObject represents a “blob” of data
– contain instance of vtkFieldDatacontain instance of vtkFieldData– an array of arraysan array of arrays– no geometric/topological structureno geometric/topological structure– Superclass of all VTK data objectsSuperclass of all VTK data objects
• vtkDataSet has geometric/topological structurevtkDataSet has geometric/topological structure– Consists of geometry (points) and topology (cells)Consists of geometry (points) and topology (cells)– Has associated “attribute data” (e.g., scalars, vectors) Has associated “attribute data” (e.g., scalars, vectors)
as well as field dataas well as field data– Convert data object to data set with Convert data object to data set with
vtkDataObjectToDataSetFiltervtkDataObjectToDataSetFilter
vtkDataObject / vtkDataObject / vtkDataSetvtkDataSet
Geometry& Topology
Attribute Data
Points& Cells
Point DataCell Data
Array of arrays Field DatavtkDataObject
vtkDataSet
Concept Implementation
Structure
Associated
Data
Dataset ModelDataset Model
• A dataset is a data object with structureA dataset is a data object with structure
• Structure consists ofStructure consists of– points (x-y-z coordinates)points (x-y-z coordinates)– cells (e.g., polygons, lines, voxels) that are defined cells (e.g., polygons, lines, voxels) that are defined
by connectivity list referring to points idsby connectivity list referring to points ids– Access is via integer IDAccess is via integer ID– implicit representationsimplicit representations– explicit representationsexplicit representations
Cell
Points
vtkDataSet SubclassesvtkDataSet Subclasses
vtkPolyData
vtkImageData
vtkStructuredGrid
vtkUnstructuredGrid
vtkRectilinearGrid
Data Set AttributesData Set Attributes
• vtkDataSet also has point and cell vtkDataSet also has point and cell attribute data:attribute data:– ScalarsScalars – (multi-component) – (multi-component)– VectorsVectors - 3-vector - 3-vector – TensorsTensors - 3x3 symmetric matrix - 3x3 symmetric matrix– NormalsNormals - unit vector - unit vector– Texture CoordinatesTexture Coordinates 1-3D 1-3D– Array of arrays (I.e. FieldData)Array of arrays (I.e. FieldData)
Scalars (An Aside)Scalars (An Aside)
• Scalars are represented by a vtkDataArray Scalars are represented by a vtkDataArray • Scalars are typically single valuedScalars are typically single valued• Scalars can also represent colorScalars can also represent color
– I (intensity)I (intensity)– IA (intensity-alpha: IA (intensity-alpha: alpha is opacity)alpha is opacity)– RGB (red-green-blue)RGB (red-green-blue)– RGBA (RGB + alpha)RGBA (RGB + alpha)
• Scalars can be used to generate colorsScalars can be used to generate colors– mapped through lookup tablemapped through lookup table– if unsigned char if unsigned char direct color specification direct color specification
Process ObjectsProcess Objects
Source
Mapper
Filter1 or more outputs
1 or more outputs
1 or more inputs
1 or more inputs
• Process objects operate on data Process objects operate on data objectsobjects
Pipeline Execution ModelPipeline Execution Model
direction of update (via Update())
Source
Data
Filter
Data
MapperRender()
direction of data flow (via Execute())
Creating Pipeline TopologyCreating Pipeline Topology
• aFilter->aFilter->SetInputSetInput( bFilter-( bFilter->>GetOutputGetOutput());());
• The Role of Type-CheckingThe Role of Type-Checking– SetInput() accepts dataset type or subclassSetInput() accepts dataset type or subclass– C++ compile-time checkingC++ compile-time checking– Interpreter run-time checkingInterpreter run-time checking
• Decimation, smoothing, normalsDecimation, smoothing, normals• Implemented in C++Implemented in C++
Example PipelineExample Pipeline
vtkSmoothPolyDataFilter
vtkDecimatePro
vtkBYUReader
vtkPolyDataNormals
vtkPolyDataMapper
Note: data objects are notshown they are impliedfrom the output type of thefilter
Create Reader & Create Reader & DecimatorDecimator
vtkBYUReader *byu = vtkBYUReader::New();vtkBYUReader *byu = vtkBYUReader::New(); byu->SetGeometryFileName("../../vtkdata/fran_cut.g”); byu->SetGeometryFileName("../../vtkdata/fran_cut.g”);
vtkDecimatePro *deci = vtkDecimatePro::New();vtkDecimatePro *deci = vtkDecimatePro::New(); deci->SetInput( byu->GetOutput() ); deci->SetInput( byu->GetOutput() ); deci->SetTargetReduction( 0.9 ); deci->SetTargetReduction( 0.9 ); deci->PreserveTopologyOn(); deci->PreserveTopologyOn(); deci->SetMaximumError( 0.0002 ); deci->SetMaximumError( 0.0002 );
Smoother & Graphics Smoother & Graphics ObjectsObjects
vtkSmoothPolyDataFilter *smooth = vtkSmoothPolyDataFilter::New();vtkSmoothPolyDataFilter *smooth = vtkSmoothPolyDataFilter::New(); smooth->SetInput(deci->GetOutput()); smooth->SetInput(deci->GetOutput()); smooth->SetNumberOfIterations( 20 ); smooth->SetNumberOfIterations( 20 ); smooth->SetRelaxationFactor( 0.05 ); smooth->SetRelaxationFactor( 0.05 );
vtkPolyDataNormals *normals = vtkPolyDataNormals::New();vtkPolyDataNormals *normals = vtkPolyDataNormals::New(); normals->SetInput( smooth->GetOutput() ); normals->SetInput( smooth->GetOutput() );
vtkPolyDataMapper *cyberMapper = vtkPolyDataMapper::New();vtkPolyDataMapper *cyberMapper = vtkPolyDataMapper::New(); cyberMapper->SetInput( normals->GetOutput() ); cyberMapper->SetInput( normals->GetOutput() );
vtkActor *cyberActor = vtkActor::New();vtkActor *cyberActor = vtkActor::New(); cyberActor->SetMapper (cyberMapper); cyberActor->SetMapper (cyberMapper); cyberActor->GetProperty()->SetColor ( 1.0, 0.49, 0.25 ); cyberActor->GetProperty()->SetColor ( 1.0, 0.49, 0.25 ); cyberActor->GetProperty()->SetRepresentationToWireframe(); cyberActor->GetProperty()->SetRepresentationToWireframe();
More Graphics ObjectsMore Graphics Objects
vtkRenderer *ren1 = vtkRenderer::New();vtkRenderer *ren1 = vtkRenderer::New();
vtkRenderWindow *renWin = vtkRenderWindow::New(); vtkRenderWindow *renWin = vtkRenderWindow::New(); renWin->AddRenderer( ren1 );renWin->AddRenderer( ren1 );
vtkRenderWindowInteractor *iren = vtkRenderWindowInteractor *iren = vtkRenderWindowInteractor ::New(); vtkRenderWindowInteractor ::New();iren->SetRenderWindow( renWin );iren->SetRenderWindow( renWin );
ren1->AddActor( cyberActor );ren1->AddActor( cyberActor );ren1->SetBackground( 1, 1, 1 );ren1->SetBackground( 1, 1, 1 );renWin->SetSize( 500, 500 );renWin->SetSize( 500, 500 );
iren->Start();iren->Start();
ResultsResults
Before(52,260 triangles)
After Decimationand Smoothing(7,477 triangles)
Parallel ProcessingParallel Processing
• Why ? – we have toWhy ? – we have to• Shared memoryShared memory• Distributed executionDistributed execution
– MPIMPI– Abstracted to support other communicationAbstracted to support other communication
• Parallel MechanismsParallel Mechanisms– TaskTask– DataData– PipelinePipeline
• ScalableScalable– Petabyte example on 2048 LANL machine (Petabyte example on 2048 LANL machine (Martin et al. Martin et al.
IEEE CG&A July 2001IEEE CG&A July 2001))(A petabyte is (A petabyte is 2 to the 50th power 2 to the 50th power (1,125,899,906,842,624) bytes. A petabyte is equal to (1,125,899,906,842,624) bytes. A petabyte is equal to 1,024 terabytes.1,024 terabytes. ) )
ExamplesExamples
• Modeling turbulence (Ken Jansen Modeling turbulence (Ken Jansen Rensselaer)Rensselaer)– 8.5 million tetrahedra (per time step)8.5 million tetrahedra (per time step)– 150 million tetrahedra (soon)150 million tetrahedra (soon)
Large Data ManagementLarge Data Management
• Visible Woman CT DataVisible Woman CT Data 870 MBytes 1734 Slices at 512x512x2870 MBytes 1734 Slices at 512x512x2
• Visible Woman CT DataVisible Woman CT Data 870 MBytes 1734 Slices at 512x512x2870 MBytes 1734 Slices at 512x512x2
• Bell-Boeing V-2 2 tiltrotor 140 Gbytes
• Bell-Boeing V-2 2 tiltrotor 140 Gbytes
Streaming PipelineStreaming Pipeline• Basic idea: handle any size data on any size Basic idea: handle any size data on any size
computercomputer
• Data is broken into pieces, and pieces processed Data is broken into pieces, and pieces processed one at a time through pipelineone at a time through pipeline– Piece size based on memory limitsPiece size based on memory limits– Can avoid system swapCan avoid system swap– Supports parallel processingSupports parallel processing– IssuesIssues
• How to create pieces• Mapping output from input• Results invariance
Filter
PiecesPieces
Imaging: i,j,k Imaging: i,j,k extents.extents.
GraphicsGraphics
xMin xMax
yMin
yMin
xMin xMax
yMin
yMin
zMin
zMax
image->SetUpdateExtent(0, 128, 0, 128, 0, 90);image->Update();
data->SetUpdateExtent(0, 2);data->Update();
Piece = 0NumberOfPieces = 2
InteractionInteraction
• Command / Observer callback Command / Observer callback mechanismmechanism
• Interactor StylesInteractor Styles
• 3D Widgets3D Widgets
vtkRenderWindowInteractvtkRenderWindowInteractororKey features:Key features:• SetRenderWindow – the single render SetRenderWindow – the single render
window to interact withwindow to interact with
• Key and mouse bindings (Interactor Key and mouse bindings (Interactor Style)Style)
• Light Follow Camera (a headlight)Light Follow Camera (a headlight)
• Picking interactionPicking interaction
Interactor Style(s)Interactor Style(s)
• Button 1 – rotateButton 1 – rotate• Button 2 – translate (<Shift> Button 1 Button 2 – translate (<Shift> Button 1
on PC)on PC)• Button 3 – zoomButton 3 – zoom• Keypress e or q – exitKeypress e or q – exit• Keypress f – “fly-to” point under mouseKeypress f – “fly-to” point under mouse• Keypress s/w – surface/wireframeKeypress s/w – surface/wireframe• Keypress p – pickKeypress p – pick• Keypress r – reset cameraKeypress r – reset camera• Keypress 3 – toggle stereoKeypress 3 – toggle stereo
Switch styles: Keypress j – joystick; t - trackball style
PickingPicking
• vtkPropPicker - hardware-assisted picking of vtkPropsvtkPropPicker - hardware-assisted picking of vtkProps
• vtkPicker - pick based on prop3D’s bounding box vtkPicker - pick based on prop3D’s bounding box (software ray cast)(software ray cast)
• vtkPointPicker - pick points (closest point to camera vtkPointPicker - pick points (closest point to camera within tolerance - software ray cast)within tolerance - software ray cast)
• vtkCellPicker - pick cells (software ray cast)vtkCellPicker - pick cells (software ray cast)
• vtkWorldPointPicker - get x-y-z coordinate; does not vtkWorldPointPicker - get x-y-z coordinate; does not pick prop (hardware assisted)pick prop (hardware assisted)
Example: Picking and Example: Picking and StyleStylevtkRenderWindowInteractor *iren = vtkRenderWindowInteractor *iren =
vtkRenderWindowInteractor::New();vtkRenderWindowInteractor::New();vtkInteractorStyleFlight *style = vtkInteractorStyleFlight *style =
vtkInteractorStyleFlight::New();vtkInteractorStyleFlight::New();vtkCellPicker *picker = vtkCellPicker::New();vtkCellPicker *picker = vtkCellPicker::New();
iren->SetInteractorStyle(flight);iren->SetInteractorStyle(flight);iren->SetPicker(picker);iren->SetPicker(picker);
(Note: defaults are automatically created, you (Note: defaults are automatically created, you rarely ever need to do this)rarely ever need to do this)
Command / Observer Command / Observer CallbacksCallbacks• Observers Observers observeobserve events on a particular VTK events on a particular VTK
instanceinstance– Use AddObserver() to watch for eventsUse AddObserver() to watch for events– The observer is implicit; you actually add the commandThe observer is implicit; you actually add the command
• When an observer sees the event it is interested When an observer sees the event it is interested in, it invokes a in, it invokes a commandcommand via the command’s via the command’s Execute() methodExecute() method
• The events originate from instances that invoke The events originate from instances that invoke events on themselves (and may pass call data)events on themselves (and may pass call data)– This->InvokeEvent(vtkCommand::ProgressEvent,NULL);This->InvokeEvent(vtkCommand::ProgressEvent,NULL);
Command / ObserverCommand / Observer
vtkObject
vtkCommand
vtkCommand
vtkCommand
Registered observers
this->InvokeEvent()
3D Widgets3D Widgets
• Added since VTK 4.0 releaseAdded since VTK 4.0 release– Requires nightly / VTK 4.2 releaseRequires nightly / VTK 4.2 release
• Subclass of vtkInteractorObserverSubclass of vtkInteractorObserver– Interactor observers watches events Interactor observers watches events
invoked on vtkRenderWindowInteractorinvoked on vtkRenderWindowInteractor– Events are caught and acted onEvents are caught and acted on– Events can be prioritized and orderedEvents can be prioritized and ordered– The handling of a particular event can be The handling of a particular event can be
abortedaborted
Some 3D WidgetsSome 3D Widgets
• vtkPointWidgetvtkPointWidget• vtkLineWidgetvtkLineWidget• vtkPlaneWidgetvtkPlaneWidget• vtkBoxWidgetvtkBoxWidget• vtkSphereWidgetvtkSphereWidget
• Widgets often provide auxiliary functionality Widgets often provide auxiliary functionality (e.g., obtaining transforms, polydata, implicit (e.g., obtaining transforms, polydata, implicit functions, etc.)functions, etc.)
• More than one widget at a time can be usedMore than one widget at a time can be used
vtkBoxWidgetvtkBoxWidget
vtkPlaneWidgetvtkPlaneWidget
vtkLineWidgetvtkLineWidget
vtkPointWidgetvtkPointWidget
vtkImplicitPlaneWidgetvtkImplicitPlaneWidget
vtkImagePlaneWidgetvtkImagePlaneWidget
vtkScalarBarWidgetvtkScalarBarWidget
vtkSphereWidgetvtkSphereWidget
Example Usage (Tcl)Example Usage (Tcl)vtkLineWidget lineWidgetvtkLineWidget lineWidgetvtkPolyData seedsvtkPolyData seedslineWidget SetInput [pl3d GetOutput]lineWidget SetInput [pl3d GetOutput]lineWidget AlignWithYAxisOnlineWidget AlignWithYAxisOnlineWidget PlaceWidgetlineWidget PlaceWidgetlineWidget GetPolyData seedslineWidget GetPolyData seeds
…….…….………………
lineWidget SetInteractor irenlineWidget SetInteractor irenlineWidget AddObserver StartInteractionEvent BeginInteractionlineWidget AddObserver StartInteractionEvent BeginInteractionlineWidget AddObserver InteractionEvent GenerateStreamlineslineWidget AddObserver InteractionEvent GenerateStreamlines
Software ProcessSoftware Process
• The Quality DashboardThe Quality Dashboard– Managing open-source developmentManaging open-source development– The importance of feedbackThe importance of feedback
• ToolsTools– CVSCVS– CMakeCMake– DoxygenDoxygen– DARTDART
Development ProcessDevelopment Process
• Standard C++ Style / MethodologyStandard C++ Style / Methodology• Documentation embedded in code (use Documentation embedded in code (use
Doxygen to generated HTML)Doxygen to generated HTML)• Use CVS source code control systemUse CVS source code control system
– Allows simultaneous editsAllows simultaneous edits– Merges files, flags conflictsMerges files, flags conflicts
• Automatic wrapper generator (look at Automatic wrapper generator (look at SWIG)SWIG)
• Daily regression testingDaily regression testing
• Cross-Platform Make (build Cross-Platform Make (build environment)environment)
• Open source, runs everywhereOpen source, runs everywhere• Simple “makefiles” CMakeLists.txtSimple “makefiles” CMakeLists.txt• Generates native build filesGenerates native build files
– Makefiles on Unix/LinuxMakefiles on Unix/Linux– Projects/workspaces on MSVCProjects/workspaces on MSVC
• www.cmake.orgwww.cmake.org
Insight Toolkit (ITK)Insight Toolkit (ITK)
C++ Toolkit
Medical ImageProcessing
Registration Segmentation
ITKITK• C++ LibraryC++ Library
– Uses Generic Programming Concepts (i.e. heavily templated)Uses Generic Programming Concepts (i.e. heavily templated)– N-Dimensional Images / MeshesN-Dimensional Images / Meshes– Complex Pixel TypesComplex Pixel Types– BSD-style open-source licenseBSD-style open-source license
• Data Flow ArchitectureData Flow Architecture– StreamingStreaming
• CABLE Interpreted Language BindingsCABLE Interpreted Language Bindings• Development ProcessDevelopment Process
– CMake Build EnvironmentCMake Build Environment– CVS Source Code ControlCVS Source Code Control– DART Testing SystemDART Testing System– Doxygen Documentation SystemDoxygen Documentation System– GNATS Bug TrackingGNATS Bug Tracking– Web (itk.org), Mailing lists (mailman), etc.Web (itk.org), Mailing lists (mailman), etc.
• www.itk.orgwww.itk.org
top related