Sebastien BARRE, Ph.D. / NA-MIC Programmers - PowerPoint PPT Presentation

1 / 21
About This Presentation
Title:

Sebastien BARRE, Ph.D. / NA-MIC Programmers

Description:

Over 100 C classes used by Kitware to develop complete open ... cb- SetCommand(NULL, '.myframe config bg #223344'); app- Script('pack %s', cb- GetWidgetName ... – PowerPoint PPT presentation

Number of Views:16
Avg rating:3.0/5.0
Slides: 22
Provided by: nam45
Category:

less

Transcript and Presenter's Notes

Title: Sebastien BARRE, Ph.D. / NA-MIC Programmers


1
Sebastien BARRE, Ph.D. / NA-MIC Programmers Week
2005
2
What is KWWidgets ?
  • A GUI toolkit
  • Cross-platform
  • Open-license
  • Free

3
What is KWWidgets ?
  • A GUI toolkit that provides low-level and
    high-level visualization-oriented widgets

Vs.
4
What is KWWidgets ?
  • Over 100 C classes used by Kitware to develop
    complete open-source and commercial end-user
    applications for more than 7 years

5
What is KWWidgets ?
6
What is KWWidgets ?
7
What is KWWidgets ?
8
Features
  • Object-oriented C layer on top of Tcl/Tk
  • Inherit from the VTK coding framework

checkbutton .cb1 .cb1 config -text "A
checkbutton" .cb1 deselect pack .cb1
vtkKWCheckButton cb1 vtkKWCheckButtonNew() c
b1-gtSetParent(parent) cb1-gtCreate(app) cb1-gtSet
Text("A checkbutton") cb1-gtDeSelect() app-gtScr
ipt("pack s", cb1-gtGetWidgetName())
9
Features
  • Can interact with Tcl/Tk from C

app-gtScript("frame .myframe") app-gtScript("pack
.myframe") vtkKWWidget myframe
vtkKWWidgetNew() myframe-gtSetWidgetName(".myfra
me") myframe-gtSetBackgroundColor(0.2, 0.5,
0.8) vtkKWCheckButton cb vtkKWCheckButtonNe
w() cb-gtSetParent(myframe) cb-gtCreate(app) cb-gt
SetCommand(NULL, ".myframe config bg
223344") app-gtScript("pack s",
cb-gtGetWidgetName())
10
Features
  • Can interact and co-exist with Tcl/Tk directly
    from Tcl/Tk or Slicer
  • Wrapped into a Tcl package just like VTK/ITK
  • Fast-prototyping

11
Features
vtkKWCheckButton cb1 vtkKWCheckButtonNew()
cb1-gtSetParent(parent) cb1-gtCreate(app) cb1-gtS
etText("A checkbutton") cb1-gtDeSelect() app-gtS
cript("pack s", cb1-gtGetWidgetName())
package require kwwidgets vtkKWCheckButton
cb1 cb1 SetParent parent cb1 Create app cb1
SetText "A checkbutton" cb1 DeSelect pack cb1
GetWidgetName button .b -text "My
Button" pack .b
12
Features
  • Testable
  • Use CMake/CTest/Dashboard framework
  • Trace framework

13
Overview
  • Core widgets
  • Composite widgets
  • VTK widgets
  • Helper classes

14
Overview
  • Core widgets

vtkKWCanvas vtkKWCheckButton vtkKWEntry
vtkKWFrame vtkKWLabel vtkKWListBox vtkKWMenu
vtkKWOptionMenu vtkKWPushButton
vtkKWRadioButton vtkKWScale vtkKWScrollbar
vtkKWText vtkKWThumbWheel vtkKWTopLevel
vtkKWTree
15
Overview
  • Composite widgets

vtkKWChangeColorButton vtkKWDialog
vtkKWExtent vtkKWListBoxToListBoxSelectionEditor
vtkKWHSVColorSelector vtkKWNotebook
vtkKWProgressGauge vtkKWRange
vtkKWSelectionFrame vtkKWSelectionFrameLayoutMan
ager vtkKWSplashScreen vtkKWSplitFrame
vtkKWTclInteractor vtkKWToolbar
vtkKWToolbarSet vtkKWUserInterfaceManager vtkKWUs
erInterfacePanel vtkKWWidgetSet vtkKWWidgetWithSc
rollbars vtkKWWindow
16
Overview
  • VTK widgets

vtkKWColorPresetSelector vtkKWColorTransferFuncti
onEditor vtkKWCornerAnnotationEditor
vtkKWHeaderAnnotationEditor vtkKWPiecewiseFuncti
onEditor vtkKWRenderWidget vtkKWScalarBarAnnotat
ion vtkKWScalarComponentSelectionWidget
vtkKWTextPropertyEditor vtkKWVolumeMaterialPrope
rtyWidget vtkKWVolumePropertyWidget
17
Overview
  • Helper classes

vtkKWApplication (init Tcl, event loop, windows,
version, registry, splashscreen, help/about,
email, updates) vtkKWBalloonHelpManager vtkKWDragA
ndDropTargetSet vtkKWEventMap vtkKWHistogram
vtkKWHistogramSet vtkKWIcon vtkKWMostRecentFile
sManager vtkKWRegistryHelper vtkKWResourceUtilit
ies vtkKWTkOptions vtkKWTkUtilities
18
Examples
  • A simple image viewer using KWWidgets and VTK

19
Examples
package require kwwidgets vtkKWApplication app
app RestoreApplicationSettingsFromRegistry app
SetHelpDialogStartingPage \
"http//public.kitware.com/KWWidgets" vtkKWWindow
Base win win SupportHelpOn app AddWindow win
win Create app vtkKWRenderWidget rw rw
SetParent win GetViewFrame rw Create app rw
CornerAnnotationVisibilityOn pack rw
GetWidgetName -side top -expand y -fill both \
-padx 0 -pady 0 vtkXMLImageDataReader reader
reader SetFileName "head100x100x47.vti" vtkImageV
iewer2 viewer viewer SetRenderWindow rw
GetRenderWindow viewer SetRenderer rw
GetRenderer viewer SetInput reader
GetOutput vtkRenderWindowInteractor iren
viewer SetupInteractor iren rw ResetCamera
set ca rw GetCornerAnnotation ca
SetImageActor viewer GetImageActor ca
SetWindowLevel viewer GetWindowLevel ca
SetText 2 "ltslicegt" ca SetText 3
"ltwindowgt\nltlevelgt" vtkKWScale slice_scale
slice_scale SetParent win GetViewFrame
slice_scale Create app slice_scale SetRange \
viewer GetWholeZMin viewer GetWholeZMax
slice_scale SetValue viewer GetZSlice
slice_scale SetCommand "" \ viewer SetZSlice
slice_scale GetValue rw Render pack
slice_scale GetWidgetName -side top -expand n
\ -fill x -padx 2 -pady 2 app Start rw
Delete reader Delete viewer Delete iren
Delete slice_scale Delete win Delete app Delete
20
Examples
  • KWWidgetsTour
  • Show all widgets
  • Provide Tcl vs. C code comparison

21
Documentation
  • Web http//public.kitware.com/KWWidgets
  • Wiki http//public.kitware.com/Wiki/KWWidgets
  • API http//public.kitware.com/KWWidgets/doc/night
    ly/html
  • Tutorial and examples available in the source
  • cvs d pserveranonymous_at_public.kitware.com/cvs
    root/KWWidgets co KWWidgets
  • Thank you. Give it a try !
Write a Comment
User Comments (0)
About PowerShow.com