Bidirectional scanning in Scanbox

We have implemented bidirectional scanning to Scanbox. To switch between bidirectional and unidirectional scanning all you have to do is hit the toggle button within the “Scanner” panel.

The defaubidirectionallt setting is “U”, standing for unidirectional scanning; hitting the button will switch it to “B”, indicating bidirectional scanning.  You can only switch between the two modes while the microscope is not scanning.

In bidirectional mode scanning samples are obtained while the laser scans in both directions of motion of the resonant mirror, and lines are advanced at both edges of the scan. On the plus side, this means that you can scan the same area twice as fast. You will notice the frame rate box doubling its value when you switch from unidirectional scanning to bidirectional scanning.

However, bidirectional scanning has some drawbacks as well.  First, you should be aware that that the Pockels’ cell will be active during both phases of the scan, while in unidirectional scanning it was active only in one direction. The result is that you will be delivering twice the amount of power onto the tissue, which may limit the length of your experiments due to potential photo-damage. Thus, use bidirectional scanning only if your indicators are fast enough and the scientific question you need to answer requires doubling the scanning speed.

Second, in bidirectional scanning even and odd lines are sampled in different directions, so they should be aligned properly to yield an image without spatial discontinuities. This alignment has to be fine tuned by the user in each setup, as there is variability in the resonant frequency of mirrors, the laser pulse frequency, and the phase of the sync pulse from the resonant mirror controller.

Scanbox allows for this fine tuning by changing a single variable in the configuration file named ‘ncolbi’ — a vector that allows alignment to be fined tuned separately for the three magnification factors.  This is necessary as well because the resonant frequency changes slightly with amplitude.

Once properly tuned, Scanbox performs compensation for non-uniform sampling and the alignment of even/odd lines during bidirectional scanning in real time.  Below is the mean image of 100 frames collected under bidirectional scanning.  You can see the alignment is very good by looking at the fine vertical processes in the image.

Alignment of even/odd lines in bidirectional scanning t 31 frames per second.

A final drawback of bidirectional scanning is that your file size will roughly double. This means that all other processing will also take longer — from aligning the images to extracting the signals.

Having said this, the faster rates achieved in bidirectional scanning will be helpful when coupled with the ability to do volumetric imaging by means of the optotune lens.

The bidirectional mode of Scanbox is now in beta testing.  I have not fully evaluated the extent to which other features of Scanbox, such as real time processing and image stabilization work in bidirectional mode. I welcome feedback from brave users who are willing to test bidirectional mode in their setups.

If you plan on giving bidirectional scanning a try let me know how it goes!  The updated code will be in Scanbox Github shortly.

4 comments

  1. I’d expect that photodamage would be rather reduced than increased if you are scanning the frames twice as fast, because this allows to reduce the laser power by 1/sqrt(2) in order to roughly maintain the overall photon yield. But there are no really reliable studies out that quantify the effects of fast and slow scanning (at least not that I know). Maybe, even if I don’t think so, the fluorophors are happy to recover their dark states for the 65 us of the line flyback time in unidirectional scanning …

    For the alignment of bidirectional scanning for my system, which is very similar to yours, I’m using an automated approach: First, I switch to line-scanning (simply setting the amplitude of the galvo mirror to zero) and then I acquire a bidirectional image full with this line. By correlating the even and odd lines, I can easily extract the optimal ‘scan phase’ and adjust it automatically. This is especially useful if you have a lot of different zoom settings which you can then align in the batch mode.
    At least for my system, every two weeks I have to adjust the bidirectional fine alignment of every zoom setting, most likely because the exact frequency of the resonant scanner changes slightly. As a sidenote, I encountered one limitation when adjusting the scan phase: For the line trigger, I’m using an NI DAQ board that is clocked at 20 MHz, which therefore does not allow to time the scan phase with the precision of acquisition (80 MHz). For use of a FOV with a line width of 2048 px (which does not happen so often), this effect is visible in the averaged image. Maybe you do not have this (small) issue due to the use of the PSoC5.

    1. Yes, automatically measuring the phase is feasible. I’ll try to add this option to Scanbox soon. As for photodamage — in our experiments we need to collect a certain number of stimuli for reverse correlation estimates of the receptive fields and scanning at twice the speed will not speed up the process. So in our application, given equal time experiments, photodamage will be more severe in bidirectional scanning.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s