Download presentation
Presentation is loading. Please wait.
Published byGabriel McLain Modified over 11 years ago
1
ITK Architecture Kitware Inc.
2
ITK Basics C++ Generic Programming Data Pipeline Multi-threading Streaming Exceptions Events / Observers Tcl, Python and Java wrapping
3
Generic Programming Example: STL Standard Template Library Abstraction of Types and Behaviors std::vector
4
itk::Image itk::Image, 2 >
5
namespaces Avoid naming collisions itk:: itk::Statistics:: itk::fem:: itk::fem::itpack itk::bio
6
Your favorite keyword typedef typedef itk::Image ImageType typedef itk::ImageFilter FilterType otherwise... itk::ImageFilter, Image > FilterType
7
Smart Pointers Object Smart Pointer counter=0counter=1counter=2counter=3 Self - Delete
8
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();
9
Const Correctness Knowing constancy is Insight. Not knowing constancy leads to disaster. Tao Te Ching, XVI. Lao Tsu
10
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 );
11
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
12
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 );
13
Exercise 3
14
Output Image Streaming Filter Processing Large Images Input Image
15
Image Regions LargestPossibleRegion BufferedRegion RequestedRegion
16
Data Pipeline Image Filter Image Filter Image Filter
17
Simple Image IO Image File ImageFileReader Image Filter Image File ImageFileWriter
18
CustomImageIO Simple Image IO Image File ImageFileReader Image PNGImageIO VTKImageIODICOMImageIOGIPLImageIO MetaImageIOAnalyzeImageIO Loadable Factories
19
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();
20
Exceptions Error Management ITK Layer Application Layer
21
Exceptions try { filter->Update(); } catch( itk::ExceptionObject & exp ) { std::cerr << exp << std::endl; }
22
Exercise 4 Image File ImageFileWriter Caster Image File ImageFileReader Filter
23
Events and Observers Itk::Object Itk::Command itk::Command Event
24
Events and Observers Common Events AnyEvent() StartEvent() EndEvent() ProgressEvent() IterationEvent()
25
Events and Observers Itk::Object Itk::ProcessObject Itk::FilterXY Itk::Command MyCommand Execute() AddObserver( ) AnyEvent MyEvent
26
Events and Observers Itk::Object Itk::ProcessObject Itk::FilterXY Itk::Command Itk::SimpleMemberCommand AddObserver( ) MyClass MethodX() AnyEvent MyEvent
27
Exercise 5 Image File ImageFileReaderFilterImageFileWriter Image File CommandObserver Execute() ProgressEvent() StartEvent() EndEvent()
28
GUI Communication ITK Layer GUI Layer Widget FilterX Callback Command FilterX Widget Observer
29
Enjoy ITK !
Similar presentations
© 2025 SlidePlayer.com Inc.
All rights reserved.