Hi all,
I have just released version 1.10.0.336 of the ImageIntegration module as an update for all supported platforms. This version comes with important bug fixes and new features implemented in the DrizzleIntegration tool.
New Feature: Drizzle Kernel FunctionsThe original, standard drizzle algorithm formulation considers square input
drops projected over output pixels. If you don't know what I'm talking about, I strongly recommend you to pay a read to the
original paper describing the drizzle algorithm. The drizzle procedure can be easily understood with the following figure, which I have borrowed from the original paper:
Blue squares are drizzle drops, read from an input image and projected over the output integrated image by means of a geometric transformation previously computed by the image registration task (the StarAlignment tool in the case of PixInsight). Drops can optionally be reduced in size by a
drop shrink factor, as happens in the example depicted in the figure above. Drop shrinking improves image resolution because it leads to a convolution with a smaller PSF on the output image.
Drizzle drops, however, don't have to be square elements necessarily. Drizzle
kernel functions are two-dimensional surface functions used to compute drop values. For example, a square drizzle drop can be interpreted as the constant surface z = 1:
In this figure we are representing an input pixel spanning from [0,0] to [1,1] on the XY plane. For simplicity, no drop shrinking is being applied (actually, a drop shrink factor of 1 is being applied). Now suppose this input pixel is transformed as appropriate for image registration, and projected over the output image. The resulting drop intersects one of the output pixels on the convex polygonal region plotted below:
Note that the intersection is no longer a square because of geometric distortions. Note also that the intersection is no longer a quadrilateral, and includes the input pixel partially, since the output pixel receives a fraction of the total input pixel in this example.
The intersected drop kernel would be:
and the resulting drop value would be the volume under the intersected surface function z = 1, projected on the XY plane. Clearly, this volume would be < 1 in this case.
Circular drizzle kernels work in a similar way, but restricted to a circle centered at an input pixel with radius of 0.5 :
For any drizzle kernel function, the value of a drop is computed as the
double integral of the kernel surface function over the intersection with the corresponding output pixel on the XY plane.
Obviously, using surface functions for constant (or flat) surface functions is an unnecessary waste of computational work, since the drop value can be computed quickly from the area of the intersection. This is what DrizzleIntegration does for square and circular drizzle kernels.
In this new implementation, drizzle kernels can also be Gaussian and variable shape functions. A Gaussian drizzle kernel looks like this:
and following the example used above, a Gaussian drizzle drop, intersected with the projected output pixel, would be:
The variable shape function is implemented as the following two-dimensional surface:
where
dx and
dy are coordinate increments with respect to the center of an input pixel,
sigma is the standard deviation of the distribution (computed for a prescribed truncation error, which has been fixed to 0.025 in this implementation), and
k > 0 is the
shape parameter of the function. For
k=2 we have a Gaussian function, k < 2 yields comparatively peaked functions (leptokurtic), and k > 2 gives flat functions (platykurtic).
Here are some examples of variable shape functions and, continuing with the example, their corresponding drizzle drop kernels:
k = 4.0
k = 2.5
k = 2.0
Variable shape functions are useful to gain finer control on the shape of drizzle drop kernels. In this implementation, the available shape parameters are 1, 1.5, 3, 4, 5 and 6. As you see, the smaller the shape parameter, the more peaked the kernel function is.
Double integrals are computed numerically for evaluation of drizzle drop values. The kernel function is evaluated on a square grid of N x N points, where N is the new
grid size parameter of the DrizzleIntegration process. The default grid size is 16, which means that 16x16 = 256 function evaluations are used for each drizzle drop. This leads to errors smaller than a 2% in the evaluation of the double integral for all implemented kernel functions. This accuracy is more than sufficient (perhaps excessive, in fact). Increasing the grid size parameter only serves to slow down the process (quadratically) in my tests.
A non-square drizzle kernel leads to a convolution with a prescribed PSF in the output drizzle integrated image. Since these PSFs are smaller than standard square drops, and smooth peaked functions in the case of Gaussian and variable shape kernels, they tend to improve resolution on the output image. However, this potential benefit comes at a cost. As you surely have figured out, non-square drizzle kernels require more input images and a better random dithering. Despite the implementation based on fast LUT-based function evaluation and indexing, this new functionality also requires more computation time.
For developers interested in this new tool, the complete source code is available at our official GitHub repository:
https://github.com/PixInsight/PCL/tree/master/src/modules/processes/ImageIntegrationNow you have a new reason for experimentation. I'll be glad to see your tests and results and your (hopefully not many) bug reports.
Bug fixes* DrizzleIntegration was applying an incorrect offset of 0.5 pixels to projections of output pixels over source images. This problem has been discovered by Mark Shelley; see the
original bug report thread. This bug is now fixed thanks to his excellent analysis and his patience.
* Along with the pixel offset bug, I have discovered also a pixel rejection issue in DrizzleIntegration through intensive testing. This problem is also fixed in the new version.