Lecture 8 Registration with ITK

Slides:



Advertisements
Similar presentations
Bayesian Belief Propagation
Advertisements

Image Registration  Mapping of Evolution. Registration Goals Assume the correspondences are known Find such f() and g() such that the images are best.
The content of these slides by John Galeotti, © 2013 Carnegie Mellon University (CMU), was made possible in part by NIH NLM contract# HHSN P,
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.
EKF, UKF TexPoint fonts used in EMF.
Medical Image Registration Kumar Rajamani. Registration Spatial transform that maps points from one image to corresponding points in another image.
The content of these slides by John Galeotti, © Carnegie Mellon University (CMU), was made possible in part by NIH NLM contract# HHSN P,
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.
The content of these slides by John Galeotti, © 2012 Carnegie Mellon University (CMU), was made possible in part by NIH NLM contract# HHSN P,
OverviewOverview Motion correction Smoothing kernel Spatial normalisation Standard template fMRI time-series Statistical Parametric Map General Linear.
Lecture 12 Level Sets & Parametric Transforms sec & ch
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.
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.
HMAX Models Architecture Jim Mutch March 31, 2010.
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.
The content of these slides by John Galeotti, © Carnegie Mellon University (CMU), was made possible in part by NIH NLM contract# HHSN P,
Instructor: Mircea Nicolescu Lecture 13 CS 485 / 685 Computer Vision.
Tuesday Seminar Deformable Image Registration
Motion Tracking. Image Processing and Computer Vision: 82 Introduction Finding how objects have moved in an image sequence Movement in space Movement.
Non-Rigid Registration. Why Non-Rigid Registration  In many applications a rigid transformation is sufficient. (Brain)  Other applications: Intra-subject:
CSE351/ IT351 Modeling and Simulation
Motion Analysis (contd.) Slides are from RPI Registration Class.
CSci 6971: Image Registration Lecture 4: First Examples January 23, 2004 Prof. Chuck Stewart, RPI Dr. Luis Ibanez, Kitware Prof. Chuck Stewart, RPI Dr.
Reinforcement Learning Rafy Michaeli Assaf Naor Supervisor: Yaakov Engel Visit project’s home page at: FOR.
Computing motion between images
Yujun Guo Kent State University August PRESENTATION A Binarization Approach for CT-MR Registration Using Normalized Mutual Information.
Texture Reading: Chapter 9 (skip 9.4) Key issue: How do we represent texture? Topics: –Texture segmentation –Texture-based matching –Texture synthesis.
CS664 Lecture #19: Layers, RANSAC, panoramas, epipolar geometry Some material taken from:  David Lowe, UBC  Jiri Matas, CMP Prague
CSci 6971: Image Registration Lecture 5: Feature-Base Regisration January 27, 2004 Prof. Chuck Stewart, RPI Dr. Luis Ibanez, Kitware Prof. Chuck Stewart,
CSci 6971: Image Registration Lecture 16: View-Based Registration March 16, 2004 Prof. Chuck Stewart, RPI Dr. Luis Ibanez, Kitware Prof. Chuck Stewart,
The content of these slides by John Galeotti, © 2008 to 2015 Carnegie Mellon University (CMU), was made possible in part by NIH NLM contract# HHSN P,
Radial Basis Function Networks
NA-MIC National Alliance for Medical Image Computing Slicer3 Tutorial: Registration Library Case 19 Multi-stage registration for group.
The content of these slides by John Galeotti, © Carnegie Mellon University (CMU), was made possible in part by NIH NLM contract# HHSN P,
The content of these slides by John Galeotti, © Carnegie Mellon University (CMU), was made possible in part by NIH NLM contract# HHSN P,
National Alliance for Medical Image Computing Registration in Slicer3 Julien Jomier Kitware Inc.
ECE 8443 – Pattern Recognition ECE 8423 – Adaptive Signal Processing Objectives: Example Clustered Transformations MAP Adaptation Resources: ECE 7000:
The content of these slides by John Galeotti, © Carnegie Mellon University (CMU), was made possible in part by NIH NLM contract# HHSN P,
Multimodal Interaction Dr. Mike Spann
The content of these slides by John Galeotti, © Carnegie Mellon University (CMU), was made possible in part by NIH NLM contract# HHSN P,
The content of these slides by John Galeotti, © Carnegie Mellon University (CMU), was made possible in part by NIH NLM contract# HHSN P,
1 ECE 738 Paper presentation Paper: Active Appearance Models Author: T.F.Cootes, G.J. Edwards and C.J.Taylor Student: Zhaozheng Yin Instructor: Dr. Yuhen.
ITK The Insight Segmentation & Registration Toolkit Martin Urschler Institute for Computer Graphics and Vision Graz University of Technology.
ITK Lecture 13: Registration
The content of these slides by John Galeotti, © Carnegie Mellon University (CMU), was made possible in part by NIH NLM contract# HHSN P,
The content of these slides by John Galeotti, © Carnegie Mellon University (CMU), was made possible in part by NIH NLM contract# HHSN P,
Coregistration and Spatial Normalisation
Jan Kamenický Mariánská  We deal with medical images ◦ Different viewpoints - multiview ◦ Different times - multitemporal ◦ Different sensors.
1 ITK Lecture 8 - Neighborhoods Methods in Image Analysis CMU Robotics Institute U. Pitt Bioengineering 2630 Spring Term, 2006 Methods in Image.
Medical Image Analysis Image Registration Figures come from the textbook: Medical Image Analysis, by Atam P. Dhawan, IEEE Press, 2003.
CO1301: Games Concepts Dr Nick Mitchell (Room CM 226) Material originally prepared by Gareth Bellaby.
The content of these slides by John Galeotti, © Carnegie Mellon University (CMU), was made possible in part by NIH NLM contract# HHSN P,
Statistical Parametric Mapping Lecture 11 - Chapter 13 Head motion and correction Textbook: Functional MRI an introduction to methods, Peter Jezzard, Paul.
MIT AI Lab / LIDS Laboatory for Information and Decision Systems & Artificial Intelligence Laboratory Massachusetts Institute of Technology A Unified Multiresolution.
Application: Multiresolution Curves Jyun-Ming Chen Spring 2001.
Lecture 9 Feature Extraction and Motion Estimation Slides by: Michael Black Clark F. Olson Jean Ponce.
Photoconsistency constraint C2 q C1 p l = 2 l = 3 Depth labels If this 3D point is visible in both cameras, pixels p and q should have similar intensities.
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.
University of Ioannina
Lecture 12 Theory of Registration ch
Computational Neuroanatomy for Dummies
2D transformations (a.k.a. warping)
SimpleITK Fundamental Concepts
Lecture 15 Active Shape Models
KFC: Keypoints, Features and Correspondences
SimpleITK Fundamental Concepts
SimpleITK Fundamental Concepts
(CMU ECE) : (CMU BME) : BioE 2630 (Pitt)
(CMU ECE) : (CMU BME) : BioE 2630 (Pitt)
Presentation transcript:

