Skip to content

How to: Demo scripts

Tea edited this page Jul 12, 2020 · 9 revisions

Instructions for installing demo scripts

AcquisitionDemo.bsh

First install MicroManager (MM) for your OS. When finished, open MM and select Demo configuration to start with. This will result in opening of GUI which is connected to so-called demo camera. Download AcquisitionDemo.bsh as well. In MM go to Tools > Script Panel > Open and open the script. Click on Add to make it permanently stay in your sidebar (area on the left side).

Pictures captured with demo camera are sine wave gratings with different spatial frequencies, therefore, analysis algorithm from AnalysisDemo.py will not be successful in finding neurons and process their activity since there are no any. To circumvent this problem and for script testing purposes, I have provided calcium recording movie which is going to be used instead, i.e. to mimic results obtained from imaging with actual camera. Note that AcquisitionDemo.bsh still captures frames using demo camera and saves results, just as it would if MM was connected to the real camera, however, this file is not used by AnalysisDemo.py.

AnalysisDemo.py

First install CaImAn toolbox as instructed. Download AnalysisDemo.py as well (and preferably open the script with Spyder; call Spyder from your caiman conda environment).

Image analysis is done by OnACID, online algorithm for processing streaming frames during calcium/fluorescence imaging. One should have some previous knowledge about the population being imaged in order to set the right analysis parameters. Here, I have provided parameter values suitable for demo movie processing. CaImAn/python and MM communicate via named pipes by sending each other cue-messages which trigger crucial processing steps in both software. One can follow their correspondence (and which steps are being executed) in python and MM console/prompt windows when the pipeline is running.

How-to: Running the Acquisition and Analysis pipeline

MicroManager and CaImAn/python communicate via channels which fist have to be opened. This was set to be done from python environment, therefore, first start AnalysisDemo.py script and only then start the AcquisitionDemo.bsh protocol. There are multiple crucial steps in full pipeline execution:

  1. MM captures user-defined n number of frames for initialisation of OnACID,
  2. MM sends message to CaImAn that frames are captured and initialisation can start,
  3. CaImAn uses OnACID algorithm and user-defined parameters to initialise,
  4. CaImAn sends message to MM after initialisation is over and high-speed acquisition can start,
  5. MM starts acquisition of user-defined n number of frames and notifies CaImAn to start processing newly acquired frames (from MultiTiff file where MM is putting them),

(6. CaImAn and MM work in synchrony during which CaImAn should output fluorescence values calculated for every processed frame; this feature is currently unavailable and we are awaiting for future CaImAn updates to gain access to streaming data)

Note that, due to MM being coupled to demo camera, steps 1. and 5. will indeed perform image acquisition, but this will not be used by CaImAn. Rather, during these steps OnACID will initialise on first n number of frames from demo movie (step 1), and will later process rest of the frames in online fashion (step 5).

For mode details on how to use demo files, have a look at my tutorial.