Download presentation
Presentation is loading. Please wait.
Published byKathlyn Griffin Modified over 8 years ago
1
ITK Introduction and Overview Spring 2006
2
Topics What Is ITK History Features Software Engineering Methodology
3
ITK 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
4
Why 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
5
ITK 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
6
Mr. ITK Many of the following ITK slides were developed by Luis Ibanez of Kitware Once you see Luis’ role in ITK, you’ll know that the following is more than appropriate Image courtesy Kitware, Inc.
7
Scope of ITK Image Processing Segmentation Registration No Graphical User Interface (GUI) No Visualization
8
ITK Sponsors The National Science Foundation The National Institute for Dental and Craniofacial Research The National Institute of Neurological Disorders and Stroke
9
ITK Developers
10
* indicates a subcontractor.
11
ITK 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
12
ITK 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
13
ITK 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)
14
Example ITK Program #include "itkImage.h" #include "itkImageFileReader.h" #include "itkGradientMagnitudeImageFilter.h" int main( int argc, char **argv ) { typedef itk::Image ImageType; typedef itk::ImageFileReader ReaderType; typedef itk::GradientMagnitudeImageFilter< ImageType,ImageType> FilterType; ReaderType::Pointer reader = ReaderType::New(); FilterType::Pointer filter = FilterType::New(); reader->SetFileName( argv[1] ); filter->SetInput( reader->GetOutput() ); filter->Update(); return 0; }
15
Documentation Resources http://www.itk.org/ItkSoftwareGuide.pdf Follow the link Alphabetical List Follow the link Groups Post to the insight-users mailing list http://www.itk.org/Doxygen/html/index.html
19
The ITK Software Guide is freely available as a PDF document at www.itk.org/ ItkSoftwareGuide.pdf Its paper version can be ordered from Amazon.com and from Kitware’s e-store. www.itk.org/
20
Useful Code in ITK Coding Infrastructure I/O Numerics Based on VNL (Vision Numerics Library) Image Processing Convolutions, Non-Linear, Anisotropic… Segmentation Registration
21
ITK Basics C++ Generic Programming Data Pipeline Multi-threading Streaming Exceptions Events / Observers Tcl, Python and Java wrapping
22
Generic Programming Example: STL Standard Template Library Abstraction of Types and Behaviors std::vector
23
itk::Image itk::Image, 2 >
24
namespaces Avoid naming collisions itk:: itk::Statistics:: itk::fem:: itk::fem::itpack itk::bio
25
Your favorite keyword typedef typedef itk::Image ImageType typedef itk::ImageFilter FilterType otherwise... itk::ImageFilter, Image > FilterType
26
Smart Pointers Object Smart Pointer counter=0counter=1counter=2counter=3 Self - Delete
27
SmartPointers typedef itk::Image ImageType typedef itk::ImageFilter FilterType FilterType::Pointer filter = FilterType::New(); ImageType::Pointer image = filter->GetOutput(); NO NEED FOR filter->Delete(); Pointer notation filter->Update();
28
Const Correctness Knowing constancy is Insight. Not knowing constancy leads to disaster. Tao Te Ching, XVI. Lao Tsu
29
Const Smart Pointers typedef itk::Image ImageType typedef itk::ImageFilter FilterType FilterType::Pointer filter = FilterType::New(); ImageType::ConstPointer image = filter->GetOutput(); Can only invoke “const” methods image->GetSpacing (); Compiler error for “non-const” methods image->SetSpacing ( spacing );
30
Creating an Image typedef itk::Image ImageType ImageType::Pointer image = ImageType::New(); ImageType::SizeType size; size[ 0 ] = 512;// x direction size[ 1 ] = 512;// y direction size[ 2 ] = 50;// z direction ImageType::IndexType start; start[ 0 ] = 0; // x direction start[ 1 ] = 0; // y direction start[ 2 ] = 0; // z direction
31
Creating an Image ImageType::RegionType region; region.SetSize( size ); region.SetIndex( start ); image->SetRegions( region ); image->Allocate(); image->FillBuffer( 0 ); ImageType::SpacingType spacing; spacing[ 0 ] = 0.83; // x direction spacing[ 1 ] = 0.83; // y direction spacing[ 2 ] = 2.15; // z direction image->SetSpacing( spacing );
32
Output Image Streaming Filter Processing Large Images Input Image
33
Image Regions LargestPossibleRegion BufferedRegion RequestedRegion
34
Data Pipeline Image Filter Image Filter Image Filter
35
Simple Image IO Image File ImageFileReader Image Filter Image File ImageFileWriter
36
CustomImageIO Simple Image IO Image File ImageFileReader Image PNGImageIO VTKImageIODICOMImageIOGIPLImageIO MetaImageIOAnalyzeImageIO Loadable Factories
37
#include “itkImage.h” #include “itkImageFileReader.h” #include “itkImageFileWriter.h” typedef itk::Image ImageType; typedef itk::ImageFileReader ReaderType; typedef itk::ImageFileWriter WriterType; ReaderType::Pointer reader = ReaderType::New(); WriterType::Pointer writer = WriterType::New(); reader->SetFileName( “inputImage.dcm” ); // DICOM writer->SetFileName( “outputImage.hdr” ); // Analyze writer->SetInput( reader->GetOutput() ); writer->Update(); Simple Image IO
38
Segmentation Overview Region Growing – ConfidenceConnected – ConnectedThreshold – IsolatedConnected Watersheds Level Sets – FastMarching – ShapeDetection – GeodesicActiveContours – ThresholdSegmentation – CannySegmentationLevelSet
39
Example: Confidence Connected Seed Point + Radius Intensity Mean Lower bound Upper bound X Multiplier Standard Deviation
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 * (as opposed to using the pixels in the neighborhood of the seed * point). The segmentation is then recalculted using these refined * estimates for the mean and variance of the pixel values. This * process is repeated for the specified number of iterations. * Setting the "NumberOfIterations" to zero stops the algorithm * after the initial segmentation from the seed point. * */
41
typedef itk::Image ImageType; typedef itk::ConfidenceConnectedImageFilter FilterType; FilterType::Pointer filter = FilterType::New(); filter->SetMultiplier( 1.5 ); filter->SetNumberOfIterations( 5 ); filter->SetInitialNeighborhoodRadius ( 2 ); filter->SetReplaceValue( 255 ); FilterType::IndexType index; index[0] = 123; index[1] = 235; filter->SetSeed( index ); filter->SetInput( reader->GetOutput() ); writer->SetInput( filter->GetOutput() ); writer->Update() Confidence Connected
42
Registration Overview Image Resampling Registration Framework Multi-Modality Multi-Resolution Deformable registration
43
Components Fixed Image Moving Image Metric Transform Interpolator Optimizer Registration Method
44
Image Metrics Mean Squares Normalized Correlation Mean Reciprocal Square Difference Mutual Information - Viola-Wells - Mattes - Histogram based - Histogram normalized
45
Transforms Translation Scaling Rotation Rigid3D Rigid2D Affine BSplines Splines: TPS, EBS, VS
46
Optimizers Gradient Descent Regular Step Gradient Descent Conjugate Gradient Levenberg-Marquardt One plus One Evolutionary Algorithm
47
Interpolators Nearest Neighbor Linear BSpline
48
ITK Software Methodology Based on “Best Practices” for Distributed Development Built on Open Source Tools Adopted by NA-MIC
49
NA-MIC National Alliance for Medical Image Computing http://na-mic.org NAMIC Software Process Dan Blezek Jim Miller Bill Lorensen
50
National Alliance for Medical Image Computing http://na-mic.org Extreme Programming
51
National Alliance for Medical Image Computing http://na-mic.org NAMIC 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
52
National Alliance for Medical Image Computing http://na-mic.org Software Process Design Process Coding Standards Testing Bug Tracker Communication –Mailing lists, Discussion forum, Wiki –Tcons Documentation Releases
53
National Alliance for Medical Image Computing http://na-mic.org Design 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
54
National Alliance for Medical Image Computing http://na-mic.org Coding Standards Follow the package’s rules ITK has certain coding standards –Style guidelines –Naming conventions –Macros
55
National Alliance for Medical Image Computing http://na-mic.org Testing If it isn’t tested, it’s broken. Tests –Ensure your code works –Documents expected results –Others free to change
56
National Alliance for Medical Image Computing http://na-mic.org Bug Tracker Bugs assigned / taken by developers Tracks progress to releases Captures feature requests Communication mechanism
57
National Alliance for Medical Image Computing http://na-mic.org Documentation Doxygen –Automatic API documentation –Algorithm references –Implementation details Books / Manuals –Insight Book
58
National Alliance for Medical Image Computing http://na-mic.org Communication Email lists Discussion forum Wiki Tcon
59
National Alliance for Medical Image Computing http://na-mic.org Extreme Programming Compression of standard analyze, design, implement, test cycle into a continuous process
60
National Alliance for Medical Image Computing http://na-mic.org Daily 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 they “Break the Build”
61
National Alliance for Medical Image Computing http://na-mic.org Daily rhythm Design, implement algorithm write regression test check it in Dart takes over Code is updated, built, tested Guilty parties are blamed Debug/Fix Build breakers are notified Work on cleaning up dashboard Repeat
62
National Alliance for Medical Image Computing http://na-mic.org Dart Testing Reports Dashboards Central site for state of the system –Updates –Builds –Test –Coverage
63
National Alliance for Medical Image Computing http://na-mic.org
65
Someone broke the build!
66
National Alliance for Medical Image Computing http://na-mic.org
67
The Big Bat of Quality
68
National Alliance for Medical Image Computing http://na-mic.org Bill “Yogi” Lorensen
69
Conculsion: 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
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.