There have been requests for Scanbox to accommodate a larger field of view and the ability to precisely calibrate the aspect ratio and size of pixels. The latest version (along with modifications in the firmware) allow you to do just this.
[This paragraph about the diodes is only relevant to older boards] A first step to maximize the field of view is to remove two diodes from the Scanbox controller board that are limiting the extend of the control signal to the galvanometer. These are located close to the connector labeled GALVO on the board and are labeled TVS4 and TVS5. In the picture below, they are found between GALVO connector and the TP9 test point. To remove them, use a soldering iron, pliers, and care not to damage other components . Remove both diodes. Make sure the board is not powered when you do this.
After you are done, download the latest version from Github, update the firmware, and the Scanbox distribution. Remember to keep a copy of your old version, so you can copy some of your old settings.
Towards the end of the scanbox_config.m file you will see a new section that contains variables that allow you more precise control of the size and aspect ratio of your pixels:
sbconfig.hsync_sign = 0; % 0-normal, 1-flip horizontal axis sbconfig.gain_override = 1; % override default gain settings? sbconfig.gain_resonant = [1.4 2.9 5.7]; % gains for x1, x2 and x4 sbconfig.gain_galvo = [1.0 2.0 4.0]; % gains for x1, x2 and x4 sbconfig.dv_galvo = 64; % dv per line (64 is the max)
The first variable is used to flip the sign of the horizontal sync signal of the resonant controller. Effectively, what this does, is flip the two-photon image left-right. Normally this variable should be zero, but we have encountered some isolated cases where the controller has a sync signal of the opposite sign. In such cases, set the variable to 1 and it will restore the orientation of the image to its normal setting.
The second variable, gain_override, allows you to change the default gain settings for the resonant and galvanometer mirrors. If the variable is zero, Scanbox will use its default settings. If it is one, it will use the ones defined by the user in the gain_resonant and gain_galvo variables.
These factors are such that for a value of 1.0 one gets the maximum possible deflection of each of the mirrors. Values larger than one will decrease the optical amplitude of the mirrors and therefore increase the magnification.
In the example above, we are maximizing the deflection of the galvanometer at x1. At x2, the factor is 2.0 (half of the max amplitude), and for x4 it is 4 (one-fourth of the max amplitude). The gains for the resonant are chosen so that in our setup the pixels are approximately square, but you can work with non-square pixels if you so desire.
To adjust the values of these variables you need to measure the aspect ratio of your pixels. One simple way to do this is to image a sample using “accumulate” mode, zero the position, and move the sample by some Δx and Δy. By measuring the displacement of the image and normalizing by the actual movement performed (as it appears in the position counters) one can obtain the size of the pixels in um.
The variables in the config file are read only at startup. However, to adjust the gains without restarting Scanbox to accept a new setting you can force a change from the command window as follows:
global sbconfig; sbconfig.gain_resonant(1) = 1.5; sb_update_gains;
The above will modify the gain of the resonant mirror at x1 and you can image again right after forcing the change without restarting Scanbox. Once the microscope is stopped, you can change the same or other variables (always followed by sb_update_gains) to continue adjusting your values (of course, there is no need to define the global variable every time).
Once you have obtained the pixel size you want at each magnification, update the config file variables gain_resonant and gain_galvo to your values so that future sessions of Scanbox will automatically use them.
With the default settings you should now obtain a field of view of roughly 1.2 x 0.76 mm at x1 with 512 lines and 31 Hz in bidirectional scanning mode. You can increase further to 1.2 x 1.5 mm at x1 with 1024 lines at 15.5 Hz in bidirectional mode.
Changes in the gain will likely require further adjustments of the line folding in bi-directional scanning, which is achieved by changing the ncolbi variable.