In this article, I will introduce a tool called CaImAn (Calcium Imaging Analysis). Official site (https://github.com/flatironinstitute/CaImAn) This software has various functions such as motion collection of calcium imaging videos, cell extraction, and signal deconvolution. It seems to be the standard of current calcium imaging analysis tools.
There are Python version and MATLAB version of CaImAn, but since the installation method of Python version is complicated and there is no Japanese document, it is summarized below. (The MATLAB version is easier to use, so it is recommended for those who have MATLAB.)
The installation method is as described in the linked Installation. Python 3.6 recommended, Anaconda or Miniconda required. You can install mac or linux just by running the bash command, but windows is a bit complicated. Below is the case when I tried it on windows around the end of 2018 and it worked.
First of all, you need to install "Desktop Development Tools with C ++" and "C / C ++ CLI Tools" of Visual Studio 2017. Download Visual Studio 2017 from the Microsoft home page. Community Edition is free. After that, start the installer and check the two workloads "Desktop Development Tools with C ++" and "C / C ++ CLI Tools" to install.
Next, create a virtual environment for CaImAn in Anaconda. Let's execute the command with anaconda prompt.
git clone https://github.com/flatironinstitute/CaImAn
cd CaImAn
conda env create -f environment.yml -n caiman
You have now created a virtual environment called caiman in Anaconda. Next, let's operate the two files in the folders under C: \ Users \ (user name) \ Anaconda3 \ envs \ caiman .
Then install CaImAn.
conda install -n caiman vs2017_win-64
activate caiman
pip install .
copy caimanmanager.py ..
conda install numba
cd ..
Next, let's create a folder to put the execution script and analysis data.
caimanmanager.py install
You now have a folder called caiman_data in your current directory. I think the analysis should be done in this folder.
You can use demo_caiman_basic.py in \ caiman_data \ demos \ general as demo code. Let's run it and see if it works.
cd caiman_data\demos\general
demo_caiman_basic.py
When executed, the following screen will appear. This is an extract of the cell shape. It is numbered.
And this shows the change in brightness of each cell, that is, the change in electrical activity. You can switch and display cells with the arrow keys.
In this demo code, we have extracted the blinking cells from the video (demoMovie.tif in the example_movies folder). Adjusting the parameters in the code will change the result.
You can now use the Python version of CaImAn. I plan to write a separate article on how to use the MATLAB version and how to deconvolution. Regarding the cell extraction algorithm, it seems that after extracting the candidate region using CNMF (conditional non-negative matrix factorization), it is judged whether it is a cell or not using CNN (convolutional neural network).
Recommended Posts