Alignment

../_images/multi-scanner-align.png

With premium ScanImage®, an affine transformation can be applied to align the scan fields of separate scanners or cameras.

When using a dual scan path microscope for photostimulation it is often desirable to image and identify cells for stimulation with one scan path, then stimulate the cells using the other scan path. For this targeting to be accurate, alignment between the scanners is critical.

Note

When using the photostimulation with a single scan path microscope, alignment is not necessary. If you are using a resonant-galvo-galvo scanhead however, it is important to have accurate settings for scan mirror angular ranges if you intend to use images collected in resonant mode to identify ROIs to stimulate. Details on how to do this can be found in the scanner configuration pages

Tutorial


Before any alignment we must immutably choose one scanner to be the reference scanner. This should be the imaging path of the microscope. Select this scanner from the configuration menu.

Note

Each scanner object hSI.hScan_[User given scanner name] has a scannerToRefTransform property representing an affine transformation to align it to the reference space. The reference scanner’s scannerToRefTransform should be a 3x3 identity matrix.

FOCUS on a sample and acquire an image with sufficient structure and contrast so that the features can be matched from images acquired from each scanner. Zoom factor can be altered, however it must remain the same for both scanners used in the alignment. ABORT when satisfied with the image.

Open the alignment gui by clicking Alignment... in the CONFIGURATION window. Then click the Show Alignment Window checkbox in the ALIGNMENT CONTROLS window. Then in the Reference Image panel, copy the channel of the display which captures the features of the sample most clearly (E.g. Copy CH1). This will insert the image data from channel 1 as a green image in the OPTICAL ALIGNMENT window.

Warning

Do not move the stage between these steps.

Switch the scanner from the CONFIGURATION window to another scanner and begin a FOCUS. From the Alignment Source dropdown in the ALIGNMENT CONTROLS, select the display channel that was used used for the reference (E.g. Channel 1). The live image should be displayed in the OPTICAL ALIGNMENT window in red.

Tip

One can emphasize the alpha of the red or green channels in the OPTICAL ALIGNMENT window by first ensuring the OPTICAL ALIGNMENT window is the active window by clicking in it, and then holding the control key while scrolling.

One can now define the scanner to reference affine matrix of the secondary scanner by overlapping characteristic features from the red image onto the green image. Right click to reveal the context menu.

As a first try, one can attempt to Auto Estimate Transform. This function is hit or miss and heavily sample dependent.

Otherwise, right click over a characteristic spot in the image to Add a fixed point at that location. Good contenders for characteristic spots are:

  • At a corner in an outline

  • At the centroid of a fluorescent bead that is smaller than the desired spatial resolution.

Then drag the fixed point to the corresponding characteristic spot in the green reference image. Because it is a fixed point, it will remain at that location relative to the reference image while adding and dragging other fixed points.

  • Dragging the only fixed point will change the X,Y offset of the image without altering XY scale, rotation, or shear.

  • Dragging one of two fixed points will change the X,Y offset and scale without altering the rotation or shear.

  • Dragging one of three fixed points will set the all of the X,Y offset and shear as well as rotation and shear.

It is counterproductive to define more than 3 points as only the above affine tranformations can be applied.

Once three fixed points have been defined, the transformation can be saved by clicking the Save Scanner Alignment Transform button in the ALIGNMENT CONTROLS window.

Camera Alignment

This same process can be applied between the reference scanner and a camera. The reference image should once again be acquired from a reference scanner. Then select the camera from the ALIGNMENT SOURCE dropdown. Start acquiring from the camera from the CAMERA window and it should populate the red image in the Optical Alignment window.

The camera alignment allows images taken from the camera to be used as context images in the ROI Group Editor.