Adapting the ITK Registration Framework to Fit Parametric Image Models

The image registration framework in the Insight Tookit offers a powerful body of code for ﬁnding the optimal spatial transform that registers one image with another. However, ITK currently lacks a way to ﬁt parametric models of image pixel values to an input image. Such a capability is necessary in certain applications such as sub-resolution localization of molecules in ﬂuorescence microscopy. This document describes new classes that enable the use of the registration framework to provide this capability. We describe a new base class, itk::ParametricImageSource , that deﬁnes an interface for parametric image sources. An adapter class itk::ImageToParametricImageSourceMetric that enables itk::ParametricImageSource s to be hooked into the registration framework is also described. An example adapter class that enables the existing itk::GaussianImageSource to be used for image ﬁtting is presented, and we demonstrate use of the classes by ﬁtting a 2D Gaussian function to an image generated by the itk::GaussianImageSource class.


INTRODUCTION
Fitting models of image pixel values to images is a task central to certain image analysis applications.For example, in fluorescence microscopy, light from an in-focus point source diffracts to an intensity pattern that approximately matches a 2D Gaussian function.Using this observation, methods for determining the positions of individual fluorescent molecules by fitting a 2D Gaussian function to the image have been developed [2,3,1].The mean (center) of the fitted Gaussian is taken to be the location of the molecule.Localization accuracy of as low as 1.5 nanometers has been reported using this method [3].
Despite having mature implementations of the necessary algorithmic foundations, the Insight Toolkit (ITK) does not currently have a mechanism to enable the fitting of image pixel value models to images.This document describes a set of classes that enable such fitting.

Parametric Models of Image Pixel Values
An image pixel value1 pattern can be modeled as a function F(x; u) where x is a spatial position and u is a set of function parameters that change the pattern.The goal in fitting the function F(x; u) to an input image I(x) is to find the parameter vector u that minimizes a cost function defining how well the pixel values from the function match the pixel values of the input image.This is largely the same goal as in image registration.However, in registration, the parameter vector u is an argument to a spatial transformation T (x; u) such that the transformed input image I 1 (T (x; u)) closely matches another input image I 2 (x).
An example of a pixel value profile often used in image analysis is the Gaussian function.For the case of a normalized k-dimensional Gaussian function whose major axes are aligned with the Cartesian axes, F(x; u) has the form where s is a scaling factor, µ is the mean (center) vector, and Σ is a diagonal matrix whose ith diagonal element is the standard deviation σ i of the Gaussian function along the i-th dimension.For this function, the parameter vector u is equal to {s, σ 1 , ..., σ k , µ 1 , ..., µ k }.In ITK, the class itk::GaussianImageSource generates images whose intensities are defined by this function when its Normalized flag is set to 1.
Certain ITK image filters may also be considered parametric models of image pixel values.For these filters, the function is of the form F(x; u, I(x)) where u is a parameter vector as before and I(x) is the image input for the filter.In some applications it may be desirable to optimize the filter parameters u.For example, the itk::MultiplyByConstantImageFilter might be used to find an optimal intensity scaling factor for an image with respect to a particular objective function.
While ITK has parametric image sources, no unified interface for setting their parameters exists.This kind of interface, analogous to the interface currently found in subclasses of itk:: Subclasses with one or more parameters must override these three methods.For example, the itk::GaussianImageSource could be modified to be a subclass of itk::ParametricImageSource.
In this case, the parameters for the Gaussian are the intensity scale, the mean, and the standard deviation.Subclasses of itk::ImageToImageFilter could also be modified to be a subclass of itk::ParametricImageSource with appropriate overriding of these three methods.

