/astro-analysis

CalciumCV: Computer vision software for calcium signaling in astrocytes

Primary LanguageMATLABOtherNOASSERTION

Software for astrocyte analysis

Introduction

Implementation of a new method for astrocyte analysis. Method is based on "sliding" window approach and include the following stages:

  1. Video preprocessing:

    • Aligning an image (eliminating jitter).
    • Calculating noise parameters and subtracting the camera noise.
    • Filtering video frames BM3D.
    • Evaluating a noise level on the filtered video.
  2. Calculating a baseline of the fluorescence intensity and its relative variation based on the noise information.

  3. Detecting calcium events based on the relative intensity variation.

Project structure

Project consists of the following directories:

  1. 3rd_party - third-party libraries is used in the project:

    • dbscan - DBScan implementation (not needed now, because faster implementation is used).
    • gtest - Google Testing Framework.
    • bm3d - BM3D implementation (follow steps in 3rd_party/bm3d/README to get implementation).
    • DataHash - data hashing for internal use.
    • plot_mk - library for prettifying MATLAB plot.
    • progress_bar - GUI progress bar library.
    • tabplot - GUI tabs library.
  2. astrocytes_library - C++ library for astrocyte analysis.

  3. auxiliary_scripts - auxiliary scripts to analyze temporary data.

  4. matlab_scripts - matlab-scripts for researchers.

  5. data - directory with short test sample (*z-max*.mat - maximal projection), three-dimensional matrix width*height*k, where width is a frame width, height is a frame height, k is a number of frames.

  6. mex_wrappers - mex-functions (wrappers) for the library of astrocyte analysis.

  7. tests - automatic tests to check correctness of the algorithm.

Prerequisites

Software for astrocyte analysis has several dependencies:

  1. MATLAB is required to read/write mat-files (version >= R2016a).
  2. Boost (version >= 1.60), binaries for Windows.
  3. OpenCV (version 2.4.*).
  4. BM3D is required for filtering frames (follow steps described in 3rd_party/bm3d/README).

Environment:

  1. Windows
    • CMake (version >=3.1.0).
    • C++ Compiler (for example, Visual C++ Compiler from Microsoft Visual Studio 2013, 2015 is preferable).
  2. Linux
    • CMake (version >=3.1.0).
    • C++ Compiler (for example, GCC >= 4.7).

How to build

Windows (Visual C++ Compiler)

  1. Install prerequisites.

  2. Download source code.

  3. Open Command Prompt Window (use this manual).

  4. Create build directory astro-events-analysis-build next to the directory astro-events-analysis using the following command:

    mkdir astro-events-analysis-build
  5. Set astro-events-analysis-build as current directory using the following command:

    cd astro-events-analysis-build
  6. Generate Visual Studio solution to compile sources using the following command. Note: if Boost library installed from binaries you must set BOOST_ROOT, Boost_INCLUDE_DIRS and Boost_LIBRARY_DIR.

    cmake -G <Generator-name>
          -DOpenCV_DIR=<OpenCVConfig.cmake-directory>
          [-DBOOST_ROOT=<Boost-library-directory>]
          [-DBoost_INCLUDE_DIRS=<dir-with-boost-header-files>]
          [-DBoost_LIBRARY_DIR=<dir-with-boost-lib-files>]
          [-DMATLAB_ROOT=<matlab-dir>]
          -DMatlab_MX_LIBRARY="<dir-with-libmx>\libmx.lib"
          -DMatlab_ENG_LIBRARY="<dir-with-libeng>\libeng.lib"
          ..\astro-events-analysis

    Example:

    cmake -G "Visual Studio 14 2015 Win64" -DOpenCV_DIR="c:\Program Files\opencv2411\vs2015" 
        -DBOOST_ROOT="c:\boost_1_60_0" 
        -DBoost_INCLUDE_DIRS="c:\boost_1_60_0\boost" 
        -DBoost_LIBRARY_DIR="c:\boost_1_60_0\lib64-msvc-14.0" 
        -DMATLAB_ROOT="c:\Program Files\MATLAB\R2010a"
        -DMatlab_MX_LIBRARY="c:\Program Files\MATLAB\R2010a\extern\lib\win64\microsoft\libmx.lib" 
        -DMatlab_ENG_LIBRARY="c:\Program Files\MATLAB\R2010a\extern\lib\win64\microsoft\libeng.lib" 
        ..\astro-events-analysis
  7. Choose Release and x64 modes in main menu of Visual Studio.

  8. Choose project ALL_BUILD and execute command Rebuild in the menu that you get after right mouse click. You will see static libraries astrocytes_analysis.lib,dbscan.lib, 3 mex-wrappers (preprocessing.mexw64, background_subtraction.mexw64, find_events.mexw64), and binary file test_astrocytes_analysis.exe (contains some automatic tests for developers) in the directory astro-events-analysis-build\bin.

How to run

Detailed user's guide located in matlab_scripts/README.