Lecture 8 Registration with ITK Methods in Medical Image Analysis - Spring 2012 BioE 2630 (Pitt) : 16-725 (CMU RI) 18-791 (CMU ECE) : 42-735 (CMU BME) By Dr. John Galeotti & Dr. Damion Shelton Note: To print these slides in grayscale (e.g., on a laser printer), first change the Theme Background to “Style 1” (i.e., dark text on white background), and then tell PowerPoint’s print dialog that the “Output” is “Grayscale.” Everything should be clearly legible then. This is how I also generate the .pdf handouts.

For more info/gory detail… Please see the following for exhaustive detail: Chapter 8 in the ITK Software Guide Currently, this does not cover the newer registration methods Insight into Images ITK Source Tree Examples/Registration/ E.g. Examples/Registration/ImageRegistration1.cxx ITK Doxygen http://www.itk.org/Doxygen40/html/group__RegistrationFilters.html http://www.itk.org/Doxygen40/html/group__Group-Registration.html

What is registration? The process of aligning a target image to a source image More generally, determining the transform that maps points in the target image to points in the source image

Transform types Rigid (rotate, translate) Affine (rigid + scale & shear) Deformable (affine + vector field) Many others

Registration in ITK ITK uses an extensible registration framework Various interchangeable classes exist Relatively easy to “twiddle” the part you’re interested in while recycling prior work

ITK terminology Fixed image f(x) - stationary in space Moving image m(x) - the fixed image with an unknown transform applied Goal: recover the transform T(x) which maps points in f(x) to m(x)

Registration framework pieces 2 input images, fixed and moving Metric - determines the “fitness” of the current registration iteration Optimizer - adjusts the transform in an attempt to improve the metric Interpolator - applies transform to image and computes sub-pixel values

ITK registration flowchart Figure 8.2 from the ITK Software Guide v 2.4, by Luis Ibáñez, et al.

ITK’s “Hello world” example 2D floating point image inputs Please see the software guide (section 8.2) for code specifics I am going to cover what each piece does, not look at code per se

