NA-MIC National Alliance for Medical Image Computing http://na-mic.org IGT Software Design and Process Bill Lorensen GE Research
Dec 25, 2015
NA-MICNational Alliance for Medical Image Computing http://na-mic.org
IGTSoftware Design and Process
Bill Lorensen
GE Research
National Alliance for Medical Image Computing http://na-mic.org
Outline
• Background• Design Principles• Software Process• Challenges
National Alliance for Medical Image Computing http://na-mic.org
Open Source Menu for Success
• A Community with a common vision• A pool of talented and motivated
developers/scientists• A mix of academic and commercial• An organized, light weight approach to
software development• A leadership structure• Communication• A business model
National Alliance for Medical Image Computing http://na-mic.org
Guiding Principles
• Open is good
• Proprietary is bad
• Reuse is good
• NIH* is bad
• Modularity is good
• Monolithic is bad
*Not invented here
NA-MICNational Alliance for Medical Image Computing http://na-mic.org
Design Principles
National Alliance for Medical Image Computing http://na-mic.org
Toolkits and Libraries
• Visualization - VTK
• Segmentation/Registration - ITK
• State machines – IGSTK
• UI – KWWidgets, ??
• Tracking – OpenTracker, ??
• DICOM – dcmtk, gdcm
• File I/O – nrrd, meta, pnglib, …
National Alliance for Medical Image Computing http://na-mic.org
Object-Oriented Design
• Dominated software systems throughout the 1990’s
• Continues to be the accepted software design technique
• Particularly useful for dealing with complexity• Provides programmatic abstractions to deal
with generalization and encapsulation• C++ and Java have mechanisms to support
OOD
National Alliance for Medical Image Computing http://na-mic.org
Generic Programming
• Organize libraries consisting of generic—or reusable—software components.
• The essential ideas of generic programming are containers to hold data, iterators to access the data, and generic algorithms that use containers and iterators to create efficient, fundamental algorithms.
• ITK uses generic programming to process n-dimensional “images”.
National Alliance for Medical Image Computing http://na-mic.org
Design Patterns
• Good object-oriented software systems have recurring designs (patterns) that occur frequently
• ITK employs a number of powerful design patterns– object factories– command/observer– smart pointer memory management
National Alliance for Medical Image Computing http://na-mic.org
Frameworks
• Define how a group of participants can be put together to solve a particular task.
• Particularly suitable for describing complex flows or algorithms that have a number of steps that can be varied
• ITK Frameworks– A demand-driven data processing pipeline
that connects algorithms to process n-dimensional image data
– Registration framework– Level-set framework
National Alliance for Medical Image Computing http://na-mic.org
Separation of Algorithms from Interfaces
• Implement the algorithms with a clear separation from the applications and especially the user interfaces.
• Uses the Command/Observer design pattern that permits applications to watch for significant events during the execution of an algorithm
• ITK has no built-in visualization, but has been interfaced to several systems including 3D Slicer, Analyze, SciRun and Volview.
National Alliance for Medical Image Computing http://na-mic.org
Slicer 3 Execution Model: Goals
• Provide interface to batch programs– Simplify and unify command line
processing• Auto generate C++ command line
processing
– Simplify and unify GUI• Auto generate GUI
National Alliance for Medical Image Computing http://na-mic.org
UserDesktop
Slicer 3.0
Algorithms ITK VTK SlicerModules
VTK AppsUsing ITK
Scripts ofSlicer Mods
BatchPrograms
Non-NAMICCmd tools
LONIPipeline
Birn GridData/Compute
Slicer 3.0
National Alliance for Medical Image Computing http://na-mic.org
Execution Model: Plugins
• XML Interface Description– Describes command line options– Describes suggestions for GUI
• GenerateCLP– Generates C++ command line
processing code from XML– Reports XML description
National Alliance for Medical Image Computing http://na-mic.org
Program Flow
UserDesktopprog.xml GenerateCLP progCLP.h
SlicerModules
prog.cxx
Non-NAMICCmd tools
LONIPipeline
Birn GridData/Compute
Slicer 3.0
National Alliance for Medical Image Computing http://na-mic.org
Resample --xml<?xml version="1.0" encoding="utf-8"?><executable> <category>filtering</category> <title>Resample Volume</title> <description>Resamples a volume</description> <version>1.0</version> <documentationurl></documentationurl> <license></license> <contributor>Bill Lorensen</contributor> <parameters> <label>Resampling Parameters</label> <description>Parameters used for resampling</description> <float-vector> <name>outputPixelSpacing</name> <flag>-s</flag> <longflag>--spacing</longflag> <description>Spacing along each dimension (0 means use
input spacing)</description> <label>Spacing</label> <default>0,0,0</default> </float-vector> </parameters>
<label>IO</label> <description>Input/output parameters</description> <image> <name>InputVolume</name> <label>input Volume</label> <channel>input</channel> <index>0</index> <description>Input volume to be
resampled</description> </image> <image> <name>OutputVolume</name> <label>Output Volume</label> <channel>output</channel> <index>1</index> <description>Resampled Volume</description> </image> </parameters></executable>
National Alliance for Medical Image Computing http://na-mic.org
Resample.cxx
.
.
.#include “ResampleCLP.h”
Main (int argc, char *argv[]){ PARSE_ARGS; algorithm code}
National Alliance for Medical Image Computing http://na-mic.org
Resample --helpUSAGE: ResampleVolume [--xml] [--echo] [-s <std::vector<float>>]
[--] [--version] [-h] <std::string> <std::string>Where: --xml Produce xml description of command line arguments (default: 0) --echo Echo the command line arguments (default: 0) -s <std::vector<float>>, --spacing <std::vector<float>> Spacing along each dimension (0 means use input spacing) (default: 0,0,0) --, --ignore_rest Ignores the rest of the labeled arguments following this flag. --version Displays version information and exits. -h, --help Displays usage information and exits. <std::string> (required) Input volume to be resampled (default: None) <std::string> (required) Resampled Volume (default: None)
Resamples a volume
NA-MICNational Alliance for Medical Image Computing http://na-mic.org
Software Process
National Alliance for Medical Image Computing http://na-mic.org
NA-MIC Rhythms
• Yearly All-Hands Meeting
• Bi-annual Programmers’ Week
• Weekly Engineering T-Cons
• Nightly Build/Test– ITK– VTK– Slicer
National Alliance for Medical Image Computing http://na-mic.org
NA-MIC Tools
• CMake– Cross-platform build
• Dart 2– Build/Test server
• CTest– Build/Test client
• Cpack– Packaging and Distribution
• Media Wiki– Reporting/discussion forum
• POTS– T-cons
National Alliance for Medical Image Computing http://na-mic.org
How DART Enables Collaboration
CVSSVN
Results posted on web(the dashboard)
CVS/SVN maintainssource code
revisions DART compilessource code, runs tests
Developers review results
Developers check-in code
National Alliance for Medical Image Computing http://na-mic.org
Dart
Dart
National Alliance for Medical Image Computing http://na-mic.org
National Alliance for Medical Image Computing http://na-mic.org
Multi-Platform Builds
National Alliance for Medical Image Computing http://na-mic.org
IGT Challenges
• Define an architecture tailored to IGT requirements
• Leverage existing toolkits
• Fill in toolkit gaps
NA-MICNational Alliance for Medical Image Computing http://na-mic.org
IGTSoftware Design and Process
Bill Lorensen
GE Research