Sub-pixel alignment in bidirectional scanning mode

When imaging at low magnification in bidirectional mode cells can be small, with a diameter of ~6 pixels or so.  In this and other situations the mechanism offer by the ncolbi variable to align even and odd lines may prove too coarse for optimal alignment.

We added a new variable to the configuration file, named bishift, that allows for sub-pixel alignment.  Like ncolbi, this array contains one entry per magnification factor.  At the beginning of your calibration set all the entries in bishift to zero and follow the same procedure as described earlier to find the best ncolbi possible.

The bishift variable allows for sub-pixel shifts only in one direction.  Thus, to use it, we need to begin with the images slightly misaligned in the opposite direction.

As an example, assume that you determined that for magnification factor of 1, the best ncolbi(1) value was 1264. Select a new value by reducing this number by 2, in this case it will result will be 1262.  Now, when you look at the images they will be misaligned, but you can start increasing the value of bishift (which is a non-negative, integer number), to bring them into alignment.

The example below shows zoomed images of a single pollen grain after this misalignment (top left) and increasing values of bishift(1), from 0 to 15. A setting of bishift equal to 7 brings the lines into optimal alignment with sub-pixel accuracy. You can repeat the procedure for each magnification factor.

subpixel

A change of 4 in bishift is equivalent to a change of 1 unit in ncolbi.  So, you can see that if we are caught in a situation similar to the panel 5 below, where the images are only slightly misaligned, a change in ncolbi by 1 unit will bring it to the situation in panel 9, which is also slightly misaligned but in the opposite direction.  The addition of bishift now allows for finer control.

Perform your calibration of ncolbi/bishift while the mirror is in continuous resonant mode and has been running for at least 5-10 min, to allow the frequency to stabilize.

There is no need to restart Scanbox to change the ncolbi and bishift variables.  To have access to these variables while Scanbox is running simply define a global sbconfig variable in Matlab’s command window and you can now change their values between acquisition runs.

We will soon be modifying the sbautocalbd function to make use of both ncolbi and bishift.

Here is one more example at higher magnification (x4) of a pollen grain:

subpixel_highmag