This documentation is for a legacy ScanImage version. The current documentation is ScanImage 2019.
Skip to end of metadata
Go to start of metadata


In a dual scan path configuration for simultaneous imaging (resonant-galvo) and photostimulation (galvo-galvo), sample motion can result in off-target stimulation. To compensate for this effect, ScanImage can detect sample motion and retarget the stimulation laser to track the sample.


Galvo Controller Board Configuration

Standard Cambridge Technologies 671 series galvo controller accept two input signals:

  • Galvo Position
  • Galvo Position Offset

ScanImage controls the stimulation pattern using the Galvo Position signal. To correct for sample motion, ScanImage uses the Galvo Position Offset Signal, which is updated independently of the Galvo Position signal.


While standard Cambridge Technologies 671 series galvo controllers support position offset inputs, this functionality is disabled by default. Check if resistors R85, R93 and R124 are installed on the galvo controller board are installed. If the resistors are unpopulated and/or zero-ohm resistors (label 000 or 0000) are installed, the controller board ignores signals provided to the offset input (pin J1.4). In this case, follow the instructions in this section to reconfigure your galvo controller board.

Modifying the galvo controller board might void the warranty and might damage your board. The information on this page is provided to our best knowledge. However, we do not assume any responsibility in case the suggested modifications result in any hardware damage.

R124 and R93 determine the gain of the inverting amplifier shown in the figure on the right. Since NI DAQ boards can drive analog outputs +-10V, no additional amplification is required. Using the formula Vout = -Vin * R93/R124 it can be seen, that  R93 and R124 should be selected to have the same value (20kOhm should be sufficient for most applications).

To determine R85, review page 13 of the Series 671 instruction manual:

R85 = ((+Offset In - -Offset In) x R54 x (R29/(R30+R119)))/(Position Output Scale Factor x Position Offset Range)

Standard values are

Offset In = 10V
R54 = 10kOhm
R29 = 10kOhm
R30 = 19kOhm
R119 = 1kOhm
Position Output Scale Factor = 0.5V /° mechanical

Choose the position Offset Range in °mechanical to select the offset range.

671 series resistor positions


Locations of the resistors R85, R93 and R124 on a Cambridge Technologies 671 series galvo controller.


671 series offset input circuit

Offset input circuit of a Cambridge Technologies 671 series galvo controller. R85, R93 and R124 might be unpopulated or zero-ohm resistors. To enable the controller board's offset input, these resistors need to be added / replaced.




To use motion correction the following signals need to be connected:

The XY Galvo Position Feedback is used to calibrate the position offset signal relative to the galvo position signal.

The galvo position and offset inputs are located on connector J1 of the Cambridge Technologies galvo controller board. Assuming these inputs are configured to be non-inverting single ended (W4 1-3 and 4-6 jumpered), the following wiring scheme can be used:

PinSignalMDF SectionMDF VariableRecommended MDF Value
J1.2 (X,Y)Signal GND---
J1.3 (X)X Galvo positionLinScanXMirrorChannelID0
J1.3 (Y)Y Galvo positionLinScanYMirrorChannelID1
J1.4 (X)X Galvo position offsetLinScanXMirrorOffsetChannelID0
J1.4 (Y)Y Galvo position offsetLinScanYMirrorOffsetChannelID1
J4.2 (X)X Galvo position feedbackLinScanXMirrorPosChannelID5
J4.2 (Y)Y Galvo position feedbackLinScanYMirrorPosChannelID6
-Photodiode feedbackPhotostimBeamAiId7
J4.3 (X,Y)Signal GND---

The DAQ device that drives the X and Y galvo position offset signals is configured in the LinScan MDF variable 'deviceNameOffset'. Any NI DAQ board with two analog outputs can be used (E,S,M,X series). While USB-DAQ boards are supported, PCI/PXI based boards are recommended. Updating the offsets using an USB-DAQ device introduces additional latency into the offset correction (~15ms), whereas the latency using PCI/PXI based devices is negligible (~2us).

Sample MDF settings for Photostimulation
Photostim Wiring

Offset correction wiring scheme of two 671 series Cambridge Technologies Galvo driver boards. To calibrate the offset output, it is essential to connect the XY position feedback signals (J4.2)



After configuring the system, it is essential to calibrate the Photostim Position Signal, Position Offset Signal and Feedback Signal.
Since the calibration settings persist between ScanImage sessions, this step needs to be done only once,

To enable sample tracking, perform the following steps:

  • Start the Photostimulation module by selecting 'Start' in the Photostimulation Controls window
  • Start a Focus/Grab/Loop
  • Right click the live image in one of the channel display windows and select 'Set motion correction reference'
  • Right click the live image in one of the channel display windows and select 'Enable motion correction'
  • (Optional) Right click the live image in one of the channel display windows and select 'Show motion'
  • (Optional) Enable the 'Monitor Show' option in the Photostimulation Controls window

The Photostimulation module is now tracking the sample by updating the offset signal whenever motion is detected.


Feedback and Offset Calibration

Calibrating the Photostim Module calibrates the galvo feedback signal and the galvo offset signal.

  • No labels