Skip to content

Code for analyzing slice imaging data (realtime and offline)

License

Notifications You must be signed in to change notification settings

ubcbraincircuits/slicescan

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Brain Slice Fluorescence Analysis Tools

This repository contains two key components for analyzing fluorescence data in brain slice experiments: SliceScan, a real-time image analysis software, and spread_analysis, a post-experiment analysis Jupyter notebook. These tools are primarily used for experiments involving fluorescence sensors like iGluSnFR and dLight to measure neurotransmitter release in brain slices.


Repository Structure

/slicescan/ # Folder containing the SliceScan real-time image analysis software
    ├── main.py # Main script for SliceScan, executed via python -m SliceScan
    ├── SliceScan.bat # Batch file to run SliceScan on Windows
    └── init.py # Empty init file for package initialization

/spread_analysis/ # Folder containing the Jupyter notebook for further analysis
    └── analysis_notebook.ipynb # Post-experiment analysis notebook

1. SliceScan: Real-time Image Analysis Software

Overview

SliceScan is a real-time image analysis tool designed for analyzing brain slice experiments as images are being collected by a camera. The software enables researchers to perform on-the-fly region of interest (ROI) selection, calculate delta F over F (dF/F), and visualize key metrics like activated pixel areas and volumes during the experiment.

Key Features:

  • Real-Time Processing: Process TIFF image stacks as they are generated by the camera.
  • ROI and Electrode Selection: Interactive selection of regions of interest (ROI) and electrode positions on the images.
  • dF/F Calculation: Calculate delta F over F in real time for selected ROIs.
  • Activation Area Calculation: Track the activation area and visualize it over the course of the experiment.
  • Drug Treatment Tracking: Add drug treatment periods and visualize their effects on activation.
  • Export Data: Save experimental metadata, calculated dF/F, and the images for post-analysis.

Requirements:

  • Python 3.10: SliceScan requires Python version 3.10.
  • Dependencies: tifffile, matplotlib, numpy, pandas, opencv-python (these should be installed manually).

How to Use SliceScan:

  1. Copy the SliceScan Folder:

    • To use python -m SliceScan or run the batch file (SliceScan.bat), you must copy the slicescan/ folder (renamed to SliceScan) to your Python library folder:
      • For Windows: Copy it to C:\Python310\Lib\site-packages\
      • For other systems, copy it to the equivalent Python site-packages directory.
  2. Running the Software:

    • Windows: Double-click the SliceScan.bat file to run the software.
    • Python Module: Alternatively, if you copied the SliceScan folder to the Python library, you can run the software using:
      python -m SliceScan
      
  3. If You Did Not Copy to Python Library:

    • If you didn't copy the SliceScan folder into your Python library, you can directly run the main Python script:
      python slicescan/__main__.py
      
  4. Select Folder: Use the GUI to select the folder containing the image stacks (hi, lo, and no files) from your experiment.

  5. Define ROI and Electrode: Select the region of interest (ROI) and electrode position on the image.

  6. Start Experiment: Click the Start Experiment button to begin real-time processing.

  7. Monitor Activation: The software will calculate and display activation volumes and areas during the experiment. Drug wash periods can also be visualized.

  8. Export Data: Once the experiment is complete, click the Export Data button to save all the processed data (metadata, dF/F values, activation area plots, and images).

Files in SliceScan:

  • __main__.py: The main script that handles the real-time image processing, plotting, and user interactions through the GUI.
  • SliceScan.bat: A simple batch file to launch the SliceScan software on Windows.
  • __init__.py: Empty file to initialize the SliceScan package.

2. spread_analysis: Post-Experiment Data Analysis

Overview

The spread_analysis folder contains a Jupyter notebook that provides comprehensive post-experiment analysis of the collected fluorescence data. It focuses on the detailed analysis of fluorescence spread and activation areas based on delta F over F (dF/F) calculations.

Key Highlights:

  • Analyzing TIFF Stacks: Process TIFF stacks from your experiments, calculating dF/F for different conditions (e.g., baseline, treatment, wash).
  • Activation Area Calculation: Compute the total number of activated pixels and plot the data.
  • Stim-Response and Drug Treatment Experiments: Compatible with both stimulus-response (uA folders) and quinpirole drug treatment experiments.

The notebook is well-documented with explanations of each step in the analysis workflow. Refer to the notebook for specific details about how to process and visualize your data.


Installation Instructions

1. Python Environment Setup:

  • Install Python 3.10.
  • Install the required dependencies manually: pip install tifffile matplotlib numpy pandas opencv-python

2. Running the Tools:

  • SliceScan:

  • For Windows users, double-click SliceScan.bat.

  • For other operating systems, or if not using the batch file, you can run the following:

    python slicescan/__main__.py
  • spread_analysis:

  • Open the Jupyter notebook in the spread_analysis folder:

    jupyter notebook spread_analysis/analysis_notebook.ipynb

License

This project is licensed under the MIT License. Feel free to use, modify, and distribute it under the terms of the license.


Contributing

Contributions are welcome! If you find any issues or have ideas for improvements, feel free to open an issue or submit a pull request.

About

Code for analyzing slice imaging data (realtime and offline)

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published