Connecting Parametric Image Sources to the Registration Framework
The image registration framework in ITK consists of several types of components: cost functions (e.g., itk::MeanSquareImageToImageMetric, itk::NormalizedCorrelationImageToImageMetric), spatial transforms (e.g., itk::AffineTransform, itk::BSplineDeformableTransform), interpolators (e.g., itk::LinearInterpolateImageFunction, itk::WindowsSincInterpolateImageFunction), and optimizers (e.g., itk::GradientDescentOptimizer, itk::PowellOptimizer).Briefly, an optimizer is a search routine that iteratively evaluates a cost function at different values of the transform parameters until the cost function is minimized (or possibly maximized).A cost function assigns a value to two images, a fixed image and a moving image, according to how well they match.The fixed image remains unmodified during registration while the moving image is warped according to the spatial transform.If the optimizer converges to a local minimum, the transform and parameters found by the optimizer define a locally optimal warping from the moving image to the fixed image.
We would like to be able to reuse the existing subclasses of itk::ImageToImageMetric as cost functions in ITK to fit parametric image models to images.These cost functions have the methods that are called by optimizers.These methods pass their parameters argument to a itk::Transform object assigned to the image-to-image metric.This behavior makes it impossible to set parameters of a itk::ParametricImageSource through the existing registration framework.To overcome this limitation, we have defined a new subclass of itk::ImageToImageMetric, called itk::ImageToParametricImageSourceMetric, that lets us control where the parameters are passed.

MeasureType
Like existing itk::ImageToImageMetric subclasses, the itk::ImageToParametricImageSourceMetric is parameterized over fixed and moving image types.The moving image type, however, is expected to be a subclass of itk::ParametricImageSource, so it is actually an image source rather than static image data.The meaning of "moving" in this context means that the image intensities are changing values, rather than that the moving image is undergoing a spatial deformation.
The itk::ImageToParametricImageSourceMetric adapts a delegate itk::ImageToImageMetric for the purposes of computing the image match value.Parameters passed to the GetValue(...) method from the optimizer are forwarded to the itk::ParametricImageSource, which is updated before the delegate computes the cost function value.Figure 1 shows how the itk::ImageToParametricImageSourceMetric integrates into the registration framework.
We assume that the parametric image source has parameters that can accommodate any necessary spatial transformations.Therefore, the itk::ImageToParametricImageSourceMetric forces the delegate metric to use an itk::IdentityTransform.We do not make any assumptions about the size, spacing, or origin of the fixed or moving images, so an interpolator for the fixed image must be set using the method SetInterpolator(...).
The interface for the itk::ParametricImageSource does not currently provide a mechanism to retrieve partial derivative images that can be used for computing the gradient of the itk::ImageToImageMetric in the method GetDerivative(...).Instead, we estimate the derivative via forward differences.
Because it may be desirable to optimize over a subset of the parameters in a itk::ParametricImageSource, the itk::ImageToParametricImageSourceMetric class also holds a mask vector that indicates which parameters should be optimized.We call these enabled parameters.The method GetNumberOfParameters() reports the number of enabled parameters.This method tells the itk::Optimizer the dimensionality of the parameter space that it will explore, so the itk::Optimizer will pass arrays containing values for only the enabled parameters to the GetValue(...) method of itk::ImageToParametricImageSourceMetric.However, the SetParameters(.The companion source code file GaussianFitting2DTest.cxxcontains a test of the classes for image model fitting presented here.It generates an image of a Gaussian intensity profile using the itk::GaussianImageSource with known mean, standard deviation, and scale, then fits a itk::ParametricGaussianImageSource to this image.
The test shows that the known Gaussian parameters can be successfully recovered using both the itk::AmoebaOptimizer and itk::ConjugateGradientOptimizer.

Figure 1 :
Figure 1: The itk::ImageToParametricImageSourceMetric adapts itk::ImageToImageMetrics for use in fitting image pixel value models.It sits between an existing itk::ImageToImageMetric and an itk::Optimizer.
Distributed under Creative Commons Attribution License in itk::ParametricImageSource expects an array containing values for all the parameters.The simple solution is to retrieve the current parameters from the itk::ParametricImageSource, set the active parameters passed in by the itk::Optimizer, and then pass this modified parameter array back to the itk::ParametricImageSource using that class's SetParameters(...) method.The class itk::ImageToParametricImageSourceMetric has its own SetParameters(...) method that takes care of this step.Several nanometer-resolution fluorescence microscopy imaging methods rely on fitting a 2D Gaussian to the pattern of image intensities produced by a single fluorescent molecule.Here, we show how this can be accomplished using ITK's registration framework and the adapter classes presented in this document.First, we include the necessary software components from the registration framework: Latest version available at the Insight Journal [ http://hdl.handle.net/10380/3167]Distributed under Creative Commons Attribution License ..) method Latest version available at the Insight Journal [ http://hdl.handle.net/10380/3167]