Skip to content
/ CaBMI Public
forked from WALIII/CaBMI

Calcium imaging BMI scripts for the 2P

Notifications You must be signed in to change notification settings

schmid89/CaBMI

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

157 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

CaBMI

In-development Calcium imaging BMI scripts for 2P imaging.

Overview

Scripts for the on-line analysis of user defined regions of interest (ROIs) for mice Brain Machine Interface (BMI) experiments.

Hardware Prerequisites

These functions are dependent on the proprietary Bruker 2P (Ultima) Microscope interface, which by current design is not 'real time', and is highly susceptible to delays like OS scheduling, etc. that increase jitter in the on-line analysis and feedback deployment. Most software prototyping is in MATLAB.

ATM the hardware output is an arduino usb device.

Basic Pipeline

PreFlight- Hardware communication

Connect to the Microscope over matlab via PrairieLink:

pl = actxserver('PrairieLink.Application');
pl.Connect();
pl.SendScriptCommands('-lbs true 5')

Connect to Arduino through a serial interface in MATLAB

arduino=serial('COM13','BaudRate',9600); % create serial communication object on port COM4
fopen(arduino); % initiate arduino communication

Baseline Data Acquisition

Collect 100 frames of data for a baseline:

% Collect Baseline Data
max_frame = 100;
[Im1] = caBMI_pullPixel(pl,s,max_frame)

Manual ROI selection

Create a Reference Image, and Manually select Regions of Interest:

% Selec ROIs & Save reference image
Ref_Im = uint16(mean(Im1,3));
imwrite(uint16(mean(Im1,3)),'Ref_Im.tif');
[ROI] = caBMI_annotate_image('Ref_Im.tif');

This function will also save ROI data to the local directory.

Plot these ROIs, and the underlying time series:

caBMI_refPlot(ROI,Im1)

ROIs are color coded:

ScreenShot

The resulting Time-series for each ROI, with color matching the ROI Map above:

ScreenShot

BMI On-line Feedback

Experiment will be run for the amount of time listed in max_time which must be specified.

% Run experiment
max_time = 30; %seconds
[data] = caBMI_feedback(pl,s,ROI,max_time)

BMI contingency will be set in a separate function. Currently this function is called WAL3_cursor.

About

Calcium imaging BMI scripts for the 2P

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • MATLAB 63.7%
  • C++ 27.5%
  • Wolfram Language 3.7%
  • C 3.3%
  • Processing 1.6%
  • M 0.2%