Month: October 2015

auto-tuning bidirectional scanning

To properly align even and odd lines in bidirectional tuning one has to set the values of the configuration variable ‘ncolbi’.  This variable is a vector where each entry controls how lines are ‘folded’ for each of the magnification settings, x1, x2 and x4.

The latest version of scanbox includes a function sbxautocalbd() that allows you to automatically determine the optimal value of these settings in your system.

To use it, simply place a sample under the microscope and focus using bidirectional scanning and 512 lines. Select a new file name for the calibration.  Then, from the Matlab window, type sbautocalbd(mag), where mag is 1 for x1, 2 for x2, and 3 for x4 magnifcation.  The microscope will automatically start sampling and search for the optimal value and print out the search values as it proceeds.  A typical output may look like this:


>> sbxautocalbd(1)
Auto-calibrating...
low :(1182, 80)
high:(1262, -78)
low=(1182, 80) high=(1262, -78)
low=(1222, 1) high=(1262, -78)
low=(1222, 1) high=(1242, -38)
low=(1222, 1) high=(1232, -20)
low=(1222, 1) high=(1227, -9)
low=(1222, 1) high=(1225, -4)
low=(1222, 1) high=(1224, -3)
Optimal value: 1223

For each value of the “line folding” variable the program estimates a displacement between even and odd lines.  The code performs a binary search to find the optimal value, which is printed at the end.  The example below show a search for the optimal value at x1.  This means that we will be setting sbconfig.ncolbi(1) to the resulting value in the configuration file.  A similar search can be done for x2 and x4 magnifications to obtain the entire set of values.  This is a one-time process and once the system is setup, it is unlikely you will need to tune it up again unless there are changes made to the mirrors and/or controllers.