Title: Slicer 3'4 Update
1Slicer 3.4 Update
- Summer NA-MIC Project Week 2009
- Steve Pieper, Ph.D.
2Topics
- Slicer 3.4 Development Highlights
- Modules and Extensions
- Extensions and You
3Slicer Goals
- Stable, Usable, Cross Platform, End-User Software
for Medical Image Analysis - 3D Slicer Role in NA-MIC and NCIGT
- Translation Platform to Deliver Medical Computing
Technology to DBP Researchers - Provide Reference Implementation using NA-MIC Kit
(End-to-End Open Source) - Outreach to New Applications
- First Slicer3 svn commit January 26, 2006
4Progress Since Jan 2009
- Numbers Jan 2009
- Subversion Commits 8,317
- Lines of Code 735,536
- Bugs Features
- 239 Submitted
- 129 Fixed
- Active Developers 53
- 3D Slicer Version 3.2
- Released August 8, 2008
- Numbers June 2009
- Subversion Commits 9,732 (1,415)
- Lines of Code 791,101
- Bugs Features
- 605 Submitted
- 323 Fixed
- Active Developers 59
- 3D Slicer Version 3.4
- Released May 2009
find . -iname \.h -o -iname \.cxx -o -iname
\.tcl -o -iname \.java -o -name \.py grep -v
svn xargs wc (does not include libraries or
modules in external repositories) svn log
grep "r" cut -d " " -f 3 sort uniq wc
5Whats New in 3.4
- Many fixes in performance, usability,
functionality - Editor, CompareView, Diffusion Tools, Load/Save,
Welcome Module, Fiducials, FetchMI (XNAT
interface) - New Modules
- Change Tracker (Tumor Metrics), IA_FEMesh
(Meshing), OpenIGTLink (Image Guided Therapy),
RegisterImages, Stochastic Tractograpy - New Infrastructure
- Python in Binary Distributions (More from Demian
at 11) - Extension Modules
6How Modules Should Work
- Slicer 3.4 is a Stable Base for Many Medical
Image Computing Apps - Core File I/O, Visualization, Interface
- Tutorials and Other Resources to Get New Users Up
to Speed - Developers of New Techniques can Draw on the
NA-MIC Kit to Implement Compatible Modules - Consistent Framework for Deployment and User
Interface - Several Styles of Development to Meet Varied
Requirements - Next Few Slides are Updated from Jims January
Presentation on Module Types
7Integrating with Slicer3
8Slicer3 data model
Provided by D. Gering
Provided by R. Kikinis
9Slicer3 Observer MVC Pattern
- MRML (Model)
- For Scene Description and Application State
- MRML Nodes are Persistent and Undoable
- Scene and Nodes are Observable
- Logic Encapsulate VTK and ITK Pipelines
(Controller) - Observe MRML to Configure Pipelines
- Help Create/Manage Nodes
- No UI Components (no Widgets, Actors, Mappers,
Renderers or RenderWindows) - GUI (View)
- Observe and Edit MRML
- Interact with User and Display Hardware
- Modules Should Follow Same Conventions
GUI
Widgets
Renderers
Edit
Observe
Logic
Observe
Edit
Observe
Edit
MRML Nodes
Observe means generic event mechanisms are
used to pass information. Edit means code can
directly call methods. Example GUI can call
methods in Logic classes,but Logic cannot call
GUI methods. MRML cannot call Logic or GUI
methods. There can be many observers for any
event.
10Variety of levels of integration
11Base Features vs. Modules
12Each module has
an entry in the module menu
a panel of user interface controls
13Module Terminology
- Built-In Modules
- Few Core Features Linked to Slicer3.cxx
- Non-Core Modules becoming Loadable
- Loadable Modules
- Dynamically Discovered and Loaded
- Can Access Applications MRML Scene Instance and
Call SlicerBaseGUI and Related APIs
(vtkRendering, KWWidgets) - Scripted Modules
- Like Loadable, but Written in Tcl or Python
- Command Line Modules
- Can Run as Stand Alone Executables
- Provide Standard Command Line Parsing, which
Allows Slicer to Generate GUI Automatically - Can be Compiled as Shared Library for Dynamic
Link to Slicer
14Built in module
vtkMRMLNode.h
vtkSlicerModuleGUI.h
vtkSlicerModuleLogic.h
- vtkSlicerYourModuleGUI.h
- BuildGUI()
- ProcessGUIEvents()
- ProcessLogicEvents()
- ProcessMRMLEvents()
- vtkMRMLYourModuleNode.h
- GetNodeTagName()
- Copy()
- ReadXMLAttributes()
- WriteXML()
- vtkSlicerYourModuleLogic.h
- ProcessMRMLEvents()
- ProcessLogicEvents()
15Loadable Modules
- http//www.slicer.org/slicerWiki/index.php/Slicer3
How_to_implement_an_Interactive_Module_GUI - http//www.slicer.org/slicerWiki/index.php/Slicer3
Loadable_ModulesHOWTO - Create vtkSlicerModuleGUI Subclass
- Override Virtual Methods for CreateGUI,
ProcessMRMLEvents, etc. - Provide Custom vtkMRMLNode Subclass(es) to
Represent, Save and Restore state - Create Logic Classes to Implement Module
Functionality - Create CMake Configuration Files to Build and
Install Shared Libraries for Runtime Discovery
and Packaging
16Loadable module
vtkMRMLNode.h
vtkSlicerModuleGUI.h
vtkSlicerModuleLogic.h
- vtkSlicerYourModuleGUI.h
- BuildGUI()
- ProcessGUIEvents()
- ProcessLogicEvents()
- ProcessMRMLEvents()
- vtkMRMLYourModuleNode.h
- GetNodeTagName()
- Copy()
- ReadXMLAttributes()
- WriteXML()
- vtkSlicerYourModuleLogic.h
- ProcessMRMLEvents()
- ProcessLogicEvents()
- YourModule.so
- GetLoadableModuleDescription()
- GetLoadableModuleLogic()
- GetLoadableModuleGUI()
17Scripted Modules
- A Generic ScriptedModule Module Provides Mapping
of C Method Entry Points to a Corresponding
Naming Convention for Scripts - vtkMRMLScriptedModuleNode, vtkSlicerScriptedModule
Logic, vtkSlicerScriptedModuleGUI - Scripts are Dynamically Discovered at Runtime
- A Generic ScriptedModuleNode Allows Save/Restore
of Keyword / Value Pairs to Represent Module
State - Full API of Slicer, MRML, KWWidgets, VTK,
available (except where not wrappable these APIs
have been designed for scriptability) - Editor is extensive Tcl-based Module
- Several Python examples are included in current
svn trunk - Python modules can also access Numpy routines for
Numerical processing (Volumes and other
DataArrays are directly mapped to Numpy arrays
for easy manipulation)
18Tcl scripted module
vtkMRMLScriptedModuleNode.h
vtkSlicerScriptedModuleGUI.h
vtkSlicerScriptedModuleLogic.h
YourModuleNode.tcl
- YourModuleGUI.tcl
- proc YourModuleBuildGUI
- proc YourModuleProcessGUIEvents
- proc YourModuleProcessLogicEvents
- proc YourModuleProcessLogicEvents
YourModuleLogic.tcl
- YourModule.tcl
- package provide YourModule x.y
19Python scripted module
vtkMRMLScriptedModuleNode.h
vtkSlicerScriptedModuleGUI.h
vtkSlicerScriptedModuleLogic.h
- YourModuleGUI.py
- def BuildGUI()
- def ProcessGUIEvents()
- def ProcessLogicEvents()
- def ProcessLogicEvents()
- YourModuleNode.py
- Optional State Management
- YourModuleLogic.py
- Optional Helper Code
20Command Line Modules
- Use the GenerateCLP command (provided with
Slicer) to convert XML description of program
arguments into a C .h file - Main program of module uses PARSE_ARGS macro
provided by .h file to instance variables
corresponding to parameters defined in XML file - PARSE_ARGS also defines a --xml argument that
returns original XML string on stdout - Slicer parses the XML to create GUI for each
module - Are Covered Extensively in the HelloWorld
Tutorial - Note Command Line Modules can be written in any
language. C utilities are provided, but can be
emulated / recreated as needed.
21Command line module
vtkMRMLCommandLineModuleNode.h
vtkCommandLineModuleGUI.h
vtkCommandLineModuleLogic.h
- YourModule.xml
- ltimagegt
- ltgeometrygt
- ltintegergt
- ltdoublegt
- ltfilegt
- YourModule.py
- XML
- def toXML()
- def Execute()
- YourModule (exe)
- YourModule xml
- YourModule.so
- XMLModuleDescription
- GetXMLModuleDescription()
- ModelEntryPoint()
or
or
22All modules are created equal
an entry in the module menu
a panel of user interface controls
23Daemons
YourTool (exernal process such as MATLAB)
slicerget.tcl name gt image.nrrd
SlicerDaemon
cat image.nrrd slicerput.tcl name
YourTool (exernal process such as Tracker or
Scanner)
OpenIGTLink Protocol
OpenIGTLinkIF
24Variety of levels of integration
25Extension Goals
- Keep the base package lean and mean
- Modules have individual identity
- Per-module web site, svn, downloads, mailing
lists, wiki - Allow users to assemble their own set of tools
- Customized Bundles by task or application
- Easy to download compatible extensions
- Analogous to Firefox extensions
- Integrate extension builds into
developer/nightly/release process - NITRC Supplement to NA-MIC helping to pay for
needed infrastructure (Neuroimaging Informatics
Tools and Resources Clearinghouse) - NITRC can host neuroimaging projects (gforge
implementation) - Other repositories can also be used
- NAMICSandBox, Institutions svn, Google Code, etc
26Extension Management Wizard
Under development
27NITRC
http//www.nitrc.org/projects/slicer3examples/ Sam
ple Code for CommandLine, Loadable, and Scripted
Extension Modules
28Extension Process
- Write your module following the examples on
nitrc.org - Create .s3ext description file
- http//viewvc.slicer.org/viewcvs.cgi/trunk/Extensi
ons/ - Svn path, dependencies, homepage, category,
status, description - Nightly builds create compatible sets of
extension binaries that correspond to the slicer
builds (windows, linux, mac) - Correct lib versions, compiler versions, etc
- Users can install from Extension Manager
29Next Steps
- Work with Terry, Katie, and me to get your code
working as an extension - We will be integrating the .s3ext files to the
Slicer 3.4 branch and enabling nightly builds of
your modules - Please give feedback - we will be refining this
process based on experience (3.4 patch releases
if needed)