Helen Frankenthaler Foundation

Ion Channel Modulators

FluoAnalysis: An Open-Source MATLAB Toolbox for Analysis of Calcium Imaging Measurements of Oscillatory Astrocytic and Neuronal Networks

Introduction

Calcium imaging, especially two-photon imaging, has emerged as a pivotal technique in neuroscience for studying neuronal activity and dynamics under both in vivo and in vitro conditions. This method allows for the visualization and quantification of calcium signals in a large number of cells simultaneously, providing valuable insights into neural communication, signal transduction, and the overall functional architecture of neural circuits. In addition to neurons, calcium imaging is particularly suitable to study the activity of astrocytes, the major non-excitable cells of the brain that play indispensable roles in a multitude of physiological and pathophysiological brain functions. Despite significant advancements and the recent release of decent calcium imaging analysis packages, there remain critical gaps in the software tools available for the analysis of calcium signals, particularly in the context of astrocytes that are often neglected due to the lack of specialized software for analyzing their activity.

Another critical limitation is the absence of software capable of performing a parallel analysis of imaging and electrophysiological data. Integrating these two types of data is crucial for a comprehensive understanding of cellular and network activity, as calcium imaging and electrophysiological data provide complementary insights into cellular function. Electrophysiological recordings offer a precise temporal resolution, while calcium imaging provides the spatial context. However, most available software solutions do not support a parallel analysis, forcing researchers to rely on separate, often incompatible tools for each data type.

Furthermore, the available analysis tools primarily focus on detecting single events (peaks) in calcium signals, paying much less attention to revealing the spectral components of the oscillating calcium signals that may provide deeper insights into the network dynamics of large-scale neuronal and astrocytic ensembles and decipher the underlying biological processes. Notably, the spectral analysis of electrophysiological signals has previously led to ground-breaking findings about neuronal oscillations and their roles in various vital physiological processes. Despite the success of the spectral analysis of electrophysiological recordings, however, the current analysis tools lack robust functionality for decomposing and analyzing different frequency components in imaging data, which may be even more relevant when considering the high-frequency calcium fluctuations in thin astrocytic processes. This limitation hampers our ability to fully interpret the complex dynamics of calcium signaling.

To address these gaps, we introduce a comprehensive analysis software for calcium imaging data. The FluoAnalysis MATLAB toolbox provides both GUI-based and command-line approaches for the simultaneous analysis of calcium imaging and electrophysiological data. In addition, the toolbox puts special focus on investigating the frequency domain of the imaging results for revealing network-level oscillatory signals that can be attributed to single-cell activity in order to fully utilize the advantages of the imaging methodology.

Results

The FluoAnalysis MATLAB toolbox is controlled by well-organized MATLAB classes. Most of the functions in these classes can be called from user-friendly GUIs as well. The analysis workflow consists of the following modules: (1) loading of the imaging data file, (2) loading of the corresponding electrophysiological recording, (3) identification of regions of interests (ROIs), (4) classification of identified ROIs as neurons or astrocytes, either automatically or manually, (5) calculation of the ΔF/F 0 traces from the imaging data, (6) spectral analysis of the imaging and electrophysiological signals, and (7) creating detailed reports in a Word format. The workflow developed with the GUI can used for automated analysis in the non-interacting mode.

Loading Calcium Imaging Data

The ‘loadImage’ function is the primary component of the FluoAnalysis toolbox. This function is designed to import various image file formats, including multipage .TIFF files, .MES and .MESC files of the MES software package for Femtonics two-photon microscopes, as well as previously analyzed .MAT files in MATLAB format. For .TIFF files, the function gathers metadata to ascertain image dimensions, frame count, and channel number, subsequently loading the data into a multidimensional array. The .MES and .MESC files are processed with particular attention to their unique metadata structures. Additionally, the function can handle previously analyzed .MAT files, facilitating the integration of historical datasets into current analyses. Either frame- or line-scan images can be loaded into the software. Moreover, the ‘loadImage’ function can also load pre-defined ROI files created by the toolbox during automatic image acquisition on Femtonics two-photon microscopes.

After the image file is loaded, it can be visualized and browsed by a slider to easily assess the dynamics of the fluorescent signal. Two independent channels can be displayed to explore signals from different fluorescent indicator dyes or proteins.

Loading Corresponding Electrophysiological Recording

The ‘loadEphys’ function is an integral part of our analysis software for synchronizing electrophysiological recordings with calcium imaging data. This function loads electrophysiological data from .ABF files and aligns it with the imaging session using the metadata in the .ABF file. If the electrophysiological recording was continuous during multiple imaging sessions, the function can also identify the electrophysiological data segment corresponding to a specific imaging session, leveraging tagged markers within the .ABF file when available. The extracted segment is downsampled by a factor of 10 and stored within the object, ensuring precise temporal alignment between electrophysiological and imaging data. This synchronization is crucial for the comprehensive analysis of neuronal activity, providing a robust framework for correlating electrophysiological and calcium signals.

