Assignment 4: Registration (Optional)
Methods In Medical Image Analysis (BioE 2630 : 18-791 : 42-735) - Spring 2016

Creative Commons License ITK Registration Assignment by John Galeotti and Srivignesh Rajendran is licensed under a Creative Commons Attribution 3.0 Unported License. It is based on SimpleITK examples by Bradley Lowekamp.

20 points total

Due Date: Your final submission must be committed to svn by 10 AM EST on Thursday Morning, April 14. Big problems may not show up until the end, so finish early!

E-mail your TA or instructor with questions or problems.

This assignment is optional, but it is not a "bonus" assignment. If you choose to submit a registration hw solution to svn by the due date, then your homework score will be based on one more assignment. If you decide that this hurt your grade, then it's up to you to ask us to not count this homework in your final grade.

  1. 2D Registration using Mean-Squared Distance
  2. 2D Registration using Mutual Information

1 SVN setup for this assignment & dataset acquisition (0 points, apx. 3 minutes)

Following our pattern from the segmentation homework, create a directorystructure in your SVN module to contain this assignment. You must first create the directories locally, then tell SVN to add them to your module, and then commit your changes to the SVN server:

cd c:\MIIA\{Your_SVN_User_Name}
mkdir hw-reg
mkdir hw-reg\Part1
mkdir hw-reg\Part2
svn add hw-reg
svn ci hw-reg -m "Setting up module for hw-reg"

Now, download the image data set you will be using for this assignment, and unzip the archive into your hw-reg folder.

For both Part1 and Part2, we will be using SimpleITK's 'ImageRegistrationMethod' function. We will be using two different metrics, to guide the registrations process. From the lectures, you'd remember that image registration involves moving one image with respect to a fixed image. To determine whether the movement of the image makes sense, whether it is indeed proceeding in the right direction and to quantify the performance of algorithm, we use metrics such as (i) Mean Squared distance - Part1 and (ii) Mutual Information - Part2.

1. 2D Registration using mean squared distance (8 points)

  1. Download registration_MSQ.py into your Part1 folder
  2. Read the code and try to build an intuition of what's happening. If you're unclear, please refer to the image registration lecture slides.
  3. Similar to your segmentation assignment's code, change registration_MSQ.py such that you get input command-line arguments from the user for:
  4. Add some basic error handling, such that if the user enter less than 3 arguments, the program exits (again, take a look at hw3's python code if necessary)
  5. Add your modified code to your svn repository:
  6. Read the documentation for ImageRegistrationMethod and figure out the parameters for SetOptimizerAsRegularStepGradientDescent(). The given code has 3 internal parameters for gradient descent: (i) Max step, (ii) Min step, and (iii) Maximum number of iterations. Hint: SimpleITK's Doxygen has links to the underlying ITK classes. Since you need to learn more about this optimizer, pay attention to the underlying ITK optimizer, as well as the ITK optimizer's parent class. So, once you get to the ITK Doxygen for SetOptimizerAsGradientDescentLineSearch, then click on the SuperClass link to get to GradientDescentOptimizerv4Template, where you can read about the parameters.
  7. Try changing the following, and then summarize your observations in a comment at the top of your code:
  8. Continue to experiment with parameters if you desire, and then save the best image you produced as registration_MSG.png. Include another comment at the top of your code to explain how you arrived at the parameters to obtain this result.
  9. Commit your result image and your modified code to your svn repository:

2. 2D Registration using Mutual Information (12 points)

  1. Download registration_MI.py into your Part2 folder
  2. Read the code and try to build an intuition of what's happening. If you're unclear, please refer to the image registration lecture slides.
  3. Similar to Part 1, change registration_MI.py such that you get input command-line arguments from the user for:
  4. Add some basic error handling, such that if the user enter less than 3 arguments, the program exits
  5. Add your modified code to your svn repository:
  6. Read the documentation for ImageRegistrationMethod and figure out the parameters for SetOptimizerAsGradientDescentLineSearch(). The given code has 4 internal parameters for gradient-descent line search: (i) LearningRate, (ii) NumberOfIterations, (iii) ConvergenceMinimumValue, and (iv) ConvergenceWindowSize
  7. Try changing the following, and then summarize your observations in a comment at the top of your code:
  8. Continue to experiment with parameters if you desire, and then save the best image you produced as registration_MI.png. Include another comment at the top of your code to explain how you arrived at the parameters to obtain this result.
  9. Commit your result image and your modified code to your svn repository:
  10. Comment out (or remove) the normalization step of fixed and moving images (e.g: comment out fixed = sitk.Normalize(fixed)). How is the registration process affected? Do you think this step is necessary or not? Explain why. Include all your answers in another comment at the top of your MI code.
  11. Comment out (or remove) the Gaussian blurring step of fixed and moving images (e.g: comment out fixed = sitk.DiscreteGaussian(fixed, 2.0)). How is the registration process affected? Do you think this step is necessary or not? Explain why. Include all your answers in another comment at the top of your MI code.
  12. Try to intuitively describe why normalization and Gaussian blur come into picture when using Mutual information as a metric and not necessarily in Mean Squared Distance (Part1). Include your answer in another comment at the top of your MI code.
  13. Commit your final code to your svn repository:

Finally, be sure all of your files are committed correctly, either by pointing your web browser to your svn URL and logging in with your svn name and password, or else by using the command "svn list -R --verbose --username {Your_SVN_User_Name} https://svn.vialab.org/svn/miia16/hw-reg/{Your_SVN_User_Name}". If these methods do not show all your submitted files present and with appropriate timestamps, then you have not properly committed them. In this case, the first thing to check is to make sure you've added the files to svn before comitting. Otherwise, email your TA and instructor for help.