Difference between revisions of "Qt in Slicer3"
Line 33: | Line 33: | ||
## Extension Modules and DBP Projects: Perk Station, VMTK Vessel Tools, others... | ## Extension Modules and DBP Projects: Perk Station, VMTK Vessel Tools, others... | ||
# Remove KWW from the builds and do a new release. | # Remove KWW from the builds and do a new release. | ||
+ | |||
+ | ==Slicer's KWWidgets-based GUI== | ||
+ | ===Statistics=== | ||
+ | * There are '''3309''' KWWidgets instance in slicer core and modules | ||
+ | * There are '''105''' classes that subclass from KWWidget classes | ||
+ | |||
+ | |||
+ | ''Statistics methods: Calculations based on slicer3 trunk revision 10456 2009-09-10'' | ||
+ | grep -r vtkKW . | grep -v svn | grep New | wc | ||
+ | grep -r vtkKW . | grep -v svn | grep public | wc' | ||
==Considerations and Open Questions== | ==Considerations and Open Questions== |
Revision as of 21:04, 10 September 2009
Home < Qt in Slicer3This page captures the design considerations about moving Slicer3 from KWWidgets to Qt. As of August 2009 there are no concrete plans for a switch; however there is significant momentum around Qt as an open source technology and interest in making it available to the Slicer community.
Contents
Background
When Slicer3 was being designed in 2004 Qt was available only under the GPL license or a commercial (pay) license (See the wikipedia discussion) and neither license option was acceptable to the community. In March 2009 Qt 4.5 was released under the LGPL license and became a possible technology for use in Slicer.
Slicer3 is implemented using KWWidgets which has proven to be extremely capable and robust. However, due to the small size of the developer team for KWWidgets Kitware has been clear that it will not be able to compete with the features being added to Qt and is in fact adopting Qt for many of its internal projects (see, for example, ParaView which migrated to Qt over the past several years).
Experiments
In August of 2009 several members of the slicer development team have been learning about Qt and reviewing options. Things that are currently working:
- Qt and KWWidgets can co-exist in same application environment (in different top level windows).
- Qt widgets interfaces can be assembled using the QtDesigner, C++, or python.
- It is feasible to create slicer widgets that use Qt (e.g. a NodeSelector widget).
Overall the experience has been positive but the experiments have shown that there will be a significant amount of programming work to be done for each part of the interface. Most of the work is probably best characterized as "easy but time consuming". The net result of converting is expected to be positive but it is likely to be several years for there to be a payoff in terms of overall increased developer productivity and improved functionality of the overall package.
Development Plan Option for Transition to Qt
The following is a summary of the work to be done organized in a more-or-less priority order that would allow a transition in-place of functionality from KWW to Qt.
- Configure CPack to include Qt libraries and turn on Qt support by default in nightly builds of slicer
- Create prototype modules built using Qt (these would appear in a distinct top level window from the rest of slicer. The size and position would be under programatic control to make the two interface somewhat unified).
- Migrate the vtkSlicerViewerWidget, vtkSlicerSliceControllerWidget, and vtkSlicerSliceWidget from KWW to Qt. This would allow the right side (2D/3D viewers) of the interface to exist in Qt with the left side (module interfaces) to exist in KWWidgets.
- Migrate interfaces from modules and left side functions into Qt
- the menu bar, tool bar, modules menu, module search and history controls
- the CommandLineModuleGUI (so CLI modules will work in Qt)
- the "Manipulate Slice Views" and "Manipulate 3D View" controls
- Transition other dialogs and modules to Qt
- Add Data, Add Volume, Save, Extension Wizard, Application Settings, Cache & Remote I/O Manager, Tcl/Python Interactors, ErrorLog Dialog, Keyboard Shortcuts...
- Core Modules: Colors, Data, Editor, Fiducials, Measurements, Models, ROI, SlicerWelcome, Slices, Transforms, Volume Rendering, Volumes
- Application Modules: Change Tracker, IA_FEMesh, Qdec, FetchMI, Query Atlas, AC/PC Transform, ModelMirror, EMSegment, LabelStatistics, Tractography, Fiber Bundles, NeuroNav, OpenIGTLink IF, ProstateNav, Clip Model, Extract Subvolume ROI, 4D Volume, 4D Analysis.
- Extension Modules and DBP Projects: Perk Station, VMTK Vessel Tools, others...
- Remove KWW from the builds and do a new release.
Slicer's KWWidgets-based GUI
Statistics
- There are 3309 KWWidgets instance in slicer core and modules
- There are 105 classes that subclass from KWWidget classes
Statistics methods: Calculations based on slicer3 trunk revision 10456 2009-09-10
grep -r vtkKW . | grep -v svn | grep New | wc grep -r vtkKW . | grep -v svn | grep public | wc'
Considerations and Open Questions
- Coding styles and conventions for classes that interface vtk and Qt
- inheritance
- memory management
- a significant number of higher level Qt widgets are required (Ranges, Extents, TransferFunctionEditors, Material Properties...)
- Work needs to be coordinated among developers at multiple sites. Significant face-to-face time should be planned to keep everyone in sync on the progress.
- It will be inevitable that revisiting some modules will involve redesign and feature improvements even if our focus is specifically on swapping the GUI.
- Difficult bugs will occur somewhere along the process even if the plan appears smooth.
- We should consider training courses or conferences to get us up to speed on best practices for development. (http://www.ics.com/QuickStart/, http://qt.nokia.com/qtdevdays2009)
- What larger design re-works should be considered at the same time? I.e. should slicer functionality be re-organized as python packages so we can get away from the monolithic application attributes of the current main program (without a reduction in functionality or usability).
Development Approaches / Tradeoffs
Several development approaches could be taken each of which has pros/cons and risks.
- Immediate rewrite: this approach would be to start a from scratch to build a new GUI using Qt. Pros: likely to result in a cleaner architecture. Cons: all progress stops until new version is ready; current slicer developers are not Qt experts so not ready to build complex application from scratch; Qt does not have all the needed widgets to implement slicer (they need to be built along side slicer).
- Wait and see: wait until Qt more 3rd party widgets fill in the missing functionality and then do the rewrite. Cons: any new GUI development in the old framework will seem like a dead end. Pros: the current framework isn't really broken so why change?
- Peaceful coexistence: allow both GUI frameworks to be used together and allow people to develop in whichever is most productive for them. Cons: extra dependencies and potential maintenance issues; may require duplicated code; still need to resolve the architecture issues for mixing vtk and qt. Pros: removes pressure to do instant port; allows developers to get good at Qt before undertaking a big porting effort; allows development of 3rd party widgets that will make future ports easier.