/Image_toolbox

This is my toolbox for image processing and downstream analysis of calcium imaging data.

Primary LanguageJupyter Notebook

Image_toolbox

Last update: 09/25/2018 by @danustc

Source code instructions

-------------------Package dependence------------------

tifffile: developed by Christoph Gohlke
scikit-image: version 0.14 or later
scikit-learn: currently 0.19.2, but other versions may work too

-------------------Main pipelines---------------------

Pipeline.py : The main pipeline of data processing. Each run pre-processes the data from one fish. The t-stacks should be pre-aligned with the MultiStackReg plugin in FIJI. Cell extraction is performed on selected slices, merged and then propagated through the whole stack to calculate the raw F values. If you need a deblur prior to cell extraction, please set sig > 0 (for instance, 4), so a Gaussian-shaped artificial PSF will be generated to deconvolve the raw images.
Pipeline_zstacks.py: The pipeline that processes z-stacks instead of t-stacks. Cells are extracted in each slice and saved as a dictionary.

------------------Modules (src folder) ------------------------

preprocessing

  • crossalign_pipeline.py: cross align T-stacks to Z-stacks and merge segmented cell informations from different stacks into one file. Detection redundancy would be removed in this pipeline.
  • stack_operations.py: some basic tiff stack operations: cropping, thresholding, binning, etc.
  • segmentation.py: segmentating regions of interest (ROI) using blob detection in scikit-image.
  • drift_correction.py: correlation-based drift-correction, still under test.

visualization

  • signal_plot.py: plot \Delta F/F signals in different styles.
  • stat_present.py: visualization of statistical analysis results, including PCA, ICA, K-means and regressions.
  • brain_navigation.py: display raw image slices or volumes, highlight marked neurons.
  • cluster_navigation.py: A 2D visualization of clustering results of 3D data.

analysis

  • df_f.py: Core functions of \Delta F/F calculation, based on the 2011 Nature Protocol paper. Exponential filtering and Bayesian inference peak detection are algo included in this module.
  • dff_pipeline.py: calculate \Delta F/F over calcium signals of a population of neurons, do edge artifact correction and smoothing if necessary.
  • network_ui.py: an interactive UI for individual dataset analysis and visualization.
  • Analysis.py: The core class of data analysis, which does activity soring, shuffling and background suppression. The class can be loaded by other analysis classes, such as pca_analysis
  • spectral.py: The analysis on the frequency domain.
  • spectral_clustering.py: some basic functions of spectral clustering. Although the clustering itself is performed by some built-in functions in scikit-learn, the unnormalized or normalized laplacian matrix and its eigen values are calculated and can be viewed, which helps you determine the number of clusters.
  • hierachical_sc.py: using divide-and-conquer strategy to cluster a large population of neurons, and merge subclusters with high correlations. This module is still under test.

registration

  • anatomy_annotation.py: annotate neuronal identities of selected neurons based on image registration outputs. Image stacks should be registered to the Z-brain template.
  • maskdb_parsing.py: anatomical annotation of cells based on 294 masks in the Z-brain atlas.

shared_funcs

Some numerical, string and image processing functions shared by other modules.