ITK’s “Hello World” Example: Flow Chart for Everything Figure 8.5 from the ITK Software Guide v 2.4, by Luis Ibáñez, et al.

Input images 2D floating point Floating point avoids loss of precision problems with integer pixel types

Transform TranslationTransform Permits translation only in 2D Documentation notes similarity to AffineTransform, but improved speed (why…?)

Transform Coordinate System Will discuss spatial coordinates more later… Figure 8.7 from the ITK Software Guide v 2.4, by Luis Ibáñez, et al.

Metric MeanSquaresImageToImageMetric Sum of squared differences between 2 images on a pixel-by-pixel basis A bit naïve Works for 2 images that were acquired with the same imaging modality

Optimizer RegularStepGradientDescent Follows the derivative of the metric Step size depends on rapid changes in the gradient’s direction Step size eventually reaches a user-defined value that determines convergence

Interpolator LinearInterpolateImageFunction Fast and conceptually simple

Wrapper ImageRegistrationMethod Combines all of the previous classes into a master class registration->SetMetric( metric ); registration->SetOptimizer( optimizer ); registration->SetTransform( transform ); registration->SetInterpolator( interpolator);

Other steps Set the region of the fixed image the registration will operate on (e.g. to ignore bad data) Initialize the transform Twiddle the optimizer for best performance* *may involve pain and suffering

Hello world input Figure 8.3 from the ITK Software Guide v 2.4, by Luis Ibáñez, et al.

X & Y translation vs. time Figure 8.6 (top) from the ITK Software Guide v 2.4, by Luis Ibáñez, et al.

Metric vs. time Figure 8.6 (bottom) from the ITK Software Guide v 2.4, by Luis Ibáñez, et al.

Registration results After registration converges/terminates you call GetLastTransformParamters to recover the final transform For the Hello World example there are 2 parameters, X & Y translation

Double checking results Use ResampleImageFilter to apply the transform for the fixed image Take the output, compute a difference image with the moving image, examine the results Good registration results in nothing much to see

Image comparison Registered moving image Difference before registration Difference after registration Figure 8.4 from the ITK Software Guide v 2.4, by Luis Ibáñez, et al.

Keeping tabs on registration Registration is often time consuming It’s nice to know that your algorithm isn’t just spinning it’s wheels Use the observer mechanism in ITK to monitor progress See the software guide, 3.2.6 and 8.4 We’ll see this again later, when we discuss how to write your own ITK filters itk::ProgressEvent is one example

Observer steps Write an observer class that will process “iteration” events (Just copy some code from an example) Add the observer to the optimizer As a generic note, observers can observe any class derived from itk::Object Start registration as usual

Things observers can do Print debugging info Update GUI Other small management functions Should not do anything too processor intensive

Multi-modality registration Remember how I said sum-of-squares difference is relatively naïve? Mutual information helps overcome this problem Section 8.5 shows how to implement a simple MI registration

Notes about the MI example Significantly, largely the same piece of code as Hello World Mutual Information is a metric, so we can keep the optimizer, the interpolator, and so on Majority of differences are in tweaking the metric, not in rewriting code

Figure 8.9 from the ITK Software Guide v 2.4, by Luis Ibáñez, et al. MI Inputs T1 MRI Proton density MRI Figure 8.9 from the ITK Software Guide v 2.4, by Luis Ibáñez, et al.

MI Output: Image Comparison WHY USE Checkerboard? Before After This is an example of a checkerboard visualization Taken from Figure 8.10 of the ITK Software Guide v 2.4, by Luis Ibáñez, et al.

Centered transforms More natural (arguably) reference frame than having the origin at the corner of the image In SimpleITK, transforms are automatically centered by default! Details are not appreciably different from other rigid registrations, see 8.6

SimpleITK Registration (Python) import SimpleITK as sitk imgT1 = sitk.ReadImage(“MRI_T1.tif”) imgPD_shifted = sitk.ReadImage(“MRI_PD_shifted.tif”) transform = sitk.AffineTransform() interp = sitk.LinearInterpolate() metric = sitk.MattesMutualInformationMetric() optimizer = sitk.RegularStepGradientDescentOptimizer() params = sitk.Register( imgPD_shifted, imgT1, transform,\ interp, metric, optimizer ) print(params) Python: back-slash and () These are ONLY OPTIONS in beta.3

