national alliance for medical image computing slicer3 architecture
TRANSCRIPT
National Alliance for Medical Image Computing http://na-mic.org
Slicer3 Architecture
National Alliance for Medical Image Computing http://na-mic.org
ScientistDesktop
NA-MIC Architecture
Algorithms ITK
VTK
SlicerModules
ExperimentControl
Workstation /Cluster /
Grid
Slicer 3.0
Python/TclMATLAB…
ExecutionModel
DatabasesLocal / BIRN
DataAcquisition
ExperimentResults
QueryPlot
Visualize
National Alliance for Medical Image Computing http://na-mic.org
Slicer3 “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
Logic
MRML Nodes
GUI
Widgets Renderers
EditObserve
Observe
Observe
Edit
Edit
“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.
MRML
BaseLogic
Links to: ITK
MRMLVTK (except Rendering)
GUILinks to:
VTK RenderingKWWidgets
LogicMRML
Observe ModifiedEvents
Edit Mrml Scene/Nodes
Mediators
Interactive ModuleLogic
Links to: Base Logic
ITKMRML
VTK (except Rendering)
GUILinks to:
VTK RenderingKWWidgets
LogicMRML
Mediators
Observe ModifiedEvents on ApplicationState
Edit Mrml Scene/Nodes
•Registers GUI Event Observers
Observe ModifiedEvents
Provides •Frames for Widgets,•Routing of User Events
CommandLineModule
LogicLinks to:
Base Logic,MRML
GUILinks to:
KWWidgets Mediators
Execution Model Modules• build as executables
or shared libraries• support –xml query
(Managed by Base and communicateslike other Modules)
Describe Input options (uses--xml option)
Formulates Command Lineand passes data
Back-door to MRML with MRMLIDImageIOITK IO Factory Library(Otherwise through files,command line options)
Slicer 3 Architecture Diagram (updated 2007-01-09)
Auto-Generated GUIs from XML Descriptions
Notes:•All classes in the Logic directory should be able to run ‘headless’ without OpenGL or window system for scripting and testing•Base Logic and GUI contain transient application state (cursor location, focus, mrml scene connection…)•Persistent and Undoable state in MRML Nodes•Interactive Modules are ones which interact with the VTK scene and/or User events•Interactive Modules interact with 3D scene by creating objects in MRML scene (not by direct manipulation of the Renderer)•Logic classes encapsulate and manage internal vtk/itk pipelines and provide helper routines to create/manage nodes•GUI classes are implemented as KWWidget subclasses•Each Logic class defines Get/Set methods for internal state and Modified Events that GUI classes can Observe•Code in Base implements “first order” Node types (Volumes, Models, Transforms, Fiducials, Colors, etc).•Code in Modules provides application-specific extensions
External Connections• Use socket connection directly
(e.g. MATLAB)• Use slicerget/slicerget utilities
(e.g. unu)
Slicer Daemoncommunication viaserver port
National Alliance for Medical Image Computing http://na-mic.org
Slicer3 Slice Coordinates
XY Image Space CoordinatesIn RenderWindow
Slice Coordinates
RAS to RAS Coordinates
IJK Volume Coordinates
XYToSlice Matrix
SliceToRAS Matrix
RASToRAS Transforms
RASToIJK Matrix
IJK = RASToIJK * RASToRAS * SliceToRAS * XYToSlice * XY
SliceNode
XYToIJK Matrix Calculated by SliceLayerLogic Coordinates are Cell Centered (no VTK flip)
From GUI
IJK = XYToIJK * XY
TransformNodeVolumeNode
National Alliance for Medical Image Computing http://na-mic.org
Slice Management
ForegroundSlice Layer Logic
Slice Node
Slice Composite Node
BackgroundSlice Layer Logic
Slice Logic
Volume Display NodeVolume Node
Volume Display NodeVolume Node
Slice GUI
MRML Nodes: Persistent, Undoable State
Logic: Encapsulate VTK Pipelines, Observe MRML Nodes
GUI: Manage Widgets and Rendering; Manipulated Nodes and Logic; Observe Nodes and Logic
National Alliance for Medical Image Computing http://na-mic.org
Slice Management
ForegroundSlice Layer Logic
Slice Node
Slice Composite Node
BackgroundSlice Layer Logic
Slice Logic
Volume Display NodeVolume Node
Volume Display NodeVolume Node
Slice GUI
MRML Nodes: Persistent, Undoable State
Logic: Encapsulate VTK Pipelines, Observe MRML Nodes
GUI: Manage Widgets and Rendering; Manipulated Nodes and Logic; Observe Nodes and Logic
Stores:
Window/Level
Lookup Table (Color Node)
Transparency Threshold
National Alliance for Medical Image Computing http://na-mic.org
Slice Management
ForegroundSlice Layer Logic
Slice Node
Slice Composite Node
BackgroundSlice Layer Logic
Slice Logic
Volume Display NodeVolume Node
Volume Display NodeVolume Node
Slice GUI
MRML Nodes: Persistent, Undoable State
Logic: Encapsulate VTK Pipelines, Observe MRML Nodes
GUI: Manage Widgets and Rendering; Manipulated Nodes and Logic; Observe Nodes and Logic
Stores:
RAS Location of Slice (Origin and Orientation)
Field of View
Pixel Dimensions
National Alliance for Medical Image Computing http://na-mic.org
Slice Management
ForegroundSlice Layer Logic
Slice Node
Slice Composite Node
BackgroundSlice Layer Logic
Slice Logic
Volume Display NodeVolume Node
Volume Display NodeVolume Node
Slice GUI
MRML Nodes: Persistent, Undoable State
Logic: Encapsulate VTK Pipelines, Observe MRML Nodes
GUI: Manage Widgets and Rendering; Manipulated Nodes and Logic; Observe Nodes and Logic
Stores:
Volume IDs per Layer
Opacity of Overlay
National Alliance for Medical Image Computing http://na-mic.org
Slice Management
ForegroundSlice Layer Logic
Slice Node
Slice Composite Node
BackgroundSlice Layer Logic
Slice Logic
Volume Display NodeVolume Node
Volume Display NodeVolume Node
Slice GUI
MRML Nodes: Persistent, Undoable State
Logic: Encapsulate VTK Pipelines, Observe MRML Nodes
GUI: Manage Widgets and Rendering; Manipulated Nodes and Logic; Observe Nodes and Logic
Stores:
Image Data
IJKToRAS Matrix
Name…
National Alliance for Medical Image Computing http://na-mic.org
Slice Management
ForegroundSlice Layer Logic
Slice Node
Slice Composite Node
BackgroundSlice Layer Logic
Slice Logic
Volume Display NodeVolume Node
Volume Display NodeVolume Node
Slice GUI
MRML Nodes: Persistent, Undoable State
Logic: Encapsulate VTK Pipelines, Observe MRML Nodes
GUI: Manage Widgets and Rendering; Manipulated Nodes and Logic; Observe Nodes and Logic
Pipeline with:
vtkImageReslice
vtkImageMapToWindowLevelColors
vtkImageMapToRGBA
National Alliance for Medical Image Computing http://na-mic.org
Slice Management
ForegroundSlice Layer Logic
Slice Node
Slice Composite Node
BackgroundSlice Layer Logic
Slice Logic
Volume Display NodeVolume Node
Volume Display NodeVolume Node
Slice GUI
MRML Nodes: Persistent, Undoable State
Logic: Encapsulate VTK Pipelines, Observe MRML Nodes
GUI: Manage Widgets and Rendering; Manipulated Nodes and Logic; Observe Nodes and Logic
Pipeline with:
vtkImageBlend
National Alliance for Medical Image Computing http://na-mic.org
Slice Management
ForegroundSlice Layer Logic
Slice Node
Slice Composite Node
BackgroundSlice Layer Logic
Slice Logic
Volume Display NodeVolume Node
Volume Display NodeVolume Node
Slice GUI
MRML Nodes: Persistent, Undoable State
Logic: Encapsulate VTK Pipelines, Observe MRML Nodes
GUI: Manage Widgets and Rendering; Manipulated Nodes and Logic; Observe Nodes and Logic
GUI:
SliceControllerWidget (Menus, Scale, Buttons…)
SliceViewer (RenderWidget, ImageMapper, ImageActor…)
National Alliance for Medical Image Computing http://na-mic.org
Undo Architecture for Slicer3
• Versioning “Commit Aside” Strategy Encapsulated within MRML
• Store “Initial Scene” (from file) and “Delta Scenes” (scenes containing undoable changes)
• Delta Scenes ‘are’ MRML Scenes • Some Nodes are Reference Nodes• Setting the MRML scene in the Application Logic
causes the cascade of observer callbacks • => All Undoable operations must store their data
as MRML nodes
National Alliance for Medical Image Computing http://na-mic.org
Undo Implementation
Initial Scene
MRML Scene
N1
N2
N3
Delta1 Scene
N4
Delta2 Scene
N5
Saved Scene
N1
N4
N5
Undo Stack