Hostname: page-component-78c5997874-94fs2 Total loading time: 0 Render date: 2024-11-19T08:37:42.021Z Has data issue: false hasContentIssue false

Open-Source Software for Controlling Two-Photon Laser Scanning Microscopes

Published online by Cambridge University Press:  31 August 2017

George Ward*
Affiliation:
Scientifica, Uckfield, TN22 1QQ, United Kingdom
Alex Murray
Affiliation:
Scientifica, Uckfield, TN22 1QQ, United Kingdom
Christian Wilms
Affiliation:
Scientifica, Uckfield, TN22 1QQ, United Kingdom

Abstract

Type
Feature Article
Copyright
Copyright © Microscopy Society of America 2017 

Introduction

Over the past 25 years two-photon laser scanning microscopy (LSM) has revolutionized research in neuroscience, immunology, and many other fields because it enables scientists to investigate the structure and function of intact tissue in living animals at diffraction-limited resolution [Reference Denk1, Reference Helmchen and Denk2]. For example, neuroscientists routinely use two-photon microscopy to monitor brain activity in awake animals with sub-cellular resolution while the animal performs behavioral tasks or responds to sensory stimulation [Reference Ohki3Reference Stirman5].

Typically, researchers integrate additional equipment (for example, XY stages, instruments for sensory or optogenetic stimulation, electrophysiology amplifiers) with their two-photon microscope to accommodate a set of experiments. This often involves custom-built hardware controlled by custom-written software. Commercially available two-photon microscopes usually include proprietary control software that allows users to operate the microscope and acquire images. However, customizing this basic functionality to interface with custom hardware and software or to automate complex experimental procedures can be a challenge, as manufacturers are often reluctant to disclose their designs.

Several software packages for operating two-photon laser scanning microscopes (LSMs) are commercially [Reference Chi6] or freely [Reference Pologruto7Reference Campagnola10] available in various programming languages including C++, LabVIEW, MATLAB, and Python. However, none of these software packages enables the end user to easily interface with any arbitrary programming language they may already be familiar with. This is a substantial drawback for scientists who intend to integrate a commercial or custom-built two-photon LSM within an existing software framework.

This article describes SciScan: a free, open-source software package with an ActiveX-based application programming interface (API) for external scripting. All commonly used data analysis and programming environments such as MATLAB, Python, C++, or Java offer ActiveX support, thereby enabling the researcher to integrate SciScan within the same environments they already use for processing and analyzing data. Thus, SciScan directly connects the data acquisition process with the data pipeline or workflow, allowing full automation of the entire process. Furthermore, imaging data recorded with SciScan is compatible with the Open Microscopy Environment (OME) such that images and metadata can be imported into OME-capable software without the need for proprietary import filters [Reference Goldberg11].

Materials and Methods

Concept and framework

