Presentation is loading. Please wait.

Presentation is loading. Please wait.

VTK 3D Widgets Karthik Krishnan Will Schroeder Kitware, Inc.

Similar presentations


Presentation on theme: "VTK 3D Widgets Karthik Krishnan Will Schroeder Kitware, Inc."— Presentation transcript:

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 3 Goals Directly interact with data Provide complex, potentially 3D interaction techniques Probing Annotation Measurements

4 4 Interactor styles Everybody has their favorite way of interacting with Data. RenderWindow User Events Interactor Interactor Style Events vtkCamera Actions Render()

5 Object Relationships vtkInteractorObserver vtkInteractorStylevtkAbstractWidget vtkRenderWindowInteractor

6 6 Interactor Styles (contd..)

7 7 Interactor styles (usage) Set the interactor style on the Render Window Interactor vtkInteractorStyleTrackballCamera *style = vtkInteractorStyleTrackballCamera::New(); renderWindowInteractor -> SetInteractorStyle( style );

8 8 VTK Widgets

9 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 10 Visualization pipeline

11 11 vtkRenderWindow Widget User Interaction Events vtkRenderWindowInteractor Widgets are interactive props vtkRenderer Render() Manipulate one or more props Widget Representation

12 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 13 RenderWindow vtkAbstractWidgetvtkWidgetRepresentation (type of vtkProp) Events Renderer Render() Widgets Architecture BehaviorGeometry

14 14 One widget, multiple geometries vtkHandleWidget vtkPointHandleRepresentation2D vtkPointHandleRepresentation3D vtkSphereHandleRepresentation vtkPolygonalHandleRepresentation BehaviorGeometry

15 15 Configurable bindings: Event Translation

16 16 Event Translation Re-configurable keyboard/mouse bindings Example: vtkWidgetEventTranslator *eventTranslator = widget- >GetEventTranslator(); eventTranslator->SetTranslation( vtkCommand::MiddleButtonPressEvent, vtkWidgetEvent::Select ); eventTranslator->SetTranslation( vtkCommand::MiddleButtonReleaseEvent, vtkWidgetEvent::EndSelect );

17 17 Widget Assemblies Create composite widgets from several individual widgets Children listen to events from Parent. Hence parent can alter behavior of child Parent Child RenderWindow Events

18 18 Widget Assemblies Code reuse Component framework: Change behaviour / geometry of Line widget by changing the handle widgets. HandleWidget Line Widget

19 19 Timer support Widgets may respond to timers Hover widget Balloon widget Timer based hover annotations, Popups (text, thumbnails etc).

20 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.

21 21 Various handle representations (geometries) vtkHandleWidget vtkPointHandleRepresentation2D vtkPointHandleRepresentation3D vtkSphereHandleRepresentation vtkPolygonalHandleRepresentation

22 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.) vtkScalarBarWidget vtkSphereWidget

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 (caller); this->Glyph->SetScaleFactor(static_cast (sliderWidget->GetRepresentation())->GetValue()); } vtkSlider2DCallback():Glyph(0) {} vtkGlyph3D *Glyph; };

37 37 vtkPointPlacer

38 38 Widget Sets Grouping widgets on multiple render windows, relieving the application of the responsibility of doing so. RenderWindow Event Widget RenderWindow Event Widget RenderWindow Event Widget WidgetSet Event


Download ppt "VTK 3D Widgets Karthik Krishnan Will Schroeder Kitware, Inc."

Similar presentations


Ads by Google