1 / 54

Image Registration Lecture 7: Getting Started with ITK March 15, 2005

Image Registration Lecture 7: Getting Started with ITK March 15, 2005. Prof. Charlene Tsai. The Insight Toolkit. The Segmentation and Registration Toolkit. What is ITK ?. Image Processing Segmentation Registration No Graphical User Interface (GUI) No Visualization. ITK Sponsors.

odele
Download Presentation

Image Registration Lecture 7: Getting Started with ITK March 15, 2005

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. Image Registration Lecture 7: Getting Started with ITKMarch 15, 2005 Prof. Charlene Tsai

  2. The Insight Toolkit The Segmentation andRegistration Toolkit Lecture 6

  3. What is ITK ? • Image Processing • Segmentation • Registration • No Graphical User Interface (GUI) • No Visualization Lecture 6

  4. ITK Sponsors The National Institute for Dental and Craniofacial Research The National Science Foundation The National Institute of Neurological Disorders and Stroke Lecture 6

  5. ITK Developers Lecture 6

  6. ITK Developers * indicates a subcontractor. Lecture 6

  7. The Insight Toolkit Starting with ITK Lecture 6

  8. C++ Glue Code GUI {MFC,Qt, wxWin FLTK} ITK Image Processing Visualization {OpenGL, VTK} Integrating ITK in your application Lecture 6

  9. C++ Compiler gcc 2.95 – 3.3 Visual C++ 6.0 Visual C++ 7.0 VC++ 7 2003 Intel 5.0 IRIX CC Borland 5.0 Mac - gcc CMake www.cmake.org What do I need ? Lecture 6

  10. Live on the Edge CVS Stability Release tar files http://www.itk.org Insight.tgz CVS anonymous Downloading ITK Or download the not-very-recent copy from the course website Lecture 6

  11. Binary Tree Out Source Build ITK ITKb Recommended ! Common Common Algorithms Algorithms BasicFilter BasicFilter Numerics Numerics In Source Build IO IO Configuring ITK Source Tree Lecture 6

  12. Configuring ITK – MS-Windows • Run CMake • Select the SOURCE directory • Select the BINARY directory • Select your Compiler Lecture 6

  13. Configuring ITK – MS-Windows Lecture 6

  14. Configuring ITK – MS-Windows • Disable BUILD_EXAMPLES • Disable BUILD_SHARED_LIBS • Disable BUILD_TESTING • Click “Configure” to configure • Click “OK” to generate project files Lecture 6

  15. Configuring ITK – Unix • Create the BINARY directory (mkdir) • Change directory to the BINARY directory (cd) • Set the environment variables CC and CXXsetenv CC /usr/bin/gcc; setenv CXX /usr/bin/g++ ORexport CC=/usr/bin/gcc; export CXX=/usr/bin/g++ • Type ccmake with argument the SOURCE directory Lecture 6

  16. Configuring ITK – Unix Lecture 6

  17. Configuring ITK – Unix • Disable BUILD_EXAMPLES • Disable BUILD_SHARED_LIBS • Disable BUILD_TESTING • Type “c” to configure • Type “g” to generate the Makefiles • Type “make” to start building Lecture 6

  18. Building ITK Lecture 6

  19. Building ITK • Open ITK.dsw in the Binary Directory • Select ALL_BUILD project • Build it …It will take about 15 minutes … Lecture 6

  20. Building ITK Lecture 6

  21. Building ITK • Open ITK.sln in the Binary Directory • Select ALL_BUILD project • Build it …It will take about 15 minutes … Lecture 6

  22. Building ITK • Most of ITK classes are C++ Templates • Basic libraries are smallthey only contain non-templated classes • Basic libraries are built in about 15 min Lecture 6

  23. Verifying the Built Libraries will be found in In MS-Windows ITK_BINARY / bin / { Debug, Release } In UNIX ITK_BINARY / bin / Lecture 6

  24. The following libraries should be there Verifying the Built • ITKCommon • ITKBasicFilters • ITKAlgorithms • ITKNumerics • ITKFEM • ITKIO • ITKStatistics • ITKMetaIO • itkpng • itkzlib Lecture 6

  25. Create “CMakeLists.txt” & cxx files In the source directory • Select Source Dir • Select Binary Dir Run CMake Using ITK – Hello World (Review) Lecture 6

  26. Using ITK – Hello World • Accept the default in CMAKE_BACKBARD_COMPATIBILITY • Leave empty EXECUTABLE_OUTPUT_PATH • Leave empty LIBRARY_OUTPUT_PATH • Set ITK_DIR to the binary directory where ITK was built Lecture 6

  27. Building the HelloWorld Project • Open HelloWorld.dsw (or .sln) generated by CMake • Select ALL_BUILD project • Build it …It will take about 3 seconds … • Locate the file HelloWorld.exe • Run it… • It should produce the message:ITK Hello World ! Lecture 6

  28. How to Find What Your Need http://www.itk.org http://www.itk.org/Doxygen/html/index.html • Follow the link Alphabetical List • Follow the link Groups • Post to the insight-users mailing list Lecture 6

  29. Doxygen Documentation Lecture 6

  30. Doxygen Groups Lecture 6

  31. Doxygen Alphabetical List Lecture 6

  32. ITK Architecture ITK Architecture Lecture 6

  33. ITK Basics • C++ Generic Programming • Data Pipeline • Multi-threading • Streaming • Exceptions • Events / Observers • Tcl and Python wrapping Lecture 6

  34. 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 > Lecture 6

  35. ITK Image Class 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 > Lecture 6

  36. C++ Namespaces Avoid naming collisions itk:: itk::Statistics:: itk::fem:: itk::fem::itpack itk::bio NEVER DO: using namespace itk; using namespace std; Lecture 6

  37. ITK Most Common Keyword typedef typedef itk::Image< char , 2 > ImageType typedef itk::ImageFilter< ImageType , ImageType > FilterType otherwise... itk::ImageFilter< Image< char , 2 > , Image< char , 2 >> FilterType Lecture 6

  38. SmartPointer SmartPointer SmartPointer Smart Pointers Object counter=0 counter=1 counter=2 counter=3 Self - Delete Lecture 6

  39. Smart Pointers typedef itk::Image< char , 2 > ImageType typedef itk::ImageFilter< ImageType , ImageType > FilterType FilterType::Pointerfilter = FilterType::New(); ImageType::Pointerimage = filter->GetOutput(); NO NEED FOR filter->Delete(); Lecture 6

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

  41. 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 ); Lecture 6

  42. Image Image Filter Image Filter Image Image Filter Data Pipeline Lecture 6

  43. LargestPossibleRegion BufferedRegion RequestedRegion Image Regions Lecture 6

  44. Streaming Processing Large Images Input Image Output Image Filter Lecture 6

  45. Image File Image File ImageFileReader ImageFileWriter Image Image Filter Simple Image IO Lecture 6

  46. Image File ImageFileReader Image PNGImageIO MetaImageIO AnalyzeImageIO GIPLImageIO VTKImageIO DICOMImageIO CustomImageIO Simple Image IO Loadable Factories Lecture 6

  47. 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(); Lecture 6

  48. Exceptions Error Management Application Layer ITK Layer Lecture 6

  49. Exceptions try { filter->Update(); } catch(itk::ExceptionObject & exp ) { std::cerr << exp << std::endl; } Lecture 6

  50. Itk::Command Event itk::Command Event Event itk::Command Event itk::Command Event itk::Command Events and Commands/Observers Itk::Object Lecture 6

More Related