BakingTray
Search…
Setting up ScanImage
Basic set up of ScanImage for use with BakingTray

USR and CFG files

ScanImage settings can be stored for recall later. Two sets of files are used: "user settings" files and "configuration files". These are outlined here.
Briefly, there will probably be one user settings file that you'll use to start ScanImage each time. It stores things like the window positions and which channels are active. So set up this sort of thing and save it as a user settings file which you call "BakingTray.usr" or similar.
Then set up some configuration files for different scan settings. These ".cfg" files will save stuff like the image size, if the pixels are square, the bidirectional scan phase correction, the PMT gains, etc.

Scan amplitude

Adjust the scanner settings until the mirrors are moving at their maximum amplitudes at a zoom setting of 1. You might find (either now or in the future) that pressing Grab or Loop generates an error like this:
1
Error using scanimage.components.scan2d.resscan.Control/start (line 153)
2
NI DAQmx error (-200462) in call to API function 'DAQmxStartTask':
3
Generation cannot be started because the output buffer is empty.
4
5
Write data before starting a buffered generation. The following actions can empty the buffer: changing the size of the buffer, unreserving a task, setting the Regeneration Mode property, changing the Sample Mode, or configuring
6
retriggering.
Copied!
One way this can happen is if the waveform of the galvo is too large. Check this as follows:
1
>> max(hSI.hWaveformManager.scannerAO.ao_volts_raw.G)
2
3
ans =
4
5
0 10.0527
6
7
>> min(hSI.hWaveformManager.scannerAO.ao_volts_raw.G)
8
9
ans =
10
11
0 -10.0527
Copied!
The DAQ is capable of producing values between +/- 10 V, so this is the problem.

Z scan settings

The PIFOC will be controlled by ScanImage and now is a good time to get to know it and ensure it's behaving well. Mount the objective you will be using into the PIFOC. Run the actuator tuning and set up reasonable parameters for, say, 5 depths spaced 10 μm apart. Use the step mode. Make sure you set reasonable default values for the Fast Z controls. We find that a flyback time of about 35 ms and a lag of about 5 ms is suitable for most scenarios. You should test this for your hardware and save these values in the configuration file. BakingTray will automatically enable Fast Z when it starts scanning and will use whatever flyback and lag settings are already there.

Choosing scan settings for linear scanners

The purpose of this section is to describe how to get a feeling for how long it will take to acquire data with linear scanners and what the images will look like. Before proceeding with this step you should calibrate the number of microns per pixel. Linear scanners are slow and driving them too hard has trade-offs with image quality. Here is how to determining scan settings and approximate imaging times:
Set up ScanImage as follows (PMTs and laser can be off):
  1. 1.
    Channels dialog: display chan 1, check save boxes for largest number of channels you anticipate using.
  2. 2.
    Set up saving into a junk directory.
  3. 3.
    Set up the fast z controls (if you use this): step, check enable, set up your typical number of optical sections and distance between sections.
  4. 4.
    In MAIN CONTROLS: set "acqs" to acquire 10 to acquisitions
  5. 5.
    In User functions add BT_timer (which will need to be in you path) to 'acqModeStart', 'frameAcquired', and 'acqDone', 'acqMode'
  6. 6.
    The pixels/line affects microns per pixel. Set zoom to 1 and makes sure Pix=Lin is checked in CONFIGURATION. Suggested pixels per line: between 500 and 1024. At larger numbers (will depend on your PC), you will get faster performance if you also disable viewing of chan1
  7. 7.
    Set the pixel bin factor and sampling rate to get a line period of around 750 to 900 microseconds.
    You can go as low as 650 with some scanners, but that's not recommended. The image quality will get better above 800 microseconds, since the bidi scan artefacts are largely gone here.
  8. 8.
    Now hit loop.
It then reports reasonable acquisition times: e.g. For 11x15 tiles of 5x10 microns in 220 physical sections
Our setup yields the following times:
  • 41 hours - 892 microsecond scan lines, 0.98 mics/pix, 2.0 MHz
  • 33 hours - 716 microsecond scan lines, 0.98 mics/pix, 2.5 MHz
  • 33 hours - 716 microsecond scan lines, 0.98 mics/pix, 2.5 MHz (NO CHAN 1 DISPLAY)
  • 49 hours - 856 microsecond scan lines, 0.77 mics/pix, 4.0 MHz
  • 106 hours - 834 microsecond scan lines, 0.52 mics/pix, 2.0 MHz (with chan1 display)
  • 77 hours - 834 microsecond scan lines, 0.52 mics/pix, 2.0 MHz (WITHOUT chan1 display)
Now repeat but with 3x10 microns and 370 physical sections
  • 35 hours - 716 microsecond scan lines, 0.98 mics/pix, 2.5 MHz
The above numbers will of course be faster for resonant scanning, which uses an FPGA.

Channel names

In the PMT set up dialog in ScanImage you should name the channels appropriately. This matters because the autoROI algorithm that finds the samples works best using the Red PMT. The far-red PMT tends to have too little autofluoresence and in the blue the agar autofluoresces a lot at longer excitation wavelengths. You should name your PMTs "Red", "Green", and "Blue". If you have "Far Red" also, that is fine: the system will ignore it. The names are case-insensitive. If you do this makae sure the colon is present. Just don't name the PMTs anything else, like "Low", "Med", "Short" or "<490 nm", etc. If you do not name the PMTs the autoROI algorithm will choose the brightest channel upon which to work.
On ScanImage Basic the PMTs should be set up in the same order as the channels so that the first PMT is assocaited with channel 1, etc. If channel 1 is unused, make a dummy PMT. Suggested PMT names for Basic: "Chan 1: RED", "Chan 2: GREEN", etc Make sure you add the colon.

Other settings

  • ScanImage has the ability to blank the laser turn-arounds. This is mainly used to avoid photo-damage in vivo when using resonant scanners (and to a lesser extent linear scanners). We don't care much about bleaching and photo-damage, since our tissue is dead and we image each frame only once. On the other hand, the blanking can lead to ringing in the amplifier for samples with high autofluoresence or where this bright signal near the tile edges. The ringing is systematic and will be removed when the average tile is divided out. Disable flyback blanking in ScanImage with caution, therefore.
  • In SI Basic the PMT GUI has a number of annoyances, one of which is that it is not very salient when the PMTs turn on. You can change the colour of the PMTs icon in the ON state to make it more obvious. To do this you will need to edit the file +dabs\+resources\+widget\+widgets\PMTWidget.m Around line 62 you will see the definiation for the PMT on state image. The color is defined by a constant that comes from dictionary. The default is most.constants.Colors.darkGrey. You can change this. e.g. you might choose darkGreen for the ON state.