Skip to main content

Dendritic calcium signals in rhesus macaque motor cortex drive an optical brain-computer interface

Cite this dataset

O'Shea, Daniel J et al. (2021). Dendritic calcium signals in rhesus macaque motor cortex drive an optical brain-computer interface [Dataset]. Dryad.



Calcium imaging has rapidly developed into a powerful tool for recording from large populations of neurons in vivo. Imaging in rhesus macaque motor cortex can enable the discovery of new principles of motor cortical function and can inform the design of next generation brain-computer interfaces (BCIs). Surface two-photon (2P) imaging, however, cannot presently access somatic calcium signals of neurons from all layers of macaque motor cortex due to photon scattering. Here, we demonstrate an implant and imaging system capable of chronic, motion-stabilized two-photon (2P) imaging of calcium signals from in macaques engaged in a motor task. By imaging apical dendrites, some of which originated from deep layer 5 neurons, as well as superficial cell bodies, we achieved optical access to large populations of deep and superficial cortical neurons across dorsal premotor (PMd) and gyral primary motor (M1) cortices. Dendritic signals from individual neurons displayed tuning for different directions of arm movement, which was stable across many weeks. Combining several technical advances, we developed an optical BCI (oBCI) driven by these dendritic signals and successfully decoded movement direction online. By fusing 2P functional imaging with CLARITY volumetric imaging, we verify that an imaged dendrite, which contributed to oBCI decoding, originated from a putative Betz cell in motor cortical layer 5. This approach establishes new opportunities for studying motor control and designing BCIs.



A complete write up of the data collection and analysis may be found in the Methods section of the publication.

Imaging was performed using a Bruker Ultima in vivo microscope with a custom motorized orbital nosepiece (Bruker Inc.) to provide off-axis imaging with a Nikon 16x 0.8 NA objective lens. Images were acquired at 512 x 512 resolution at a single depth at 30.3Hz using resonant-scanning galvanometers (or occasionally at lower resolution and higher framerate while imaging a portion of the 512 x 512 pixel field). Laser power was adjusted as necessary to optimize SNR prior to each recording series and typical values were between 50-150mW. Using dichroic beam splitter (555 nm) and a pair of filters, we collected both a functional green channel (520/44 nm) and a static red fluorescent channel (624/40 nm) to facilitate registration.

Typical sessions in which the subject was working in the imaging rig lasted between 90-180 minutes. Imaging was performed during decode blocks, typically lasting between 5-30 minutes, and different decoding sessions were performed in different fields of view during a single session in order to explore different injection sites and depths. We typically performed imaging (while the monkey was at rest and not performing the task) for several minutes in between decode blocks to localize distinct fields of view with neural features, or to localize an imaging field of view based on the surface vasculature. We did not observe photobleaching over the course of a decode block or across blocks within a session in the same region.

2P imaging sessions were collected over sessions spanning the following number of days in the three subjects included here: monkey S, 122 days; monkey W, 30 days; monkey X, 144 days. We note that for all three subjects, degradation of imaging quality was not a driver for terminating experiments, and imaging data were collected until we had sufficient data within the imageable injection regions. In particular, for monkey W, imaging quality remained excellent but as we did not observe functional tuning in the neurons we imaged, we did not continue to collect data beyond the first month of exploration after observing virus expression.

The positioning of the imaging plane for each decode session was chosen to maximize the number of modulated processes observed in the field of view. We did not attempt to optimize correspondence of the imaging field of view across sessions.

We processed each imaging session offline using Suite2P ( and analyzed 36 imaging decode sessions collected on eight days. Imaging datasets were aligned using the red, static fluorescence channel using a rigid coarse alignment step followed by a non-rigid block-wise alignment step. Standard settings for the algorithm were used with the following exceptions to optimize for dendritic ROIs and GCaMP6f (connected=False, tau=0.7). We identified putative dendritic/axonal ROIs in the datasets as those ROIs with a computed aspect ratio greater than 2 (ratio of long axis to short axis of ROI shape) and manually verified that this selection criterion identified only ROIs that appeared to be neuronal processes.

Usage notes

This DRYAD dataset contains two photon calcium imaging data accompanying the 2021 manuscript "Dendritic calcium signals in rhesus macaque motor cortex drive an optical brain-computer interface" by Trautmann, O'Shea, Sun et al., to be published in Nature Communications.

The dataset was assembled by Dan O'Shea (djoshea at stanford). Data may be loaded in MATLAB without any accompanying software.


This contains a Matlab table of analysis on ROIs aggregated from all 36 imaging datasets.

dataset: to which session does each ROI belong

roiInd: index of ROI within that session

best_move_zscore (best_target_zscore, best_go_zscore): zscore value with largest absolute value over time for each ROIs Z-scored peri-movement (post target onset, post go cue) responses

pval_move_ranksum (pval_target_ranksum, pval_go_ranksum): p value from rank sum test comparing pre-movement to peri-movement (post target onset, post go cue) responses, for detecting a significant response during movement (post target onset, post go cue)

pval_tuning_anova : p value for ANOVA for a fixed effect of reach direction on peri-movement responses, for detecting significantly tuned responses

aspect_ratio : related to ROI geometry from Suite2P, ratio between major and minor axes of a 2D Gaussian fit to mask
Is_neural_process : considered to be a putative dendritic / axonal process in analysis

npixTotal : number of pixels in overall ROI mask

npixDominant: number of pixels where this ROI is given the greatest weight of all ROIs that a given pixel contributes to

beta : x and y beta coefficients for each ROIs velocity tuning regression

r : r-squared statistic for the velocity tuning regression 

p :  p value for the F-test for the velocity tuning regression

theta : preferred movement direction from cosine tuning curve

amp : amplitude of ROI tuning curve

cmap : RGB color associated with each ROI for plotting preferred direction in a cyclic color map (colorcet CET-C2).

delta_tuning_early_late : change in preferred direction angle for the last 25% of the session relative to the first 25% of the session.

pval_tuning_changed : p value associated with a bootstrap test for significant drift in preferred direction across the session

pixel_theta_rel_roi : preferred direction angle of each pixel in the ROI individually, relative to the preferred direction of the cluster

pixel_beta : x and y beta regression coefficients for each pixel in the ROI individually

pixel_optimal_clusters : optimal number of pixel-wise subclusters within each ROI. (Computed for reviewer request).


This contains a collection of metadata saved by Prairie regarding the imaging timeseries collection parameters.


stat : ROI statistics computed by Suite2P and described here [ ].

dfof, dfof_tvec_ms : ΔF/F responses of each ROI vs image frames, and time vector in ms

meanImg, meanImgLog : session-mean image (and log-transformed mean image)

x/y_um_per_pixel: scale factors associated with each image (to microns)

mask_dendrite, mask_responsive, mask_tuned : indicates which ROIs were considered putative dendrites, responsive to movement, and tuned to movement direction

move_response_tensor, move_response_tvec : 4 reach direction conditions x time x ROIs array of trial-averaged ROI responses during reaching movements as a function of target direction (equivalent to a peri-movement PSTH). Time vector is in ms relative to movement onset.


Defense Advanced Research Projects Agency, Award: NeuroFAST W911NF-14-2-0013

National Cancer Institute, Award: Pioneer 8DPIHD075623