2011_Summer-Slicer4 - National Alliance for Medical Image

advertisement
NA-MIC
National Alliance for Medical Image Computing
http://na-mic.org
Slicer4
Guided Tour
Steve Pieper, Ph.D.
Goals
• Understanding the Lay of the Land
• Developing our Common Language
• Highlighting the Points of Interest
http://www.slicer.org/slicerWiki/index.php/Slicer4
National Alliance for Medical Image Computing
http://na-mic.org
The Big Picture
• Model / View / Controller Style
– MRML / GUI / Logic
• Rules:
– MRML: Things that get loaded with a
scene file.
– GUI: Things that depend on a display.
– Logic: Things that operate on MRML.
National Alliance for Medical Image Computing
http://na-mic.org
Overview
National Alliance for Medical Image Computing
http://na-mic.org
MRML Concepts: Nodes
• Data Containers and Data Helpers
– XML (De)Serializable
– Issue Events when Changed
– Have Pointers to Bulk Data
• E.g. vtkImageData, vtkPolyData…
• Have Unique IDs
• Exist in only one MRML Scene
– One MRML Scene for the Application
National Alliance for Medical Image Computing
http://na-mic.org
Coordinate Systems
• Interface Works in Millimeters,
Patient Space
• Volume Nodes have IJKToRAS
– IJK is Index Space of Image
– RAS is Right/Anterior/Superior
• vtkImageData is pixel container with
origin 0,0,0 and spacing 1,1,1
• Annotations, PolyData are RAS mm
http://www.slicer.org/slicerWiki/index.php/Coordinate_systems
National Alliance for Medical Image Computing
http://na-mic.org
MRML: Storable
• Storable Nodes Reference Storage
Nodes
• Storage Nodes: Bulk Data I/O
• Storage Nodes allow RemoteIO
(URL access to Bulk Data)
– HTTP download supported now
– Upload handlers still experimental
– Scene files can contain URLs
National Alliance for Medical Image Computing
http://na-mic.org
MRML: Displayable
• Has List of Display Nodes
– Tagged by ViewNode IDs: each display
node on/off in each view
– E.g. FiberBundles with Lines + Glyphs
• DisplayNode has Parameters and
Pipelines to Implement Visualization
of Displayable
National Alliance for Medical Image Computing
http://na-mic.org
MRML Transformable
• Has Reference to TransformNode
defining Transform To Parent
• Transforms are RAS to RAS
• Linear Transforms are Handled Onthe-fly
• Non-Linear Transforms must be
applied using modules
National Alliance for Medical Image Computing
http://na-mic.org
MRML: Hierarchies
• Grouping Concept Independent of
Transform Hierarchy
– E.g. Vascular Tree Levels of Detail
• In Slicer3, Parent Model Display
Parameters Override when
Collapsed
• In Slicer4, Plans to Use Hierarchies
for Time Series, DICOM, etc.
National Alliance for Medical Image Computing
http://na-mic.org
MRML: SceneViews
• (Were SceneSnapShots in Slicer3)
• Retains State of MRML Nodes
– Included in MRML Scene File
– Optional Image and Text Description
• Bulk Data Not Copied
– Load all Bulk Data Before Making
SceneViews
– Use Visibility to Control what is Shown
National Alliance for Medical Image Computing
http://na-mic.org
Module GUIs
• qSlicerAbstractModuleWidget
subclasses (are QWidgets)
• setup()
• enter()
• exit()
• Are MRMLNode Editors
– Synchronize MRML Events
to/from Widgets
National Alliance for Medical Image Computing
http://na-mic.org
Modules
• Slicer Loadable Modules
– Shared Libraries Discovered at RunTime
– Can use Qt, MRML, VTK, ITK, Teem,
etc.
– Best Choice for Full Control,
Interactivity, Optimized Computation
• Requires Familiarity with C++ APIs
National Alliance for Medical Image Computing
http://na-mic.org
Command Line Interface
(CLI) Modules
• Just Like Slicer3
• Any Executable that Works with –xml
can be used (even via wrapper
scripts)
• Shared Library CLI for Better
Performance
• No Slicer API Knowledge Required
• Interface is Consistent, but Limited
National Alliance for Medical Image Computing
http://na-mic.org
Scripted Modules
• Most of Qt, VTK, Slicer API Exposed
– Only Python Supported
– Tcl Legacy Mode to Ease Transition
• Very Rapid Development Iterations
• Requires Some Familiarity with APIs
• More about Slicer4 Python Later…
National Alliance for Medical Image Computing
http://na-mic.org
Extensions
• Any Module Type can be an
Extension
• Optional User Install
– Built to Match Slicer Version
– Network Download from within Slicer
• NA-MIC DBPs, Collaborations are
Expected to Deliver Extensions
• Extension Writing Tutorial Later…
National Alliance for Medical Image Computing
http://na-mic.org
Slicer4 Views
• LayoutNode Defines Interface
• Layout Manager Creates View
Widget Instances to Match Layout
• ViewNodes Describe 3D Views
• SliceNodes + SliceCompositeNodes
Describe 2D Slice Views
National Alliance for Medical Image Computing
http://na-mic.org
DisplayableManagers
• DisplaybleManagers Link
DisplayableNodes to VTK
Actors/Mappers/Props/Widgets
– Must Synchronize Events from Either
Source (like Module GUIs)
• Modules Can Register
DisplayableManagers with Factory
– DisplayableManagers are Instanced as
Views are Created
National Alliance for Medical Image Computing
http://na-mic.org
Overview Revisited
National Alliance for Medical Image Computing
http://na-mic.org
Functional Decomposition
• Reusable Components with Only Needed
Dependencies
–
–
–
–
–
CTK for Non-Slicer-Specific Qt+DICOM (+VTK)
Reusable MRML: MRMLLogic, qMRMLWidgets
Module Support: SlicerExecutionModel, QTCLI
Slicer: QTCore, QTGUI
Modules: QTCoreModules, QTModules,
QTScriptedModules
• Extensions
National Alliance for Medical Image Computing
http://na-mic.org
DICOM Interface
• Slicer3
– File Based, Limited Write
– Special Purpose Converters (e.g. DWI)
• Slicer4 (in Development)
– Networking and Database (Q/R, Store)
– Ron’s “Lollipop” Model (MRMLScene in
Private Tags)
• Community Input Needed
National Alliance for Medical Image Computing
http://na-mic.org
Collaborating Groups
• CTK, DCMTK, ITKv4, VTK, CMake,
Python, Qt…
• “SuperBuild Philosophy”
– Slicer Organization on github.com
• patched versions as needed
– Edits “Belonging” in Package Go in git
– Avoid Workarounds/Duplicates in Slicer
National Alliance for Medical Image Computing
http://na-mic.org
svn and git
• http://svn.slicer.org/Slicer4/trunk
– For Nightly builds, releases,
collaboration
• http://www.slicer.org/slicerWiki/index.
php/Slicer:git-svn
– Developers can choose to use git for
topic branches
• Extensions can use git/svn/cvs
National Alliance for Medical Image Computing
http://na-mic.org
Coding Conventions
• http://www.slicer.org/slicerWiki/index.
php/Slicer:Style_and_Conventions
– Use Style of Parent Class
• VTK Classes use VTK Style
• Qt Classes use Qt Style
• Python Code uses Python Style
– Comments and Testing
– Communicate with your Colleagues
National Alliance for Medical Image Computing
http://na-mic.org
Python in Slicer4
•
•
•
•
•
•
•
Scripted Modules as Slicelets
Python Console
PythonQt
Slicer in External Python
.slicerrc.py
Python testing
Scripted Access to Modules
National Alliance for Medical Image Computing
http://na-mic.org
Slicer4: What Works (mostly)
•
•
•
•
•
•
•
•
•
•
•
Main GUI, Toolbars, Menus
Scene/Data Load/Save
Slice and 3D Visualization (pan/zoom, overlays, models…)
Command Line Modules
Python Wrapping, Python Scripted Modules
Loadable Modules
Editor
Annotations (Evolution of Fiducials and Measurements)
Nightly Builds
Volume Rendering
Many things…
National Alliance for Medical Image Computing
http://na-mic.org
Slicer4: What’s Missing
•
•
•
•
•
Some Core Modules Need Work
Hierarchies Need Elaboration
IGT Modules
Performance Optimization
Your Extensions!
Please help identify what is needed to support your work.
National Alliance for Medical Image Computing
http://na-mic.org
Developer Decision Tree
• Working on the Slicer Core?
– Focus on Qt Transition
• Working on a Module?
– Build it as an Extension
Just use Slicer4 for
New Projects
• Command Line Module?
– Develop and Test with Slicer3.6 or Slicer4
• GUI Project with Deadlines in early 2011?
– Develop with KWWidgets for 3.6.X
– Keep your Logic and MRML Distinct from the GUI
– Ongoing Support will be Provided
• Longer-Term Project that Needs a Custom GUI?
– Start working with developer builds of Slicer4
– Talk with dev team about any key missing features
– Consider doing some or all coding in Python
National Alliance for Medical Image Computing
http://na-mic.org
Implementation Strategies
• Non-Interactive Algorithm
– Write ITK Class
– Use Slicer Execution Model
– Add as Extension
• Interactive Segmentation
– Add Effect to Editor Module
– Add as Extension (coming soon)
• Custom GUI?
– Loadable Module
National Alliance for Medical Image Computing
http://na-mic.org
Download