3D Slicer Architecture and Implementation

Slides:



Advertisements
Similar presentations
National Alliance for Medical Image Computing Integrating with Slicer3.
Advertisements

National Alliance for Medical Image Computing Slicer3 plugins Common architecture for interactive and batch processing.
National Alliance for Medical Image Computing User Desktop Slicer 3.0 Architecure AlgorithmsITKVTK Slicer Modules VTK Apps Using ITK.
National Alliance for Medical Image Computing Slicer3 Architecture.
National Alliance for Medical Image Computing Slicer MRML MRML Library provides API for managing medical image data types (Volumes, Models,
NA-MIC National Alliance for Medical Image Computing 3D Slicer Version 4 Architecture and Status Steve Pieper, Ph.D.
National Alliance for Medical Image Computing Anatomy of a plugin Common architecture for interactive and batch processing.
MITK Diffusion (under the hood)
NA-MIC National Alliance for Medical Image Computing 3D Slicer Interactive Modules Steve Pieper, PhD.
National Alliance for Medical Image Computing User Desktop Slicer 3.0 Architecure AlgorithmsITKVTK Slicer Modules VTK Apps Using ITK.
Presented by IBM developer Works ibm.com/developerworks/ 2006 January – April © 2006 IBM Corporation. Making the most of Creating Eclipse plug-ins.
1 ParaView Current Architecture and History Current Architecture and History Issues with the Current Design Issues with the Current Design.
NA-MIC National Alliance for Medical Image Computing Slicer4 Guided Tour Steve Pieper, Ph.D.
NA-MIC National Alliance for Medical Image Computing Slicer Custom Modules Steve Pieper, PhD.
Xenios Papademetris Departments of Diagnostic Radiology and Biomedical Engineering Yale University School of Medicine.
NA-MIC National Alliance for Medical Image Computing Core 1b – Engineering End-user Platform Steve Pieper Isomics, Inc.
NA-MIC National Alliance for Medical Image Computing Core 1b – Engineering End-user Platform Steve Pieper Isomics, Inc.
Windows.Net Programming Series Preview. Course Schedule CourseDate Microsoft.Net Fundamentals 01/13/2014 Microsoft Windows/Web Fundamentals 01/20/2014.
NA-MIC National Alliance for Medical Image Computing IGT Software Design and Process Bill Lorensen GE Research.
Getting Started with ITK in Python Language
Core 1b – Engineering Dynamic Coding a.k.a. Python in Slicer
NA-MIC National Alliance for Medical Image Computing NAMIC-Kit Update Will Schroeder Jim Miller Bill Lorensen.
NA-MIC National Alliance for Medical Image Computing NA-MIC Software Engineering Bill Lorensen GE Research NA-MIC Engineering Core PI.
Capture and Replay Often used for regression test development –Tool used to capture interactions with the system under test. –Inputs must be captured;
NA-MIC National Alliance for Medical Image Computing Why NITRC Matters to NA-MIC Steve Pieper, PhD.
DTIAtlasBuilder Adrien Kaiser Neuro Image Research and Analysis Laboratories University of North Carolina at Chapel Hill A tool to create an atlas from.
Module 7: Fundamentals of Administering Windows Server 2008.
NA-MIC National Alliance for Medical Image Computing Slicer 3.4 Update Summer NA-MIC Project Week 2009 Steve Pieper, Ph.D.
9 Chapter Nine Compiled Web Server Programs. 9 Chapter Objectives Learn about Common Gateway Interface (CGI) Create CGI programs that generate dynamic.
NA-MIC National Alliance for Medical Image Computing Slicer4 CLI Slicer Execution Model.
1 Module Objective & Outline Module Objective: After completing this Module, you will be able to, appreciate java as a programming language, write java.
Workflow based Slicer IGT Module : Tutorial Andinet Enquobahrie, PhD Kitware Inc December, 2008.
NA-MIC National Alliance for Medical Image Computing Slicer Building and Deployment Steve Pieper, PhD.
Replay Compilation: Improving Debuggability of a Just-in Time Complier Presenter: Jun Tao.
William Schroeder, Ph.D. §, Andy Cedilnik §, Sebastien Barré, Ph.D. §, William Lorensen ‡, James Miller, Ph.D. ‡, Daniel Blezek, Ph.D. ‡ § Kitware Inc.,
Sonia Pujol, PhD National Alliance for Medical Image Computing © 2010, ARR.
NA-MIC National Alliance for Medical Image Computing Core 1b – Engineering Software Process Stephen R. Aylward Kitware, Inc.
_______________________________________________________________CMAQ Libraries and Utilities ___________________________________________________Community.
NA-MIC National Alliance for Medical Image Computing ParaView Server Manager Berk Geveci Andy Cedilnik.
NA-MIC National Alliance for Medical Image Computing Registering Image Volumes in Slicer Steve Pieper.
NA-MIC National Alliance for Medical Image Computing UCSD: Engineering Core 2 Portal and Grid Infrastructure.
NA-MIC National Alliance for Medical Image Computing Core 1b – Engineering Components Jim Miller GE Research.
Slicer3 for developers – S.Pujol -1- National Alliance for Medical Image Computing Slicer3 Course for developers Sonia Pujol, Ph.D. Surgical Planning Laboratory.
NA-MIC National Alliance for Medical Image Computing Using Annotations in Slicer 4.0 Yong Zhang, Kilian Pohl June 2010.
NA-MIC National Alliance for Medical Image Computing 3D Slicer and the NA-MIC Kit for IGT Research Steve Pieper, PhD NAC, SPL, NA-MIC,
Java Beans. Definitions A reusable software component that can be manipulated visually in a ‘builder tool’. (from JavaBean Specification) The JavaBeans.
Surgical Planning Laboratory -1- Brigham and Women’s Hospital Converting DTI data into Nrrd file format Sonia Pujol, Ph.D. Gordon.
NA-MIC National Alliance for Medical Image Computing Slicer 2010: Past, Present, and Future Steve Pieper, Ph.D.
© FPT SOFTWARE – TRAINING MATERIAL – Internal use 04e-BM/NS/HDCV/FSOFT v2/3 JSP Application Models.
August 2003 At A Glance The IRC is a platform independent, extensible, and adaptive framework that provides robust, interactive, and distributed control.
Neuroimage Analysis Center An NCRR National Resource Center NAC Engineering Core Steve Pieper, Core PI SPL; Isomics, Inc.
NA-MIC National Alliance for Medical Image Computing 3D Slicer Modules and Extensions Steve Pieper, Ph.D.
NA-MIC National Alliance for Medical Image Computing Non-Interactive Tools Stephen Aylward, Kitware
Chapter 11: Advanced Inheritance Concepts. Objectives Create and use abstract classes Use dynamic method binding Create arrays of subclass objects Use.
NA-MIC National Alliance for Medical Image Computing Slicer 2010: Past, Present, and Future Steve Pieper, Ph.D.
.NET Mobile Application Development XML Web Services.
INFSO-RI Enabling Grids for E-sciencE Using of GANGA interface for Athena applications A. Zalite / PNPI.
NA-MIC National Alliance for Medical Image Computing Slicer3 Update
Copyright 2007, Information Builders. Slide 1 iWay Web Services and WebFOCUS Consumption Michael Florkowski Information Builders.
National Alliance for Medical Image Computing User Desktop Slicer 3.0 Architecure AlgorithmsITKVTK Slicer Modules VTK Apps Using ITK.
National Alliance for Medical Image Computing Integrating with Slicer3.
Wednesday NI Vision Sessions
NA-MIC National Alliance for Medical Image Computing Core 1b – Engineering Data Management Daniel Marcus Washington University.
3D Slicer module programming
3D Slicer Architecture and Implementation
Pipeline Execution Environment
Core 1b – Engineering Data and Clinical Interface
Slicer3 Architecture.
3D Slicer Architecture and Implementation
Ron Kikinis, MD Professor of Radiology, Harvard Medical School
Presentation transcript:

3D Slicer Architecture and Implementation You’ve just seen the why and the what, now we’ll discuss the how… Steve Pieper, PhD

Goals NA-MIC Kit: Software and Methodologies for Medical Image Computing Facilitate Research Promote Interoperability Stable, Cross-Platform Run Time Environment Full Set of Core Features Avoid Duplicated Effort Flexible Module Architecture Plug-ins should be As Simple As Possible

Overview MRML, Logic, GUI Core Libraries and Dependencies Some Details of MRML Modules

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 Modules Should Follow Same Conventions GUI Renderers Widgets Edit Observe Logic Observe Edit Observe Edit MRML Nodes Motivation for this architecture: modularize! Make the parts resuable. MVC is model/view/controller – often used as an idealized design pattern, but almost always gets customized for any give application “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.

Example: EM in Slicer3 MRML Logic GUI Manage MRML nodes API for access to parameters Manage hierarchy Segmentation algorithm Window to parameter set Wizard Interaction with images Global Parameters Hierarchical parameters Image data Segmentation output

Example: EM Batch Tool MRML Logic CLI Manage MRML nodes API for access to parameters Manage hierarchy Segmentation algorithm Command Line Parsing Load Parameter Description MRML Scenes Global Parameters Hierarchical parameters Image data Segmentation output

Library Dependencies ITK VTK Tcl/Tk Teem KWWidgets vtkTeem vtkITK MRML SlicerBaseLogic SlicerBaseGUI Slicer3

vtkITK, vtkTeem Slicer3 Teem: Multidimensional Raster Image Library (Gordon Kindlmann) Includes NRRD File Format ExtensiveTensor Manipulation Utilities vtkTeem, vtkITK: Create VTK Compatible Filters using ITK and Teem Code for Implementation Includes vtkITKArchetype* Readers and Writers Implemented with ITK I/O Factories SlicerBaseGUI SlicerBaseLogic MRML KWWidgets vtkTeem vtkITK Tcl/Tk VTK Teem ITK

MRML MRML: Medical Reality Markup Language Slicer3 MRML: Medical Reality Markup Language Library Provides Central Data Representation for Slicer3 Application State is Explicitly Described in MRML GUI and Modules: Observe MRML to Learn of Changes to State Manipulate State to Reflect User Interaction and Calculation Results SlicerBaseGUI SlicerBaseLogic MRML KWWidgets vtkTeem vtkITK Tcl/Tk VTK Teem ITK

SlicerBaseLogic Slicer3 Utility Code for Implementing Base Application Functionality Input/Output Volume Reslicing Image Filters No Rendering, and No GUI Code SlicerBaseGUI SlicerBaseLogic MRML KWWidgets vtkTeem vtkITK Tcl/Tk VTK Teem ITK

SlicerBaseGUI KWWidgets Subclasses vtkSlicerApplication Custom KWWidgets Rendering Utility Code VTK 3D Widget Subclasses SlicerBaseGUI SlicerBaseLogic MRML KWWidgets vtkTeem vtkITK Tcl/Tk VTK Teem ITK

Scene Description Provided by D. Gering

MRML Concepts Node Unit of Organization for MRML Group of Variables Representing an Object or Concept State Scene Slicer Application has Single Scene Instance that has Collection of Nodes and API for Access/Create/Delete Undo/Redo & Scene Snapshots Scene Swaps Nodes in to / out of Current State Logic/GUI Auto-Update through Observers Serialization / Deserialization Nodes Responsible for Read/Write of XML Version of State Scene Read/Write Analogous to Snapshots

MRML Concepts (cont) Observers / Events Scene and Nodes Invoke Custom Observable Events for Specific Actions (e.g. NodeAddedEvent) or ModifiedEvents for General Updates Node API Allows Disabling ModifiedEvent Invocation to Allow Groups of Operations with Single ModifiedEvent Node API Includes MRMLObserverManager Class to Simplify Addition/Removal of Multiple Event Observers Scene Provides EventBroker to Support Observer Introspection, Asynchronous Invocation, Logging, and Event Compression

MRML Concepts (cont) IDs & References Each Node is Given a Unique ID for Retrieval in Scene Nodes Can Refer to Other Nodes by ID E.g. TransformableNodes can Refer to a TransformNode by ID E.g. ModelNode can Refer to ModelDisplayNode by ID Scene Maintains ReferencedIDs and ReferencingNodes Lists to Maintain One-to-One Relationship During Scene Import

Node Types Displayable/Storable/Transformable Display/Storage/Transform Hierarchy Parameter Selection Slice SliceComposite Color Fiducial Snapshot Command Line Module Other Module-Specific Nodes

“Observer MVC” Example Event: User Picks Add Volume in Volumes GUI (KWWidget) Volumes GUI calls AddArchetypeVolume in VolumesLogic Volumes Logic Creates VolumeNode and VolumeStorageNode, Reads Data, and Adds to Scene Scene Invokes NodeAddedEvent NodeSelector Widgets Update Menus Volumes GUI Sets Active Volume on SelectionNode Slice Viewers Updated to New Volume GUI Renderers Widgets Edit Observe Logic Observe Edit Observe Edit MRML Nodes Motivation for this architecture: modularize! Make the parts resuable. MVC is model/view/controller – often used as an idealized design pattern, but almost always gets customized for any give application Notes: Event invocation happens synchronously in Slicer 3.2, meaning volume is read and updated before AddArchetypeVolume method returns. Asynchronous event processing may become the default in the future. GUI Currently propagates selection to each slice composite node in the scene. In the future the slice GUIs should be observing the scene and optionally display newly loaded volumes.

Coordinate Systems IJK (Index Coordinates of Volume) vtkMRMLVolumeNode uses vtkImageData to store voxels, with Origin 0,0,0 and Spacing 1,1,1 RAS (Right-Anterior-Superior) vtkMRMLVolumeNode::GetIJKToRASMatrix provides vtkMatrix4x4 that includes origin, spacing, and direction vectors to map to patient space Origin is at the center of the voxel Vectors Point in Specified Direction (i.e. R goes from Left to Right) LPS (Left-Posterior-Superior) Used by ITK code and DICOM Slicer Automatically Converts RAS->LPS

Transforms TransformToParent vtkMRMLTransformableNode Instances Contain TransformNodeID Reference to a vtkMRMLTransformNode Allows Many Nodes Inside Each Transform and Transform Hierarchies TranfrormNode Defines how to Go from Child to Parent Space (e.g. a ModelNode points to a TransfromNode that Scales it to Global RAS Coordinates) Transforms Represented by vtkGeneralTransforms (linear/nonlinear) (TransformFromParent – not yet implemented) Nonlinear Registration Results Often Better Represented as Resampling Transforms, Opposite of Current Modeling Transforms

Modularity 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 processs NITRC Supplement to NA-MIC helping to pay for needed infrastructure (Neuroimaging Informatics Tools and Resources Clearinghouse) NITRC can host neuroimaging projects (gforge implementation)

Base Features vs. Modules Visualization MRML: Models, Volumes, Volume Rendering, Fiducials, Continuum Meshes, Labeled Data Can create custom MRML Nodes and behavior Filtering None Implemented as Modules using ITK or other Libraries Registration Transform Display and Edit, Save/Restore Calculate Transforms, Resample Data Segmentation Label Maps, Parcellated Surfaces Segmentation Algorithms in ITK or other Libraries Quantification Label, Image, Volume Statistics; Numpy access to MRML Applications in Python or MATLAB Real-time Integration VTK Rendering, KWWidgets framework, Tracker Support (as Transforms) Direct Manipulation of the MRML Scene; 2D/3D Widgets; Device Interfaces, OpenIGTLink Module Diffusion Imaging DWI, DTI, Fiber Bundles Tractography, Clustering, Atlases Applications “Bundles” of Modules in Distribution: Registration, Editor, some Filters, Customized Extensions, Domain-specific code, Optimized Interfaces…

Module Terminology Built-In Modules Few Core Features Linked to Slicer3.cxx Non-Core Modules becoming Loadable Loadable Modules Dynamically Discovered and Loaded Can Access Application’s 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

Loadable Modules Create vtkSlicerModuleGUI Subclass http://www.slicer.org/slicerWiki/index.php/Slicer3:How_to_implement_an_Interactive_Module_GUI http://www.slicer.org/slicerWiki/index.php/Slicer3:Loadable_Modules:HOWTO 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

Scripted Modules A Generic ScriptedModule Module Provides Mapping of C++ Method Entry Points to a Corresponding Naming Convention for Scripts 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)

Command 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.