3D Slicer module programming

Slides:



Advertisements
Similar presentations
National Alliance for Medical Image Computing User Desktop Slicer 3.0 Architecure AlgorithmsITKVTK Slicer Modules VTK Apps Using ITK.
Advertisements

National Alliance for Medical Image Computing Slicer3 Architecture.
An Object/Relational Mapping tool Free and open source Simplifies storage of object data in a relational database Removes the need to write and maintain.
Visual Scripting of XML
Integrating DICOM RT Import into Slicer 4
National Alliance for Medical Image Computing Slicer MRML MRML Library provides API for managing medical image data types (Volumes, Models,
Utilizing the GDB debugger to analyze programs Background and application.
Tutorial 12: Enhancing Excel with Visual Basic for Applications
National Alliance for Medical Image Computing Anatomy of a plugin Common architecture for interactive and batch processing.
Design Patterns Pepper. Find Patterns Gang of Four created 23 Siemens published another good set x
NA-MIC National Alliance for Medical Image Computing 3D Slicer Interactive Modules Steve Pieper, PhD.
A Guide to Oracle9i1 Introduction To Forms Builder Chapter 5.
UvA, Amsterdam June 2007WS-VLAM Introduction presentation WS-VLAM Requirements list known as the WS-VLAM wishlist System and Network Engineering group.
Data Linkage Graphical User Interface for Febrl Author: Changyang Li Student ID:u Supervisor: Peter Christen Faculty of Engineering and Information.
WebDynpro for ABAP Short introduction.
NA-MIC National Alliance for Medical Image Computing Slicer4 Guided Tour Steve Pieper, Ph.D.
Introducing JavaBeans Lesson 2A / Slide 1 of 30 JDBC and JavaBeans Pre-assessment Questions 1.Which of the given symbols is used as a placeholder for PreparedStatement.
VxOware Progress Report August How to create a new section? Configure section –Create metadata structure (template) –Create elements map for web.
Scott Pinkerton Sample GUI/Application Portfolio 1.
NA-MIC National Alliance for Medical Image Computing Core 1b – Engineering End-user Platform Steve Pieper Isomics, Inc.
3D Slicer Architecture and Implementation
AMI GUI Design V1.1 by Kilian Pohl - Reflects changes in AMI MRML Structure - Includes feedback from AMI Workshop in Dec 09.
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.
Stephen R. Aylward, Director of Medical Imaging, Kitware.
Marcel Casado NCAR/RAP WEATHER WARNING TOOL NCAR.
NA-MIC National Alliance for Medical Image Computing Slicer4 CLI Slicer Execution Model.
JQuery UI. Slide 2 Introduction From the jQuery UI Home Page jQuery UI is a curated set of user interface interactions, effects, widgets, and themes built.
Segmentation support in Slicer Csaba Pinter Laboratory for Percutaneous Surgery, Queen’s University, Canada.
Lecture Set 2 Part A: Creating an Application with Visual Studio – Solutions, Projects, Files.
1 Schema Registries Steven Hughes, Lou Reich, Dan Crichton NASA 21 October 2015.
Coupling Cohesion Chandan R. Rupakheti Steve Chenoweth (Chapter 18)
NA-MIC National Alliance for Medical Image Computing Registering Image Volumes in Slicer Steve Pieper.
VAPOR 3.0 Architecture Overview. Purpose of this document Provide understandable overview of 3.0 architecture Enable the development team to maintain.
RPMS - EHR v1.1 Techie Class Really Powerful at Measuring Stuff.
Developing Great Dashlets Will Abson About Me Project Lead, Share Extras Alfresco Developer and previously Solutions Engineer DevCon 2011 –
Managed by UT-Battelle for the Department of Energy CSS Update Matthias Clausen, Helge Rickens, Jan Hatje and DESY Delphy Armstrong, Xihui Chen,
Introduction to Interactive Media Interactive Media Tools: Authoring Applications.
Innovation Intelligence ® 1 Chapter 4: Using TCL to Control the HyperMesh Session.
Accessing XML Documents Using DOM ©NIITeXtensible Markup Language/Lesson 8/Slide 1 of 23 Objectives In this lesson, you will learn to: * Use XML DOM objects.
1 Integrating Models with Domain-Specific Modeling Languages 18 October 2010 Steven Kelly & Juha-Pekka Tolvanen.
S.Linev: Go4 - J.Adamczewski, H.G.Essel, S.Linev ROOT 2005 New development in Go4.
NA-MIC National Alliance for Medical Image Computing Slicer3 Update
Overview 3D Slicer currently provides very basic technology for annotating images. This limits users in their ability to properly capture semantic information.
National Alliance for Medical Image Computing User Desktop Slicer 3.0 Architecure AlgorithmsITKVTK Slicer Modules VTK Apps Using ITK.
PLUS overview (PerkLab ultrasound library and applications)
Developing Great Dashlets Will Abson About Me Project Lead, Share Extras Alfresco Developer and previously Solutions Engineer DevCon 2011 –
Visual Programming Borland Delphi. Developing Applications Borland Delphi is an object-oriented, visual programming environment to develop 32-bit applications.
Developing Great Dashlets Will Abson About Me Project Lead, Share Extras Alfresco Developer and previously Solutions Engineer DevCon 2011 –
1 Copyright © 2008, Oracle. All rights reserved. Repository Basics.
Chapter 5 Introduction to Defining Classes Fundamentals of Java.
Development Environment
Dynamic management of segmented structures in 3D Slicer
Topics Graphical User Interfaces Using the tkinter Module
3D Slicer Architecture and Implementation
XINFO – Scanner DS – File Content
DICOM-RT support in SlicerRT
JQuery UI.
Activities and Intents
on 3D Slicer module programming
3D Slicer hands-on tutorial
Deploying and Configuring SSIS Packages
Databases.
Slicer3 Architecture.
Lesson 1: Introduction to Trifacta Wrangler
Lesson 1: Introduction to Trifacta Wrangler
Chapter 2: Operating-System Structures
Unreal Engine and C++ We’re finally at a point where we can start working in C++ with Unreal Engine To get everything set up for this properly, we’re going.
3D Slicer Architecture and Implementation
Review Session Biggest discrepancy questions
Presentation transcript:

3D Slicer module programming Beyond the basics

If any of the answers is NO… pay attention! Motivation Can the module be used from another module (without using GUI)? If you save and reload the scene, are all the settings on the module user interface preserved? Most nodes can be transformed. Does your module work correctly if inputs or outputs are transformed? Does your module work correctly if the scene is closed? If the same scene is loaded twice? If any of the answers is NO… pay attention! Questions to attendees: Who has Linux / C++ / python / Slicer / VTK / ITK / Qt experience? Laboratory for Percutaneous Surgery – Copyright © Queen’s University, 2013

Slicer data model Global repository for all data: MRML scene (MRML: Medical Reality Markup Language) List of nodes, each identified by a unique string ID Relationship between nodes: references, hierarchies Modules do not need to know about each other! Questions to attendees: Who has Linux / C++ / python / Slicer / VTK / ITK / Qt experience? Laboratory for Percutaneous Surgery – Copyright © Queen’s University, 2013

MRML node Responsibilities: Basic types: Store data Serialization to/from XML element for persistency No display or processing methods Basic types: Data node Display node: visualization options for data node content; multiple display nodes allowed Storage node: what format, file name to use for persistent storage of the data node content Questions to attendees: Who has Linux / C++ / python / Slicer / VTK / ITK / Qt experience? Laboratory for Percutaneous Surgery – Copyright © Queen’s University, 2013

Node references Always use this whenever a node relies on data stored in other nodes Specified by role name, referenced node ID, index (multiple references with the same role is allowed) Saved/restored with the scene Not trivial: When importing a scene and a node ID is already found in the current scene, the imported node ID is automatically renamed and all references are updated Scene ModelNode1 ModelDisplayNode1 ModelDisplayNode2 ModelStorageNode1 VolumeNode1 Questions to attendees: Who has Linux / C++ / python / Slicer / VTK / ITK / Qt experience? VolumeDisplayNode1 VolumeStorageNode1 Laboratory for Percutaneous Surgery – Copyright © Queen’s University, 2013

Node hierarchies Tree structure, for data grouping Same nodes can be in multiple hierarchies: Transform Display Subject (patient/study/series) Questions to attendees: Who has Linux / C++ / python / Slicer / VTK / ITK / Qt experience? Laboratory for Percutaneous Surgery – Copyright © Queen’s University, 2013

Transforms Slicer world coordinate system: RAS (right-anterior-superior) Get linear transform from the node to RAS: nodeToRas = vtk.vtkMatrix4x4() if node.GetTransformNodeID(): nodeToRasNode = slicer.mrmlScene.GetNodeByID(node.GetTransformNodeID()) nodeToRasNode.GetMatrixTransformToWorld(nodeToRas) Transform may be non-linear At least log an error if transform is present but it is ignored Questions to attendees: Who has Linux / C++ / python / Slicer / VTK / ITK / Qt experience? Laboratory for Percutaneous Surgery – Copyright © Queen’s University, 2013

Scripted module implementation (MyFirst) Widget (MyFirstWidget) Logic (MyFirstLogic) Questions to attendees: Who has Linux / C++ / python / Slicer / VTK / ITK / Qt experience? Laboratory for Percutaneous Surgery – Copyright © Queen’s University, 2013

Module class Required. Only one global instance exists: module = slicer.modules.volumes Stores module description, icon, etc. Creates and holds a reference to logic and widget: Loadable modules: widget = module.widgetRepresentation() logic = module.logic() Python scripted modules: widget = module.widgetRepresentation().self() logic = widget.logic Questions to attendees: Who has Linux / C++ / python / Slicer / VTK / ITK / Qt experience? Laboratory for Percutaneous Surgery – Copyright © Queen’s University, 2013

Scripted module implementation Create Create Widget Logic Logic Create (only for scripted) Current limitation: Scripted module logic is not created automatically, it has to be instantiated in the Widget class. Questions to attendees: Who has Linux / C++ / python / Slicer / VTK / ITK / Qt experience? Laboratory for Percutaneous Surgery – Copyright © Queen’s University, 2013

Widget class Needed if the module has a user interface Typically only one global instance exists Defines the module’s user interface Keeps user interface and nodes in sync (Observes MRML nodes to get change notifications) Launches processing methods implemented in the logic class Questions to attendees: Who has Linux / C++ / python / Slicer / VTK / ITK / Qt experience? Laboratory for Percutaneous Surgery – Copyright © Queen’s University, 2013

Widget class Include a parameter node selector at the top (or use a singleton parameter node) If a parameter node is selected then add an observer to its modified events; if modified then call widget’s UpdateGUIFromParameterNode() If a parameter is changed in the GUI then update the parameter node Questions to attendees: Who has Linux / C++ / python / Slicer / VTK / ITK / Qt experience? Laboratory for Percutaneous Surgery – Copyright © Queen’s University, 2013

Scripted module implementation Create Create Widget Logic Use Notify Observe Questions to attendees: Who has Linux / C++ / python / Slicer / VTK / ITK / Qt experience? MRML node Modify Laboratory for Percutaneous Surgery – Copyright © Queen’s University, 2013

Logic class Needed if the module does any processing (always?) The module must be usable from another module, just by calling logic methods Must not rely on the Widget class: the module must be usable without even having a widget class Logic may be instantiated many times (to access utility functions inside) Logic may observe nodes: only if real-time background processing is needed (e.g., we observe some input nodes and update other nodes if input nodes are changed) Questions to attendees: Who has Linux / C++ / python / Slicer / VTK / ITK / Qt experience? Laboratory for Percutaneous Surgery – Copyright © Queen’s University, 2013

Scripted module implementation Create Create Widget Logic Use X Notify Notify Observe Questions to attendees: Who has Linux / C++ / python / Slicer / VTK / ITK / Qt experience? MRML node Modify Modify Laboratory for Percutaneous Surgery – Copyright © Queen’s University, 2013

Example https://www.assembla.com/code/slicerrt/subversion/nodes/1975/trunk/SlicerRt/sandbox/SegmentationUtils/FillRoi/FillRoi.py Questions to attendees: Who has Linux / C++ / python / Slicer / VTK / ITK / Qt experience? Laboratory for Percutaneous Surgery – Copyright © Queen’s University, 2013

Common mistakes 1 Module Create Create Widget Logic Notify Observe Questions to attendees: Who has Linux / C++ / python / Slicer / VTK / ITK / Qt experience? MRML node Modify Everything is implemented in the widget, therefore the module is not usable from another module or with a custom GUI! Laboratory for Percutaneous Surgery – Copyright © Queen’s University, 2013

Problem: changes made to the MRML node are not reflected in the GUI! Common mistakes 2 Module Create Create Widget Logic Use Problem: changes made to the MRML node are not reflected in the GUI! Questions to attendees: Who has Linux / C++ / python / Slicer / VTK / ITK / Qt experience? MRML node Modify Modify Laboratory for Percutaneous Surgery – Copyright © Queen’s University, 2013

Common mistakes 3 Module Create Create Widget Logic Use No parameter node is used. When the scene is saved and reloaded all the settings in the module user interface are lost! Questions to attendees: Who has Linux / C++ / python / Slicer / VTK / ITK / Qt experience? Laboratory for Percutaneous Surgery – Copyright © Queen’s University, 2013

Thanks for your attention. Laboratory for Percutaneous Surgery – Copyright © Queen’s University, 2013

Slicer data model MRML node File reader/writer DICOM importer/exporter Displayable manager Editor effect GUI from UI file: http://www.slicer.org/slicerWiki/index.php/Documentation/Nightly/Developers/Tutorials/PythonAndUIFile Questions to attendees: Who has Linux / C++ / python / Slicer / VTK / ITK / Qt experience? Laboratory for Percutaneous Surgery – Copyright © Queen’s University, 2013

Agenda Observers GetOutput/Update/GetOutputPort Memory management Scripted module Module template Debugging (reload&test, PyDev) Slicelets Questions to attendees: Who has Linux / C++ / python / Slicer / VTK / ITK / Qt experience? Laboratory for Percutaneous Surgery – Copyright © Queen’s University, 2013