+ All Categories
Home > Documents > Getting Started with ITK in Python Language I. Introduction to ITK, Python Wrapping and VTK-ITK...

Getting Started with ITK in Python Language I. Introduction to ITK, Python Wrapping and VTK-ITK...

Date post: 11-Jan-2016
Category:
Upload: norman-richard
View: 249 times
Download: 1 times
Share this document with a friend
32
Getting Started with ITK in Python Language I. Introduction to ITK, Python Wrapping and VTK-ITK Connection
Transcript
Page 1: Getting Started with ITK in Python Language I. Introduction to ITK, Python Wrapping and VTK-ITK Connection.

Getting Started with ITK in Python Language

I. Introduction to ITK, Python Wrapping and VTK-ITK Connection

Page 2: Getting Started with ITK in Python Language I. Introduction to ITK, Python Wrapping and VTK-ITK Connection.

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?

Page 3: Getting Started with ITK in Python Language I. Introduction to ITK, Python Wrapping and VTK-ITK Connection.

What is ITK

Open Source C++ Toolkit

Medical ImageProcessing

Registration Segmentation

Page 4: Getting Started with ITK in Python Language I. Introduction to ITK, Python Wrapping and VTK-ITK Connection.

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)

Page 5: Getting Started with ITK in Python Language I. Introduction to ITK, Python Wrapping and VTK-ITK Connection.

The Big Picture

ITKITK

Common Basic Filters

Algorithms Numerics

Page 6: Getting Started with ITK in Python Language I. Introduction to ITK, Python Wrapping and VTK-ITK Connection.

Common

Common

Data

System

Pipeline

PointSet

MeshImage

ListFeatures

Histogram

Basic

VectorContainer

MapContainer

MultiThreader

Mutex

PointMatrix

Vector

Size

Exceptions

ProcessObject

DataObject

Events

ObserverTransforms Index

Page 7: Getting Started with ITK in Python Language I. Introduction to ITK, Python Wrapping and VTK-ITK Connection.

Numerics

Numerics

VNL

Linear Algebra

Matrix

Vector

SVD Eigen

Optimizers

EvolutionaryAlgorithmsGradient

Descent

MembershipFunctions

Optimizers

Statistics

FEM

Classifiers

Element

Node

Solver

Load

Material

Histogrammethods

Listmethods

Page 8: Getting Started with ITK in Python Language I. Introduction to ITK, Python Wrapping and VTK-ITK Connection.

MorphoMath

Basic Filters

Basic FiltersPixelWise

Neighborhood

Arithmetic

Trigonometric

Global

Median

Derivative

Laplacian

DistanceMap

HaussdorfDistanceAnisotropicDiffusion

EdgeDetection

ConnectedComponents

PNGVTK

DICOM

Meta

IO

Intensity Transf

Page 9: Getting Started with ITK in Python Language I. Introduction to ITK, Python Wrapping and VTK-ITK Connection.

Algorithms

Algorithms

Registration

Metrics

Transforms

Interpolators

Optimizers

MultiResolution

Level Sets

PDE

DeformableModels

Connectedness

FastMarching

NarrowBand

ShapeDetection

GeodesicContours

Watershed

Demons

CurvatureFlow

Fuzzy

Hard

SimpleFuzzy

Balloon Force

Markov RF

Page 10: Getting Started with ITK in Python Language I. Introduction to ITK, Python Wrapping and VTK-ITK Connection.

Pipeline Architecture

Data Flow Data Objects

Image Mesh

Process Objects (Algorithms) Segmentation Registration Image Processing

Streaming capable

Page 11: Getting Started with ITK in Python Language I. Introduction to ITK, Python Wrapping and VTK-ITK Connection.

Pipeline Architecture

Image Filter

Filter

Image

FilterImage Image

Image

Page 12: Getting Started with ITK in Python Language I. Introduction to ITK, Python Wrapping and VTK-ITK Connection.

OutputImage

Architecture

Filter

Streaming – Processing Large ImagesStreaming – Processing Large Images

InputImage

Page 13: Getting Started with ITK in Python Language I. Introduction to ITK, Python Wrapping and VTK-ITK Connection.

Registration Framework

ImageRegistrationFramework

MultiResolution

RegistrationFramework

PDEBased

Registration

FEMBased

Registration

Components

Page 14: Getting Started with ITK in Python Language I. Introduction to ITK, Python Wrapping and VTK-ITK Connection.

Registration Components

FixedImage

MovingImage

Metric

Transform

Interpolator

Optimizer