SciScan is based on the idea of providing the scientific community with a LabVIEW-based software LSM that is open-source, free of charge, and highly modular. To this end, we chose a design pattern based on a functional global variable (FGV) in which variables of data type “Variant” can be stored. The Variant data type can contain strings, numerics, Booleans, arrays, clusters, refnums, or any other data type available in LabVIEW. Therefore, we refer to this FGV as a Generalized Functional Global (GFG), a concept that was previously suggested by a user on the LabVIEW Idea Exchange forum (http://scien.se/GFG-Sci).

We have expanded this idea such that any change of a GFG variable automatically triggers an event, which can be listened for in other stand-alone, top-level virtual instruments (VIs). This facilitates easy communication between modules with minimal overhead. End users can write custom modules that can access the GFG either by using set or get methods or by listening for variable change events. Thus, new functionality can be added without modifying any of the existing code itself. This is conceptually like LabVIEW object-oriented programming (LVOOP), but it avoids the steep learning curve, which researchers without a background in computer science often experience with LVOOP.

Functionality

SciScan can be used to control and acquire data from both galvanometer and resonant LSMs. A graphical user interface (GUI) provides control over all the features commonly found in LSM software (Figure 1), such as two-dimensional frame scans, z stacks, arbitrary line scans (Galvo only), zoom (digital and optical), on-the-fly plotting of mean gray values of multiple regions of interest (ROIs), and controls for piezoelectric focusing devices to facilitate fast 3D scanning, among others. Furthermore, SciScan provides functionality that is rarely found in other LSM software packages, such as the Position Save Module, the SciScript Module, ActiveX connectivity, and OME compatibility.

Figure 1 GUI of SciScan’s main display window including the main controls and the image display.

Position Save Module

The Position Save Module allows users to store multiple positions of their XY stage and Z focus motor and easily recall them later. This is a crucial functionality for long-term in vivo imaging studies. Points of interest are saved relative to a user-defined origin, usually an easily identifiable landmark (for example, a meningeal blood vessel pattern). A reference image for each position is also stored. It is not unusual that the absolute position of the origin changes slightly between experimental days (due to the practicalities of positioning a live specimen), in which case the user can easily reassign the absolute position of the origin landmark. All stored points of interest will automatically be corrected accordingly. Furthermore, positions can be manually fine-tuned using the “overlay” function, whereby the stored image and the current live image are displayed as a red/green overlay image. (Figure 2 shows a red/blue overlay image suitable for some color-blind individuals.) This enables the user to easily reposition the current field of view to match images between two experiments.

Figure 2 User interface for SciScan’s position save module, which enables users to store multiple positions of their XY stage and Z focus motor and to easily recall them at a later date.

SciScript Module

SciScript is a scripting feature that provides a macro-like functionality (Figure 3), allowing the user to automate repetitive tasks that would otherwise need to be carried out manually via the main SciScan GUI. Macro files are stored in a human readable format and can be generated and edited either via the SciScript GUI, by using a simple text editor, or by generating a text file from other programming environments. SciScript pre-sets are available to auto-generate macros for commonly used experimental sequences. The Slow Z Stack pre-set creates a macro representation of the data that has been set up in the z-stack table. It converts each plane into a discrete 2D acquisition to ensure accurate objective positioning and improved imaging stability. The macro will step between each plane before adjusting the laser power as specified in the table and executing the 2D scan. Separate 2D images are recorded as raw files into a temporary folder, after completion of the macro the images are recombined and saved into the standard root folder with a batch file to open the combined raw image in ImageJ [Reference Rasband12]. The Image Tiling pre-set allows users to automatically collect multiple 2D or 3D acquisitions across a predefined region for post hoc mosaic stitching.

Figure 3 SciScript Module provides a macro-like functionality, allowing the user to automate repetitive tasks. Presets are available to auto-generate macros for commonly used experimental sequences.

Active X connectivity

ActiveX connectivity allows the user to control SciScan from programming languages such as MATLAB or Python. It provides easy access to basic SciScan functions (start/stop recording, adjust scan parameters, control stage motion, etc.) but also caters to advanced automation requirements. In fact, any variable used within SciScan can be accessed, not only via the GFG methods within LabVIEW, but also via ActiveX from external programming environments.

OME compatibility

SciScan supports the OME’s XML and OME-TIFF formats. This allows users to load, organize, and analyze data with the Bio-Formats Java library. The OME (https://www.openmicroscopy.org) is a consortium of academic laboratories and commercial entities that create open tools to support data management for biological light microscopy. They have created the OME Model, a specification for storing biological imaging data including a wide variety of picture, acquisition, and experimental parameters [Reference Goldberg11]. This enables the simple exchange of imaging data between different software packages.

The OME-XML is a file format used to store metadata per the OME model in an XML file, which can be shared easily among different sites and users. The OME-TIFF is a multi-page tiff file that contains the OME metadata within the header as OME-XML. The pixels of the OME-TIFF file can be read by any TIFF-compatible programm, and the metadata can be extracted with an OME-aware application.

The ability to save imaging data as an OME-TIFF or with an OME-XML file allows users to open, organize, and share metadata in a fully standardized format. This helps researchers to disseminate and analyze data in other software, compare their data with others using the OME Model, and keep track of where and how the images were acquired. In addition, the OME consortium currently has two major tools to help those working with OME-XML and OME-TIFF files: (a) Bio-Formats, a library containing many features related to OME-XML, including conversion of third-party metadata into the OME-XML structure and (b) OMERO, a server that can import OME-XML and OME-TIFF data and export OME-TIFF files, providing research groups with a means of cataloging and storing imaging data on a central server.

Results

Several of the functions described above are currently in use in labs around the world. Thus, SciScan is enabling neuroscientists to pursue complex questions.

Position Save Module

Dr. Sabine Liebscher at the Ludwig-Maximilians-Universität Mìnchen uses the Position Save Module within SciScan to perform chronic in vivo imaging in mice. Using a Scientifica Multiphoton Resonant System, a fiduciary marker such as a crossing or branching of blood vessels is stored as the “origin” (Figure 4). This point is easily relocated during each imaging session and can be aligned to the image taken at an earlier time point. The coordinates of all imaging regions are stored relative to the origin, making it easy to relocate and image the same region days or weeks apart. This enables Dr Liebscher’s lab to ask questions about changes in function of the same neurons over long time periods.

Figure 4 Side projection of an in vivo Z-stack of Layer V pyramidal cells in the visual cortex of Thy-1 green fluorescent protein (GFP) mice taken in SciScan using a Scientifica Multiphoton Resonant System.

SciScript Module

Dr. Jonathan Taylor from the University of Glasgow is currently working on a SciScript macro that will enable the microscope to create a 3D image stack of a beating zebra fish heart as if it were not moving, while it continues to beat as normal. The researchers use a synchronization algorithm that analyzes the motion of the heartbeat via simultaneous bright-field illumination. They use this synchronization to time the acquisition of a single 2D plane of the heart at a specific point in the heartbeat. The software then advances the imaging plane to the next step in the Z scan and waits for another trigger when the heart is back in the same position during the next beat. This will allow the acquisition of 3D two-photon datasets of the beating heart to properly image subcellular structures without motion artifacts. These datasets could be used to investigate the details of cell-cell interactions during development or during healing. It could also be used to observe detailed dynamics of the developing valve in the heart.

Active X connectivity

Dr. Jerome Lecoq and Jed Perkins from the Allen Institute for Brain Science use SciScan’s external programmatic control to enable three things: (1) a consistent experience for performing optical physiology on mice across multiple systems. (2) a more natural coordinate system in the context of the targeted visual areas in the mouse. (3) additional functionality not currently available in SciScan. The data they collect becomes part of the Allen Brain Observatory’s standardized in vivo survey of physiological activity in the mouse visual cortex (http://observatory.brain-map.org/visualcoding).

Using intrinsic signal imaging, they generate maps of the visual areas for each mouse. The coordinate system for those maps is developed using a hardware registration scheme that can be shared across all their systems (surgical, intrinsic imaging, and optical physiology). The users can then target a desired visual area by selecting it with a web tool, which provides the X, Y coordinates of the region in the registration space. The software then performs the transformations from those X, Y coordinates into the relative positions of the SciScan coordinate system and issues these new coordinates, through ActiveX, to move the scope into position. This has another advantage in that safety limits can be set, based on the home position and well size, to prevent moves that would be harmful.

Additionally, the exact length of an acquisition is unknown at the time of starting, as it will depend on the stimulus presented and any latency issues in the stimulus system. SciScan doesn’t have built-in support for stopping on a hardware line (it can only start on one). The researchers from the Allen Institute developed a way of waiting on the trigger line to programmatically start SciScan acquiring, and then programmatically cancel the acquisition when the line goes back low.

Discussion

We presented here SciScan, a LabVIEW-based open-source software package developed by Scientifica Ltd for the control of LSMs. Its primary application is to acquire imaging data with Scientifica’s multiphoton microscope range (Figure 5). In addition, SciScan can be used for image acquisition with any LSM employing National Instruments DAQ hardware. This includes most custom-built multiphoton microscopes and many commercial third-party systems. SciScan is provided free of charge to the scientific community and operates standard galvanometer scanners as well as resonant scanners. SciScan allows researchers to control image acquisition from pre-prepared scripts via SciScript or externally via its ActiveX API. This enables scientists to integrate SciScan into the same environments used for post-processing and data analysis. Thus, SciScan directly connects the data acquisition process with the data pipeline or workflow, facilitating automation of the entire process. The interoperability of SciScan with existing data pipelines is further enhanced by compatibility with the OME. This allows any OME-capable software to load images recorded with SciScan along with any metadata without the need for proprietary import filters. This makes SciScan the only open-source software package for LSM, which is free of charge, OME-compatible, and scriptable both internally and externally. These features reduce the time for initial setup and thereby increase research productivity. SciScan’s ability to interface with external software from within the programming environment used to process and analyze the data opens the door to numerous sophisticated and data-intensive applications, including closed-loop operation. This makes experiments easily scalable, allowing a single user to fully automate data acquisition on multiple systems at the same time, enabling higher throughput data acquisition and allowing “big data” applications. More information about SciScan, including the download files, can be found on the SciScan Knowledge Base (sciscan.scientifica.uk.com).

Figure 5 A single plane from a two-channel Z-stack of the Drosophila optical lobe labeled with GFP and red fluorescent protein (RFP) taken in SciScan using a Scientifica Multiphoton Resonant System. Bar = 50 µm.

Conclusion

This article describes a free, open-source, LabVIEW-based software framework for controlling two-photon laser scanning experiments on any LSM. It is compatible with the OME, allowing any OME-capable software to load images recorded with SciScan along with any metadata without the need for proprietary import filters. It is also scriptable both internally and externally, allowing image registration over long-term experiments.

References

[1] Denk, W et al., Science 248 (1990) 73–776.Google Scholar
[2] Helmchen, F and Denk, W, Nat Methods 2 (2005) 932940.Google Scholar
[3] Ohki, K et al., Nature 433 (2005) 597603.Google Scholar
[4] Dombeck, DA et al., Neuron 56 (2007) 4357.Google Scholar
[5] Stirman, JN et al., Nat Biotechnol 34 (2016) 857862.Google Scholar
[6] Chi, KR, Nat Methods 5 (2008) 651658.Google Scholar
[7] Pologruto, TA et al., Biomed Eng Online 2 (2003) 13.CrossRefGoogle Scholar
[8] Nguyen, Q-T et al., J Neurosci Methods 156 (2006) 351359.Google Scholar
[9] Langer, D et al., J Neurosci Methods 215(1) (2013) 3852.Google Scholar
[10] Campagnola, L et al., Front Neuroinformatics 8 (2014) 3.Google Scholar
[11] Goldberg, IG et al., Genome Biol 6 (2005) R47.Google Scholar
[12] Rasband, WS, ImageJ., U.S. National Institutes of Health, Bethesda, MD, 1997.Google Scholar
Figure 0

Figure 1 GUI of SciScan’s main display window including the main controls and the image display.

Figure 1

Figure 2 User interface for SciScan’s position save module, which enables users to store multiple positions of their XY stage and Z focus motor and to easily recall them at a later date.

Figure 2

Figure 3 SciScript Module provides a macro-like functionality, allowing the user to automate repetitive tasks. Presets are available to auto-generate macros for commonly used experimental sequences.

Figure 3

Figure 4 Side projection of an in vivo Z-stack of Layer V pyramidal cells in the visual cortex of Thy-1 green fluorescent protein (GFP) mice taken in SciScan using a Scientifica Multiphoton Resonant System.

Figure 4

Figure 5 A single plane from a two-channel Z-stack of the Drosophila optical lobe labeled with GFP and red fluorescent protein (RFP) taken in SciScan using a Scientifica Multiphoton Resonant System. Bar = 50 µm.