Identifying Cells

The ‘findROIs’ function in the FluoAnalysis toolbox is designed to identify regions of interest (ROIs) on a reference image. The reference image can be either made by external tools and loaded by a GUI command or created from a given set of the series of frames applying the average, maximum, or standard deviation function to the selected frames. After loading or creating the reference image, various parameters can be set to threshold it and create a binary image from which objects are extracted and filtered based on specified cell size criteria. For line-scan data, the function maps the ROIs to line-scan positions and filters out objects with insufficient pixel representation. The identified ROIs are visualized in pseudo color on the GUI. This comprehensive approach ensures the accurate supervised detection and mapping of ROIs, crucial for analyzing cellular activity.

To facilitate the investigation of the same cells over multiple imaging sessions, the ROIs can be imported from a previously analyzed .MAT file using the ‘File > Load objects from another file’ GUI menu. To adjust for specimen or objective movements, the imported ROIs can be moved in the x–y plane using the ‘Tools > Move ROIs’ menu option.

Classification of Identified Cells as Neurons or Astrocytes

The FluoAnalysis toolbox is tailored to analyze calcium imaging data measured simultaneously in neurons and astrocytes. Therefore, it is crucial to appropriately classify cell types. The ‘autoClassifyCells’ function provides an automated classification method based on the ratio of green channel (calcium-sensitive dye or protein, e.g., Oregon Green BAPTA or GCaMP-6) and red channel (fluorescent astrocyte marker, e.g., SR-101) fluorescence. ROIs are first validated as cells if the ROI area is higher than a predefined threshold (100 pixels), the eccentricity of the ROI is lower than 0.85 (assuming that mostly the cell bodies are labelled), and the mean fluorescent intensity within the ROI is at least two times higher than the mean fluorescent intensity in the close vicinity of the ROI. The identified cells are further classified as astrocytes if they have sufficient area, appropriate eccentricity, and specific intensity ratios indicating glial characteristics. Conversely, neurons are identified based on distinct intensity profiles and ratios indicative of neuronal properties. This automated approach streamlines the identification and categorization of cellular elements in imaging datasets, enhancing the efficiency and accuracy of data analysis.

The automatic classification can be replaced or overridden by manual cell identification using a GUI. The ‘Tools > Cell validation’ menu provides a user interface that displays the reference image, a high magnification view of the green and red channels of the ROIs, as well as the calculated ΔF/F 0 traces for each cell to allow the experimenter to make an informative decision on the cell type.

Moreover, cells can be extracted as individual images by the ‘exportCells2DB’ function to be classified by external programs or used as a training set for machine learning approaches. The classification results can be imported back to the original dataset by the ‘importCellAnnotation’ function.

Analysis of Calcium Activity

Following ROI identification, cell validation, and cell type classification, the ‘calculateF’ and ‘calculateDeltaFperF0’ functions compute fluorescence intensity (F) and relative fluorescent intensity changes (ΔF/F 0) within ROIs across multiple frames and channels from raw imaging data. Additionally, if a red channel is present, the green-to-red fluorescence ratio change (ΔG/R) is calculated as the fluorescent intensity change from the first frame in the green channel, divided by the fluorescent intensity of the red channel to provide a measure that can minimize potential movement artefacts. The user can choose between automatic or manual background correction and can also override the control range across which the F 0 value is calculated. The GUI also provides a convenient way to smooth the resulting ΔF/F 0 traces.

Wavelet Analysis

The FluoAnalysis toolbox puts special focus on the analysis of calcium imaging data acquired at a high sampling rate, which enables the identification of periodic activity in the physiologically relevant frequency ranges identified for neurons, like the delta (0.5–4 Hz), theta (4–8 Hz), alpha (8–13 Hz), or beta (13–30 Hz) frequency bands that are correlated with distinct physiological and pathological functions. The ‘calculateWavelet’ function is designed to perform a wavelet analysis on both calcium imaging and electrophysiological data, providing insights into the dynamics of different frequency components of these signals. The function utilizes the continuous wavelet transform (CWT) with a complex Morlet wavelet to analyze the time series data. The normalized wavelet coefficients are stored as a function of both time and frequency, facilitating the subsequent analysis of temporal dynamics and frequency content. This dual approach allows for the simultaneous analysis of both calcium imaging and electrophysiological data within a unified framework and enables researchers to investigate and compare the temporal and frequency domain characteristics of neuronal and astrocytic activity.

Analysis of Network Synchronization

Since the FluoAnalysis toolbox is specifically tailored for the analysis of calcium activity simultaneously measured in large numbers of astrocytes or neurons, it provides different parameters that can be used to characterize network synchronization.

The ’calculatePhaselock’ function is designed to