Download presentation
1
Getting Started with ITK in Python Language
I. Introduction to ITK, Python Wrapping and VTK-ITK Connection
2
Outline ITK Overview (most slides are adopted from Documents in Insight Toolkit 1.2 CD) Python Wrapping Installations Examples Filter Registration ITK-VTK connection Where to get help?
3
Open Source C++ Toolkit
What is ITK Open Source C++ Toolkit Medical Image Processing Registration Segmentation
4
ITK Overview Core design concepts
Generic programming (e.g. temper late, containers, iterators.) Smart pointers for memory management Object factories for adaptable object instantiation Command/observer design paradigm for event management Multithreading support Cross-platform (CMake) Efficient n-dimensional implementation
5
The Big Picture Common Basic Filters ITK Numerics Algorithms
6
Common Common System Data Pipeline Basic MultiThreader Mutex
Exceptions Data Basic PointSet Pipeline Image VectorContainer MapContainer ListFeatures Histogram Mesh Point Matrix Vector ProcessObject DataObject Events Observer Size Transforms Index
7
Numerics Numerics Optimizers VNL Statistics FEM Eigen SVD Matrix
Membership Functions Classifiers Vector Linear Algebra Evolutionary Algorithms Gradient Descent Histogram methods Optimizers List methods Optimizers VNL Element Statistics Node Numerics Solver FEM Load Material
8
Basic Filters Basic Filters PixelWise Neighborhood IO Global
Arithmetic Basic Filters PixelWise Trigonometric Intensity Transf MorphoMath Neighborhood IO Median Global Derivative Laplacian EdgeDetection PNG VTK DICOM Meta DistanceMap HaussdorfDistance Anisotropic Diffusion Connected Components
9
Algorithms Algorithms Markov RF Level Sets Registration PDE
Interpolators Narrow Band Shape Detection Fast Marching Transforms Optimizers Geodesic Contours Metrics Multi Resolution Watershed Markov RF Level Sets Registration Demons CurvatureFlow PDE Algorithms Fuzzy Connectedness Hard SimpleFuzzy Deformable Models Balloon Force
10
Pipeline Architecture
Data Flow Data Objects Image Mesh Process Objects (Algorithms) Segmentation Registration Image Processing Streaming capable
11
Pipeline Architecture
Image Filter
12
Streaming – Processing Large Images
Architecture Streaming – Processing Large Images Input Image Output Image Filter
13
Registration Framework
Multi Resolution Registration Framework Image Registration Framework Components PDE Based Registration FEM Based Registration
14
Registration Components
Registration Method Fixed Image Metric Optimizer Transform Interpolator Moving Image Metric: Mutual Information, Mean Squares, Normalized Correlation and Pattern Intensity Optimizer: Gradient Descent, Regular Step Gradient Descent, Conjugate Gradient, Levenberg-Marquardt Transform: Translation, Scale, Rotation, Rigid3D, Rigid2D, Affine and Splines (TPS, EBS, VS) Interpolator: Nearest neighbor, Linear, BSpline
15
Other Frameworks Level Set Framework for segmentation FEM Framework
A subsystem for solving general FEM problems, in particular non-rigid registration IO Framework Use a flexible object factory mechanism to support a variety of file formats
16
Why Python Wrapping ? Interpreted Language Interactive
Simplifies teaching and learning Facilitates rapid prototyping Large python-vtk user base in our Labs
17
How Does It Work? ITK Core is implemented in C++
Tcl and Python bindings are generated automatically using a combination of gccxml -- a modified version of gcc Cable -- processes XML info from gccxml and generates input for CSWIG CSWIG -- modified version of SWIG that produces Python (or Tcl ) binding Under active development, no binary installation package yet.
18
Python wrapping requires fully specified C++ types
How does it work ? Python wrapping requires fully specified C++ types C++ Python Image<T,N> Image<ushort,2> ImageUS2 Image<ushort,3> ImageUS3 Image<float,2> ImageF2 Image<float,3> ImageF3
19
How does it work ? ITK Filters are Templated over Image Type
GaussianImageFilter< InputImage, OutputImage > GaussianImageFilter< ImageU2 , ImageU2 > GaussianImageFilter< ImageF2 , ImageF2 > GaussianImageFilter< ImageU2 , ImageF2 > GaussianImageFilter< ImageF2 , ImageU2 > GaussianImageFilter< ImageF3 , ImageU3 >
20
How does it work? C++ Python
Python wrapper for filters should define type combinations C++ Python GaussianImageFilter<ImageUS2,ImageUS2> GaussianFilterUS2US2 GaussianImageFilter<ImageF2,ImageF2> GaussianFilterF2F2 GaussianImageFilter<ImageUS2,ImageF2> GaussianFilterUS2F2 GaussianImageFilter<ImageF2,ImageUS2> GaussianFilterF2US2 GaussianImageFilter<ImageF3,ImageUS3> GaussianFilterF3US3
21
VTK-ITK Connection in Python
Implemented as an module ConnectVTKITK in InsightApplication repository Connect the pipeline with Import and Export classed in VTK and ITK VTK exporter ITK importer ITK exporter VTK importer Use ITK for image processing, registration, segmentation and VTK for visualization Status: Under active development
22
Installation What do I need?
C++ Compiler -- gcc 2.95 to 3.3, Visual C ) CMake (1.67 or cvs checkout) Python (2.1, 2.2, or 2.3) VTK (4.2.2 or cvs checkout) Insight (cvs checkout) InsightApplications Installation for Python-VTK-ITK is not straight forward right now, no binary distribution. A step by step instruction will be posted on Image Lab coders’ web page.
23
Step 1 Python and modules
Linux comes with python and tcl/tk Windows: python 2.2, tcl/tk 8.3 Numpy (Numeric Python) Scientific Python (Install NetCDF library first for NetCDF and MINC support)
24
Step 2 CMake Download the latest (1.67) binary for your platform from
25
Step 3 Install VTK Install VTK from source distribution . Turn on the following flags VTK_USE_HYBRID VTK_USE_PATENTED VTK_WRAP_PYTHON VTK_USE_ANSI_STDLIB
26
Step 4 Install Insight Get the source cvs Build with CMake
CSWIG_WRAP_PYTHON USE_VTK
27
Step 5 Install InsightApplications
CVS checkout CMake CONNECT_VTK_ITK
28
Step 6 Environment Variables
Linux/Unix PYTHONPATH LD_LIBRARY_PATY Windows PATH
29
Examples CurvatureAnisotropicDiffusionImageFilter.py
30
Examples ImageRegistration3.py
31
Examples : VTK-ITK Connection
CannyEdgeDetectionImageFilterConnectVTKITK.py
32
Where to get help? www.itk.org Image Labs coders mailing lists:
ITK Software Guild : PDF document (Over 500 pages) Doxygen generated manual pages Insight-users Mailing Lists Image Labs coders mailing lists:
Similar presentations
© 2024 SlidePlayer.com. Inc.
All rights reserved.