calibration

Automatic Optotune Calibration

We previously explained how to calibrate the optotune manually.  With the introduction of Knobby 2, we are able to make this process automatic.  You will now find a ‘Calibration’ button in the Optotune panel.  To use it, do the following:

  1. Set the optotune slider to its lowest value (slide all the way down)
  2. Bring some pollen grains into focus
  3. Stop focusing
  4. Make sure the data directory has a directory named xx0
  5. Click the ‘Calibrate’ button
  6. Sit back and relax.  Wait for the process to complete.

Knobby will run some z-stack acquisitions for different values of the optotune current setting.  The volumetric data will be used to calculate the shift in z at various values of the current. A panel will display the progress in processing the images (it takes about 2 min). Scanbox will then plot the raw data and a fit by a quadratic polynomial, which may look something like this:

opto_calib

Scanbox will write a calibration file which will take effect next time you start Scanbox.

After restarting Scanbox, you can check the calibration as follows:

  1. Set the optotune slider to its lowest value (slide all the way down)
  2. Set Knobby to super-fine mode
  3. Focus on some pollen grains
  4. Zero Knobby (XYZ)
  5. Move out-of-focus by moving the optotune slider up to some value
  6. Now bring sample back into focus using the z-axis knob
  7. Compare the reading of the z-axis in Knobby’s screen with the depth noted in the optotune panel. These two numbers should match very closely.

 

Bidirectional scanning and resonant driver calibration

Resonant mirrors vary somewhat in their resonant frequency and the settings of the mirror controller must be adjusted to obtain the best possible images in bidirectional mode.

A synchronization signal from the resonant board must be adjusted so that it is both symmetric and its phase is aligned with the zero crossings of the mirror velocity.

First, connect an oscilloscope to the HSYNC signal in the extension header of Scanbox.  The HSYNC signal is exposed on the header only in the latest version of the firmware, so please download and install it from Github before proceeding.  It is the fourth pin from the left on the top row of the connector as one looks from the top.  Tip: A jumper wire makes it easy to get access to this signal without shorting nearby pins with your scope probe.

Capture_hsync

Look at this signal on the oscilloscope while scanning.  Any modern oscilloscope will allow you to measure the period of the signal as well as the positive and negative pulse width.  In the example below, the resonant frequency is 7928 Hz, the positive pulse width is 63.22 us and the negative pulse width is 62.91 us.

hsync

The first step consists in making sure the signal is symmetric.  In other words, the positive and negative pulse widths should be equal.  You can adjust this by rotating the SYM pot on the resonant scanner driver board, which is the small board mounted on top of the main Scanbox card.  There are 3 pots on this card labeled SCALE, SYM and PHASE.  The SYM pot is the one in the middle.  Slowly rotate the pot until you get the high and low pulse widths to be within 0.5 us of each other.  In the example above the difference is 0.31um.

Now, measure the laser frequency at the wavelength you typically image.  This can be done by measuring the frequency of the signal that comes out of the SYNC OUT of the Chameleon.  It will be close (but not exactly) to 80 MHz.  In my case, I get 80.10 MHz.

laserfreq

Now, we need to calculate the number of samples that comprise one line.  This is ratio between the laser frequency and the resonant frequency divided by 8 (because each period is two lines and each pixel is 4 samples).  Given the numbers above, we get: round(80100000/7928/8) = 1263 samples per line.

Ideally, this is where lines should be “folded” during bidirectional scanning to get even and odd lines aligned.  So, lets start by setting the ncolbi variable to be 1263 (or the value that you found for your setup) for all 3 entries in the scanbox_config file.  (Remember you need to restart Scanbox for these new values to take effect).

Now scan a target that has some nice structure at a magnification of x1.  It may still be the case that the lines are not perfectly aligned.  While looking at the image, rotate the PHASE pot on the resonant controller to make the even and odd lines align as close as possible.  Warning: this pot is VERY sensitive, so turn it slowly.  The result does not need to be perfect, but close enough so that even and odd lines do not look obviously displaced from each other.

Now, with the target in place, run the auto-calibration procedure described here.  Scanbox should be able to find the optimal values that makes the even/odd lines align as much as possible.

Note: your PMT amplifiers should be set at full-bandwidth and a gain of 10^4, resulting in a bandwidth of 80 MHz for this procedure (and for imaging in general).

After going through this procedure you should be getting nice, sharp images in bidirectional mode across the entire field (both in the center and the sides of the image).

Update 9/28/16:

It is typical for some resonant mirrors to experience a small change in frequency with time.  A typical measurement looks like this:

resonant_drift

Resulting in 2 parts per 8000 change in frequency over the first 5 min of operation.  This change can misalign the odd/even lines by ~1 or 2 pixels, which is visible.  To ensure stable calibration and operation during bidirectional scanning, we recommend you use Scanbox in continuous resonant mode.  Here, the resonant mirror will remain in operation throughout your acquisition session.  Of course, you should also perform the above calibration after the mirror has been operating for 5 min or more.

Calibrating the Optotune

If you have been using the Optotune, you must have noticed that the values displayed within the optotune panel for the setting of the slider and the parameters of the z-scanning waveform are unit-less and not very useful.

The latest update to Scanbox allows you to calibrate the Optotune and have all the units within the Optotune panel in micrometers.

A new configuration variable “optocal” in scanbox_config.m can be either empty or contain calibration data.  If optocal is empty, Scanbox behaves as it has done up to now — showing the unit-less values.

Start by setting optocal=[].

To calibrate simply take a green fluorescent slide and make a small marking on its surface.  Small dots with a fine, black sharpie should do.  Focus the microscope near the very top of the slide and pick one feature with the optotune slider set at zero.  Now, zero the position counters.  Our first point, corresponding to pairs of (values, depth) is (0,0).

Move the optotune slider up to a value near 200.  Then, compensate by lowering the objective (z-position) to bring back the feature you selected into focus. Once this is done, write down your next pair (value, depth), as the value of the slider and the depth you read in the position panel (or in Knobby). Continue this process, increasing the value of the optotune slider in steps of ~200, up to a value of ~2000.

Here is the set of measurements I obtained in my setup:

optocal

The curve saturates at a value of ~1760. This is because the current source has reached its maximum output voltage. The range of depths spanned by the optotune is ~340um (vertical axis). The smooth rising part of the curve, before saturation, is well approximated by a second-order polynomial (red curve).  To obtain the values of the coefficients use Matlab’s polyfit function by calling “polyfit(vals,depth,2)” (don’t include the saturating part of the curve!).  The coefficients of these polynomial are what the optocal variable should be set to.  In my case, I get the optimal coefficients to be [0.0001  0.0732 1.3162] and, therefore, I modified the config file so that optocal = [0.0001  0.0732  1.3162].

optotuneum

Once the optocal variable is set, you can restart Scanbox.  The result should be that all the values within the Optotune panel will read in microns (as shown on the left). This includes the slider and the parameters to the waveforms.  Moreover, as the function is slightly nonlinear, the actual waveforms will be linearized accordingly — so a linear ramp should very closely approximate a linear change in depth.