Presentation is loading. Please wait.

Presentation is loading. Please wait.

Image Registration Lecture 7: Getting Started with ITK March 15, 2005 Prof. Charlene Tsai.

Similar presentations


Presentation on theme: "Image Registration Lecture 7: Getting Started with ITK March 15, 2005 Prof. Charlene Tsai."— Presentation transcript:

1 Image Registration Lecture 7: Getting Started with ITK March 15, 2005 Prof. Charlene Tsai

2 Image RegistrationLecture 6 2 The Insight Toolkit The Segmentation and Registration Toolkit

3 Image RegistrationLecture 6 3 What is ITK ?  Image Processing  Segmentation  Registration  No Graphical User Interface (GUI)  No Visualization

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

5 Image RegistrationLecture 6 5 ITK Developers

6 Image RegistrationLecture 6 6 ITK Developers * indicates a subcontractor.

7 Image RegistrationLecture 6 7 The Insight Toolkit Starting with ITK

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

9 Image RegistrationLecture 6 9 What do I need ? 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

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

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

12 Image RegistrationLecture 6 12 Configuring ITK – MS-Windows  Run CMake  Select the SOURCE directory  Select the BINARY directory  Select your Compiler

13 Image RegistrationLecture 6 13 Configuring ITK – MS-Windows

14 Image RegistrationLecture 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

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

16 Image RegistrationLecture 6 16 Configuring ITK – Unix

17 Image RegistrationLecture 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

18 Image RegistrationLecture 6 18 Building ITK

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

20 Image RegistrationLecture 6 20 Building ITK

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

22 Image RegistrationLecture 6 22 Building ITK  Most of ITK classes are C++ Templates  Basic libraries are small they only contain non-templated classes  Basic libraries are built in about 15 min

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

24 Image RegistrationLecture 6 24 Verifying the Built  ITKCommon  ITKBasicFilters  ITKAlgorithms  ITKNumerics  ITKFEM The following libraries should be there  ITKIO  ITKStatistics  ITKMetaIO  itkpng  itkzlib

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

26 Image RegistrationLecture 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

27 Image RegistrationLecture 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 !

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

29 Image RegistrationLecture 6 29 Doxygen Documentation

30 Image RegistrationLecture 6 30 Doxygen Groups

31 Image RegistrationLecture 6 31 Doxygen Alphabetical List

32 Image RegistrationLecture 6 32 ITK Architecture

33 Image RegistrationLecture 6 33 ITK Basics  C++ Generic Programming  Data Pipeline  Multi-threading  Streaming  Exceptions  Events / Observers  Tcl and Python wrapping

34 Image RegistrationLecture 6 34 Generic Programming Example: STL Standard Template Library Abstraction of Types and Behaviors std::vector

35 Image RegistrationLecture 6 35 ITK Image Class itk::Image itk::Image, 2 >

36 Image RegistrationLecture 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;

37 Image RegistrationLecture 6 37 ITK Most Common Keyword typedef typedef itk::Image ImageType typedef itk::ImageFilter FilterType otherwise... itk::ImageFilter, Image > FilterType

38 Image RegistrationLecture 6 38 Smart Pointers Object Smart Pointer counter=0counter=1counter=2counter=3 Self - Delete

39 Image RegistrationLecture 6 39 Smart Pointers typedef itk::Image ImageType typedef itk::ImageFilter FilterType FilterType::Pointer filter = FilterType::New(); ImageType::Pointer image = filter->GetOutput(); NO NEED FOR filter->Delete();

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

41 Image RegistrationLecture 6 41 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 );

42 Image RegistrationLecture 6 42 Data Pipeline Image Filter Image Filter Image Filter

43 Image RegistrationLecture 6 43 Image Regions LargestPossibleRegion BufferedRegion RequestedRegion

44 Image RegistrationLecture 6 44 Streaming Output Image Filter Processing Large Images Input Image

45 Image RegistrationLecture 6 45 Simple Image IO Image File ImageFileReader Image Filter Image File ImageFileWriter

46 Image RegistrationLecture 6 46 Simple Image IO CustomImageIO Image File ImageFileReader Image PNGImageIO VTKImageIODICOMImageIOGIPLImageIO MetaImageIOAnalyzeImageIO Loadable Factories

47 Image RegistrationLecture 6 47 Simple Image IO #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();

48 Image RegistrationLecture 6 48 Exceptions Error Management ITK Layer Application Layer

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

50 Image RegistrationLecture 6 50 Events and Commands/Observers Itk::Object Itk::Command itk::Command Event

51 Image RegistrationLecture 6 51 Events Common Events AnyEvent() StartEvent() EndEvent() ProgressEvent() IterationEvent()

52 Image RegistrationLecture 6 52 Events and Commands/Observers Itk::Object Itk::ProcessObject Itk::FilterXY Itk::Command MyCommand Execute() AddObserver( ) AnyEvent MyEvent

53 Image RegistrationLecture 6 53 GUI Communication ITK Layer GUI Layer Widget FilterX Callback Command FilterX Widget Observer

54 Image RegistrationLecture 6 54 End Enjoy ITK !


Download ppt "Image Registration Lecture 7: Getting Started with ITK March 15, 2005 Prof. Charlene Tsai."

Similar presentations


Ads by Google