Documentation/CLI Support in CTK: Difference between revisions
Line 95: | Line 95: | ||
* Rename ctkCmdLineModule* into ctkCommandLineModule* | * Rename ctkCmdLineModule* into ctkCommandLineModule* | ||
* Command Line XML designer tool | * Command Line XML designer tool | ||
** Left side: | ** Left side: XML editor, right side: generated GUI to give immediate feedback from XML |
Revision as of 17:56, 9 July 2012
Home < Documentation < CLI Support in CTKThis page is a working draft and does not contain final information.
Command Line Interface (CLI) support in CTK will primarly focus on providing an API for working with existing CLI modules. Providing utiltities and tools for creating CLI modules from scratch is a desired addition but there are no concrete plans for this yet.
Experimental Code
Some experimental code can be found here:
https://github.com/commontk/CTK/tree/cli-module-support
Enable the following CMake options to be able to play with the code:
- BUILD_TESTING (for creating CLI test modules)
- CTK_APP_ctkCommandLineModuleExplorer (small program allowing you to test-drive CLI modules using the CTK CLI module API)
- CTK_BUILD_QTDESIGNER_PLUGINS (needed by the ctkCLIPluginExplorer to create a Qt GUI from the generated .ui files at runtime)
- CTK_LIB_CommandLineModules (the CTK library providing the CLI module API)
- CTK_LIB_Widgets (used by the ctkCLIPluginExplorer to create a Qt GUI for the CLI module from the .ui file)
API Design
Overview of some central classes and their scope:
ctkCmdLineModuleDescription
C++ API for accessing the command line arguments meta-data defined in the XML description.
This class is read-only.
ctkCmdLineModuleReference
A handle to a command line module.
- Get ctkCmdLineModuleDescription class
- Convenient meta-data access (module location etc.)
- Used to get actual ctkCmdLineModuleInstance instances from ctkCmdLineModuleManager
ctkCmdLineModuleInstance
Represents an invokable command line module and its current parameter values.
Multiple instances for the same ModuleReference may exist.
- Set/Get individual parameter values or all at once
- Reset to default parameters
- Run/Abort
- Status
- Progress reporting
- Get GUI representation (QObject*)
- Get parameter value change notifications
ctkCmdLineModuleManager
Responsible for instantiating other ctkCmdLineModule* classes.
- Register factory for customizing GUI generation
- Register/Unregister modules
- Get ctkCmdLineModuleReference objects
- Create/List ModuleInstance objects
Customizability
- Use parameters for the default XSLT file to customize widget class names for argument types
- Use your own XSLT file for custom transformations of XML to UI
- Use your own QUILoader to control instantiation of certain widget types
General
- Use a custom factory to create your own GUI based on a ctkCmdLineModuleDescription instance.
Boston Hackfest Work Items
First Step
- Improve XSD validation file
- Fixup existing Slicer CLI
- Add support for hidden parameters
- Suggestion: Just map hidden attribute with "visible" property ?
- Add support for application specific parameters
- Suggestion: via a <generic>, <custom>, <application>, <advanced>... element ?
- Synchronize between QtGUI and ctkCmdLineModuleDescription
- Add support to "restore defaults"
- Slicer integration ( Julien )
- Use CTK mechanism
- Derive QUILoader for custom qMRMLWidgets initialization (setMRMLScene)
- Customize XSL file
Future work
- Progress Report
- Suggestion: Using QFuture
- Rename ctkCmdLineModule* into ctkCommandLineModule*
- Command Line XML designer tool
- Left side: XML editor, right side: generated GUI to give immediate feedback from XML