USE
Xinwei Xue
11/07/02
SCI Institute
OUTLINE
Overview
Software Architecture
Major Functionalities
Applications
Write your applications
Download & Compile
What is ITK
C++ Library for Medical Image
Segmentation & Registration
Open Source
Cross Platform: Linux, Irix, Windows, Sun, etc.
Wrapped with Interpreted Languages
e.g. Tcl, Python, Java, etc.
Goals
Support the Visible Human Project.
Establish a foundation for future research.
Create a repository of fundamental algorithms.
Develop a platform for advanced product
development.
Create conventions for future work.
Grow a self-sustaining community of software
users and developers.
ITK Architecture
Data Flow Architecture
Update Request Triggers Processing
Application
Data Storage
Update
Process Process
Source Object Object
Sink
Data Data Data
Object Object Object
Architectural Features
Reference counting (smart pointers)
Object Factory (plug-in support)
ObjectType::Pointer myObject = ObjectType::New()
Event callbacks (command/observer)
Portable multi-threading
GenerateData()
ThreadedGenerateData()
Architectural Features
Generic Programming
Compile-time oriented
Employs C++ Templates
Iterators
Image Iterators
Neighborhood Iterators
Slice Iterators Requested
Concept of Regions Region
Typedef Buffered Region
Largest Possible Region
Major Funcationalities
Segmentation
Registration
PDE Solver
Image Enhancement
Feature Detection
Image Transformations
Other
Segmentation Tools
Similarity-Based Segmentation
Statistical Pattern Classification:
Supervised (Gaussian) and Unsupervised (Kmeans)
Fuzzy Connectedness
Region-Based Segmentation
Watersheds
Voronoi
Model-Based Segmentation
Level-set Based Segmentation: Threshold, Laplacian
Deformable Mesh
Balloon Force
Hybrid Segmentation
Fuzzy connectedness + voronoi
Registration Tools
Image Multi
Registration Resolution
Framework Registration
Framework
Components
PDE FEM
Based Based
Registration Registration
Components
Registration Method
Fixed
Image
Metric Optimizer
Interpolator
Moving
Image
Transform
Components
Metrics Optimizers
Mutual Information Gradient Descent
Mean Squares Regular Step Gradient Descent
Normalized Correlation Conjugate Gradient
Pattern Intensity Levenberg-Marquardt
Transform Interpolators
Translation Nearest neighbor
Scale Linear
Rotation BSpline
Rigid3D
Rigid2D
Affine
Splines: TPS, EBS, VS
PDE Solver Framework
Finite Difference
Finite Difference Function
Solver
Level
Set
Sparse
Dense Diffusion
Narrow Segment.
Band
Aniso. Diff
Diffusion Curv.
Limited
Other Solvers Other Functions
PDE Filter Structure
Solver Object
Output
Input
Image
Image
Function (Filtered)
Object
Parameters
Image Enhancement
Morphology
Filter
Gaussian
Filters Erode/Dilate
Filters
Anisotropic Image
Diffusion Binary
Enhancemnet
Filters
Curvature
Diffusion
Other
Curvature
Filters
MinMax Flow
Low Level Feature Detection
Sobel Edge
Detection
Gradient
Thresholding
Laplacian Feature
Detection Canny
Edges
Zero-
Crossing
Other
Laplacian of
Filters
Gaussian
ITK Applications
Watershed Segmentation
Interactive Segmentation
Multi Field
MRI Results
Start Using ITK
Image Class
Related to Image Class:
Region, Size, Index, etc.
ImageToImageFilter
Image Region Iterator
Neighborhood & Neighborhood Iterators
NeighborhoodIterator SmartNeighborhoodIterator
RandomAccessNeighhoodIterator
Neighborhood Operators
DerivativeOperator, GaussisnOperator, LaplacianOperator, etc.
Image IO: PNG, Raw,VOL,VTK, Dicom, Meta formate supported
Neighborhood
Templeted over neighorhood radius, image,
and image region to be processed.
0 1 2 Radius = 1
3 4 5
6 7 8
0 1 2 3 4 5 6 7 8
Image Declaration & Allocation
typedef itk::Image ImageType;
typedef typename ImageType::RegionType RegionType;
typedef typename ImageType::SizeType SizeType;
typedef typename ImageType::IndexType IndexType
//Creates an image pointer
ImageType::Pointer image;
//Allocating memory for a image
RegionType region;
SizeType size;
IndexType index;
size[0] = 256; size[1] = 256;
index[0] = 0; index[1] = 0;
region.SetSize(size);
region.SetIndex(index);
image->SetRegions(region);
image->Allocate( );
Neighhood Iterators Example
itk::NeighborhoodInnerProduct IP;
itk::DerivativeOperator operator;
operator->SetOrder(1);
operator->SetDirection(0);
operator->CreateDirectional();
itk::NeighborhoodIterator iterator(operator->GetRadius(),
myImage, myImage->GetRequestedRegion());
iterator.SetToBegin();
while ( ! iterator.IsAtEnd() )
{
std::cout ImageType
typedef itk::ImageFileReader FileSourceType;
typedef itk::PNGImageIO PNGReaderType;
typedef itk::ImageFileWriter FileSinkType;
typedef itk::PNGImageIO PNGWriterType;
//read
FileSourceType::Pointer fileSource = FileSourceType::New();
fileSource->SetFileName( inputFileName );
PNGReaderType::Pointer pngReader = PNGReaderType::New();
pngReader->SetNumberOfDimensions( 3 );
fileSource->SetImageIO( pngReader );
//write
FileSinkType::Pointer fileSink = FileSinkType::New();
PNGWriterType::Pointer pngWriter = PNGWriterType::New();
fileSink->SetImageIO( pngWriter );
fileSink->SetFilePrefix( outputFileName );
fileSink->SetInput( fileSource->GetOutput() );
fileSink->Update( );
Calling An Image Filter
#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 FilterType;
typedef itk::PNGImageIO PNGReaderType;
PNGReaderType::Pointer pngReader = PNGReaderType::New();
ReaderType::Pointer reader = ReaderType::New();
FilterType::Pointer filter = FilterType::New();
reader->SetFileName( argv[1] );
reader->SetImageIO(
filter->SetInput( reader->GetOutput() );
filter->Update();
return 0;
}
Get ITK
Depending your building options, you may need
other tools to do a complete build.
Configure & Compile ITK
mkdir build
cd build
ccmake ../Insight
Make
See http://www.itk.org/HTML/BuildOptions.htm
For More Building Options.
Configure ITK
Writing myProject.cxx
#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 FilterType;
typedef itk::PNGImageIO PNGReaderType;
PNGReaderType::Pointer pngReader = PNGReaderType::New();
ReaderType::Pointer reader = ReaderType::New();
FilterType::Pointer filter = FilterType::New();
reader->SetFileName( argv[1] );
reader->SetImageIO(
filter->SetInput( reader->GetOutput() );
filter->Update();
return 0;
}
Meet Problems?
Join the ITK user’s email list
http://www.itk.org/HTML/MailingLists.htm
Very Helpful!!!
Reference
www.itk.org
Presentations of ITK Meetings
Thank you!