Download presentation
Published byKaleb Prewett Modified over 9 years ago
1
VTK 3D Widgets Karthik Krishnan Will Schroeder Kitware, Inc.
2
Thanks National Library of Medicine / NIH
Dr. Terry Yoo: A2D2 awards (Algorithms, Adaptors, and Data Distribution) National Science Foundation Visual Journal project NIH National Center for Biomedical Computing NAMIC DOE National Labs Sandia Livermore Contributors Will Schroeder Karthik Krishnan Lisa Avila Brad King Sebastien Barre Dave Cole
3
Goals Directly interact with data
Provide complex, potentially 3D interaction techniques Probing Annotation Measurements
4
Interactor styles Render()
Everybody has their favorite way of interacting with Data. User Events RenderWindow Interactor Interactor Style Events Actions vtkCamera Render()
5
Object Relationships vtkRenderWindowInteractor vtkInteractorObserver
vtkInteractorStyle vtkAbstractWidget
6
Interactor Styles (contd..)
7
Interactor styles (usage)
Set the interactor style on the Render Window Interactor vtkInteractorStyleTrackballCamera *style = vtkInteractorStyleTrackballCamera::New(); renderWindowInteractor -> SetInteractorStyle( style );
8
VTK Widgets
9
VTK - Widgets Widgets are simply Interactive Props
VTK currently has widgets to perform Measurements Annotation and Labeling Segmentation Registration Data interaction Scene parameter manipulation: Light, camera, etc. Probing underlying data Timer support Multiple geometrical representations for the same widget Reconfigurable key/mouse bindings Grouping widgets
10
Visualization pipeline
11
Widgets are interactive props
vtkRenderWindow vtkRenderWindowInteractor User Interaction Events Widget Manipulate one or more props vtkRenderer Render() Widget Representation
12
Widgets – Design goals Separate representation from event processing
Support distributed processing (client-server) Reconfigurable bindings Support hierarchical use of widgets Grouping widgets Timer, Hover support
13
vtkWidgetRepresentation (type of vtkProp)
Widgets Architecture Behavior Geometry RenderWindow Renderer Events Render() vtkAbstractWidget vtkWidgetRepresentation (type of vtkProp)
14
One widget, multiple geometries
Behavior Geometry vtkPointHandleRepresentation2D vtkHandleWidget Run HandleWidget1 and HandleWidget2 – Sphere and Arnie vtkPointHandleRepresentation3D vtkSphereHandleRepresentation vtkPolygonalHandleRepresentation
15
Configurable bindings: Event Translation
16
Event Translation Re-configurable keyboard/mouse bindings Example:
vtkWidgetEventTranslator *eventTranslator = widget->GetEventTranslator(); eventTranslator->SetTranslation( vtkCommand::MiddleButtonPressEvent, vtkWidgetEvent::Select ); vtkCommand::MiddleButtonReleaseEvent, vtkWidgetEvent::EndSelect ); Run ContourWidget5.sh
17
Widget Assemblies Create composite widgets from several individual widgets Children listen to events from Parent. Hence parent can alter behavior of child RenderWindow Events Parent Events Events Child Child
18
Widget Assemblies Line Widget HandleWidget HandleWidget Code reuse
Component framework: Change behaviour / geometry of Line widget by changing the handle widgets. Run the Line widget Line Widget HandleWidget HandleWidget
19
Timer support Widgets may respond to timers Hover widget
Balloon widget Timer based hover annotations, Popups (text, thumbnails etc). Run the BalloonWidget
20
Handle Framework Handles are often fundamental building blocks of other widgets vtkLineWidget2 vtkDistanceWidget vtkAngleWidget vtkBiDimensionalWidget vtkSeedWidget vtkParallelopipedWidget Need multiple representations for handles Need a framework for constraints on handles To plane To surface To a terrain To a region. Run the Line widget
21
Various handle representations (geometries)
vtkPointHandleRepresentation2D vtkHandleWidget Run HandleWidget1 and HandleWidget2 – Sphere and Arnie vtkPointHandleRepresentation3D vtkSphereHandleRepresentation vtkPolygonalHandleRepresentation
22
Constraints – Point Placers
To map 2D display positions to 3D world coordinates. Does a 2D display position map to: Focal Plane ? Point on a surface ? Point on a plane / image ? Out of bounds ? Allows a variety of constraints to be placed the placement of widgets.
23
Widgets Handles
24
Widgets (cont.) vtkSliderWidget 2D 3D vtkBorderWidget
Widgets with rectangular borders vtkTextWidget Position & size text
25
Widgets (cont.) BalloonWidget Text and/or image in rectangular popup
26
Widgets (cont.) vtkCameraWidget Keyframe & playback camera
vtkCaptionWidget Text with leader
27
Widgets (cont.) vtkCheckerboardWidget Interleave two images
vtkRectilinearWipeWidget Window pane (2x2 checkerboard) with movable focus
28
Widgets (cont.) vtkContourWidget 2D (on plane)
3D (move contours through slices in a volume)
29
Widgets (cont.) vtkDistanceWidget Measure distance between points
vtkAngleWidget Measure angles
30
Widgets (cont.) vtkSeedWidget Add one or more seeds / markers
vtkAffineWidget Translate Scale Rotate Shear images
31
Widgets (cont.) vtkBiDimensionalWidget Tumor response (RECIST vs WHO)
32
Widgets (cont.) Box Implicit Plane
33
Widgets (cont.) Finite Plane Line
34
Widgets (cont.) vtkSphereWidget vtkScalarBarWidget
35
Slider Widget Example vtkSliderRepresentation2D *sliderRep = vtkSliderRepresentation2D::New(); sliderRep->SetValue(0.25); sliderRep->SetTitleText("Spike Size"); sliderRep->GetPoint1Coordinate()->SetCoordinateSystemToNormalizedDisplay(); sliderRep->GetPoint1Coordinate()->SetValue(0.2,0.15); sliderRep->GetPoint2Coordinate()->SetCoordinateSystemToNormalizedDisplay(); sliderRep->GetPoint2Coordinate()->SetValue(0.8,0.15); sliderRep->SetSliderLength(0.02); sliderRep->SetSliderWidth(0.03); sliderRep->SetEndCapLength(0.01); sliderRep->SetEndCapWidth(0.03); sliderRep->SetTubeWidth(0.005); vtkSliderWidget *sliderWidget = vtkSliderWidget::New(); sliderWidget->SetInteractor(iren); sliderWidget->SetRepresentation(sliderRep); sliderWidget->SetAnimationModeToAnimate(); vtkSlider2DCallback *callback = vtkSlider2DCallback::New(); callback->Glyph = glyph; sliderWidget->AddObserver(vtkCommand::InteractionEvent,callback);
36
Slider Widget Example (Cont.)
class vtkSlider2DCallback : public vtkCommand { public: static vtkSlider2DCallback *New() { return new vtkSlider2DCallback; } virtual void Execute(vtkObject *caller, unsigned long, void*) vtkSliderWidget *sliderWidget = reinterpret_cast<vtkSliderWidget*>(caller); this->Glyph->SetScaleFactor(static_cast<vtkSliderRepresentation *>(sliderWidget->GetRepresentation())->GetValue()); } vtkSlider2DCallback():Glyph(0) {} vtkGlyph3D *Glyph; };
37
vtkPointPlacer
38
Widget Sets Event RenderWindow Widget Event RenderWindow Widget
Grouping widgets on multiple render windows, relieving the application of the responsibility of doing so. Event RenderWindow Widget Event Run PaintbrushExample3, then run PaintbrushExample6 to show that operations may be performed that use run algorithms real-time Event RenderWindow Event Widget WidgetSet Event RenderWindow Widget Event
Similar presentations
© 2024 SlidePlayer.com Inc.
All rights reserved.