Registration Method

Page 15: Getting Started with ITK in Python Language I. Introduction to ITK, Python Wrapping and VTK-ITK Connection.

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

Page 16: Getting Started with ITK in Python Language I. Introduction to ITK, Python Wrapping and VTK-ITK Connection.

Why Python Wrapping ?

Interpreted Language

Interactive

Simplifies teaching and learning

Facilitates rapid prototyping

Large python-vtk user base in our Labs

Page 17: Getting Started with ITK in Python Language I. Introduction to ITK, Python Wrapping and VTK-ITK Connection.

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.

Page 18: Getting Started with ITK in Python Language I. Introduction to ITK, Python Wrapping and VTK-ITK Connection.

How does it work ?

Python wrapping requires fully specified C++ types

Image<T,N>

Image<ushort,2>

Image<ushort,3>

Image<float,2>

Image<float,3>

ImageUS2

C++ Python

ImageUS3

ImageF2

ImageF3

Page 19: Getting Started with ITK in Python Language I. Introduction to ITK, Python Wrapping and VTK-ITK Connection.

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 >

Page 20: Getting Started with ITK in Python Language I. Introduction to ITK, Python Wrapping and VTK-ITK Connection.

How does it work?Python wrapper for filters should define type combinations

GaussianImageFilter<ImageUS2,ImageUS2>

GaussianImageFilter<ImageF2,ImageF2>

GaussianImageFilter<ImageUS2,ImageF2>

GaussianImageFilter<ImageF2,ImageUS2>

GaussianImageFilter<ImageF3,ImageUS3>

C++ Python

GaussianFilterUS2US2

GaussianFilterF2F2

GaussianFilterUS2F2

GaussianFilterF2US2

GaussianFilterF3US3

Page 21: Getting Started with ITK in Python Language I. Introduction to ITK, Python Wrapping and VTK-ITK Connection.

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

Page 22: Getting Started with ITK in Python Language I. Introduction to ITK, Python Wrapping and VTK-ITK Connection.

Installation

What do I need? C++ Compiler -- gcc 2.95 to 3.3, Visual C++ 6 -7.1 ) 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.

Page 23: Getting Started with ITK in Python Language I. Introduction to ITK, Python Wrapping and VTK-ITK Connection.

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)

Page 24: Getting Started with ITK in Python Language I. Introduction to ITK, Python Wrapping and VTK-ITK Connection.

Step 2 CMake

Download the latest (1.67) binary for your platform from www.cmake.org

Page 25: Getting Started with ITK in Python Language I. Introduction to ITK, Python Wrapping and VTK-ITK Connection.

Step 3 Install VTK

Install VTK 4.2.2 from source distribution . Turn on the following flags VTK_USE_HYBRID VTK_USE_PATENTED VTK_WRAP_PYTHON VTK_USE_ANSI_STDLIB

Page 26: Getting Started with ITK in Python Language I. Introduction to ITK, Python Wrapping and VTK-ITK Connection.

Step 4 Install Insight

Get the source

cvs Build with CMake

CSWIG_WRAP_PYTHON USE_VTK

Page 27: Getting Started with ITK in Python Language I. Introduction to ITK, Python Wrapping and VTK-ITK Connection.

Step 5 Install InsightApplications

CVS checkout CMake

CONNECT_VTK_ITK

Page 28: Getting Started with ITK in Python Language I. Introduction to ITK, Python Wrapping and VTK-ITK Connection.

Step 6 Environment Variables

Linux/Unix PYTHONPATH LD_LIBRARY_PATY

Windows PATH PYTHONPATH

Page 29: Getting Started with ITK in Python Language I. Introduction to ITK, Python Wrapping and VTK-ITK Connection.

Examples

CurvatureAnisotropicDiffusionImageFilter.py

Page 30: Getting Started with ITK in Python Language I. Introduction to ITK, Python Wrapping and VTK-ITK Connection.

Examples

ImageRegistration3.py

Page 31: Getting Started with ITK in Python Language I. Introduction to ITK, Python Wrapping and VTK-ITK Connection.

Examples : VTK-ITK Connection

CannyEdgeDetectionImageFilterConnectVTKITK.py

Page 32: Getting Started with ITK in Python Language I. Introduction to ITK, Python Wrapping and VTK-ITK Connection.

Where to get help?

www.itk.org ITK Software Guild : PDF document (Over 500

pages) Doxygen generated manual pages Insight-users Mailing Lists

Image Labs coders mailing lists:

http://www.imaging.robarts.ca/coders


Recommended