1 ITK Lecture 9 - Toolbox Part I Methods in Image Analysis CMU Robotics Institute 16-725 U. Pitt Bioengineering 2630 Spring Term, 2006 Methods in Image.

Slides:



Advertisements
Similar presentations
Robot Modeling and the Forward Kinematic Solution
Advertisements

Robot Modeling and the Forward Kinematic Solution
Medical Image Registration Kumar Rajamani. Registration Spatial transform that maps points from one image to corresponding points in another image.
SOFTWARE TESTING. INTRODUCTION  Software Testing is the process of executing a program or system with the intent of finding errors.  It involves any.
Timed Automata.
Computer vision: models, learning and inference Chapter 13 Image preprocessing and feature extraction.
This work by John Galeotti and Damion Shelton, © , was made possible in part by NIH NLM contract# HHSN P, and is licensed under a Creative.
CHAPTER 12 Height Maps, Hidden Surface Removal, Clipping and Level of Detail Algorithms © 2008 Cengage Learning EMEA.
Image Segmentation Image segmentation (segmentace obrazu) –division or separation of the image into segments (connected regions) of similar properties.
1 ITK Lecture 7 - Writing Filters, Part 1 Methods in Image Analysis CMU Robotics Institute U. Pitt Bioengineering 2630 Spring Term, 2006 Methods.
Methods in Image Analysis 2004, Damion Shelton 1 ITK Lecture 6 - The Pipeline Methods in Image Analysis CMU Robotics Institute U. Pitt Bioengineering.
Geometry Control – Modifying and Relimiting; Using Axes and Transformation Ideas Chapter 2: 2.4 & 2.5 R. Lindeke IE 1225.
Radial Basis Functions
CS 128/ES Lecture 5b1 Vector Based Data. CS 128/ES Lecture 5b2 Spatial data models 1.Raster 2.Vector 3.Object-oriented Spatial data formats:
17 VECTOR CALCULUS.
Single Point of Contact Manipulation of Unknown Objects Stuart Anderson Advisor: Reid Simmons School of Computer Science Carnegie Mellon University.
1 Numerical geometry of non-rigid shapes Non-Euclidean Embedding Non-Euclidean Embedding Lecture 6 © Alexander & Michael Bronstein tosca.cs.technion.ac.il/book.
October 7, 2010Neural Networks Lecture 10: Setting Backpropagation Parameters 1 Creating Data Representations On the other hand, sets of orthogonal vectors.
Abstraction: Polymorphism, pt. 1 Abstracting Objects.
Face Recognition Using Neural Networks Presented By: Hadis Mohseni Leila Taghavi Atefeh Mirsafian.
Chapter 9: Boundary Testing
ME751 Advanced Computational Multibody Dynamics Review Calculus Starting Chapter 9 of Haug book January 26, 2010 © Dan Negrut, 2010 ME751, UW-Madison "Motivation.
SVD(Singular Value Decomposition) and Its Applications
The content of these slides by John Galeotti, © Carnegie Mellon University (CMU), was made possible in part by NIH NLM contract# HHSN P,
COMP 175: Computer Graphics March 24, 2015
Inheritance. Recall the plant that we defined earlier… class Plant { public: Plant( double theHeight ) : hasLeaves( true ), height (theHeight) { } Plant(
BACKGROUND LEARNING AND LETTER DETECTION USING TEXTURE WITH PRINCIPAL COMPONENT ANALYSIS (PCA) CIS 601 PROJECT SUMIT BASU FALL 2004.
Digital Image Fundamentals II 1.Image modeling and representations 2.Pixels and Pixel relations 3.Arithmetic operations of images 4.Image geometry operation.
CSIE Dept., National Taiwan Univ., Taiwan
Under Supervision of Dr. Kamel A. Arram Eng. Lamiaa Said Wed
The content of these slides by John Galeotti, © Carnegie Mellon University (CMU), was made possible in part by NIH NLM contract# HHSN P,
September 23, 2014Computer Vision Lecture 5: Binary Image Processing 1 Binary Images Binary images are grayscale images with only two possible levels of.
1 Subdivision Termination Criteria in Subdivision Multivariate Solvers Iddo Hanniel, Gershon Elber CGGC, CS, Technion.
Digital Image Processing CCS331 Relationships of Pixel 1.
1 ITK Lecture 8 - Neighborhoods Methods in Image Analysis CMU Robotics Institute U. Pitt Bioengineering 2630 Spring Term, 2006 Methods in Image.
Methods in Image Analysis 2004, Damion Shelton 1 ITK Lecture 9 - Toolbox Part I Methods in Image Analysis CMU Robotics Institute U. Pitt Bioengineering.
Feature based deformable registration of neuroimages using interest point and feature selection Leonid Teverovskiy Center for Automated Learning and Discovery.
CSCI-383 Object-Oriented Programming & Design Lecture 18.
Digital Media Dr. Jim Rowan ITEC So far… We have compared bitmapped graphics and vector graphics We have discussed bitmapped images, some file formats.
Advanced Computer Graphics Spring 2014 K. H. Ko School of Mechatronics Gwangju Institute of Science and Technology.
Basic Perspective Projection Watt Section 5.2, some typos Define a focal distance, d, and shift the origin to be at that distance (note d is negative)
Hough transform and geometric transform
Data Design and Implementation. Definitions Atomic or primitive type A data type whose elements are single, non-decomposable data items Composite type.
1 ITK Lecture 6 - The Pipeline Methods in Image Analysis CMU Robotics Institute U. Pitt Bioengineering 2630 Spring Term, 2006 Methods in Image Analysis.
1 ITK Lecture 5 Intro to Iterators Methods in Image Analysis CMU Robotics Institute U. Pitt Bioengineering 2630 Spring Term, 2006 Methods in Image.
Advanced Computer Graphics Spring 2014 K. H. Ko School of Mechatronics Gwangju Institute of Science and Technology.
Digital Media Lecture 5: Vector Graphics Georgia Gwinnett College School of Science and Technology Dr. Jim Rowan.
Cell Arrays: An Introduction Without an understanding of how cell arrays work and how to interact with them, cell arrays can be one of the most frustrating.
More on Ray Tracing Glenn G. Chappell U. of Alaska Fairbanks CS 481/681 Lecture Notes Wednesday, April 14, 2004.
Digital Image Processing CCS331 Relationships of Pixel 1.
ITK. Ch 9 Segmentation Confidence Connected Isolated Connected Confidence Connected in Vector Images Jin-ju Yang.
Lecture 8: Collections, Comparisons and Conversions. Svetla Boytcheva AUBG, Spring COS 240 Object-Oriented Languages.
Topics  Direct Predicate Characterization as an evaluation method.  Implementation and Testing of the Approach.  Conclusions and Future Work.
Eigenfaces (for Face Recognition)
Matlab Training Session 4: Control, Flow and Functions
Mean Shift Segmentation
Computer Vision Lecture 5: Binary Image Processing
Lecture 19 Write Your Own ITK Filters, Part2
T490 (IP): Tutorial 2 Chapter 2: Digital Image Fundamentals
Discussion section #2 HW1 questions?
CSC4820/6820 Computer Graphics Algorithms Ying Zhu Georgia State University Transformations.
EE/CSE 576 HW 1 Notes.
Digital Media Dr. Jim Rowan ITEC 2110.
Lecture 19 ITK’s Path Framework
EE/CSE 576 HW 1 Notes.
Quantum Foundations Lecture 3
Review for test #3 Radial basis functions SVM SOM.
Lecture 3 Math & Probability Background ch
(CMU ECE) : (CMU BME) : BioE 2630 (Pitt)
ECE/CSE 576 HW 1 Notes.
Presentation transcript:

1 ITK Lecture 9 - Toolbox Part I Methods in Image Analysis CMU Robotics Institute U. Pitt Bioengineering 2630 Spring Term, 2006 Methods in Image Analysis CMU Robotics Institute U. Pitt Bioengineering 2630 Spring Term, 2006 Damion Shelton

2 Goals for this lecture  There are quite a few “hidden” features in ITK that don’t occupy a complete lecture - we’ll talk about some of those today

3 Points and Vectors  itk::Point is the representation of a point in n-d space  itk::Vector is the representation of a vector in n-d space  Both of these are derived from ITK’s non-dynamic array class (meaning their length is fixed)  itk::Point is the representation of a point in n-d space  itk::Vector is the representation of a vector in n-d space  Both of these are derived from ITK’s non-dynamic array class (meaning their length is fixed)

4 Interchangability  You can convert between Points and Vectors in a logical manner:  Point + Vector = Point  Vector + Vector = Vector  Point + Point = Undefined  This is pretty handy for maintaining clarity, since it distinguishes between the intent of different arrays  You can convert between Points and Vectors in a logical manner:  Point + Vector = Point  Vector + Vector = Vector  Point + Point = Undefined  This is pretty handy for maintaining clarity, since it distinguishes between the intent of different arrays

5 Things to do with Points  Get a vector from the origin to this Point  GetVectorFromOrigin  Get the distance to another Point  EuclideanDistanceTo  Set the location of this point to the midpoint of the vector between two other points  SetToMidPoint  Get a vector from the origin to this Point  GetVectorFromOrigin  Get the distance to another Point  EuclideanDistanceTo  Set the location of this point to the midpoint of the vector between two other points  SetToMidPoint

6 Things to do with Vectors  Get the length (norm) of the vector  GetNorm  Normalize the vector  Normalize  Scale by a scalar value  Use the * operator  Get the length (norm) of the vector  GetNorm  Normalize the vector  Normalize  Scale by a scalar value  Use the * operator

7 Code demo…  InteriorExterior spatial functions  Points  Vectors  Converting between the two  InteriorExterior spatial functions  Points  Vectors  Converting between the two

8 Need more complicated math?  ITK maintains a local copy of the VNL numerics library  You can get vnl_vector objects from both Points and Vectors by calling Get_vnl_vector  Ex: You can build a rotation matrix by knowing basis vectors  ITK maintains a local copy of the VNL numerics library  You can get vnl_vector objects from both Points and Vectors by calling Get_vnl_vector  Ex: You can build a rotation matrix by knowing basis vectors

9 VNL  VNL could easily occupy an entire lecture, or more  Extensive documentation is available at:  Click on the the VXL book link and look at chapter 6  VNL could easily occupy an entire lecture, or more  Extensive documentation is available at:  Click on the the VXL book link and look at chapter 6

10 Things VNL can do  Dot products dot_product(G1.Get_vnl_vector(), C12.Get_vnl_vector() )  Create a matrix vnl_matrix_fixed myMatrix;  Dot products dot_product(G1.Get_vnl_vector(), C12.Get_vnl_vector() )  Create a matrix vnl_matrix_fixed myMatrix;

11 More VNL tricks  If it were just good at simple linear algebra, it wouldn’t be very interesting: vnl_generalized_eigensystem* pEigenSys = new vnl_generalized_eigensystem( m_RawCMatrix, identMatrix);  If it were just good at simple linear algebra, it wouldn’t be very interesting: vnl_generalized_eigensystem* pEigenSys = new vnl_generalized_eigensystem( m_RawCMatrix, identMatrix); Consult the documentation for what these parameters mean - the names derive from my code, not their function

12 VNL take home message  VNL can do a lot more cool stuff that you do not want to write from scratch  SVD  Quaternions  C++ can work like Matlab!  It’s worth spending the time to learn VNL  VNL can do a lot more cool stuff that you do not want to write from scratch  SVD  Quaternions  C++ can work like Matlab!  It’s worth spending the time to learn VNL

13 Change of topic  Next we’ll talk about how ITK encapsulates the general idea of functions  Generically, functions map a point in their domain to a point in their range  Next we’ll talk about how ITK encapsulates the general idea of functions  Generically, functions map a point in their domain to a point in their range

14 Functions  ITK has a generalized function class called FunctionBase  itk::FunctionBase  By itself it’s pretty uninteresting, and it’s purely virtual  ITK has a generalized function class called FunctionBase  itk::FunctionBase  By itself it’s pretty uninteresting, and it’s purely virtual Domain Range

15 What good is FunctionBase? It enforces an interface... virtual OutputType Evaluate (const InputType &input) const=0 The evaluate call is common to all derived classes; pass it an object in the domain and you get an object in the range It enforces an interface... virtual OutputType Evaluate (const InputType &input) const=0 The evaluate call is common to all derived classes; pass it an object in the domain and you get an object in the range

16 Spatial functions  Spatial functions are functions where the domain is the set of N-d points in continuous space  The base class is itk::SpatialFunction  Note that the range (TOutput) is still templated  Spatial functions are functions where the domain is the set of N-d points in continuous space  The base class is itk::SpatialFunction  Note that the range (TOutput) is still templated

17 Spatial function example  GaussianSpatialFunction evaluates an N-d Gaussian  It forms the basis for GaussianImageSource, which evaluates the function at all of the pixels in an image and stores the value  GaussianSpatialFunction evaluates an N-d Gaussian  It forms the basis for GaussianImageSource, which evaluates the function at all of the pixels in an image and stores the value

18 Interior-exterior spatial functions  These are a further specialization of spatial functions, where the range is enforced to be of type bool  Semantically, the output value is taken to mean “inside” the function if true and “outside” the function if false  These are a further specialization of spatial functions, where the range is enforced to be of type bool  Semantically, the output value is taken to mean “inside” the function if true and “outside” the function if false

19 IE spatial function example  itk::ConicShellInteriorExteriorSpatialFuncti on let’s you determine whether or not a point lies within the volume of a truncated cone  itk::SphereSpatialFunction does the same thing for a N-d sphere (circle, sphere, hypersphere...) - note a naming inconsistency here  itk::ConicShellInteriorExteriorSpatialFuncti on let’s you determine whether or not a point lies within the volume of a truncated cone  itk::SphereSpatialFunction does the same thing for a N-d sphere (circle, sphere, hypersphere...) - note a naming inconsistency here

20 Image functions  Image functions are functions where the domain is the pixels within an image  The function evaluates based on the value of a pixel accessed by its position in:  Physical space (via Evaluate)  Discrete data space (via EvaluateAtIndex)  Continuous data space (via EvaluateAtContinuousIndex)  Image functions are functions where the domain is the pixels within an image  The function evaluates based on the value of a pixel accessed by its position in:  Physical space (via Evaluate)  Discrete data space (via EvaluateAtIndex)  Continuous data space (via EvaluateAtContinuousIndex)

21 Image function examples  itk::BinaryThresholdImageFunction returns true if the value being accessed lies within the bounds of a lower and upper threshold  itk::InterpolateImageFunction is the base class for image functions that allow you to access subpixel interpolated values  itk::BinaryThresholdImageFunction returns true if the value being accessed lies within the bounds of a lower and upper threshold  itk::InterpolateImageFunction is the base class for image functions that allow you to access subpixel interpolated values

22 Hey - this is messy...  You might be wondering why there are so many levels in this hierarchy  The goal is to enforce conceptual similarity in order to better organize the toolkit  In particular, the interior-exterior functions have a specific reason for existence  You might be wondering why there are so many levels in this hierarchy  The goal is to enforce conceptual similarity in order to better organize the toolkit  In particular, the interior-exterior functions have a specific reason for existence

23 Change of topic  You may have observed that we have (at least) two ways of determining whether or not a point/pixel is “included” in some set  Within the bounds of a spatial function  Within a threshold defined by an image function  If you’ve had image processing before, you should be familiar with connected component labeling...  You may have observed that we have (at least) two ways of determining whether or not a point/pixel is “included” in some set  Within the bounds of a spatial function  Within a threshold defined by an image function  If you’ve had image processing before, you should be familiar with connected component labeling...

24 Conditional iterators  One way to think about iterators is that they return all of the objects within a certain set  With ImageRegionIterators, the set is all pixels within a particular image region  What about more complicated sets?  One way to think about iterators is that they return all of the objects within a certain set  With ImageRegionIterators, the set is all pixels within a particular image region  What about more complicated sets?

25 The “condition”  The condition in a ConditionalIterator is the test that you apply to determine whether or not a pixel is included within the set of interest  Examples:  Is the pixel inside a spatial function?  Is the pixel within a certain threshold?  The condition in a ConditionalIterator is the test that you apply to determine whether or not a pixel is included within the set of interest  Examples:  Is the pixel inside a spatial function?  Is the pixel within a certain threshold?

26 Using the condition - brute force  If the pixel passes the test, it can be accessed by the iterator  Otherwise, it’s not part of the set  The brute force implementation is to visit all pixels in an image, apply the test, and return the pixel if it passes  If the pixel passes the test, it can be accessed by the iterator  Otherwise, it’s not part of the set  The brute force implementation is to visit all pixels in an image, apply the test, and return the pixel if it passes

27 Conditional iterators - UI The interface to conditional iterators is consistent with the other iterators: ++ means get the next pixel GetIndex() returns the index of the current pixel IsAtEnd() returns true if there are no more pixels to access The interface to conditional iterators is consistent with the other iterators: ++ means get the next pixel GetIndex() returns the index of the current pixel IsAtEnd() returns true if there are no more pixels to access

28 Conditional iterators - guts What’s happening “underneath” may be quite complex, in general: 1. Start at some pixel 2. Find the next pixel 3. Next pixel exists? Return it, otherwise we’re finished and IsAtEnd() returns true. 4. Go to 2. What’s happening “underneath” may be quite complex, in general: 1. Start at some pixel 2. Find the next pixel 3. Next pixel exists? Return it, otherwise we’re finished and IsAtEnd() returns true. 4. Go to 2.

29 Special case - connected regions  For small regions within large, high- dimension images, applying this test everywhere is needlessly expensive  Moreover, the brute-force method can’t handle region growing, where the “condition” is based on neighbor inclusion (in an iterative sense)  For small regions within large, high- dimension images, applying this test everywhere is needlessly expensive  Moreover, the brute-force method can’t handle region growing, where the “condition” is based on neighbor inclusion (in an iterative sense)

30 Flood filled iterators  Flood filled iterators get around these limitations by performing an N-d flood fill of a connected region where all of the pixels meet the “condition”  FloodFilledSpatialFunctionConditionalIterator  FloodFilledImageFunctionConditionalIterator  Flood filled iterators get around these limitations by performing an N-d flood fill of a connected region where all of the pixels meet the “condition”  FloodFilledSpatialFunctionConditionalIterator  FloodFilledImageFunctionConditionalIterator

31 How they work  Create the iterator and specify an appropriate function  You need a seed pixel(s) to start the flood - set these a priori or find them automatically with FindSeedPixel(s)  Start using the iterator as you normally would  Create the iterator and specify an appropriate function  You need a seed pixel(s) to start the flood - set these a priori or find them automatically with FindSeedPixel(s)  Start using the iterator as you normally would

32 “Drawing” geometric objects Given an image, spatial function, and seed position: TItType sfi = TItType(sourceImage, spatialFunc, seedPos); for( ; !( sfi.IsAtEnd() ); ++sfi) { sfi.Set(255); } This code sets all pixels “inside” the function to 255 The cool part: the function can be arbitrarily complex - we don’t care! Given an image, spatial function, and seed position: TItType sfi = TItType(sourceImage, spatialFunc, seedPos); for( ; !( sfi.IsAtEnd() ); ++sfi) { sfi.Set(255); } This code sets all pixels “inside” the function to 255 The cool part: the function can be arbitrarily complex - we don’t care!

33 Flood filled spatial function example  Here we’ll look at some C++ code:  itkFloodFilledSpatialFunctionExample.cxx found in the InsightApplications module  This code illustrates a subtlety of spatial function iterators - determining pixel inclusion by vertex/corner/center inclusion  Inclusion is determined by the “inclusion strategy”  Here we’ll look at some C++ code:  itkFloodFilledSpatialFunctionExample.cxx found in the InsightApplications module  This code illustrates a subtlety of spatial function iterators - determining pixel inclusion by vertex/corner/center inclusion  Inclusion is determined by the “inclusion strategy”

34 Origin Strategy

35 Center Strategy

36 Complete Strategy

37 Intersect Strategy