SimpleITK Registration (C++) #include <SimpleITK.h> int main(void) { itk::simple::ImageFileReader reader; itk::simple::Image fixed = reader.SetFileName(“FixedImage.nii” ).Execute(); itk::simple::Image moving = reader.SetFileName(“MovingImage.nii”).Execute(); itk::simple::AffineTransform transform; itk::simple::MattesMutualInformationMetric metric; itk::simple::LinearInterpolate interpolate; itk::simple::RegularStepGradientDescentOptimizer optimizer; // Longer form (Python can likewise also set these one at a time): itk::simple::Registration registration; registration.SetTransform ( &transform ); registration.SetMetric ( &metric ); registration.SetInterpolate ( &interpolate ); registration.SetOptimizer ( &optimizer ); std::vector<double> params; params = registration.Execute ( fixed, moving ); }

An aside: “Twiddling” A common criticism of many/most registration techniques is their number of parameters A successful registration often depends on a very specific fine-tuning of the algorithm “Generalized” registration is an open problem WARNINGS for SimpleITK beta 0.3: Beta v. 0.3 currently does NOT allow twiddling of any of the registration parameters The beta’s choices of registration parameters are not necessarily very good yet.

Multi-Resolution registration Useful to think of this as algorithmic “squinting” by using image pyramids Start with something simple and low-res Use low-res registration to seed the next higher step Eventually run registration at high-res Also called “coarse to fine”

Multi-resolution schematic Figure 8.36 from the ITK Software Guide v 2.4, by Luis Ibáñez, et al.

Image pyramids Figure 8.37 from the ITK Software Guide v 2.4, by Luis Ibáñez, et al.

Optimization Parameter dependency rears its ugly head You often/usually need to adjust optimizer parameters as you move through the pyramid You can do this using the Observer mechanism

Multi-resolution example Again, mostly the same code as Hello World Use MultiResolutionPyramidImage filter to build fixed and moving pyramids MultiResolutionImageRegistrionMethod is now the overall framework

Benefits of multi-resolution Often faster More tolerant of noise (from “squinting”) Minimizes initialization problems to a certain extent, though not perfect

See the software guide for… Detailed list of: Transforms Optimizers Interpolation methods You’re encouraged to mix and match! Note: ITKv4’s new registration methods are still being developed, and the documentation is not yet complete for them. Check Doxygen and ITK source code for ImageRegistrationMethodv4

Deformable registration ITK has 2 primary techniques: Finite element: treat small image regions as having physical properties that control deformation Demons: images are assumed to have iso-intensity contours (isophotes); image deformations occur by pushing on these contours

Model based registration Build a simplified geometric model from a training set Identify parameters that control the characteristics of the model Register the model to a target image to adapt to a particular patient

Model based, cont. Uses the Spatial Objects framework for representing geometry Useful because it derives analytical data from the registration process, not just a pixel-to-pixel mapping

Note: This is what we want, NOT the output of an actual registration Model-based example Note: This is what we want, NOT the output of an actual registration Figure 8.60 from the ITK Software Guide v 2.4, by Luis Ibáñez, et al.

Model-based reg. schematic Figure 8.59 from the ITK Software Guide v 2.4, by Luis Ibáñez, et al.

Model-based registration: Warning! ITK does not yet directly support generic model-based registration “out of the box” ITKv4 does support point-set to image registration Otherwise, model-based reg. requires writing your own custom ITK transform, with new parameters Transform’s new parameters  Spatial Object parameters You must individually map your custom transform’s new parameters to the specific spatial object parameters you want to allow registration to adjust This isn’t too complicated if you know what you’re doing Search Insight Journal for examples

Speed issues Execution time can vary wildly Optimizer (more naïve = faster) Image dimensionality (fewer = faster) Transform (fewer DOF = faster) Interpolator (less precise = faster)

New in ITKv4 (ImageRegistrationMethodv4, etc.) New unified and fully multi-threaded optimization and registration framework Unified framework supports sparse and dense metric computation Unified framework supports low and high dimensional mapping Improved multi-threaded metrics for rigid, affine and deformable registration New metrics support sparse or dense sampling Metrics for landmark or label guided registration Automatic parameter scale estimation for registration Automatic step-size selection for gradient-based registration optimizers Composite transforms and composite transform optimization Displacement field and diffeomorphic velocity field-based transforms Better support for multi-threading in optimizers and metrics Additional evolutionary optimizers Improved B-Spline registration approach available and bug fixes to old framework Accurately transform and reorient covariant tensors and vectors List taken from http://www.itk.org/Wiki/ITK_Release_4/Why_Switch_to_ITKv4

Take home messages Exactly what parameters do what is not always obvious, even if you are familiar with the code Successful registrations can be something of an art form Multi-resolution techniques can help Work within the framework!