Tuesday, January 09, 2007

Derivative & Blurring



The above is a movie of the registration process with the changes added below.

I got the registration to accept the new derivative that I created. The derivative is calculated by using the normal direction of the face on the mesh that I am interested in multiplied by the magnitude of the metric. The metric is calculated by finding the chi-squared difference between the point in between the Gaussian and the logistic fit positions to the data in the intensities. The derivative has to be negated since in the itk::VersorRigid3DTransformOptimizer it assumes that the derivative is calculated from the gradient and that would point in the direction of the maximum, and in the case I am looking at I am trying to minimize the metric value and therefore the optimizer will try to compensate for that by changing the direction of the derivative. I had issues with the metric going off in a weird direction before, but I found that the problem stemmed from the scaling in the optimizer. I had drowned out the angle and z-parameters in the itk::PointSetToImageRegistrationMethod registration framework by scaling the values with 10000000000000.0, which would divide the derivative value inside the optimizer and therefore make it have no contribution to the registration at all. In some of the ITK examples I had found that they used a translation scaling of 1/1000 for the parameters of interest, specifically the translation parameters. So I thought that I could be having issues with that drowning out the effects of the derivative value that I had created. So I set that value to 1 and the registration finally performed as I expected it to with the derivative that I had been feeding it. In this particular situation I had been experimenting with just one intensity process, but now I need to add the rest of the intensity values back into the registration. The registration now works using translation with one intensity profile from any distance as long as the fitting program is able to work with the intensities that it is passed.

I also figured out where the skipping of the lines was located. It was a line in the intens_process class that would throw out a new line as it were iterating through the cells. And I completed changing the itk::IntensityProfileMetric class so that it only loads the image into the intensity_process class process once in the class constructor. Thus the speed is increased for each iteration, but starting up the program takes a long time because the image is being smoothed using itk::BinomialBlurImageFilter which helps to stabalize the results of the fitting program from iteration to iteration.

Another thing that might be good to complete would be to finish making the visualization that shows the normals and the magnitudes that they contribute to the metric and derivative.

Friday, January 05, 2007

Derivatives & Metric

Today I was looking into ways to improve the registration. One thing that needs to be analyzed is how the derivative is computed in the itk:IntensityProfileMetric. This value could be making the optimizer go off in the wrong direction. I also need to look at the optimizer to see how it takes into account the derivative and how it looks at the value of the metric to decide on what direction to take next. Another thing that needs to be improved is loading all the necessary components of the itk::IntensityProfileMetric. Right now it instantiates an instance of the intensity process class in each iteration, I need to make them class members and do all of that work once. Another improvement would be to find what is making the output of the command iteration class, that tells what the parameters of the registration are, skip so many lines before it enters another value.

The fit to the values of the intensity profile could also need some help, because in some instances it seems as though it is coming off giving an error that is bringing the ellipse closer to the wrong direction. Smoothing has been implemented, but the intensity profile metric class needs to be adjusted to allow for testing since it is too slow.