CLI Module - National Alliance for Medical Image Computing

advertisement
NA-MIC
National Alliance for Medical Image Computing
http://na-mic.org
Slicer4 CLI
Slicer Execution Model
Variety of levels of integration
Slicer Libs
•
•
•
•
Slicer Base
• Application logic
• Widgets
Common infrastructure for Slicer
applications
Built in modules
•
•
•
•
Slice viewers
Models
Fiducials
Transforms
Full access to Slicer internals
Loadable modules
•
•
•
•
•
Query Atlas
QDEC
Volume rendering
ChangeTracker
EMSegment
Full access to Slicer internals
Scripted modules
• Editor
• Teem Two Tensor Tractography
• VMTK
Limited access to Slicer internals
Command line modules
• Registration
Restricted access to Slicer internals
Daemon
• OpenIGTLink
• Stochastic Tractography
Access to MRML
ModuleDescriptionParser
GenerateCLP
vtkITK
MRML
National Alliance for Medical Image Computing
http://na-mic.org
Non-slicer specific support libraries
What is a CLI Module?
• Simplest mechanism to contribute an algorithm to Slicer
• Plugin mechanism
• Command line paradigm
– Plugins are called with (argc, argv)
– Arguments are flags, flags with values, or just indexed on the
command line
• CLI modules are self describing
– ./myplugin –xml
– Produces an XML description of the parameters for the plugin
• CLI modules can be executables, shared libraries, or
scripts
• CLI modules can be used within Slicer or in batch
National Alliance for Medical Image Computing
http://na-mic.org
XML description of a module…
National Alliance for Medical Image Computing
http://na-mic.org
… produces a user interface
National Alliance for Medical Image Computing
http://na-mic.org
… produces command line
parsing code
National Alliance for Medical Image Computing
http://na-mic.org
MRML magic
If built as a shared
library, these calls
will pull data directly
from the MRML
scene!
National Alliance for Medical Image Computing
http://na-mic.org
Inside Slicer…
Slicer provided
Module writer provided
vtkMRMLCommandLine
ModuleNode
qSlicerCLIModule
Widget
qSlicerCLIModule
UIHelper
YourModule.xml
•<image>
•<geometry>
•<integer>
•<double>
•<file>
YourModule.so
•XMLModuleDescription
•GetXMLModuleDescription()
•ModelEntryPoint()
vtkSlicerCLIModule
Logic
or
YourModule (exe)
•YourModule –xml
National Alliance for Medical Image Computing
http://na-mic.org
or
YourModule.py
•XML
•def toXML()
•def Execute()
CLI Build System (within Slicer tree)
One CLI, one directory
CMakeList.txt
National Alliance for Medical Image Computing
http://na-mic.org
CLI Build System (as Slicer Extension)
National Alliance for Medical Image Computing
http://na-mic.org
What can SEM/CLI do today?
•
•
•
•
•
•
•
•
•
Modules can be executables, shared libraries, scripts
Module “interface” defined through parameters
Parameters include “simple” and “bulk” types
Parameters passed through command line and files
Modules can be run inside and outside of 3D Slicer
Modules can report progress
Modules can be aborted
Modules are run in a separate processing thread
User interface built automatically from the parameter
descriptions
• Modules can be re-used easily from Python, harder to reuse in C++
National Alliance for Medical Image Computing
http://na-mic.org
What CAN’T SEM/CLI do today
•
•
•
•
•
•
•
•
Pass back intermediate results
Update the 3D Visualization/Slice Viewers while executing
Accept input while running to steer the module
Request input while running
Automatically execute with changes in MRML
Orchestrate a change in layout or visualization content
Easily use collections of Modules in a workflow or wizard
Call a SEM/CLI from a SEM/CLI
National Alliance for Medical Image Computing
http://na-mic.org
Download