Title: ITK Introduction and Overview Spring 2006
1ITK Introduction and Overview Spring 2006
2Topics
- What Is ITK
- History
- Features
- Software Engineering Methodology
3ITK History
- Sponsored by the National Library of Medicine as
part of the Visible Human Project - Original Contract was Approximately 10 Million
over 3 years - All dedicated to Implementing Existing Algorithms
- Currently Only Maintenance Funding from NLM
(mostly to Kitware) - Ongoing Development by User Community
- ITK is a Major Part of the NA-MIC Kit
4Why ITK
- Provide a Standard Implementation of State of the
Art Segmentation and Registration Algorithms - BSD Style Licensing
- Compatible with Commercialization and Academic
Research - Modern Object Oriented Design
- Cross Platform
- Windows, Mac, Linux, Irix, AIX, Solaris
- Run-Time Efficiency
- Multi-threaded, Generic (Templated)
- Carefully Engineered for Stability
- Regression Testing
- Documentation
5ITK in Practice
- ITK Only Recently Added Direction Cosine
Information to Images - Supported in Most I/O
- Not Supported in Most Filters or Registration
- C Learning Curve Very Steep
- Generic Programming Means Very Little Run Time
Flexibility - Code is Compiled to Support Just One Data Type
6Mr. ITK
- Many of the following ITK slides were developed
by Luis Ibanez of Kitware - Once you see Luis role in ITK, youll know that
the following is more than appropriate
Image courtesy Kitware, Inc.
7Scope of ITK
- Image Processing
- Segmentation
- Registration
- No Graphical User Interface (GUI)
- No Visualization
8ITK Sponsors
The National Institute for Dental and
Craniofacial Research
The National Science Foundation
The National Institute of Neurological Disorders
and Stroke
9ITK Developers
10ITK Developers
indicates a subcontractor.
11ITK by the Numbers
- March 2000
- First code check-in
- 1300
- of nightly builds
- 1062
- tests run nightly
- 41
- of platforms ( software hardware )
- 700
- of classes
- 1600
- of files with code
12ITK by the Numbers
- 400K
- of lines of code
- 100K
- of lines of test code
- 35K
- of lines of examples
- 150K
- of lines of Applications
- 240
- weekly t-cons
- 50
- unique developers
13ITK by the Numbers
- 1032
- of users subscribed to the mailing-list
- 400
- of emails posted monthly to the users-list
- 819
- of pages in the Software Guide PDF document
- 1800
- of monthly hits to the URL of the Software
Guide PDF - 1900
- of monthly hits to the URL of the Tutorial PDF
- 2400
- of monthly hits to the source code files (.zip
.tar.gz)
14Example ITK Program
- include "itkImage.h"
- include "itkImageFileReader.h"
- include "itkGradientMagnitudeImageFilter.h"
- int main( int argc, char argv )
- typedef itkImageltunsigned short,2gt
ImageType - typedef itkImageFileReaderltImageTypegt
ReaderType - typedef itkGradientMagnitudeImageFilterlt
- ImageType,ImageTypegt FilterType
- ReaderTypePointer reader ReaderTypeNew()
- FilterTypePointer filter FilterTypeNew()
- reader-gtSetFileName( argv1 )
- filter-gtSetInput( reader-gtGetOutput() )
- filter-gtUpdate()
- return 0
15Documentation Resources
http//www.itk.org/ItkSoftwareGuide.pdf
http//www.itk.org/Doxygen/html/index.html
- Follow the link Alphabetical List
- Follow the link Groups
- Post to the insight-users mailing list
16(No Transcript)
17(No Transcript)
18(No Transcript)
19The ITK Software Guide is freely available as a
PDF document at www.itk.org/
ItkSoftwareGuide.pdfIts paper version can be
ordered from Amazon.com and from Kitwares
e-store.
20Useful Code in ITK
- Coding Infrastructure
- I/O
- Numerics
- Based on VNL (Vision Numerics Library)
- Image Processing
- Convolutions, Non-Linear, Anisotropic
- Segmentation
- Registration
21ITK Basics
- C Generic Programming
- Data Pipeline
- Multi-threading
- Streaming
- Exceptions
- Events / Observers
- Tcl, Python and Java wrapping
22Generic Programming
Example STL Standard Template Library
Abstraction of Types and Behaviors
stdvectorlt T gt
stdvectorlt int gt stdvectorlt double
gt stdvectorlt char gt stdvectorlt Point
gt stdvectorlt Image gt
23itkImage
itkImagelt PixelType , Dimension gt
itkImagelt char , 2 gt itkImagelt char , 3 gt
itkImagelt char , 4 gt itkImagelt float , 2 gt
itkImagelt RGB , 3 gt itkImagelt unsigned short
, 2 gt itkImagelt itkVectorltfloat,2gt , 2 gt
24namespaces
Avoid naming collisions
itk itkStatistics itkfem itkfemitpac
k itkbio
25Your favorite keyword
typedef
typedef itkImagelt char , 2 gt
ImageType typedef itkImageFilterlt ImageType ,
ImageType gt FilterType
otherwise... itkImageFilterlt Imagelt char , 2 gt
, Imagelt char , 2 gt gt
FilterType
26Smart Pointers
Object
counter0
counter1
counter2
counter3
Self - Delete
27SmartPointers
typedef itkImagelt char , 2 gt
ImageType typedef itkImageFilterlt ImageType ,
ImageType gt FilterType
FilterTypePointer filter FilterTypeNew() I
mageTypePointer image filter-gtGetOutput()
Pointer notation filter-gtUpdate()
NO NEED FOR filter-gtDelete()
28Const Correctness
Knowing constancy is Insight. Not knowing
constancy leads to disaster.
Tao Te Ching, XVI. Lao Tsu
29Const Smart Pointers
typedef itkImagelt char , 2 gt
ImageType typedef itkImageFilterlt ImageType ,
ImageType gt FilterType
FilterTypePointer filter FilterTypeNew() I
mageTypeConstPointer image filter-gtGetOutput()
Can only invoke const methods image-gtGetSpacing
()
Compiler error for non-const methods image-gtSetS
pacing ( spacing )
30Creating an Image
typedef itkImagelt char , 3 gt
ImageType ImageTypePointer image
ImageTypeNew() ImageTypeSizeType
size size 0 512 // x direction size 1
512 // y direction size 2 50 // z
direction ImageTypeIndexType start start 0
0 // x direction start 1 0 // y
direction start 2 0 // z direction
31Creating an Image
ImageTypeRegionType region region.SetSize(
size ) region.SetIndex( start ) image-gtSetRegio
ns( region ) image-gtAllocate() image-gtFillBuffer
( 0 ) ImageTypeSpacingType spacing spacing
0 0.83 // x direction spacing 1 0.83
// y direction spacing 2 2.15 // z
direction image-gtSetSpacing( spacing )
32Streaming
Processing Large Images
Output Image
Input Image
Filter
33Image Regions
34Data Pipeline
35Simple Image IO
36Simple Image IO
Loadable Factories
37Simple Image IO
include itkImage.h include itkImageFileReader
.h include itkImageFileWriter.h typedef
itkImagelt char , 2 gt ImageType typedef
itkImageFileReaderlt ImageType gt
ReaderType typedef itkImageFileWriterlt
ImageType gt WriterType ReaderTypePointer
reader ReaderTypeNew() WriterTypePointer
writer WriterTypeNew() reader-gtSetFileName
( inputImage.dcm ) // DICOM writer-gtSetFi
leName( outputImage.hdr ) //
Analyze writer-gtSetInput( reader-gtGetOutput()
) writer-gtUpdate()
38Segmentation Overview
- Region Growing
- ConfidenceConnected
- ConnectedThreshold
- IsolatedConnected
- Watersheds
- Level Sets
- FastMarching
- ShapeDetection
- GeodesicActiveContours
- ThresholdSegmentation
- CannySegmentationLevelSet
39Example Confidence Connected
Seed Point Radius
40- / /class ConfidenceConnectedImageFilter
- /brief Segment pixels with similar statistics
using connectivity -
- This filter extracts a connected set of pixels
whose pixel - intensities are consistent with the pixel
statistics of a seed - point. The mean and variance across a
neighborhood (8-connected, - 26-connected, etc.) are calculated for a seed
point. Then - pixels connected to this seed point whose
values are within - the confidence interval for the seed point are
grouped. The - width of the confidence interval is controlled
by the "Multiplier" - variable (the confidence interval is the mean
plus or minus - the "Multiplier" times the standard
deviation). If the intensity - variations across a segment were gaussian, a
"Multiplier" setting - of 2.5 would define a confidence interval wide
enough to capture - 99 of samples in the segment.
-
- After this initial segmentation is calculated,
the mean and - variance are re-calculated. All the pixels in
the previous - segmentation are used to calculate the mean
the standard deviation
41Confidence Connected
typedef itkImagelt unsigned char , 2 gt
ImageType typedef itkConfidenceConnectedImage
Filterlt ImageType, ImageType gt
FilterType FilterTypePointer filter
FilterTypeNew() filter-gtSetMultiplier( 1.5 )
filter-gtSetNumberOfIterations( 5 )
filter-gtSetInitialNeighborhoodRadius ( 2 )
filter-gtSetReplaceValue( 255 )
FilterTypeIndexType index index0 123
index1 235 filter-gtSetSeed( index
) filter-gtSetInput( reader-gtGetOutput() )
writer-gtSetInput( filter-gtGetOutput() )
writer-gtUpdate()
42Registration Overview
- Image Resampling
- Registration Framework
- Multi-Modality
- Multi-Resolution
- Deformable registration
43Components
Registration Method
FixedImage
Metric
Optimizer
Interpolator
MovingImage
Transform
44Image Metrics
- Mean Squares
- Normalized Correlation
- Mean Reciprocal Square Difference
- Mutual Information- Viola-Wells- Mattes-
Histogram based- Histogram normalized
45Transforms
- Translation
- Scaling
- Rotation
- Rigid3D
- Rigid2D
- Affine
- BSplines
- Splines TPS, EBS, VS
46Optimizers
- Gradient Descent
- Regular Step Gradient Descent
- Conjugate Gradient
- Levenberg-Marquardt
- One plus One Evolutionary Algorithm
47Interpolators
- Nearest Neighbor
- Linear
- BSpline
48ITK Software Methodology
- Based on Best Practices for Distributed
Development - Built on Open Source Tools
- Adopted by NA-MIC
49NAMIC Software Process
Dan Blezek Jim Miller Bill Lorensen
50Extreme Programming
51NAMIC Process
- Light weight
- Based on Extreme Programming
- High intensity cycle
- Design
- Test
- Implement
- Supported with web-enabled tools
- Automated testing integrated with the software
development
52Software Process
- Design Process
- Coding Standards
- Testing
- Bug Tracker
- Communication
- Mailing lists, Discussion forum, Wiki
- Tcons
- Documentation
- Releases
53Design Process
- Take the time to design a good API
- Plan for future use
- Plan for future extension
- Two routes
- Code something, check it in
- Others will tear it down make it better
- Put together a strawman
- Solicit ideas, implement
54Coding Standards
- Follow the packages rules
- ITK has certain coding standards
- Style guidelines
- Naming conventions
- Macros
55Testing
- If it isnt tested, its broken.
- Tests
- Ensure your code works
- Documents expected results
- Others free to change
56Bug Tracker
- Bugs assigned / taken by developers
- Tracks progress to releases
- Captures feature requests
- Communication mechanism
57Documentation
- Doxygen
- Automatic API documentation
- Algorithm references
- Implementation details
- Books / Manuals
- Insight Book
58Communication
- Email lists
- Discussion forum
- Wiki
- Tcon
59Extreme Programming
- Compression of standard analyze, design,
implement, test cycle into a continuous process
60Daily Testing Is The Key
- Testing anchors the development process (Dart)
- Developers monitor the testing dashboard
constantly - Problems are identified and fixed immediately
- Developers receive e-mail if theyBreak the
Build
61Daily rhythm
- Design, implement algorithm
- write regression test
- check it in
62Dart
- Testing
- Reports
- Dashboards
- Central site for state of the system
- Updates
- Builds
- Test
- Coverage
63(No Transcript)
64(No Transcript)
65Someone broke the build!
66(No Transcript)
67The Big Bat of Quality
68Bill Yogi Lorensen
69Conculsion ITK for BIRN
- For BIRN Developers
- Nice set of imaging code
- Open and freely reusable
- For the BIRN Community
- Benchmark of multi-site collaboration on
large-scale engineering effort