1 / 69

ITK Introduction and Overview Spring 2006

Discover the history, features, and software engineering of ITK. Learn how ITK revolutionizes segmentation and registration algorithms with its modern, cross-platform design. Explore the scope of ITK and how it's supported and developed by various sponsors. Dive into the numbers and examples of ITK, and find out why it's a vital tool in medical imaging. Get started with useful code and resources to leverage ITK's powerful image processing capabilities in C++. ####

deenar
Download Presentation

ITK Introduction and Overview Spring 2006

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. ITK Introduction and OverviewSpring 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 Institute for Dental and Craniofacial Research The National Science Foundation The National Institute of Neurological Disorders and Stroke

  9. ITK Developers

  10. ITK Developers * 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<unsigned short,2> ImageType; typedef itk::ImageFileReader<ImageType> 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 • Follow the link Alphabetical List • Follow the link Groups • Post to the insight-users mailing list http://www.itk.org/ItkSoftwareGuide.pdf http://www.itk.org/Doxygen/html/index.html

  16. The ITK Software Guide is freely available as a PDF document atwww.itk.org/ ItkSoftwareGuide.pdfIts paper version can be ordered from Amazon.com and from Kitware’s e-store.

  17. Useful Code in ITK • Coding Infrastructure • I/O • Numerics • Based on VNL (Vision Numerics Library) • Image Processing • Convolutions, Non-Linear, Anisotropic… • Segmentation • Registration

  18. ITK Basics • C++ Generic Programming • Data Pipeline • Multi-threading • Streaming • Exceptions • Events / Observers • Tcl, Python and Java wrapping

  19. Generic Programming Example: STL Standard Template Library Abstraction of Types and Behaviors std::vector< T > std::vector< int > std::vector< double > std::vector< char * > std::vector< Point > std::vector< Image >

  20. itk::Image itk::Image< PixelType , Dimension > itk::Image< char , 2 > itk::Image< char , 3 > itk::Image< char , 4 > itk::Image< float , 2 > itk::Image< RGB , 3 > itk::Image< unsigned short , 2 > itk::Image< itk::Vector<float,2> , 2 >

  21. namespaces Avoid naming collisions itk:: itk::Statistics:: itk::fem:: itk::fem::itpack itk::bio

  22. Your favorite keyword typedef typedef itk::Image< char , 2 > ImageType typedef itk::ImageFilter< ImageType , ImageType > FilterType otherwise... itk::ImageFilter< Image< char , 2 > ,Image< char , 2 >> FilterType

  23. SmartPointer SmartPointer SmartPointer Smart Pointers Object counter=0 counter=1 counter=2 counter=3 Self - Delete

  24. SmartPointers typedef itk::Image< char , 2 > ImageType typedef itk::ImageFilter< ImageType , ImageType > FilterType FilterType::Pointerfilter = FilterType::New(); ImageType::Pointerimage = filter->GetOutput(); Pointer notation filter->Update(); NO NEED FOR filter->Delete();

  25. Const Correctness Knowing constancy is Insight. Not knowing constancy leads to disaster. Tao Te Ching, XVI. Lao Tsu

  26. Const Smart Pointers typedef itk::Image< char , 2 > ImageType typedef itk::ImageFilter< ImageType , ImageType > FilterType FilterType::Pointerfilter = FilterType::New(); ImageType::ConstPointerimage = filter->GetOutput(); Can only invoke “const” methods image->GetSpacing (); Compiler error for “non-const” methods image->SetSpacing ( spacing );

  27. Creating an Image typedef itk::Image< char , 3 > ImageType ImageType::Pointerimage = ImageType::New(); ImageType::SizeTypesize; size[ 0 ] = 512; // x direction size[ 1 ] = 512; // y direction size[ 2 ] = 50; // z direction ImageType::IndexTypestart; start[ 0 ] = 0; // x direction start[ 1 ] = 0; // y direction start[ 2 ] = 0; // z direction

  28. Creating an Image ImageType::RegionTyperegion; region.SetSize( size ); region.SetIndex( start ); image->SetRegions( region ); image->Allocate(); image->FillBuffer( 0 ); ImageType::SpacingTypespacing; spacing[ 0 ] = 0.83; // x direction spacing[ 1 ] = 0.83; // y direction spacing[ 2 ] = 2.15; // z direction image->SetSpacing( spacing );

  29. Streaming Processing Large Images Input Image Output Image Filter

  30. LargestPossibleRegion BufferedRegion RequestedRegion Image Regions

  31. Image Image Filter Image Filter Image Image Filter Data Pipeline

  32. Image File Image File ImageFileReader ImageFileWriter Image Image Filter Simple Image IO

  33. Image File ImageFileReader Image PNGImageIO MetaImageIO AnalyzeImageIO GIPLImageIO VTKImageIO DICOMImageIO CustomImageIO Simple Image IO Loadable Factories

  34. Simple Image IO #include “itkImage.h” #include “itkImageFileReader.h” #include “itkImageFileWriter.h” typedef itk::Image<char , 2 > ImageType; typedef itk::ImageFileReader< ImageType> ReaderType; typedef itk::ImageFileWriter< ImageType> WriterType; ReaderType::Pointerreader = ReaderType::New(); WriterType::Pointerwriter = WriterType::New(); reader->SetFileName( “inputImage.dcm” ); // DICOM writer->SetFileName( “outputImage.hdr” ); // Analyze writer->SetInput( reader->GetOutput() ); writer->Update();

  35. Segmentation Overview • Region Growing • ConfidenceConnected • ConnectedThreshold • IsolatedConnected • Watersheds • Level Sets • FastMarching • ShapeDetection • GeodesicActiveContours • ThresholdSegmentation • CannySegmentationLevelSet

  36. Intensity Upper bound X Multiplier Standard Deviation Mean Lower bound Example: Confidence Connected Seed Point + Radius

  37. /** /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. * */

  38. Confidence Connected typedef itk::Image< unsigned char , 2 > ImageType; typedef itk::ConfidenceConnectedImageFilter< ImageType, ImageType > FilterType; FilterType::Pointerfilter = FilterType::New(); filter->SetMultiplier( 1.5 ); filter->SetNumberOfIterations( 5 ); filter->SetInitialNeighborhoodRadius ( 2 ); filter->SetReplaceValue( 255 ); FilterType::IndexTypeindex; index[0] = 123; index[1] = 235; filter->SetSeed( index); filter->SetInput( reader->GetOutput() ); writer->SetInput( filter->GetOutput() ); writer->Update()

  39. Registration Overview • Image Resampling • Registration Framework • Multi-Modality • Multi-Resolution • Deformable registration

  40. Components Registration Method FixedImage Metric Optimizer Interpolator MovingImage Transform

  41. Image Metrics • Mean Squares • Normalized Correlation • Mean Reciprocal Square Difference • Mutual Information- Viola-Wells- Mattes- Histogram based- Histogram normalized

  42. Transforms • Translation • Scaling • Rotation • Rigid3D • Rigid2D • Affine • BSplines • Splines: TPS, EBS, VS

  43. Optimizers • Gradient Descent • Regular Step Gradient Descent • Conjugate Gradient • Levenberg-Marquardt • One plus One Evolutionary Algorithm

  44. Interpolators • Nearest Neighbor • Linear • BSpline

  45. ITK Software Methodology • Based on “Best Practices” for Distributed Development • Built on Open Source Tools • Adopted by NA-MIC

  46. NAMIC Software Process Dan Blezek Jim Miller Bill Lorensen

  47. Extreme Programming

More Related